@neoskola/auto-play 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -61,7 +61,7 @@ class AutoPlayInterfaceController: NSObject, CPInterfaceControllerDelegate {
|
|
|
61
61
|
return true
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
return
|
|
64
|
+
return pushNowPlayingTemplateSafely(animated: animated)
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
return try await interfaceController.pushTemplate(
|
|
@@ -72,23 +72,18 @@ class AutoPlayInterfaceController: NSObject, CPInterfaceControllerDelegate {
|
|
|
72
72
|
|
|
73
73
|
/// Pushes CPNowPlayingTemplate using ObjC @try/@catch to prevent crash from NSException.
|
|
74
74
|
/// The push call is made entirely in Objective-C so NSExceptions never propagate through Swift frames.
|
|
75
|
-
private func pushNowPlayingTemplateSafely(animated: Bool)
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
} catch {
|
|
89
|
-
print("[AutoPlay] CPNowPlayingTemplate push threw ObjC exception: \(error.localizedDescription)")
|
|
90
|
-
continuation.resume(returning: false)
|
|
91
|
-
}
|
|
75
|
+
private func pushNowPlayingTemplateSafely(animated: Bool) -> Bool {
|
|
76
|
+
do {
|
|
77
|
+
try ObjCExceptionCatcher.pushTemplate(
|
|
78
|
+
CPNowPlayingTemplate.shared,
|
|
79
|
+
on: self.interfaceController,
|
|
80
|
+
animated: animated
|
|
81
|
+
)
|
|
82
|
+
print("[AutoPlay] CPNowPlayingTemplate pushed successfully")
|
|
83
|
+
return true
|
|
84
|
+
} catch {
|
|
85
|
+
print("[AutoPlay] CPNowPlayingTemplate push threw ObjC exception: \(error.localizedDescription)")
|
|
86
|
+
return false
|
|
92
87
|
}
|
|
93
88
|
}
|
|
94
89
|
|
|
@@ -11,7 +11,6 @@ API_AVAILABLE(ios(14.0))
|
|
|
11
11
|
+ (BOOL)pushTemplate:(CPTemplate * _Nonnull)templateToPush
|
|
12
12
|
onInterfaceController:(CPInterfaceController * _Nonnull)interfaceController
|
|
13
13
|
animated:(BOOL)animated
|
|
14
|
-
completion:(void (^ _Nullable)(BOOL success, NSError * _Nullable error))completion
|
|
15
14
|
error:(NSError * _Nullable * _Nullable)error;
|
|
16
15
|
|
|
17
16
|
@end
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
+ (BOOL)pushTemplate:(CPTemplate *)templateToPush
|
|
6
6
|
onInterfaceController:(CPInterfaceController *)interfaceController
|
|
7
7
|
animated:(BOOL)animated
|
|
8
|
-
completion:(void (^)(BOOL, NSError *))completion
|
|
9
8
|
error:(NSError **)error {
|
|
10
9
|
@try {
|
|
11
|
-
[interfaceController pushTemplate:templateToPush animated:animated completion:
|
|
10
|
+
[interfaceController pushTemplate:templateToPush animated:animated completion:nil];
|
|
12
11
|
return YES;
|
|
13
12
|
} @catch (NSException *exception) {
|
|
14
13
|
NSLog(@"[ObjCExceptionCatcher] Caught exception during pushTemplate: %@ — %@", exception.name, exception.reason);
|