react-native-audio-browser 0.2.0-next.22 → 0.2.0-next.24

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.
Files changed (42) hide show
  1. package/android/gradle.properties +1 -1
  2. package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +9 -1
  3. package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +6 -0
  4. package/android/src/test/java/com/audiobrowser/util/BrowserPathHelperTest.kt +14 -0
  5. package/ios/Browser/BrowserPathHelper.swift +6 -2
  6. package/ios/CarPlay/CPInterfaceController+Safe.swift +93 -23
  7. package/ios/CarPlay/CarPlayController.swift +5 -1
  8. package/ios/CarPlay/TopTemplateReplacer.swift +96 -0
  9. package/ios/Extension/NavigationError+Conversion.swift +7 -0
  10. package/ios/HybridAudioBrowser.swift +4 -1
  11. package/ios/Tests/BrowserPathHelperTests.swift +11 -0
  12. package/ios/Tests/TopTemplateReplacerTests.swift +172 -0
  13. package/lib/commonjs/web/browser/NavigationErrorManager.js +3 -1
  14. package/lib/commonjs/web/browser/NavigationErrorManager.js.map +1 -1
  15. package/lib/commonjs/web/util/BrowserPathHelper.js +6 -0
  16. package/lib/commonjs/web/util/BrowserPathHelper.js.map +1 -1
  17. package/lib/module/web/browser/NavigationErrorManager.js +3 -1
  18. package/lib/module/web/browser/NavigationErrorManager.js.map +1 -1
  19. package/lib/module/web/util/BrowserPathHelper.js +6 -0
  20. package/lib/module/web/util/BrowserPathHelper.js.map +1 -1
  21. package/lib/typescript/src/types/browser.d.ts +8 -1
  22. package/lib/typescript/src/types/browser.d.ts.map +1 -1
  23. package/nitrogen/generated/android/c++/JFormatNavigationErrorParams.hpp +9 -3
  24. package/nitrogen/generated/android/c++/JFunc_std__shared_ptr_Promise_std__optional_FormattedNavigationError____FormatNavigationErrorParams.hpp +2 -0
  25. package/nitrogen/generated/android/c++/JHybridAudioBrowserSpec.cpp +4 -0
  26. package/nitrogen/generated/android/c++/JNativeBrowserConfiguration.hpp +2 -0
  27. package/nitrogen/generated/android/c++/JNavigationErrorKind.hpp +58 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/FormatNavigationErrorParams.kt +6 -3
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/NavigationErrorKind.kt +23 -0
  30. package/nitrogen/generated/ios/AudioBrowser-Swift-Cxx-Bridge.hpp +3 -0
  31. package/nitrogen/generated/ios/AudioBrowser-Swift-Cxx-Umbrella.hpp +3 -0
  32. package/nitrogen/generated/ios/c++/HybridAudioBrowserSpecSwift.hpp +3 -0
  33. package/nitrogen/generated/ios/swift/FormatNavigationErrorParams.swift +7 -2
  34. package/nitrogen/generated/ios/swift/NavigationErrorKind.swift +40 -0
  35. package/nitrogen/generated/shared/c++/FormatNavigationErrorParams.hpp +9 -2
  36. package/nitrogen/generated/shared/c++/NavigationErrorKind.hpp +76 -0
  37. package/package.json +1 -1
  38. package/src/types/browser.ts +9 -1
  39. package/src/web/browser/NavigationErrorManager.ts +3 -1
  40. package/src/web/util/BrowserPathHelper.test.ts +16 -0
  41. package/src/web/util/BrowserPathHelper.ts +9 -0
  42. package/website/guide/carplay.md +30 -0
@@ -50,3 +50,19 @@ describe('BrowserPathHelper contextual URL round-trip', () => {
50
50
  ).toBeUndefined()
51
51
  })
52
52
  })
