Add minimum viable product

This commit is contained in:
Spotlight 2021-11-15 02:33:34 -06:00
commit 5a5dfb7bb2
Signed by: spotlight
GPG key ID: 874AA355B3209BDC
41 changed files with 405 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.theos
packages

18
Headers/CALayer.h Normal file
View file

@ -0,0 +1,18 @@
//
// CALayer.h
// ScreenShredder
//
// Created by Spotlight Deveaux on 2021-11-14.
//
#ifndef CALayer_h
#define CALayer_h
@import QuartzCore;
#import "CAState.h"
@interface CALayer (PrivateDefinitions)
@property(readonly) NSArray<CAState *> *_Nonnull states;
@end
#endif /* CALayer_h */

31
Headers/CAPackage.h Normal file
View file

@ -0,0 +1,31 @@
//
// CAPackage.h
// ScreenShredder
//
// Created by Spotlight Deveaux on 2021-11-14.
//
#ifndef CAPackage_h
#define CAPackage_h
@import QuartzCore;
extern NSString *_Nonnull kCAPackageTypeArchive;
@interface CAPackage : NSObject
+ (CAPackage *_Nullable)packageWithContentsOfURL:(NSURL *_Nonnull)url
type:(NSString *_Nonnull)type
options:(NSDictionary *_Nullable)opts
error:(NSError *_Nullable *_Nullable)
outError;
- (NSArray<NSString *> *_Nonnull)publishedObjectNames;
- (CALayer *_Nullable)publishedObjectWithName:(NSString *_Nonnull)name;
@property(readonly, getter=isGeometryFlipped) BOOL geometryFlipped;
@property(readonly) CALayer *_Nonnull rootLayer;
@end
#endif /* CAPackage_h */

21
Headers/CAState.h Normal file
View file

@ -0,0 +1,21 @@
//
// CAState.h
// ScreenShredder
//
// Created by Spotlight Deveaux on 2021-11-14.
//
#ifndef CAState_h
#define CAState_h
@import QuartzCore;
@interface CAState : NSObject
// We most likely don't need to define its methods, as we use none directly.
// Instead, we define this solely for type checking.
// (I apologize if you were looking for them here.)
@end
#endif /* CAState_h */

View file

@ -0,0 +1,43 @@
//
// CAStateController.h
// ScreenShredder
//
// Created by Spotlight Deveaux on 2021-11-14.
//
#ifndef CAStateController_h
#define CAStateController_h
@import QuartzCore;
#import "CAState.h"
@interface CAStateController : NSObject
// TODO: Do we need to bother with delegates?
//@property(__weak) NSObject *<CAStateControllerDelegate> delegate;
//- (NSObject *<CAStateControllerDelegate>)delegate;
//- (void)setDelegate:(NSObject *<CAStateControllerDelegate>)delegate;
- (CALayer *_Nullable)layer;
- (void)_removeTransition:(id _Nonnull)arg1 layer:(CALayer *_Nonnull)arg2;
- (CAStateController *_Nonnull)initWithLayer:(CALayer *_Nonnull)layer;
- (CAState *_Nonnull)stateOfLayer:(CALayer *_Nonnull)arg1;
- (void)setState:(CAState *_Nonnull)state
ofLayer:(CALayer *_Nonnull)layer
transitionSpeed:(float)speed;
- (void)setState:(CAState *_Nonnull)state ofLayer:(CALayer *_Nonnull)layer;
- (void)setInitialStatesOfLayer:(CALayer *_Nonnull)layer
transitionSpeed:(float)speed;
- (void)setInitialStatesOfLayer:(CALayer *_Nonnull)layer;
// TODO: What type is id in the beneath here?
- (id _Nonnull)removeAllStateChanges;
- (void)restoreStateChanges:(id _Nonnull)arg1;
- (void)cancelTimers;
- (void)_nextStateTimer:(id _Nonnull)arg1;
- (void)_addAnimation:(id _Nonnull)arg1
forKey:(id _Nonnull)arg2
target:(id _Nonnull)arg3
undo:(id _Nonnull)arg4;
@end
#endif /* CAStateController_h */

12
Makefile Normal file
View file

@ -0,0 +1,12 @@
TARGET := iphone:clang:latest:6.1
INSTALL_TARGET_PROCESSES = shoehorn
include $(THEOS)/makefiles/common.mk
APPLICATION_NAME = shoehorn
shoehorn_ARCHS = armv7
shoehorn_FILES = main.m SPAppDelegate.m SPRootViewController.m
shoehorn_FRAMEWORKS = UIKit CoreGraphics PassKit
shoehorn_CFLAGS = -fobjc-arc -I./Headers/
include $(THEOS_MAKE_PATH)/application.mk

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

