@neoskola/auto-play 0.2.3 → 0.2.5
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.
|
@@ -181,17 +181,6 @@ class HybridAutoPlay: HybridAutoPlaySpec {
|
|
|
181
181
|
carPlayTemplate,
|
|
182
182
|
animated: animated
|
|
183
183
|
)
|
|
184
|
-
} else if carPlayTemplate is CPNowPlayingTemplate {
|
|
185
|
-
// CPNowPlayingTemplate is a singleton — push it but catch errors
|
|
186
|
-
// since it can fail if no audio session is active
|
|
187
|
-
do {
|
|
188
|
-
let _ = try await interfaceController.pushTemplate(
|
|
189
|
-
carPlayTemplate,
|
|
190
|
-
animated: true
|
|
191
|
-
)
|
|
192
|
-
} catch {
|
|
193
|
-
print("[AutoPlay] CPNowPlayingTemplate push failed: \(error.localizedDescription)")
|
|
194
|
-
}
|
|
195
184
|
} else {
|
|
196
185
|
let _ = try await interfaceController.pushTemplate(
|
|
197
186
|
carPlayTemplate,
|
|
@@ -49,6 +49,15 @@ class AutoPlayInterfaceController: NSObject, CPInterfaceControllerDelegate {
|
|
|
49
49
|
_ templateToPush: CPTemplate,
|
|
50
50
|
animated: Bool
|
|
51
51
|
) async throws -> Bool {
|
|
52
|
+
// CPNowPlayingTemplate is a singleton — check if already in the stack
|
|
53
|
+
if templateToPush is CPNowPlayingTemplate {
|
|
54
|
+
let alreadyInStack = interfaceController.templates.contains(where: { $0 is CPNowPlayingTemplate })
|
|
55
|
+
if alreadyInStack {
|
|
56
|
+
print("[AutoPlay] CPNowPlayingTemplate already in stack, skipping push")
|
|
57
|
+
return true
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
52
61
|
return try await interfaceController.pushTemplate(
|
|
53
62
|
templateToPush,
|
|
54
63
|
animated: animated
|