@neoskola/auto-play 0.2.15 → 0.2.17

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 await pushNowPlayingTemplateSafely(animated: animated)
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) async -> Bool {
76
- return await withCheckedContinuation { continuation in
77
- do {
78
- try ObjCExceptionCatcher.pushTemplate(
79
- CPNowPlayingTemplate.shared,
80
- on: self.interfaceController,
81
- animated: animated
82
- ) { success, error in
83
- if let error = error {
84
- print("[AutoPlay] CPNowPlayingTemplate push completion error: \(error)")
85
- }
86
- continuation.resume(returning: success)
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
+ onInterfaceController: 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: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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoskola/auto-play",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",