react-native-audio-browser 0.2.0-next.53 → 0.2.0-next.55

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 (599) hide show
  1. package/README.md +32 -19
  2. package/android/src/cast/java/com/audiobrowser/cast/CastSupport.kt +8 -10
  3. package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +96 -243
  4. package/android/src/main/java/com/audiobrowser/AudioBrowserLifecycleModule.kt +8 -12
  5. package/android/src/main/java/com/audiobrowser/AudioBrowserPackage.kt +1 -3
  6. package/android/src/main/java/com/audiobrowser/Callbacks.kt +1 -10
  7. package/android/src/main/java/com/audiobrowser/ForegroundStart.kt +13 -18
  8. package/android/src/main/java/com/audiobrowser/HeadlessTaskService.kt +3 -7
  9. package/android/src/main/java/com/audiobrowser/RemoteOutputs.kt +8 -10
  10. package/android/src/main/java/com/audiobrowser/Service.kt +20 -61
  11. package/android/src/main/java/com/audiobrowser/ServiceBinding.kt +9 -17
  12. package/android/src/main/java/com/audiobrowser/browser/ArtworkResolutionRegistry.kt +10 -9
  13. package/android/src/main/java/com/audiobrowser/browser/BrowseArtworkRegistry.kt +11 -8
  14. package/android/src/main/java/com/audiobrowser/browser/BrowserManager.kt +117 -448
  15. package/android/src/main/java/com/audiobrowser/browser/BrowserUrlResolution.kt +21 -60
  16. package/android/src/main/java/com/audiobrowser/browser/InertStyleDiagnostic.kt +20 -80
  17. package/android/src/main/java/com/audiobrowser/browser/JsonArtwork.kt +6 -10
  18. package/android/src/main/java/com/audiobrowser/browser/JsonModels.kt +7 -24
  19. package/android/src/main/java/com/audiobrowser/browser/RouteMatch.kt +2 -4
  20. package/android/src/main/java/com/audiobrowser/browser/SectionScope.kt +13 -31
  21. package/android/src/main/java/com/audiobrowser/browser/SimpleRouter.kt +12 -40
  22. package/android/src/main/java/com/audiobrowser/browser/StyleResolver.kt +15 -26
  23. package/android/src/main/java/com/audiobrowser/browser/TrackLoadHandler.kt +5 -15
  24. package/android/src/main/java/com/audiobrowser/extension/EnumExtensions.kt +1 -0
  25. package/android/src/main/java/com/audiobrowser/extension/NumberExt.kt +2 -0
  26. package/android/src/main/java/com/audiobrowser/extension/ResolvedTrackExt.kt +4 -8
  27. package/android/src/main/java/com/audiobrowser/extension/TappedTrack.kt +4 -6
  28. package/android/src/main/java/com/audiobrowser/extension/TrackIdentity.kt +3 -7
  29. package/android/src/main/java/com/audiobrowser/http/HttpClient.kt +13 -22
  30. package/android/src/main/java/com/audiobrowser/http/RequestConfigBuilder.kt +17 -38
  31. package/android/src/main/java/com/audiobrowser/model/IcyTitle.kt +5 -6
  32. package/android/src/main/java/com/audiobrowser/model/PlaybackMetadata.kt +4 -9
  33. package/android/src/main/java/com/audiobrowser/model/PlayerSetupOptions.kt +18 -29
  34. package/android/src/main/java/com/audiobrowser/model/PlayerUpdateOptions.kt +6 -16
  35. package/android/src/main/java/com/audiobrowser/player/AutomaticBufferManager.kt +15 -45
  36. package/android/src/main/java/com/audiobrowser/player/CapabilityControls.kt +23 -59
  37. package/android/src/main/java/com/audiobrowser/player/CrossOriginHeaderStripper.kt +14 -26
  38. package/android/src/main/java/com/audiobrowser/player/DynamicLoadControl.kt +15 -43
  39. package/android/src/main/java/com/audiobrowser/player/EnginePlayback.kt +4 -4
  40. package/android/src/main/java/com/audiobrowser/player/EqualizerController.kt +15 -21
  41. package/android/src/main/java/com/audiobrowser/player/InterceptingPlayer.kt +14 -31
  42. package/android/src/main/java/com/audiobrowser/player/LocalEngine.kt +8 -8
  43. package/android/src/main/java/com/audiobrowser/player/MediaFactory.kt +16 -27
  44. package/android/src/main/java/com/audiobrowser/player/MediaSessionCallback.kt +119 -237
  45. package/android/src/main/java/com/audiobrowser/player/MediaSessionCommandManager.kt +48 -145
  46. package/android/src/main/java/com/audiobrowser/player/NowPlayingUpdater.kt +39 -100
  47. package/android/src/main/java/com/audiobrowser/player/PlaybackErrorClassifier.kt +16 -26
  48. package/android/src/main/java/com/audiobrowser/player/PlaybackStateMachine.kt +22 -28
  49. package/android/src/main/java/com/audiobrowser/player/PlaybackStateStore.kt +28 -64
  50. package/android/src/main/java/com/audiobrowser/player/PlaybackTimer.kt +8 -4
  51. package/android/src/main/java/com/audiobrowser/player/Player.kt +117 -405
  52. package/android/src/main/java/com/audiobrowser/player/PlayerCapabilitiesExt.kt +1 -1
  53. package/android/src/main/java/com/audiobrowser/player/PlayerEngineFactory.kt +11 -19
  54. package/android/src/main/java/com/audiobrowser/player/PlayerListener.kt +30 -96
  55. package/android/src/main/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicy.kt +39 -95
  56. package/android/src/main/java/com/audiobrowser/player/ShuffleOrderLedBy.kt +7 -13
  57. package/android/src/main/java/com/audiobrowser/player/SleepTimer.kt +13 -30
  58. package/android/src/main/java/com/audiobrowser/player/SleepTimerManager.kt +7 -11
  59. package/android/src/main/java/com/audiobrowser/player/StuckRecoveryPolicy.kt +9 -22
  60. package/android/src/main/java/com/audiobrowser/player/TransformingDataSource.kt +22 -54
  61. package/android/src/main/java/com/audiobrowser/player/VolumeFader.kt +8 -15
  62. package/android/src/main/java/com/audiobrowser/remote/RemoteItem.kt +9 -8
  63. package/android/src/main/java/com/audiobrowser/remote/RemoteOutputsController.kt +13 -10
  64. package/android/src/main/java/com/audiobrowser/remote/RemotePlayback.kt +8 -8
  65. package/android/src/main/java/com/audiobrowser/remote/RemoteQueue.kt +12 -5
  66. package/android/src/main/java/com/audiobrowser/remote/RemoteSwitchingPlayer.kt +28 -48
  67. package/android/src/main/java/com/audiobrowser/sonos/DeviceDescriptionParser.kt +11 -19
  68. package/android/src/main/java/com/audiobrowser/sonos/DidlLite.kt +2 -2
  69. package/android/src/main/java/com/audiobrowser/sonos/SoapClient.kt +6 -6
  70. package/android/src/main/java/com/audiobrowser/sonos/SoapEnvelopes.kt +8 -9
  71. package/android/src/main/java/com/audiobrowser/sonos/SoapResponseParser.kt +11 -18
  72. package/android/src/main/java/com/audiobrowser/sonos/SonosDiscoverer.kt +10 -10
  73. package/android/src/main/java/com/audiobrowser/sonos/SonosOutputs.kt +10 -10
  74. package/android/src/main/java/com/audiobrowser/sonos/SonosPlayer.kt +21 -33
  75. package/android/src/main/java/com/audiobrowser/sonos/SonosRemote.kt +4 -6
  76. package/android/src/main/java/com/audiobrowser/sonos/SonosRouteProviderService.kt +9 -10
  77. package/android/src/main/java/com/audiobrowser/sonos/SonosStreamUri.kt +7 -7
  78. package/android/src/main/java/com/audiobrowser/sonos/SonosTransport.kt +5 -4
  79. package/android/src/main/java/com/audiobrowser/sonos/SsdpDiscovery.kt +8 -3
  80. package/android/src/main/java/com/audiobrowser/sonos/SsdpMessages.kt +4 -6
  81. package/android/src/main/java/com/audiobrowser/sonos/ZoneGroupState.kt +13 -11
  82. package/android/src/main/java/com/audiobrowser/tls/AiaCertChaser.kt +34 -71
  83. package/android/src/main/java/com/audiobrowser/tls/AiaChasingExtendedTrustManager.kt +20 -37
  84. package/android/src/main/java/com/audiobrowser/tls/AiaChasingTrustManager.kt +18 -27
  85. package/android/src/main/java/com/audiobrowser/tls/AiaTls.kt +14 -29
  86. package/android/src/main/java/com/audiobrowser/tls/CachingCertificateFetcher.kt +68 -133
  87. package/android/src/main/java/com/audiobrowser/util/ArtworkContentProvider.kt +10 -22
  88. package/android/src/main/java/com/audiobrowser/util/ArtworkRoutes.kt +6 -6
  89. package/android/src/main/java/com/audiobrowser/util/ArtworkUris.kt +4 -3
  90. package/android/src/main/java/com/audiobrowser/util/ArtworkVariant.kt +2 -13
  91. package/android/src/main/java/com/audiobrowser/util/Automotive.kt +2 -4
  92. package/android/src/main/java/com/audiobrowser/util/BatteryOptimizationHelper.kt +3 -9
  93. package/android/src/main/java/com/audiobrowser/util/BatteryWarningStore.kt +4 -14
  94. package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +21 -85
  95. package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoader.kt +7 -7
  96. package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoaderHolder.kt +5 -8
  97. package/android/src/main/java/com/audiobrowser/util/CoilBitmapLoader.kt +8 -24
  98. package/android/src/main/java/com/audiobrowser/util/EqualizerManager.kt +7 -39
  99. package/android/src/main/java/com/audiobrowser/util/MediaExtrasBuilder.kt +10 -14
  100. package/android/src/main/java/com/audiobrowser/util/MetadataAdapter.kt +5 -9
  101. package/android/src/main/java/com/audiobrowser/util/NetworkConnectivityMonitor.kt +5 -9
  102. package/android/src/main/java/com/audiobrowser/util/OutputMonitor.kt +21 -50
  103. package/android/src/main/java/com/audiobrowser/util/OutputSwitcher.kt +7 -20
  104. package/android/src/main/java/com/audiobrowser/util/PlayingStateFactory.kt +3 -5
  105. package/android/src/main/java/com/audiobrowser/util/RatingFavorites.kt +4 -5
  106. package/android/src/main/java/com/audiobrowser/util/StyleWire.kt +5 -5
  107. package/android/src/main/java/com/audiobrowser/util/SvgArtworkRenderer.kt +5 -9
  108. package/android/src/main/java/com/audiobrowser/util/SystemVolumeMonitor.kt +6 -9
  109. package/android/src/main/java/com/audiobrowser/util/TrackFactory.kt +25 -47
  110. package/android/src/nocast/java/com/audiobrowser/cast/CastSupport.kt +0 -2
  111. package/android/src/test/java/com/audiobrowser/ForegroundStartTest.kt +1 -2
  112. package/android/src/test/java/com/audiobrowser/LegacyRatingTest.kt +3 -3
  113. package/android/src/test/java/com/audiobrowser/ServiceBindingTest.kt +0 -13
  114. package/android/src/test/java/com/audiobrowser/ServiceTaskRemovedTest.kt +2 -3
  115. package/android/src/test/java/com/audiobrowser/TestFixtures.kt +5 -14
  116. package/android/src/test/java/com/audiobrowser/browser/BrowseArtworkRegistryTest.kt +1 -1
  117. package/android/src/test/java/com/audiobrowser/browser/BrowserManagerBuildApiRequestTest.kt +2 -8
  118. package/android/src/test/java/com/audiobrowser/browser/BrowserManagerFavoritesTest.kt +2 -12
  119. package/android/src/test/java/com/audiobrowser/browser/BrowserManagerLayerResolutionTest.kt +5 -28
  120. package/android/src/test/java/com/audiobrowser/browser/BrowserManagerTest.kt +11 -43
  121. package/android/src/test/java/com/audiobrowser/browser/BrowserUrlResolutionTest.kt +4 -13
  122. package/android/src/test/java/com/audiobrowser/browser/InertStyleDiagnosticTest.kt +2 -11
  123. package/android/src/test/java/com/audiobrowser/browser/JsonArtworkTest.kt +0 -2
  124. package/android/src/test/java/com/audiobrowser/browser/JsonStyleTest.kt +3 -8
  125. package/android/src/test/java/com/audiobrowser/browser/SectionScopeTest.kt +2 -14
  126. package/android/src/test/java/com/audiobrowser/browser/SimpleRouterTest.kt +1 -5
  127. package/android/src/test/java/com/audiobrowser/browser/StyleResolverTest.kt +2 -13
  128. package/android/src/test/java/com/audiobrowser/extension/TappedTrackTest.kt +1 -7
  129. package/android/src/test/java/com/audiobrowser/extension/TrackIdentityTest.kt +0 -5
  130. package/android/src/test/java/com/audiobrowser/http/RequestConfigBuilderTest.kt +8 -16
  131. package/android/src/test/java/com/audiobrowser/model/IcyTitleTest.kt +1 -1
  132. package/android/src/test/java/com/audiobrowser/player/BrowseTilesTest.kt +12 -29
  133. package/android/src/test/java/com/audiobrowser/player/CapabilityControlsTest.kt +3 -12
  134. package/android/src/test/java/com/audiobrowser/player/CrossOriginHeaderStripperTest.kt +0 -7
  135. package/android/src/test/java/com/audiobrowser/player/DynamicLoadControlTest.kt +0 -1
  136. package/android/src/test/java/com/audiobrowser/player/EqualizerControllerTest.kt +0 -9
  137. package/android/src/test/java/com/audiobrowser/player/LiveSeekCommandTest.kt +1 -2
  138. package/android/src/test/java/com/audiobrowser/player/MediaSessionSlotMappingTest.kt +0 -9
  139. package/android/src/test/java/com/audiobrowser/player/NowPlayingUpdaterTest.kt +15 -22
  140. package/android/src/test/java/com/audiobrowser/player/PlaybackErrorClassifierTest.kt +1 -24
  141. package/android/src/test/java/com/audiobrowser/player/PlaybackStateMachineTest.kt +0 -20
  142. package/android/src/test/java/com/audiobrowser/player/PlaybackStateStoreTrackJsonTest.kt +1 -6
  143. package/android/src/test/java/com/audiobrowser/player/PlaybackTimerTest.kt +2 -4
  144. package/android/src/test/java/com/audiobrowser/player/PlayerCastTest.kt +2 -2
  145. package/android/src/test/java/com/audiobrowser/player/PlayerEngineFactoryTest.kt +0 -3
  146. package/android/src/test/java/com/audiobrowser/player/PlayerInvalidTrackTest.kt +0 -1
  147. package/android/src/test/java/com/audiobrowser/player/PlayerSetupTest.kt +3 -2
  148. package/android/src/test/java/com/audiobrowser/player/PlayerSonosTest.kt +5 -1
  149. package/android/src/test/java/com/audiobrowser/player/PlayerSuppressionTest.kt +5 -7
  150. package/android/src/test/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicyTest.kt +4 -35
  151. package/android/src/test/java/com/audiobrowser/player/SessionErrorMaskTest.kt +0 -5
  152. package/android/src/test/java/com/audiobrowser/player/ShuffleOrderLedByTest.kt +1 -8
  153. package/android/src/test/java/com/audiobrowser/player/StandardSkipTest.kt +4 -6
  154. package/android/src/test/java/com/audiobrowser/player/StuckRecoveryPolicyTest.kt +11 -11
  155. package/android/src/test/java/com/audiobrowser/player/TransformingDataSourceTest.kt +2 -23
  156. package/android/src/test/java/com/audiobrowser/remote/FakeRemote.kt +9 -10
  157. package/android/src/test/java/com/audiobrowser/remote/RemoteSwitchingPlayerTest.kt +0 -1
  158. package/android/src/test/java/com/audiobrowser/sonos/DeviceDescriptionParserTest.kt +1 -3
  159. package/android/src/test/java/com/audiobrowser/sonos/DidlLiteTest.kt +0 -1
  160. package/android/src/test/java/com/audiobrowser/sonos/SoapClientTest.kt +0 -3
  161. package/android/src/test/java/com/audiobrowser/sonos/SoapEnvelopesTest.kt +0 -1
  162. package/android/src/test/java/com/audiobrowser/sonos/SoapResponseParserTest.kt +0 -1
  163. package/android/src/test/java/com/audiobrowser/sonos/SonosDiscovererTest.kt +2 -0
  164. package/android/src/test/java/com/audiobrowser/sonos/SonosPlayerTest.kt +0 -1
  165. package/android/src/test/java/com/audiobrowser/sonos/SonosRemoteTest.kt +1 -1
  166. package/android/src/test/java/com/audiobrowser/sonos/SonosRoutesTest.kt +2 -0
  167. package/android/src/test/java/com/audiobrowser/sonos/SonosTransportTest.kt +2 -6
  168. package/android/src/test/java/com/audiobrowser/sonos/SsdpMessagesTest.kt +0 -2
  169. package/android/src/test/java/com/audiobrowser/tls/AiaCertChaserTest.kt +13 -37
  170. package/android/src/test/java/com/audiobrowser/tls/AiaChasingTrustManagerTest.kt +10 -24
  171. package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherCallSiteTest.kt +15 -39
  172. package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherTest.kt +4 -10
  173. package/android/src/test/java/com/audiobrowser/util/ArtworkContentProviderTest.kt +2 -11
  174. package/android/src/test/java/com/audiobrowser/util/ArtworkUrisTest.kt +0 -1
  175. package/android/src/test/java/com/audiobrowser/util/BrowserPathHelperTest.kt +0 -4
  176. package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderHolderTest.kt +1 -1
  177. package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderTest.kt +0 -5
  178. package/android/src/test/java/com/audiobrowser/util/FakeImageLoader.kt +2 -2
  179. package/android/src/test/java/com/audiobrowser/util/MediaExtrasBuilderTest.kt +4 -12
  180. package/android/src/test/java/com/audiobrowser/util/OutputMonitorTest.kt +1 -1
  181. package/android/src/test/java/com/audiobrowser/util/PlayingStateFactoryTest.kt +0 -4
  182. package/android/src/test/java/com/audiobrowser/util/TrackFactoryBrowseTest.kt +1 -1
  183. package/android/src/test/java/com/audiobrowser/util/TrackFactoryMediaIdTest.kt +4 -6
  184. package/android/src/testCast/java/com/audiobrowser/cast/CastEndsTest.kt +1 -1
  185. package/android/src/testCast/java/com/audiobrowser/cast/SendingMediaItemConverterTest.kt +1 -0
  186. package/ios/AVPlayerEngine.swift +13 -21
  187. package/ios/AVPlayerEngineCallbacks.swift +2 -4
  188. package/ios/Browser/BrowseGate.swift +7 -8
  189. package/ios/Browser/BrowserConfig.swift +19 -34
  190. package/ios/Browser/BrowserError.swift +0 -1
  191. package/ios/Browser/BrowserManager.swift +29 -75
  192. package/ios/Browser/BrowserPathHelper.swift +13 -93
  193. package/ios/Browser/FavoriteSet.swift +7 -10
  194. package/ios/Browser/InertStyleDiagnostic.swift +17 -82
  195. package/ios/Browser/JsonModels.swift +11 -51
  196. package/ios/Browser/NavigationErrorState.swift +3 -2
  197. package/ios/Browser/PageResolver.swift +13 -23
  198. package/ios/Browser/RequestLayer.swift +16 -20
  199. package/ios/Browser/RequestPipeline.swift +33 -43
  200. package/ios/Browser/SearchDrillIn.swift +7 -13
  201. package/ios/Browser/SectionScope.swift +14 -26
  202. package/ios/Browser/SimpleRouter.swift +8 -15
  203. package/ios/Browser/StyleResolver.swift +12 -29
  204. package/ios/Browser/TabBarEntries.swift +6 -11
  205. package/ios/Browser/TrackIdTemplate.swift +6 -14
  206. package/ios/CarPlay/CPInterfaceController+Safe.swift +19 -28
  207. package/ios/CarPlay/CarPlayArtworkResolver.swift +5 -9
  208. package/ios/CarPlay/CarPlayController.swift +4 -4
  209. package/ios/CarPlay/CarPlayImageLoader.swift +11 -26
  210. package/ios/CarPlay/CarPlayListItemFactory.swift +30 -80
  211. package/ios/CarPlay/CarPlayNowPlayingManager.swift +19 -54
  212. package/ios/CarPlay/CarPlaySession+Navigator.swift +10 -10
  213. package/ios/CarPlay/CarPlaySession+PageLoader.swift +6 -5
  214. package/ios/CarPlay/CarPlaySession+Refresher.swift +2 -2
  215. package/ios/CarPlay/CarPlaySession+TabBar.swift +19 -26
  216. package/ios/CarPlay/CarPlaySession.swift +13 -17
  217. package/ios/CarPlay/CarPlayTemplates.swift +6 -7
  218. package/ios/CarPlay/IntentHandlers.swift +3 -5
  219. package/ios/CarPlay/MediaIntentCriteria.swift +15 -29
  220. package/ios/CarPlay/MediaIntentHandler.swift +4 -7
  221. package/ios/CarPlay/MediaIntentPlayback.swift +9 -8
  222. package/ios/CarPlay/NowPlayingButtonRules.swift +3 -4
  223. package/ios/CarPlay/SectionPresentation.swift +18 -28
  224. package/ios/CarPlay/TopTemplateReplacer.swift +8 -9
  225. package/ios/Extension/Capability+RemoteCommand.swift +3 -3
  226. package/ios/Extension/ChapterMetadata+AVFoundation.swift +2 -5
  227. package/ios/Extension/CxxVectorConformances.swift +4 -16
  228. package/ios/Extension/NavigationError+Conversion.swift +4 -7
  229. package/ios/Extension/PlayerCapabilities+Favorite.swift +0 -1
  230. package/ios/Extension/RequestConfig+Copying.swift +2 -6
  231. package/ios/Extension/ResolvedTrack+Copying.swift +2 -8
  232. package/ios/Extension/SearchParams+Query.swift +4 -4
  233. package/ios/Extension/Section+Copying.swift +3 -6
  234. package/ios/Extension/String+IcyCharset.swift +5 -5
  235. package/ios/Extension/TimedMetadata+AVFoundation.swift +6 -12
  236. package/ios/Extension/Track+AVPlayer.swift +1 -2
  237. package/ios/Extension/Track+Copying.swift +2 -8
  238. package/ios/Extension/Track+Identity.swift +4 -9
  239. package/ios/Extension/TrackMetadata+AVFoundation.swift +10 -13
  240. package/ios/Extension/UIApplication+ActiveScene.swift +6 -14
  241. package/ios/Extension/Variant+Artwork.swift +8 -22
  242. package/ios/Http/HttpClient.swift +3 -3
  243. package/ios/HybridAudioBrowser+Browser.swift +10 -16
  244. package/ios/HybridAudioBrowser+Options.swift +6 -9
  245. package/ios/HybridAudioBrowser+Player.swift +8 -16
  246. package/ios/HybridAudioBrowser+PlayerCallbacks.swift +4 -5
  247. package/ios/HybridAudioBrowser+Stubs.swift +5 -7
  248. package/ios/HybridAudioBrowser.swift +54 -79
  249. package/ios/Model/NitroTypeStubs.swift +15 -22
  250. package/ios/Model/PlayerUpdateOptions.swift +6 -21
  251. package/ios/Model/RemoteCommand.swift +2 -2
  252. package/ios/Model/TrackPlayerError.swift +9 -22
  253. package/ios/NowPlayingInfo/NowPlayingInfoController.swift +21 -40
  254. package/ios/NowPlayingInfo/SilentAudioPrimer.swift +10 -16
  255. package/ios/Observer/ItemObserver.swift +7 -5
  256. package/ios/Observer/PlayerObserver.swift +5 -5
  257. package/ios/PlaybackEvent.swift +2 -2
  258. package/ios/Player/AirPlayStallJudgement.swift +7 -9
  259. package/ios/Player/AudioSessionController.swift +14 -15
  260. package/ios/Player/DeferredSeek.swift +2 -2
  261. package/ios/Player/EndOfTrackJudgement.swift +6 -13
  262. package/ios/Player/ErrorStatus.swift +8 -7
  263. package/ios/Player/MediaLoader.swift +20 -24
  264. package/ios/Player/NowPlayingLines.swift +1 -4
  265. package/ios/Player/NowPlayingUpdater.swift +35 -61
  266. package/ios/Player/PersistedPlaybackState.swift +1 -2
  267. package/ios/Player/PlaybackFailure.swift +20 -24
  268. package/ios/Player/PlaybackPersistence.swift +5 -6
  269. package/ios/Player/PlaybackStateMachine.swift +8 -11
  270. package/ios/Player/PlaybackTimer.swift +8 -11
  271. package/ios/Player/Player.swift +6 -13
  272. package/ios/Player/PlayerEngine.swift +20 -20
  273. package/ios/Player/PlayerStatusTypes.swift +1 -2
  274. package/ios/Player/QueueManager.swift +23 -67
  275. package/ios/Player/RetryLoop.swift +39 -50
  276. package/ios/Player/ShuffleOrder.swift +17 -57
  277. package/ios/Player/SleepTimerManager.swift +13 -28
  278. package/ios/Player/VolumeFader.swift +16 -16
  279. package/ios/RemoteCommand/RemoteCommandCallbacks.swift +6 -16
  280. package/ios/RemoteCommand/RemoteCommandController.swift +8 -10
  281. package/ios/Tests/AirPlayStallJudgementTests.swift +4 -4
  282. package/ios/Tests/BrowserPathHelperTests.swift +3 -6
  283. package/ios/Tests/DeferredSeekTests.swift +1 -3
  284. package/ios/Tests/EmitterTests.swift +0 -1
  285. package/ios/Tests/EndOfTrackJudgementTests.swift +1 -6
  286. package/ios/Tests/FavoriteSetTests.swift +1 -0
  287. package/ios/Tests/GenerationMemoTests.swift +2 -2
  288. package/ios/Tests/InertStyleDiagnosticTests.swift +4 -10
  289. package/ios/Tests/JsonModelsTests.swift +5 -12
  290. package/ios/Tests/LRUCacheTests.swift +1 -5
  291. package/ios/Tests/MediaIntentCriteriaTests.swift +2 -7
  292. package/ios/Tests/MediaLoaderTests.swift +3 -12
  293. package/ios/Tests/ObserverTests.swift +3 -3
  294. package/ios/Tests/PlaybackErrorTests.swift +7 -9
  295. package/ios/Tests/PlaybackFailureTests.swift +9 -17
  296. package/ios/Tests/PlaybackPersistenceTests.swift +1 -0
  297. package/ios/Tests/PlaybackStateMachineTests.swift +1 -16
  298. package/ios/Tests/PlaybackTimerTests.swift +2 -3
  299. package/ios/Tests/PlayerPolicyTests.swift +10 -26
  300. package/ios/Tests/PlayerTests.swift +53 -88
  301. package/ios/Tests/PlayingStateTests.swift +0 -1
  302. package/ios/Tests/QueueManagerTests.swift +30 -80
  303. package/ios/Tests/RemoteCommandControllerTests.swift +5 -13
  304. package/ios/Tests/ResolvedTrackCopyingTests.swift +0 -2
  305. package/ios/Tests/RetryLoopTests.swift +12 -35
  306. package/ios/Tests/SearchDrillInTests.swift +4 -5
  307. package/ios/Tests/SectionPresentationTests.swift +3 -16
  308. package/ios/Tests/SectionScopeTests.swift +3 -6
  309. package/ios/Tests/SimpleRouterTests.swift +1 -5
  310. package/ios/Tests/SleepTimerManagerTests.swift +8 -11
  311. package/ios/Tests/StyleResolverTests.swift +4 -13
  312. package/ios/Tests/Support/ManualSleepTimerScheduler.swift +3 -8
  313. package/ios/Tests/Support/TestTypes.swift +5 -15
  314. package/ios/Tests/TabBarEntriesTests.swift +0 -2
  315. package/ios/Tests/TimedMetadataAVFoundationTests.swift +2 -3
  316. package/ios/Tests/TopTemplateReplacerTests.swift +1 -1
  317. package/ios/Tests/TrackIdTemplateTests.swift +2 -6
  318. package/ios/Tests/TrackMetadataAVFoundationTests.swift +1 -4
  319. package/ios/Tests/TrackSelectorTests.swift +3 -15
  320. package/ios/TrackSelector.swift +13 -25
  321. package/ios/Util/ArtworkFreshness.swift +6 -6
  322. package/ios/Util/ArtworkImageFetcher.swift +19 -20
  323. package/ios/Util/ConcurrentMap.swift +2 -2
  324. package/ios/Util/Emitter.swift +8 -13
  325. package/ios/Util/NetworkMonitor.swift +4 -6
  326. package/ios/Util/OutputPicker.swift +1 -1
  327. package/ios/Util/ReadyValue.swift +3 -2
  328. package/ios/Util/SFSymbolRenderer.swift +17 -30
  329. package/ios/Util/SVGProcessor.swift +5 -9
  330. package/lib/commonjs/CLAUDE.md +7 -2
  331. package/lib/commonjs/features/battery.js +16 -12
  332. package/lib/commonjs/features/battery.js.map +1 -1
  333. package/lib/commonjs/features/browser-config.js +1 -1
  334. package/lib/commonjs/features/browser.js +74 -24
  335. package/lib/commonjs/features/browser.js.map +1 -1
  336. package/lib/commonjs/features/carConnection.js +3 -4
  337. package/lib/commonjs/features/carConnection.js.map +1 -1
  338. package/lib/commonjs/features/equalizer.js +9 -5
  339. package/lib/commonjs/features/equalizer.js.map +1 -1
  340. package/lib/commonjs/features/errors.js +35 -21
  341. package/lib/commonjs/features/errors.js.map +1 -1
  342. package/lib/commonjs/features/favorites.js +15 -13
  343. package/lib/commonjs/features/favorites.js.map +1 -1
  344. package/lib/commonjs/features/gate.js +12 -6
  345. package/lib/commonjs/features/gate.js.map +1 -1
  346. package/lib/commonjs/features/metadata.js +16 -14
  347. package/lib/commonjs/features/metadata.js.map +1 -1
  348. package/lib/commonjs/features/network.js +5 -1
  349. package/lib/commonjs/features/network.js.map +1 -1
  350. package/lib/commonjs/features/nowPlaying.js +28 -14
  351. package/lib/commonjs/features/nowPlaying.js.map +1 -1
  352. package/lib/commonjs/features/output.js +8 -4
  353. package/lib/commonjs/features/output.js.map +1 -1
  354. package/lib/commonjs/features/playback/controls.js +10 -5
  355. package/lib/commonjs/features/playback/controls.js.map +1 -1
  356. package/lib/commonjs/features/playback/playWhenReady.js +6 -5
  357. package/lib/commonjs/features/playback/playWhenReady.js.map +1 -1
  358. package/lib/commonjs/features/playback/playing.js +5 -3
  359. package/lib/commonjs/features/playback/playing.js.map +1 -1
  360. package/lib/commonjs/features/playback/progress.js +11 -5
  361. package/lib/commonjs/features/playback/progress.js.map +1 -1
  362. package/lib/commonjs/features/playback/state.js +3 -3
  363. package/lib/commonjs/features/playback/state.js.map +1 -1
  364. package/lib/commonjs/features/playback/trackPlaybackTime.js +6 -1
  365. package/lib/commonjs/features/playback/trackPlaybackTime.js.map +1 -1
  366. package/lib/commonjs/features/playback/volume.js +6 -5
  367. package/lib/commonjs/features/playback/volume.js.map +1 -1
  368. package/lib/commonjs/features/player/options.js +20 -10
  369. package/lib/commonjs/features/player/options.js.map +1 -1
  370. package/lib/commonjs/features/player/setup.js +34 -38
  371. package/lib/commonjs/features/player/setup.js.map +1 -1
  372. package/lib/commonjs/features/queue/activeTrack.js +0 -1
  373. package/lib/commonjs/features/queue/activeTrack.js.map +1 -1
  374. package/lib/commonjs/features/queue/queue.js +48 -20
  375. package/lib/commonjs/features/queue/queue.js.map +1 -1
  376. package/lib/commonjs/features/queue/repeatMode.js +2 -1
  377. package/lib/commonjs/features/queue/repeatMode.js.map +1 -1
  378. package/lib/commonjs/features/queue/shuffle.js +0 -1
  379. package/lib/commonjs/features/queue/shuffle.js.map +1 -1
  380. package/lib/commonjs/features/remoteControls.js +59 -35
  381. package/lib/commonjs/features/remoteControls.js.map +1 -1
  382. package/lib/commonjs/features/sleepTimer.js +15 -6
  383. package/lib/commonjs/features/sleepTimer.js.map +1 -1
  384. package/lib/commonjs/utils/LazyNativeEmitter.js +6 -9
  385. package/lib/commonjs/utils/LazyNativeEmitter.js.map +1 -1
  386. package/lib/commonjs/utils/NativeUpdatedValue.js +13 -12
  387. package/lib/commonjs/utils/NativeUpdatedValue.js.map +1 -1
  388. package/lib/commonjs/utils/getTrackIdentity.js +6 -4
  389. package/lib/commonjs/utils/getTrackIdentity.js.map +1 -1
  390. package/lib/commonjs/utils/useDebug.js +16 -3
  391. package/lib/commonjs/utils/useDebug.js.map +1 -1
  392. package/lib/commonjs/web/NativeAudioBrowser.js +2 -4
  393. package/lib/commonjs/web/NativeAudioBrowser.js.map +1 -1
  394. package/lib/commonjs/web/browser/parseSearchResponse.js +3 -4
  395. package/lib/commonjs/web/browser/parseSearchResponse.js.map +1 -1
  396. package/lib/commonjs/web/browser/sections.js +1 -1
  397. package/lib/commonjs/web/util/BrowserPathHelper.js +1 -3
  398. package/lib/commonjs/web/util/BrowserPathHelper.js.map +1 -1
  399. package/lib/module/CLAUDE.md +7 -2
  400. package/lib/module/features/battery.js +16 -12
  401. package/lib/module/features/battery.js.map +1 -1
  402. package/lib/module/features/browser-config.js +1 -1
  403. package/lib/module/features/browser.js +74 -24
  404. package/lib/module/features/browser.js.map +1 -1
  405. package/lib/module/features/carConnection.js +3 -4
  406. package/lib/module/features/carConnection.js.map +1 -1
  407. package/lib/module/features/equalizer.js +9 -5
  408. package/lib/module/features/equalizer.js.map +1 -1
  409. package/lib/module/features/errors.js +35 -21
  410. package/lib/module/features/errors.js.map +1 -1
  411. package/lib/module/features/favorites.js +15 -13
  412. package/lib/module/features/favorites.js.map +1 -1
  413. package/lib/module/features/gate.js +12 -6
  414. package/lib/module/features/gate.js.map +1 -1
  415. package/lib/module/features/metadata.js +16 -14
  416. package/lib/module/features/metadata.js.map +1 -1
  417. package/lib/module/features/network.js +5 -1
  418. package/lib/module/features/network.js.map +1 -1
  419. package/lib/module/features/nowPlaying.js +28 -14
  420. package/lib/module/features/nowPlaying.js.map +1 -1
  421. package/lib/module/features/output.js +8 -4
  422. package/lib/module/features/output.js.map +1 -1
  423. package/lib/module/features/playback/controls.js +10 -5
  424. package/lib/module/features/playback/controls.js.map +1 -1
  425. package/lib/module/features/playback/playWhenReady.js +6 -5
  426. package/lib/module/features/playback/playWhenReady.js.map +1 -1
  427. package/lib/module/features/playback/playing.js +5 -3
  428. package/lib/module/features/playback/playing.js.map +1 -1
  429. package/lib/module/features/playback/progress.js +11 -5
  430. package/lib/module/features/playback/progress.js.map +1 -1
  431. package/lib/module/features/playback/state.js +3 -3
  432. package/lib/module/features/playback/state.js.map +1 -1
  433. package/lib/module/features/playback/trackPlaybackTime.js +6 -1
  434. package/lib/module/features/playback/trackPlaybackTime.js.map +1 -1
  435. package/lib/module/features/playback/volume.js +6 -5
  436. package/lib/module/features/playback/volume.js.map +1 -1
  437. package/lib/module/features/player/options.js +20 -10
  438. package/lib/module/features/player/options.js.map +1 -1
  439. package/lib/module/features/player/setup.js +34 -38
  440. package/lib/module/features/player/setup.js.map +1 -1
  441. package/lib/module/features/queue/activeTrack.js +0 -1
  442. package/lib/module/features/queue/activeTrack.js.map +1 -1
  443. package/lib/module/features/queue/queue.js +48 -20
  444. package/lib/module/features/queue/queue.js.map +1 -1
  445. package/lib/module/features/queue/repeatMode.js +2 -1
  446. package/lib/module/features/queue/repeatMode.js.map +1 -1
  447. package/lib/module/features/queue/shuffle.js +0 -1
  448. package/lib/module/features/queue/shuffle.js.map +1 -1
  449. package/lib/module/features/remoteControls.js +59 -35
  450. package/lib/module/features/remoteControls.js.map +1 -1
  451. package/lib/module/features/sleepTimer.js +15 -6
  452. package/lib/module/features/sleepTimer.js.map +1 -1
  453. package/lib/module/utils/LazyNativeEmitter.js +6 -9
  454. package/lib/module/utils/LazyNativeEmitter.js.map +1 -1
  455. package/lib/module/utils/NativeUpdatedValue.js +13 -12
  456. package/lib/module/utils/NativeUpdatedValue.js.map +1 -1
  457. package/lib/module/utils/getTrackIdentity.js +6 -4
  458. package/lib/module/utils/getTrackIdentity.js.map +1 -1
  459. package/lib/module/utils/useDebug.js +16 -3
  460. package/lib/module/utils/useDebug.js.map +1 -1
  461. package/lib/module/web/NativeAudioBrowser.js +2 -4
  462. package/lib/module/web/NativeAudioBrowser.js.map +1 -1
  463. package/lib/module/web/browser/parseSearchResponse.js +3 -4
  464. package/lib/module/web/browser/parseSearchResponse.js.map +1 -1
  465. package/lib/module/web/browser/sections.js +1 -1
  466. package/lib/module/web/util/BrowserPathHelper.js +1 -3
  467. package/lib/module/web/util/BrowserPathHelper.js.map +1 -1
  468. package/lib/typescript/src/features/battery.d.ts +17 -12
  469. package/lib/typescript/src/features/battery.d.ts.map +1 -1
  470. package/lib/typescript/src/features/browser.d.ts +64 -24
  471. package/lib/typescript/src/features/browser.d.ts.map +1 -1
  472. package/lib/typescript/src/features/carConnection.d.ts +3 -4
  473. package/lib/typescript/src/features/carConnection.d.ts.map +1 -1
  474. package/lib/typescript/src/features/equalizer.d.ts +9 -5
  475. package/lib/typescript/src/features/equalizer.d.ts.map +1 -1
  476. package/lib/typescript/src/features/errors.d.ts +37 -22
  477. package/lib/typescript/src/features/errors.d.ts.map +1 -1
  478. package/lib/typescript/src/features/favorites.d.ts +15 -13
  479. package/lib/typescript/src/features/favorites.d.ts.map +1 -1
  480. package/lib/typescript/src/features/gate.d.ts +14 -8
  481. package/lib/typescript/src/features/gate.d.ts.map +1 -1
  482. package/lib/typescript/src/features/metadata.d.ts +37 -17
  483. package/lib/typescript/src/features/metadata.d.ts.map +1 -1
  484. package/lib/typescript/src/features/network.d.ts +5 -1
  485. package/lib/typescript/src/features/network.d.ts.map +1 -1
  486. package/lib/typescript/src/features/nowPlaying.d.ts +28 -14
  487. package/lib/typescript/src/features/nowPlaying.d.ts.map +1 -1
  488. package/lib/typescript/src/features/output.d.ts +8 -4
  489. package/lib/typescript/src/features/output.d.ts.map +1 -1
  490. package/lib/typescript/src/features/playback/controls.d.ts +10 -5
  491. package/lib/typescript/src/features/playback/controls.d.ts.map +1 -1
  492. package/lib/typescript/src/features/playback/playWhenReady.d.ts +6 -5
  493. package/lib/typescript/src/features/playback/playWhenReady.d.ts.map +1 -1
  494. package/lib/typescript/src/features/playback/playing.d.ts +16 -3
  495. package/lib/typescript/src/features/playback/playing.d.ts.map +1 -1
  496. package/lib/typescript/src/features/playback/progress.d.ts +11 -5
  497. package/lib/typescript/src/features/playback/progress.d.ts.map +1 -1
  498. package/lib/typescript/src/features/playback/state.d.ts +8 -3
  499. package/lib/typescript/src/features/playback/state.d.ts.map +1 -1
  500. package/lib/typescript/src/features/playback/trackPlaybackTime.d.ts +9 -2
  501. package/lib/typescript/src/features/playback/trackPlaybackTime.d.ts.map +1 -1
  502. package/lib/typescript/src/features/playback/volume.d.ts +6 -5
  503. package/lib/typescript/src/features/playback/volume.d.ts.map +1 -1
  504. package/lib/typescript/src/features/player/options.d.ts +52 -37
  505. package/lib/typescript/src/features/player/options.d.ts.map +1 -1
  506. package/lib/typescript/src/features/player/setup.d.ts +65 -60
  507. package/lib/typescript/src/features/player/setup.d.ts.map +1 -1
  508. package/lib/typescript/src/features/queue/activeTrack.d.ts +0 -1
  509. package/lib/typescript/src/features/queue/activeTrack.d.ts.map +1 -1
  510. package/lib/typescript/src/features/queue/queue.d.ts +48 -20
  511. package/lib/typescript/src/features/queue/queue.d.ts.map +1 -1
  512. package/lib/typescript/src/features/queue/repeatMode.d.ts +1 -1
  513. package/lib/typescript/src/features/queue/repeatMode.d.ts.map +1 -1
  514. package/lib/typescript/src/features/queue/shuffle.d.ts +0 -1
  515. package/lib/typescript/src/features/queue/shuffle.d.ts.map +1 -1
  516. package/lib/typescript/src/features/remoteControls.d.ts +58 -25
  517. package/lib/typescript/src/features/remoteControls.d.ts.map +1 -1
  518. package/lib/typescript/src/features/sleepTimer.d.ts +15 -7
  519. package/lib/typescript/src/features/sleepTimer.d.ts.map +1 -1
  520. package/lib/typescript/src/types/browser-nodes.d.ts +54 -57
  521. package/lib/typescript/src/types/browser-nodes.d.ts.map +1 -1
  522. package/lib/typescript/src/types/browser.d.ts +181 -144
  523. package/lib/typescript/src/types/browser.d.ts.map +1 -1
  524. package/lib/typescript/src/utils/LazyNativeEmitter.d.ts +6 -9
  525. package/lib/typescript/src/utils/LazyNativeEmitter.d.ts.map +1 -1
  526. package/lib/typescript/src/utils/NativeUpdatedValue.d.ts +13 -12
  527. package/lib/typescript/src/utils/NativeUpdatedValue.d.ts.map +1 -1
  528. package/lib/typescript/src/utils/getTrackIdentity.d.ts +6 -4
  529. package/lib/typescript/src/utils/getTrackIdentity.d.ts.map +1 -1
  530. package/lib/typescript/src/utils/useDebug.d.ts +16 -3
  531. package/lib/typescript/src/utils/useDebug.d.ts.map +1 -1
  532. package/package.json +1 -1
  533. package/src/CLAUDE.md +7 -2
  534. package/src/docs-floors.test.ts +71 -0
  535. package/src/features/battery.ts +17 -13
  536. package/src/features/browser-config.ts +1 -1
  537. package/src/features/browser.ts +65 -24
  538. package/src/features/carConnection.ts +3 -4
  539. package/src/features/equalizer.ts +9 -5
  540. package/src/features/errors.ts +37 -22
  541. package/src/features/favorites.ts +15 -13
  542. package/src/features/gate.ts +14 -8
  543. package/src/features/metadata.ts +37 -17
  544. package/src/features/network.ts +5 -1
  545. package/src/features/nowPlaying.ts +28 -14
  546. package/src/features/output.ts +8 -4
  547. package/src/features/playback/controls.ts +10 -5
  548. package/src/features/playback/playWhenReady.ts +6 -5
  549. package/src/features/playback/playing.ts +16 -3
  550. package/src/features/playback/progress.ts +11 -5
  551. package/src/features/playback/state.ts +8 -3
  552. package/src/features/playback/trackPlaybackTime.ts +9 -2
  553. package/src/features/playback/volume.ts +6 -5
  554. package/src/features/player/options.ts +54 -43
  555. package/src/features/player/setup.ts +67 -61
  556. package/src/features/queue/activeTrack.ts +0 -1
  557. package/src/features/queue/queue.ts +48 -20
  558. package/src/features/queue/repeatMode.ts +1 -1
  559. package/src/features/queue/shuffle.ts +0 -1
  560. package/src/features/remoteControls.ts +59 -35
  561. package/src/features/sleepTimer.ts +15 -7
  562. package/src/types/browser-nodes.ts +54 -57
  563. package/src/types/browser.ts +183 -146
  564. package/src/utils/LazyNativeEmitter.ts +6 -9
  565. package/src/utils/NativeUpdatedValue.ts +13 -12
  566. package/src/utils/getTrackIdentity.ts +6 -4
  567. package/src/utils/useDebug.ts +16 -3
  568. package/src/web/NativeAudioBrowser.ts +2 -4
  569. package/src/web/browser/parseSearchResponse.ts +3 -4
  570. package/src/web/browser/sections.ts +1 -1
  571. package/src/web/util/BrowserPathHelper.ts +1 -3
  572. package/website/guide/android-auto.md +25 -13
  573. package/website/guide/android-certificates.md +199 -120
  574. package/website/guide/artwork.md +93 -48
  575. package/website/guide/audio-output.md +86 -68
  576. package/website/guide/automotive.md +15 -10
  577. package/website/guide/basic-usage.md +5 -2
  578. package/website/guide/battery.md +50 -23
  579. package/website/guide/browser.md +155 -68
  580. package/website/guide/carplay.md +132 -49
  581. package/website/guide/configuration.md +85 -49
  582. package/website/guide/equalizer.md +36 -32
  583. package/website/guide/errors.md +106 -64
  584. package/website/guide/favorites.md +41 -31
  585. package/website/guide/gate.md +24 -10
  586. package/website/guide/getting-started.md +55 -2
  587. package/website/guide/hooks.md +53 -47
  588. package/website/guide/live-streams.md +80 -49
  589. package/website/guide/metadata.md +87 -53
  590. package/website/guide/migrating-from-track-player.md +94 -49
  591. package/website/guide/native-callback-fetch.md +46 -36
  592. package/website/guide/network.md +36 -20
  593. package/website/guide/now-playing.md +72 -44
  594. package/website/guide/playback.md +112 -35
  595. package/website/guide/queue.md +77 -43
  596. package/website/guide/remote-controls.md +87 -29
  597. package/website/guide/search.md +37 -22
  598. package/website/guide/sleep-timer.md +35 -14
  599. package/website/guide/track.md +59 -35