154
Resources/Info.plist Normal file
View file

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>shoehorn</string>
<key>CFBundleIcons</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29</string>
<string>AppIcon40x40</string>
<string>AppIcon57x57</string>
<string>AppIcon60x60</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIcons~ipad</key>
<dict>
<key>CFBundlePrimaryIcon</key>
<dict>
<key>CFBundleIconFiles</key>
<array>
<string>AppIcon29x29</string>
<string>AppIcon40x40</string>
<string>AppIcon57x57</string>
<string>AppIcon60x60</string>
<string>AppIcon50x50</string>
<string>AppIcon72x72</string>
<string>AppIcon76x76</string>
</array>
<key>UIPrerenderedIcon</key>
<true/>
</dict>
</dict>
<key>CFBundleIdentifier</key>
<string>space.joscomputing.spacehorn</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UILaunchImageFile</key>
<string>LaunchImage</string>
<key>UILaunchImages</key>
<array>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 480}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-700-568h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{320, 568}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-Portrait</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>7.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-Landscape</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{768, 1024}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-800-667h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{375, 667}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-800-Portrait-736h</string>
<key>UILaunchImageOrientation</key>
<string>Portrait</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
<dict>
<key>UILaunchImageMinimumOSVersion</key>
<string>8.0</string>
<key>UILaunchImageName</key>
<string>LaunchImage-800-Landscape-736h</string>
<key>UILaunchImageOrientation</key>
<string>Landscape</string>
<key>UILaunchImageSize</key>
<string>{414, 736}</string>
</dict>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

View file

View file

View file

View file

8
SPAppDelegate.h Normal file
View file

@ -0,0 +1,8 @@
@import UIKit;
@interface SPAppDelegate : UIResponder <UIApplicationDelegate>
@property(nonatomic, strong) UIWindow *window;
@property(nonatomic, strong) UINavigationController *rootViewController;
@end

16
SPAppDelegate.m Normal file
View file

@ -0,0 +1,16 @@
#import "SPAppDelegate.h"
#import "SPRootViewController.h"
@import UIKit;
@import QuartzCore;
@implementation SPAppDelegate
- (void)applicationDidFinishLaunching:(UIApplication *)application {
_window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
_rootViewController = [[UINavigationController alloc]
initWithRootViewController:[[SPRootViewController alloc] init]];
_window.rootViewController = _rootViewController;
[_window makeKeyAndVisible];
}
@end

5
SPRootViewController.h Normal file
View file

@ -0,0 +1,5 @@
@import UIKit;
@interface SPRootViewController : UIViewController
- (CGImageRef)getImage:(NSString *)named;
@end

78
SPRootViewController.m Normal file
View file

@ -0,0 +1,78 @@
#import "SPRootViewController.h"
#import "CALayer.h"
#import "CAPackage.h"
#import "CAState.h"
#import "CAStateController.h"
@interface SPRootViewController ()
- (CGImageRef)getImage:(NSString *)named;
@end
@implementation SPRootViewController
- (void)loadView {
[super loadView];
// Let's get this party started! Load our package.
NSURL *caarPath = [[NSBundle bundleForClass:NSClassFromString(@"PKPass")]
URLForResource:@"ShredderSheet"
withExtension:@"caar"];
CAPackage *package = [CAPackage packageWithContentsOfURL:caarPath
type:kCAPackageTypeArchive
options:nil
error:nil];
// Determine the frame of the unarchived root layer.
CALayer *rootLayer = [package rootLayer];
CGRect rootLayerFrame = [rootLayer frame];
// We can create a new view to harass.
// Exhilerating!
UIView *layerView = [[UIView alloc] initWithFrame:rootLayerFrame];
[[layerView layer] addSublayer:rootLayer];
[self.view addSubview:layerView];
// Ensure our package's root layer does similar, I... think.
[[package publishedObjectWithName:@"Root"] setFrame:rootLayerFrame];
// Oh, our very own state controller!
// We've grown up so quickly.
CAStateController *stateController =
[[CAStateController alloc] initWithLayer:rootLayer];
// Configure our initial state.
CAState *shreddingState = [[rootLayer states] objectAtIndex:2];
[stateController setInitialStatesOfLayer:rootLayer];
[stateController setState:shreddingState
ofLayer:rootLayer
transitionSpeed:1.0f];
// Have our wonderful, extremely 2011/2012-esque metal design.
// It's local! There's no reason not to.
[[package publishedObjectWithName:@"shredderFront"]
setContents:(id)[self getImage:@"ShredderMetal"]];
[[package publishedObjectWithName:@"shredderBack"]
setContents:(id)[self getImage:@"ShredderMetal"]];
// Set what we're shredding.
[[package publishedObjectWithName:@"cardFrontUnshredded"]
setContents:(id)[[UIColor redColor] CGColor]];
[[package publishedObjectWithName:@"cardFrontShredded"]
setContents:(id)[[UIColor blueColor] CGColor]];
[[package publishedObjectWithName:@"cardBackUnshredded"]
setContents:(id)[[UIColor blueColor] CGColor]];
}
- (CGImageRef)getImage:(NSString *)named {
NSBundle *passKitBundle =
[NSBundle bundleForClass:NSClassFromString(@"PKPass")];
NSString *filename = [NSString stringWithFormat:@"%@@2x", named];
NSString *path = [passKitBundle pathForResource:filename ofType:@"png"];
UIImage *image = [UIImage imageWithContentsOfFile:path];
return [image CGImage];
}
@end

8
control Normal file
View file

@ -0,0 +1,8 @@
Package: space.joscomputing.spacehorn
Name: shoehorn
Version: 0.0.1
Architecture: iphoneos-arm
Description: An awesome application!
Maintainer: Spotlight Deveaux
Author: Spotlight Deveaux
Section: Utilities

9
main.m Normal file
View file

@ -0,0 +1,9 @@
#import "SPAppDelegate.h"
#import <Foundation/Foundation.h>
int main(int argc, char *argv[]) {
@autoreleasepool {
return UIApplicationMain(argc, argv, nil,
NSStringFromClass(SPAppDelegate.class));
}
}