@neoskola/auto-play 0.2.1 → 0.2.3

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.
@@ -171,7 +171,7 @@ class HybridAutoPlay: HybridAutoPlaySpec {
171
171
 
172
172
  let carPlayTemplate = template.getTemplate()
173
173
 
174
- if carPlayTemplate is CPAlertTemplate || carPlayTemplate is CPNowPlayingTemplate {
174
+ if carPlayTemplate is CPAlertTemplate {
175
175
  let animated = try await
176
176
  !interfaceController.dismissTemplate(
177
177
  animated: false
@@ -181,6 +181,17 @@ 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
+ }
184
195
  } else {
185
196
  let _ = try await interfaceController.pushTemplate(
186
197
  carPlayTemplate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neoskola/auto-play",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",