@@ -2,8 +2,8 @@ import CarPlay
2
2
  import NitroModules
3
3
 
4
4
  extension CarPlaySession {
5
- /// A row or tile was tapped. CarPlay is released at once, so the list never locks: a browse
6
- /// pushes its destination and fills it in, and playback owns its loading state on Now Playing.
5
+ /// A row or tile was tapped. Calls `completion` at once so the list never locks: a browse
6
+ /// pushes its destination and fills it in; playback shows its loading state on Now Playing.
7
7
  func select(_ track: Track, completion: @escaping () -> Void) {
8
8
  logger.info("Selected track: \(track.title)")
9
9
  // A tap queued before `end()`: the next run owns the screen.
@@ -19,8 +19,8 @@ extension CarPlaySession {
19
19
  return
20
20
  }
21
21
 
22
- // A playable track always lands on Now Playing, so it is pushed now with the tapped
23
- // track's fields: the queue expansion and media resolve may both hit the network.
22
+ // A playable track always lands on Now Playing, so it shows now with the tapped track's
23
+ // fields: the queue expansion and media resolve may both hit the network.
24
24
  if track.src != nil {
25
25
  player?.previewNowPlaying(track)
26
26
  nowPlaying.prepare(for: track)
@@ -50,10 +50,10 @@ extension CarPlaySession {
50
50
  }
51
51
 
52
52
  /// Pushes `path`'s page as an empty, spinning template that fills in once it appears; or the
53
- /// Browse Gate's page when the gate gates it; or selects the tab that is that path.
53
+ /// Browse Gate's page when the gate holds the path; or selects the tab that is that path.
54
54
  func navigate(to path: String, title: String) async {
55
- // A push lands asynchronously, so a double tap is caught by `navigatingPaths` until the
56
- // pushed template appears.
55
+ // A push lands asynchronously: `navigatingPaths` catches a double tap until the pushed
56
+ // template appears and clears it.
57
57
  guard interfaceController.topTemplate?.carPlayInfo?.path != path, !navigatingPaths.contains(path) else { return }
58
58
  navigatingPaths.insert(path)
59
59
  var pushing = false
@@ -73,15 +73,15 @@ extension CarPlaySession {
73
73
  pushing = true
74
74
  interfaceController.safePush(template, animated: true) { [weak self] pushed, error in
75
75
  guard !pushed else { return }
76
- // It will never appear to clear the guard (e.g. at the depth limit).
76
+ // The template never appears to clear the guard (e.g. at the depth limit).
77
77
  self?.navigatingPaths.remove(path)
78
78
  if let error { self?.logger.error("pushTemplate failed for \(path): \(error.localizedDescription)") }
79
79
  }
80
80
  }
81
81
 
82
82
  /// Switches to the tab whose path this is, popping any pushed stack first, instead of pushing
83
- /// a second copy of the tab into another tab's stack. False when no tab has the path, when
84
- /// the root is not a tab bar, or before iOS 17, which cannot select a tab.
83
+ /// a second copy of the tab. False when no tab has the path, when the root is not a tab bar,
84
+ /// or before iOS 17, which cannot select a tab.
85
85
  private func selectTab(owning path: String) -> Bool {
86
86
  guard #available(iOS 17.0, *),
87
87
  let tabBar = interfaceController.rootTemplate as? CPTabBarTemplate,
@@ -32,8 +32,8 @@ extension CarPlaySession {
32
32
  } catch {
33
33
  outcome = .failure(error)
34
34
  }
35
- // As soon as the resolve settles: formatting its error is a JS round trip the timeout must
36
- // not overwrite.
35
+ // Cancelled as soon as the resolve settles: formatting its error is a JS round trip the
36
+ // timeout must not overwrite.
37
37
  watchdog.cancel()
38
38
 
39
39
  switch outcome {
@@ -62,8 +62,8 @@ extension CarPlaySession {
62
62
  }
63
63
  }
64
64
 
65
- /// Shows a navigation error, as the app's `formatNavigationError` formats it, as the
66
- /// template's centered message (ADR 0001).
65
+ /// Shows `error`, as the app's `formatNavigationError` formats it, as the template's centered
66
+ /// message (ADR 0001).
67
67
  private func showNavigationError(_ error: NavigationError, path: String, on template: CPListTemplate) async {
68
68
  let formatted = await audioBrowser.browserManager.formatted(error, path: path)
69
69
  guard !Task.isCancelled else { return }
@@ -78,7 +78,8 @@ extension CarPlaySession {
78
78
  template.updateSections([])
79
79
  } else {
80
80
  // A pushed template's empty view renders reliably only as its initial state, so it is
81
- // replaced. The message has no path: backing out and re-tapping retries.
81
+ // replaced. The message has no path, so no refresh reloads it: backing out and
82
+ // re-tapping retries.
82
83
  interfaceController.safeReplaceTop(
83
84
  template, with: CPListTemplate.message(title, subtitle: formatted.message, listTitle: template.title), animated: false,
84
85
  )
@@ -19,8 +19,8 @@ extension CarPlaySession {
19
19
  }
20
20
  }
21
21
 
22
- /// Re-resolves every displayed template at once, bypassing the cache: all content was
23
- /// invalidated (e.g. a locale change).
22
+ /// Re-resolves every displayed template concurrently, bypassing the cache, for when all
23
+ /// content was invalidated (e.g. a locale change).
24
24
  func refreshAllDisplayedTemplates() async {
25
25
  let browserManager = audioBrowser.browserManager
26
26
  let targets = displayedListTemplates().compactMap { template in template.contentPath.map { (template, $0) } }
@@ -2,8 +2,8 @@ import CarPlay
2
2
  import NitroModules
3
3
 
4
4
  extension CarPlaySession {
5
- /// The tabs the tab bar shows: a disabled tab hides, as `CPTabBarTemplate` has no disabled
6
- /// state (Android Auto filters the same way).
5
+ /// Drops disabled tabs: `CPTabBarTemplate` has no disabled state (Android Auto filters the
6
+ /// same way).
7
7
  static func visibleTabs(_ tabs: [Track]) -> [Track] {
8
8
  tabs.filter { $0.disabled != true }
9
9
  }
@@ -36,8 +36,8 @@ extension CarPlaySession {
36
36
  let tabs = Array(Self.visibleTabs(allTabs).prefix(CPTabBarTemplate.maximumTabCount))
37
37
  let gated = audioBrowser.browseGate.isActive
38
38
 
39
- // A tab bar with no tabs renders blank. A gate shows one full-screen page instead;
40
- // otherwise it is the empty-content error, like any other failure (ADR 0001).
39
+ // An empty tab bar renders blank: show the gate's page, or else the empty-content error
40
+ // (ADR 0001).
41
41
  guard !tabs.isEmpty else {
42
42
  if gated, let chrome = await browseGates(for: [nil])[0] {
43
43
  guard isCurrent(build) else { return }
@@ -65,8 +65,8 @@ extension CarPlaySession {
65
65
  interfaceController.safeSetRoot(CPTabBarTemplate(templates: templates), animated: true)
66
66
  }
67
67
 
68
- // Tabs fill lazily on first appearance. The first one is on screen already, and a template
69
- // swapped in by `updateTemplates` may never report appearing.
68
+ // Tabs load on first appearance. The first is already on screen, and a template swapped in
69
+ // by `updateTemplates` may never report appearing.
70
70
  let eager = gated ? templates : Array(templates.prefix(1))
71
71
  for template in eager {
72
72
  guard let path = template.contentPath else { continue }
@@ -74,8 +74,8 @@ extension CarPlaySession {
74
74
  }
75
75
  }
76
76
 
77
- /// The tabs changed: restamp their entries in place when the paths are the same, else
78
- /// rebuild, once the user is back at the root.
77
+ /// Restamps the tab entries in place when the paths are unchanged; otherwise rebuilds the tab
78
+ /// bar, deferred until the user is back at the root.
79
79
  func tabsChanged(_ tabs: [Track]) {
80
80
  guard !TabBarEntries.same(builtTabs, tabs) else { return }
81
81
  let visible = Self.visibleTabs(tabs)
@@ -95,8 +95,8 @@ extension CarPlaySession {
95
95
  _ = rebuildTabsIfAtRoot()
96
96
  }
97
97
 
98
- /// Rebuilds the tab bar if a rebuild is due and the user is at the root. True when it did,
99
- /// so the caller can skip work on a template about to be replaced.
98
+ /// Rebuilds the tab bar if a rebuild is due and the user is at the root. True when it did, so
99
+ /// the caller can skip work on a template about to be replaced.
100
100
  func rebuildTabsIfAtRoot() -> Bool {
101
101
  guard needsTabRebuild, interfaceController.templates.count <= 1 else { return false }
102
102
  needsTabRebuild = false
@@ -104,8 +104,7 @@ extension CarPlaySession {
104
104
  return true
105
105
  }
106
106
 
107
- /// The gate was set or cleared: pushed content must not stay reachable behind it, and a
108
- /// clear returns to the root.
107
+ /// Rebuilds the root, popping pushed content so none stays reachable behind a new gate.
109
108
  func gateChanged() {
110
109
  let tabs = audioBrowser.browserManager.tabs ?? []
111
110
  if tabs.isEmpty, !audioBrowser.browseGate.isActive {
@@ -117,16 +116,15 @@ extension CarPlaySession {
117
116
  nowPlaying.refresh()
118
117
  }
119
118
 
120
- /// The chrome to show if the Browse Gate gates this request, reporting it to JS; nil when the
121
- /// request is allowed.
119
+ /// The chrome to show if the Browse Gate gates this request, reported to JS; nil when allowed.
122
120
  func gate(_ reason: GateReason, path: String?, search: SearchParams? = nil) async -> Gate? {
123
121
  let chrome = await audioBrowser.browseGate.decide(NativeGateRequest(reason: reason, path: path, search: search))
124
122
  reportGates([chrome], reason: reason)
125
123
  return chrome
126
124
  }
127
125
 
128
- /// One browse decision per path, made concurrently and returned in path order. Reports
129
- /// nothing: the caller reports once it knows its build is still current.
126
+ /// One decision per path, made concurrently, in path order. Reports nothing: the caller
127
+ /// reports once it knows its build is still current.
130
128
  private func browseGates(for paths: [String?]) async -> [Gate?] {
131
129
  let browseGate = audioBrowser.browseGate
132
130
  return await paths.concurrentMap { path in
@@ -134,24 +132,20 @@ extension CarPlaySession {
134
132
  }
135
133
  }
136
134
 
137
- /// Fires `onGate` once for each request the gate gated.
138
135
  private func reportGates(_ chromes: [Gate?], reason: GateReason) {
139
136
  for _ in chromes.compactMap(\.self) {
140
137
  audioBrowser.onGate(GateEvent(reason: reason))
141
138
  }
142
139
  }
143
140
 
144
- /// A tab's content shell, which loads when it first appears.
145
141
  private func makeTabTemplate(for tab: Track) -> CPListTemplate {
146
142
  let template = CPListTemplate.loading(title: tab.title, path: tab.path, loadingTitle: config.carPlayLoadingTitle)
147
143
  applyTabBarEntry(to: template, for: tab)
148
144
  return template
149
145
  }
150
146
 
151
- /// The gate page: a list template, because the audio entitlement does not allow
152
- /// `CPInformationTemplate` (the tab bar raises on one), showing the chrome as its centered
153
- /// empty view. No action button: a gate withholds content, and the app offers any
154
- /// "subscribe" in its own UI.
147
+ /// A list template, as the audio entitlement does not allow `CPInformationTemplate` (the tab
148
+ /// bar raises on one). No action button: the app offers any "subscribe" in its own UI.
155
149
  func makeGatePage(_ chrome: Gate, path: String?, tab: Track?) -> CPListTemplate {
156
150
  let template = CPListTemplate.message(
157
151
  chrome.title, subtitle: chrome.message, listTitle: chrome.title,
@@ -161,18 +155,17 @@ extension CarPlaySession {
161
155
  return template
162
156
  }
163
157
 
164
- /// Stamps a template's tab-bar title and image: an SF Symbol, loaded artwork, or none. Tab
165
- /// icons are 24 pt (CarPlay Developer Guide).
166
158
  func applyTabBarEntry(to template: CPTemplate, for track: Track) {
167
159
  template.tabTitle = track.title
168
160
  if let artwork = track.artwork?.url, SFSymbolRenderer.isSFSymbol(artwork) {
169
- // A plain symbol: CarPlay tints the tab image itself.
161
+ // CarPlay tints the tab image, so the artwork's colours are dropped.
170
162
  let (symbolName, _, _) = SFSymbolRenderer.parseArtwork(artwork)
171
163
  if let image = UIImage(systemName: symbolName) {
172
164
  template.tabImage = image
173
165
  }
174
166
  } else if track.artwork != nil || track.artworkSource != nil {
175
167
  spawn { [weak template] session in
168
+ // Tab icons are 24 pt (CarPlay Developer Guide).
176
169
  let image = await session.imageLoader.artwork(for: track, size: CGSize(width: 24, height: 24))
177
170
  guard !Task.isCancelled, let image else { return }
178
171
  template?.tabImage = image
@@ -183,7 +176,7 @@ extension CarPlaySession {
183
176
  }
184
177
  }
185
178
 
186
- /// Shows a navigation error as the root: the app's formatting of it at path "/" (ADR 0001).
179
+ /// Shows the app's formatting of `error` at path "/" as the root (ADR 0001).
187
180
  func showRootError(_ error: NavigationError, build: UInt) async {
188
181
  let formatted = await audioBrowser.browserManager.formatted(error, path: "/")
189
182
  guard isCurrent(build) else { return }
@@ -3,8 +3,8 @@ import NitroModules
3
3
  import os.log
4
4
 
5
5
  /// One CarPlay run, from the moment the player and a configured browser exist until the scene
6
- /// stops or the bridge is replaced. It owns its subscriptions and tasks: `end()` cancels them,
7
- /// so nothing a stopped run started can paint over the next one.
6
+ /// stops or the bridge is replaced. `end()` cancels its subscriptions and tasks, so nothing a
7
+ /// stopped run started paints over the next one.
8
8
  @MainActor
9
9
  final class CarPlaySession {
10
10
  let logger = Logger(subsystem: "com.audiobrowser", category: "CarPlaySession")
@@ -29,23 +29,21 @@ final class CarPlaySession {
29
29
  private var tasks: [UUID: Task<Void, Never>] = [:]
30
30
  private(set) var ended = false
31
31
 
32
- /// Paths whose pushed template has not appeared yet; guards a double tap, since
33
- /// `topTemplate` only shows a push once it lands.
32
+ /// Paths pushed but not yet appeared; `topTemplate` shows a push only once it lands, so this
33
+ /// catches a double tap.
34
34
  var navigatingPaths: Set<String> = []
35
35
 
36
- /// Templates with a content load in flight, so a re-appearing one doesn't start another.
36
+ /// Templates with a load in flight, so a re-appearing one does not start another.
37
37
  var loadingTemplates: Set<ObjectIdentifier> = []
38
38
 
39
- /// Set when the tabs change while the user is browsing: rebuilding the tab bar would tear
40
- /// down the pushed stack, so it waits until they are back at the root.
39
+ /// Rebuilding the tab bar tears down the pushed stack, so a tab change waits for the root.
41
40
  var needsTabRebuild = false
42
41
 
43
- /// The tabs the current root was built from; their change event, which the browser delivers
44
- /// after the build has begun, has nothing left to change.
42
+ /// The tabs the current root was built from; their change event, which arrives after the
43
+ /// build began, has nothing left to change.
45
44
  var builtTabs: [Track]?
46
45
 
47
- /// Bumped by every root build (initial interface, tab bar, root error). A build that
48
- /// suspended and finds it bumped has been superseded, and leaves the root alone.
46
+ /// Bumped by every root build; a suspended build that finds it bumped leaves the root alone.
49
47
  private var rootBuildGeneration: UInt = 0
50
48
 
51
49
  /// How long a destination may spin before it shows an error.
@@ -135,8 +133,8 @@ final class CarPlaySession {
135
133
  // MARK: - Template Events
136
134
 
137
135
  func templateDidAppear(_ template: CPTemplate) {
138
- // Popping back from Now Playing reveals the tab bar, not a list; both repaint the playing
139
- // indicator, which may have changed while the list was covered.
136
+ // Popping Now Playing reports the tab bar appearing, not the list; both repaint the
137
+ // indicator, which may have changed while covered.
140
138
  guard template is CPListTemplate || template is CPTabBarTemplate else { return }
141
139
  if let path = template.carPlayInfo?.path { navigatingPaths.remove(path) }
142
140
  if rebuildTabsIfAtRoot() { return }
@@ -146,7 +144,7 @@ final class CarPlaySession {
146
144
 
147
145
  func templateDidDisappear(_ template: CPTemplate) {
148
146
  // Whether popping Now Playing reports the list appearing or only Now Playing leaving is a
149
- // platform detail; both repaint the indicator.
147
+ // platform detail; both repaint.
150
148
  guard template is CPNowPlayingTemplate else { return }
151
149
  updatePlayingIndicators()
152
150
  }
@@ -161,14 +159,12 @@ final class CarPlaySession {
161
159
  }
162
160
 
163
161
  private func playerOptionsChanged() {
164
- // The factory's copy is the last-applied location: sweep only on a real change.
165
162
  let location = playingIndicatorLocation
166
163
  guard listItemFactory.playingIndicatorLocation != location else { return }
167
164
  listItemFactory.playingIndicatorLocation = location
168
165
  updatePlayingIndicators()
169
166
  }
170
167
 
171
- /// Updates every displayed list item's playing flag and indicator location.
172
168
  func updatePlayingIndicators() {
173
169
  let location = playingIndicatorLocation
174
170
  for template in displayedListTemplates() {
@@ -188,7 +184,7 @@ final class CarPlaySession {
188
184
  }
189
185
  }
190
186
  // A flag set on a displayed item does not reliably reach the car screen; re-pushing the
191
- // sections re-serializes every item, so it is done only when something changed.
187
+ // sections re-serializes every item, so it is done only on a change.
192
188
  if changed { template.updateSections(template.sections) }
193
189
  }
194
190
  }
@@ -3,13 +3,13 @@ import CarPlay
3
3
  /// What a CarPlay template shows, kept in its `userInfo`.
4
4
  struct CarPlayTemplateInfo {
5
5
  enum Kind {
6
- /// Content that `path` resolves to; loaded lazily and refreshed.
6
+ /// Content that `path` resolves to, loaded lazily and refreshed.
7
7
  case content
8
- /// The Browse Gate's page for `path`, which is never loaded.
8
+ /// The Browse Gate's page for `path`; never loaded.
9
9
  case gate
10
10
  }
11
11
 
12
- /// The browse path the template stands for. Nil only for a gate page shown at the root.
12
+ /// Nil only for a gate page shown as the root.
13
13
  let path: String?
14
14
  let kind: Kind
15
15
  }
@@ -20,7 +20,6 @@ extension CPTemplate {
20
20
  set { userInfo = newValue }
21
21
  }
22
22
 
23
- /// The path this template loads content from; nil for gate and message pages.
24
23
  var contentPath: String? {
25
24
  guard let info = carPlayInfo, info.kind == .content else { return nil }
26
25
  return info.path
@@ -29,8 +28,8 @@ extension CPTemplate {
29
28
 
30
29
  extension CPListTemplate {
31
30
  /// A list template whose content is still resolving: the system spinner on iOS 18.4+, and
32
- /// the app's `loadingTitle`, when it set one, as the empty-view subtitle. A title-slot hint
33
- /// would render at CarPlay's large empty-state size.
31
+ /// `loadingTitle` as the empty-view subtitle, since the title slot renders at CarPlay's large
32
+ /// empty-state size.
34
33
  static func loading(title: String?, path: String?, loadingTitle: String?) -> CPListTemplate {
35
34
  let template = CPListTemplate(title: title, sections: [])
36
35
  if let path { template.carPlayInfo = CarPlayTemplateInfo(path: path, kind: .content) }
@@ -41,7 +40,7 @@ extension CPListTemplate {
41
40
  return template
42
41
  }
43
42
 
44
- /// An empty list template showing a centered message. CarPlay renders an empty view reliably
43
+ /// An empty list template showing a centered message. CarPlay renders the empty view reliably
45
44
  /// only as a template's initial state, so a pushed page's message is a new template.
46
45
  static func message(
47
46
  _ title: String,
@@ -18,8 +18,8 @@ public final class IntentHandlers: NSObject {
18
18
  }
19
19
 
20
20
  /// "Add this to my favorites" and "I like / don't like this": sets the favorite state of the
21
- /// playing track, through the same path as the CarPlay favorite button. A named item that is
22
- /// not playing is out of scope.
21
+ /// playing track, as the CarPlay favorite button does. A named item that is not playing is
22
+ /// out of scope.
23
23
  final class FavoriteIntentHandler: NSObject, INAddMediaIntentHandling, INUpdateMediaAffinityIntentHandling {
24
24
  private static let logger = Logger(subsystem: "com.audiobrowser", category: "FavoriteIntentHandler")
25
25
 
@@ -59,7 +59,7 @@ final class FavoriteIntentHandler: NSObject, INAddMediaIntentHandling, INUpdateM
59
59
  completion([.success(with: Self.spokenItem(intent.mediaSearch))])
60
60
  }
61
61
 
62
- /// One flat favorites collection: always the user's library.
62
+ // Favorites are one flat collection: always the user's library.
63
63
  @objc(resolveMediaDestinationForAddMedia:withCompletion:)
64
64
  func resolveMediaDestination(
65
65
  for _: INAddMediaIntent,
@@ -81,8 +81,6 @@ final class FavoriteIntentHandler: NSObject, INAddMediaIntentHandling, INUpdateM
81
81
  return INMediaItem(identifier: name, title: name, type: .unknown, artwork: nil)
82
82
  }
83
83
 
84
- /// False when nothing is playing, the playing track has no identity to favorite, or the
85
- /// change throws.
86
84
  @MainActor
87
85
  private static func favoriteCurrentTrack(_ favorited: Bool) -> Bool {
88
86
  guard let browser = HybridAudioBrowser.shared else { return false }
@@ -1,13 +1,9 @@
1
1
  import Foundation
2
2
 
3
- /// Normalized "what did the user ask to play", derived from a media intent.
4
- /// Deliberately free of `Intents` types so the core (`HybridAudioBrowser`)
5
- /// never imports the Intents framework — the mapping lives in the
6
- /// `Intents`-aware `MediaIntentHandler`.
3
+ /// What the user asked Siri to play, normalized from a media intent. Free of `Intents` types so
4
+ /// it builds in the SwiftPM target; `MediaIntentHandler` does the mapping.
7
5
  public struct MediaIntentCriteria: Sendable {
8
- /// Media-reference axis (mirrors `INMediaReference`). `currentlyPlaying`
9
- /// routes to native resume and never reaches the consumer; `my` routes to
10
- /// the search source; `unknown` is the default.
6
+ /// Mirrors `INMediaReference`: `currentlyPlaying` resumes natively, `my` searches.
11
7
  public enum Reference: Sendable { case my, currentlyPlaying, unknown }
12
8
 
13
9
  let query: String
@@ -18,10 +14,10 @@ public struct MediaIntentCriteria: Sendable {
18
14
  /// not a search.
19
15
  let matchesAppName: Bool
20
16
 
21
- // Structured search payload, mirroring `SearchParams` in plain strings so this type stays in
22
- // the SwiftPM target; the funnel builds the Nitro `SearchParams`.
23
- /// The container-vertical `SearchMode` name, or nil. Comes only from the intent's media type,
24
- /// never from which filter field is set.
17
+ // Structured search payload in plain strings, mirroring `SearchParams`, so this type stays in
18
+ // the SwiftPM target; `MediaIntentPlayback` builds the Nitro `SearchParams`.
19
+ /// The `SearchMode` name for the intent's media type, or nil. Never inferred from which
20
+ /// filter field is set.
25
21
  let searchMode: String?
26
22
  let genre: String?
27
23
  let artist: String?
@@ -29,10 +25,8 @@ public struct MediaIntentCriteria: Sendable {
29
25
  let title: String?
30
26
  let playlist: String?
31
27
 
32
- /// Builds criteria from the raw fields of a media-search intent.
33
- ///
34
- /// `mediaTypeMode` is the `SearchMode` string for the intent's container vertical ("station",
35
- /// "podcast", "song", …), or nil for a filter-only or unclassified type.
28
+ /// `mediaTypeMode` is a `SearchMode` name ("station", "podcast", "song", …), or nil for a
29
+ /// filter-only or unclassified media type.
36
30
  init(
37
31
  mediaName: String?,
38
32
  genreNames: [String],
@@ -52,7 +46,6 @@ public struct MediaIntentCriteria: Sendable {
52
46
  genre = genreNames.isEmpty ? nil : genreNames.joined(separator: " ")
53
47
  artist = trimmedNonEmpty(artistName)
54
48
  album = trimmedNonEmpty(albumName)
55
- // song/playlist carry their spoken name into a dedicated field.
56
49
  title = mediaTypeMode == "song" ? (name.isEmpty ? nil : name) : nil
57
50
  playlist = mediaTypeMode == "playlist" ? (name.isEmpty ? nil : name) : nil
58
51
 
@@ -65,30 +58,23 @@ public struct MediaIntentCriteria: Sendable {
65
58
  searchMode = mediaTypeMode
66
59
  }
67
60
 
68
- /// Resume vs search, by reference:
69
- /// - `currentlyPlaying` → always resume ("play this" plays the active track)
70
- /// - `my` → always search ("play my favorites" goes to the consumer)
71
- /// - `unknown` → the no-criteria / app-name heuristic
61
+ /// Resume rather than search. `currentlyPlaying` always resumes and `my` always searches;
62
+ /// otherwise a bare "play" resumes unless a genre or media type is given, and "play «app name»"
63
+ /// resumes unless a genre is given (Siri sends it with a media type).
72
64
  var isResume: Bool {
73
65
  switch reference {
74
66
  case .currentlyPlaying: return true
75
67
  case .my: return false
76
68
  case .unknown:
77
69
  let q = query.trimmingCharacters(in: .whitespacesAndNewlines)
78
- // "Play «app»": no search term and no other filter → resume.
79
70
  if q.isEmpty { return genre == nil && !hasMediaType }
80
- // "Play «app-name»": resume — unless a real filter signals a search.
81
71
  return matchesAppName && genre == nil
82
72
  }
83
73
  }
84
74
 
85
- /// Whether `query` is effectively the host app's own name. Case- and
86
- /// diacritic-insensitive.
87
- ///
88
- /// Whole-word subset match in either direction. Siri may deliver only part of
89
- /// the name ("Name" for «App Name»), so a partial match must count — but a
90
- /// substring match swallowed any query appearing inside the app name, making
91
- /// one-word stations unreachable by voice.
75
+ /// Whole-word subset match in either direction, case- and diacritic-insensitive. Siri may
76
+ /// deliver only part of the name, so a partial match counts; a substring match would swallow
77
+ /// any query inside the app name and make one-word stations unreachable by voice.
92
78
  private static func queryMatchesAppName(_ query: String, appName: String?) -> Bool {
93
79
  guard let appName else { return false }
94
80
  let tokens: (String) -> Set<String> = {
@@ -28,9 +28,9 @@ final class MediaIntentHandler: NSObject, INPlayMediaIntentHandling {
28
28
  }
29
29
  }
30
30
 
31
- /// Collapse `INMediaItemType` to a `SearchMode` string (the container
32
- /// vertical), or nil for filter-only / unclassified types. `genre`/`artist`/
33
- /// `album` are filters, not verticals — they yield no mode.
31
+ /// The `SearchMode` name of a container vertical; a name `SearchMode(fromString:)` does not
32
+ /// know silently drops the mode. Nil for unclassified types and for album, artist and genre,
33
+ /// which are filters, not verticals.
34
34
  private static func mediaTypeMode(_ type: INMediaItemType) -> String? {
35
35
  switch type {
36
36
  case .station, .radioStation, .algorithmicRadioStation, .musicStation: "station"
@@ -44,12 +44,10 @@ final class MediaIntentHandler: NSObject, INPlayMediaIntentHandling {
44
44
  case .movie: "movie"
45
45
  case .tvShow: "tv-show"
46
46
  case .tvShowEpisode: "tv-show-episode"
47
- default: nil // album/artist/genre/unknown
47
+ default: nil
48
48
  }
49
49
  }
50
50
 
51
- /// Map the SiriKit reference to the pure criteria enum. `.currentlyPlaying`
52
- /// routes to native resume; `.my` to the consumer; everything else is unknown.
53
51
  private static func reference(_ ref: INMediaReference) -> MediaIntentCriteria.Reference {
54
52
  switch ref {
55
53
  case .currentlyPlaying: .currentlyPlaying
@@ -58,7 +56,6 @@ final class MediaIntentHandler: NSObject, INPlayMediaIntentHandling {
58
56
  }
59
57
  }
60
58
 
61
- /// Host app's display name, used to recognise "Play «app»" as a resume.
62
59
  private static func hostAppName() -> String? {
63
60
  let info = Bundle.main.infoDictionary
64
61
  return (info?["CFBundleDisplayName"] as? String) ?? (info?["CFBundleName"] as? String)
@@ -5,19 +5,20 @@ import os.log
5
5
  private let logger = Logger(subsystem: "com.audiobrowser", category: "MediaIntentPlayback")
6
6
 
7
7
  /// Plays a Siri play-media intent through the single voice play funnel (ADR 0002): resume, or
8
- /// search → queue → play, then surface Now Playing.
8
+ /// search, queue and play, then ask for Now Playing.
9
9
  enum MediaIntentPlayback {
10
- /// Callable before the bridge exists: it waits, within the assistant's budget, for the player
11
- /// and a configured browser, which come up once React Native boots. Each await may outlive the
12
- /// bridge or its player (a JS reload or a second setup replaces them), so the player is looked
13
- /// up again after one, and the intent fails once the bridge is gone.
10
+ /// Callable before React Native has booted: waits, within the assistant's time budget, for the
11
+ /// player and a configured browser. A JS reload or a second setup can replace the bridge during
12
+ /// any await, so the player is looked up again after one and the intent fails once the bridge is
13
+ /// gone. Returns whether playback was requested; true does not mean audio has started, and a
14
+ /// failed cold resume still returns true.
14
15
  @MainActor
15
16
  static func play(criteria: MediaIntentCriteria) async -> Bool {
16
17
  guard let (browser, player) = await playerAndConfiguredBrowser.wait(timeout: .seconds(8)) else {
17
18
  logger.error("browser/player not ready within budget")
18
19
  return false
19
20
  }
20
- // Resume is not gated: the gate blocks finding content, never hearing the active or
21
+ // Resume is not gated: the gate blocks finding content, never hearing the current or
21
22
  // persisted track.
22
23
  if criteria.isResume {
23
24
  if player.currentTrack != nil {
@@ -36,8 +37,8 @@ enum MediaIntentPlayback {
36
37
  return true
37
38
  }
38
39
 
39
- // The API still text-searches `q`; the structured fields are forward-compatible, as on
40
- // Android.
40
+ // The search API still text-searches `q` only; the structured fields are forward-compatible,
41
+ // as on Android.
41
42
  let params = SearchParams(
42
43
  mode: criteria.searchMode.flatMap { SearchMode(fromString: $0) },
43
44
  query: criteria.query,
@@ -4,8 +4,8 @@ enum NowPlayingButtonRules {
4
4
  /// more.
5
5
  static let maximumButtonCount = 5
6
6
 
7
- /// The configured buttons, first occurrence of each kept, capped at `maximumButtonCount`:
8
- /// the configuration comes from JS, where duplicates and excess are representable.
7
+ /// The configured buttons, first occurrence of each kept, capped at `maximumButtonCount`: JS
8
+ /// can configure duplicates and more than fit.
9
9
  static func buttons<Button: Equatable>(_ configured: [Button]) -> [Button] {
10
10
  var buttons: [Button] = []
11
11
  for button in configured where !buttons.contains(button) {
@@ -14,7 +14,6 @@ enum NowPlayingButtonRules {
14
14
  return Array(buttons.prefix(maximumButtonCount))
15
15
  }
16
16
 
17
- /// The repeat button cycles off → track → queue → off.
18
17
  static func repeatMode(after mode: RepeatMode) -> RepeatMode {
19
18
  switch mode {
20
19
  case .off: .track
@@ -24,7 +23,7 @@ enum NowPlayingButtonRules {
24
23
  }
25
24
 
26
25
  /// The rate after `current` in `rates`: the next one, wrapping, when `current` is one of them;
27
- /// else the first rate above it, else the first. Nil when there are no rates.
26
+ /// else the first rate above it, else the first. Nil when `rates` is empty.
28
27
  static func rate(after current: Double, in rates: [Double]) -> Double? {
29
28
  guard !rates.isEmpty else { return nil }
30
29
  if let index = rates.firstIndex(where: { (current - $0).magnitude < 0.01 }) {