Skip to content

Commit 1d91dfe

Browse files
committed
Basic Shortcut menus support and Refactoring
1 parent 0ef546b commit 1d91dfe

File tree

10 files changed

+508
-296
lines changed

10 files changed

+508
-296
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
TARGET := iphone:clang:latest:11.0
22
INSTALL_TARGET_PROCESSES = TrollLEDs
33
ARCHS = arm64
4-
PACKAGE_VERSION = 1.3.1
4+
PACKAGE_VERSION = 1.4.0
55

66
include $(THEOS)/makefiles/common.mk
77

@@ -13,9 +13,9 @@ else
1313
IPA_NAME = $(APPLICATION_NAME)
1414
endif
1515

16-
$(APPLICATION_NAME)_FILES = main.m TLSceneDelegate.m TLAppDelegate.m TLRootViewController.m
16+
$(APPLICATION_NAME)_FILES = main.m TLDeviceManager.m TLSceneDelegate.m TLAppDelegate.m TLRootViewController.m
1717
$(APPLICATION_NAME)_FRAMEWORKS = UIKit CoreGraphics CoreMedia
18-
$(APPLICATION_NAME)_CFLAGS = -fobjc-arc -Wno-unguarded-availability-new
18+
$(APPLICATION_NAME)_CFLAGS = -fobjc-arc
1919
ifeq ($(UNSANDBOX),1)
2020
$(APPLICATION_NAME)_CODESIGN_FLAGS = -Sentitlements-unsandboxed.plist
2121
else

Resources/Info.plist