53
+
54
+ describe('BrowserPathHelper.navigationErrorKind', () => {
55
+ it('is a search for a search path and a browse for anything else', () => {
56
+ expect(
57
+ BrowserPathHelper.navigationErrorKind(
58
+ BrowserPathHelper.createSearchPath('jazz')
59
+ )
60
+ ).toBe('search')
61
+ expect(BrowserPathHelper.navigationErrorKind('/search?q=jazz')).toBe(
62
+ 'browse'
63
+ )
64
+ expect(BrowserPathHelper.navigationErrorKind('/__searchable')).toBe(
65
+ 'browse'
66
+ )
67
+ })
68
+ })
@@ -1,3 +1,5 @@
1
+ import type { NavigationErrorKind } from '../../types/browser'
2
+
1
3
  /**
2
4
  * Utility for handling browser paths and contextual URLs in the media browser system.
3
5
  * Mirrors Android's BrowserPathHelper.kt
@@ -28,6 +30,13 @@ export const BrowserPathHelper = {
28
30
  /** Query parameter name for the tapped child's page position (tie-breaker) */
29
31
  CONTEXTUAL_INDEX_PARAM: '__index',
30
32
 
33
+ /**
34
+ * Whether a navigation error on this path came from a browse or a search
35
+ */
36
+ navigationErrorKind(path: string): NavigationErrorKind {
37
+ return path.startsWith(`${this.SEARCH_PATH_PREFIX}?`) ? 'search' : 'browse'
38
+ },
39
+
31
40
  /**
32
41
  * Create a search path for a given query
33
42
  */
@@ -601,6 +601,36 @@ Return a browse path to enable the album line for that track, or `undefined` to
601
601
  CarPlay renders the tappable album/artist button as a **separate line built from the track's `album`** (visible as the third metadata line, with a chevron). Tracks without an `album` have no string for CarPlay to turn into a button — the artist line alone is never tappable. Set `album` on any track that should offer album-line navigation. See [Now Playing](/guide/now-playing) for the full field-by-surface rendering matrix.
602
602
  :::
603
603
 
604
+ ## Template Depth
605
+
606
+ CarPlay limits an audio app's template stack to **five templates, the tab bar included** (CarPlay App Programming Guide, p. 15), so the stack is full four pushes in. Now Playing and Up Next each take a slot like any list. A browse tree with a fixed shape (tabs → show → episodes) never gets there; one that can be drilled without end — a place, a place near it, a place near that — does.
607
+
608
+ At the limit, the library replaces the **top** page with the new one, so a push always lands:
609
+
610
+ ```
611
+ [tabs, A, B, C, D] + push E
612
+ [tabs, A, B, C, E]
613
+ ```
614
+
615
+ - **Forward never blocks.** A deeper list, Now Playing and Up Next all open at full depth.
616
+ - **Back skips one page.** From `E` it goes to `C`: `D`, the page the listener came from, is the one that was replaced. Below full depth, back works as usual.
617
+ - **The swap is a pop and a push.** CarPlay can't replace a template in place, so the library pops the top one without animation and then pushes the new one.
618
+
619
+ Each replacement is logged under the `com.audiobrowser` subsystem, category `TemplateStack`:
620
+
621
+ ```
622
+ push at the depth limit: replacing the top, CPListTemplate, with CPListTemplate
623
+ ```
624
+
625
+ To watch for it on the simulator:
626
+
627
+ ```sh
628
+ xcrun simctl spawn booted log stream --level info \
629
+ --predicate 'subsystem == "com.audiobrowser" AND category == "TemplateStack"'
630
+ ```
631
+
632
+ An `error` line in that category means the pop or the push failed; it names the template involved.
633
+
604
634
  ## Testing
605
635
 
606
636
  Test your app in the `CarPlay Simulator.app`, which is part of the [Additional Tools for Xcode](https://developer.apple.com/download/all/?q=additional%20tools%20for%20xcode). Siri voice search works there, so you can exercise the full intent flow without a car. CarPlay support on the iOS Simulator can be a little flaky — if something looks broken, retry or fall back to a physical device for final verification.