Lines changed: 115 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,93 +2,120 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5-
<key>CFBundleExecutable</key>
6-
<string>TrollLEDs</string>
7-
<key>CFBundleName</key>
8-
<string>TrollLEDs</string>
9-
<key>CFBundleIcons</key>
10-
<dict>
11-
<key>CFBundlePrimaryIcon</key>
12-
<dict>
13-
<key>CFBundleIconFiles</key>
14-
<array>
15-
<string>AppIcon60x60</string>
16-
</array>
17-
<key>UIPrerenderedIcon</key>
18-
<true/>
19-
</dict>
20-
</dict>
21-
<key>CFBundleIcons~ipad</key>
22-
<dict>
23-
<key>CFBundlePrimaryIcon</key>
24-
<dict>
25-
<key>CFBundleIconFiles</key>
26-
<array>
27-
<string>AppIcon60x60</string>
28-
<string>AppIcon76x76</string>
29-
</array>
30-
<key>UIPrerenderedIcon</key>
31-
<true/>
32-
</dict>
33-
</dict>
34-
<key>CFBundleIdentifier</key>
35-
<string>com.ps.TrollLEDs</string>
36-
<key>CFBundleInfoDictionaryVersion</key>
37-
<string>6.0</string>
38-
<key>CFBundlePackageType</key>
39-
<string>APPL</string>
40-
<key>CFBundleSignature</key>
41-
<string>????</string>
42-
<key>CFBundleSupportedPlatforms</key>
43-
<array>
44-
<string>iPhoneOS</string>
45-
</array>
46-
<key>CFBundleShortVersionString</key>
47-
<string>1.3.1</string>
48-
<key>CFBundleVersion</key>
49-
<string>1.3.1</string>
50-
<key>LSRequiresIPhoneOS</key>
51-
<true/>
52-
<key>MinimumOSVersion</key>
53-
<string>11.0</string>
54-
<key>UIDeviceFamily</key>
55-
<array>
56-
<integer>1</integer>
57-
<integer>2</integer>
58-
</array>
59-
<key>UIRequiredDeviceCapabilities</key>
60-
<array>
61-
<string>arm64</string>
62-
</array>
63-
<key>UISupportedInterfaceOrientations</key>
64-
<array>
65-
<string>UIInterfaceOrientationPortrait</string>
66-
<string>UIInterfaceOrientationLandscapeLeft</string>
67-
<string>UIInterfaceOrientationLandscapeRight</string>
68-
</array>
69-
<key>UISupportedInterfaceOrientations~ipad</key>
70-
<array>
71-
<string>UIInterfaceOrientationPortrait</string>
72-
<string>UIInterfaceOrientationPortraitUpsideDown</string>
73-
<string>UIInterfaceOrientationLandscapeLeft</string>
74-
<string>UIInterfaceOrientationLandscapeRight</string>
75-
</array>
76-
<key>UIApplicationSceneManifest</key>
77-
<dict>
78-
<key>UIApplicationSupportsMultipleScenes</key>
79-
<false/>
80-
<key>UISceneConfigurations</key>
81-
<dict>
82-
<key>UIWindowSceneSessionRoleApplication</key>
83-
<array>
84-
<dict>
85-
<key>UISceneConfigurationName</key>
86-
<string>Default Configuration</string>
87-
<key>UISceneDelegateClassName</key>
88-
<string>TLSceneDelegate</string>
89-
</dict>
90-
</array>
91-
</dict>
92-
</dict>
5+
<key>CFBundleExecutable</key>
6+
<string>TrollLEDs</string>
7+
<key>CFBundleName</key>
8+
<string>TrollLEDs</string>
9+
<key>CFBundleIcons</key>
10+
<dict>
11+
<key>CFBundlePrimaryIcon</key>
12+
<dict>
13+
<key>CFBundleIconFiles</key>
14+
<array>
15+
<string>AppIcon60x60</string>
16+
</array>
17+
<key>UIPrerenderedIcon</key>
18+
<true/>
19+
</dict>
20+
</dict>
21+
<key>CFBundleIcons~ipad</key>
22+
<dict>
23+
<key>CFBundlePrimaryIcon</key>
24+
<dict>
25+
<key>CFBundleIconFiles</key>
26+
<array>
27+
<string>AppIcon60x60</string>
28+
<string>AppIcon76x76</string>
29+
</array>
30+
<key>UIPrerenderedIcon</key>
31+
<true/>
32+
</dict>
33+
</dict>
34+
<key>CFBundleIdentifier</key>
35+
<string>com.ps.TrollLEDs</string>
36+
<key>CFBundleInfoDictionaryVersion</key>
37+
<string>6.0</string>
38+
<key>CFBundlePackageType</key>
39+
<string>APPL</string>
40+
<key>CFBundleSignature</key>
41+
<string>????</string>
42+
<key>CFBundleSupportedPlatforms</key>
43+
<array>
44+
<string>iPhoneOS</string>
45+
</array>
46+
<key>CFBundleShortVersionString</key>
47+
<string>1.4.0</string>
48+
<key>CFBundleVersion</key>
49+
<string>1.4.0</string>
50+
<key>LSRequiresIPhoneOS</key>
51+
<true/>
52+
<key>MinimumOSVersion</key>
53+
<string>11.0</string>
54+
<key>UIDeviceFamily</key>
55+
<array>
56+
<integer>1</integer>
57+
<integer>2</integer>
58+
</array>
59+
<key>UIRequiredDeviceCapabilities</key>
60+
<array>
61+
<string>arm64</string>
62+
</array>
63+
<key>UISupportedInterfaceOrientations</key>
64+
<array>
65+
<string>UIInterfaceOrientationPortrait</string>
66+
<string>UIInterfaceOrientationLandscapeLeft</string>
67+
<string>UIInterfaceOrientationLandscapeRight</string>
68+
</array>
69+
<key>UISupportedInterfaceOrientations~ipad</key>
70+
<array>
71+
<string>UIInterfaceOrientationPortrait</string>
72+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
73+
<string>UIInterfaceOrientationLandscapeLeft</string>
74+
<string>UIInterfaceOrientationLandscapeRight</string>
75+
</array>
76+
<key>UIApplicationSceneManifest</key>
77+
<dict>
78+
<key>UIApplicationSupportsMultipleScenes</key>
79+
<false/>
80+
<key>UISceneConfigurations</key>
81+
<dict>
82+
<key>UIWindowSceneSessionRoleApplication</key>
83+
<array>
84+
<dict>
85+
<key>UISceneConfigurationName</key>
86+
<string>Default Configuration</string>
87+
<key>UISceneDelegateClassName</key>
88+
<string>TLSceneDelegate</string>
89+
</dict>
90+
</array>
91+
</dict>
92+
</dict>
93+
<key>UIApplicationShortcutItems</key>
94+
<array>
95+
<dict>
96+
<key>UIApplicationShortcutItemIconFile</key>
97+
<string>AmberOn</string>
98+
<key>UIApplicationShortcutItemTitle</key>
99+
<string>Amber On</string>
100+
<key>UIApplicationShortcutItemType</key>
101+
<string>com.ps.TrollLEDs.AmberOn</string>
102+
</dict>
103+
<dict>
104+
<key>UIApplicationShortcutItemIconFile</key>
105+
<string>WhiteOn</string>
106+
<key>UIApplicationShortcutItemTitle</key>
107+
<string>White On</string>
108+
<key>UIApplicationShortcutItemType</key>
109+
<string>com.ps.TrollLEDs.WhiteOn</string>
110+
</dict>
111+
<dict>
112+
<key>UIApplicationShortcutItemIconFile</key>
113+
<string>AllOn</string>
114+
<key>UIApplicationShortcutItemTitle</key>
115+
<string>All On</string>
116+
<key>UIApplicationShortcutItemType</key>
117+
<string>com.ps.TrollLEDs.AllOn</string>
118+
</dict>
119+
</array>
93120
</dict>
94121
</plist>

TLAppDelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#import <UIKit/UIKit.h>
1+
#import "TLRootViewController.h"
22

33
@interface TLAppDelegate : UIResponder <UIApplicationDelegate>
44
@property (nonatomic, strong) UIWindow *window;
55
@property (nonatomic, strong) UINavigationController *rootViewController;
6+
@property (nonatomic, strong) TLRootViewController *myViewController;
67
@end

TLAppDelegate.m

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,30 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
88
return YES;
99
}
1010
_window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
11-
_rootViewController = [[UINavigationController alloc] initWithRootViewController:[[TLRootViewController alloc] init]];
12-
_window.rootViewController = _rootViewController;
11+
_myViewController = [[TLRootViewController alloc] init];
12+
if (launchOptions[UIApplicationLaunchOptionsShortcutItemKey])
13+
_myViewController.shortcutAction = launchOptions[UIApplicationLaunchOptionsShortcutItemKey];
14+
_rootViewController = [[UINavigationController alloc] initWithRootViewController:_myViewController];
1315
_rootViewController.navigationBarHidden = YES;
16+
_window.rootViewController = _rootViewController;
1417
[_window makeKeyAndVisible];
1518
return YES;
1619
}
1720

18-
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
21+
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options API_AVAILABLE(ios(13.0)) {
1922
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
2023
}
2124

25+
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
26+
[_myViewController handleShortcutAction:shortcutItem.type];
27+
}
28+
29+
- (void)applicationWillResignActive:(UIApplication *)application {
30+
[_myViewController releaseStream];
31+
}
32+
33+
- (void)applicationDidBecomeActive:(UIApplication *)application {
34+
[_myViewController setupStream];
35+
}
36+
2237
@end

TLDeviceManager.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#import "Header.h"
2+
3+
@interface TLDeviceManager : NSObject {
4+
BOOL initialized;
5+
pid_t pid;
6+
int client;
7+
Class BWFigCaptureDeviceVendorClass;
8+
BWFigCaptureDeviceVendor *vendor;
9+
BWFigCaptureDevice *device;
10+
BWFigCaptureStream *stream;
11+
OpaqueFigCaptureDeviceRef deviceRef;
12+
OpaqueFigCaptureStreamRef streamRef;
13+
CMBaseObjectSetPropertyFunction streamSetProperty;
14+
BOOL legacyLEDs;
15+
BOOL quadLEDs;
16+
}
17+
@property (nonatomic, strong) NSString *currentError;
18+
- (BOOL)isLegacyLEDs;
19+
- (BOOL)isQuadLEDs;
20+
- (BOOL)setupStream;
21+
- (void)releaseStream;
22+
- (void)initVendor;
23+
- (void)checkType;
24+
- (void)setNumberProperty:(CFStringRef)property value:(id)value;
25+
- (void)setDictionaryProperty:(CFStringRef)property value:(id)value;
26+
@end

0 commit comments

Comments
 (0)