react-native-audio-browser 0.2.0-next.53 → 0.2.0-next.54
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.
- package/android/src/cast/java/com/audiobrowser/cast/CastSupport.kt +8 -10
- package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +96 -243
- package/android/src/main/java/com/audiobrowser/AudioBrowserLifecycleModule.kt +8 -12
- package/android/src/main/java/com/audiobrowser/AudioBrowserPackage.kt +1 -3
- package/android/src/main/java/com/audiobrowser/Callbacks.kt +1 -10
- package/android/src/main/java/com/audiobrowser/ForegroundStart.kt +13 -18
- package/android/src/main/java/com/audiobrowser/HeadlessTaskService.kt +3 -7
- package/android/src/main/java/com/audiobrowser/RemoteOutputs.kt +8 -10
- package/android/src/main/java/com/audiobrowser/Service.kt +20 -61
- package/android/src/main/java/com/audiobrowser/ServiceBinding.kt +9 -17
- package/android/src/main/java/com/audiobrowser/browser/ArtworkResolutionRegistry.kt +10 -9
- package/android/src/main/java/com/audiobrowser/browser/BrowseArtworkRegistry.kt +11 -8
- package/android/src/main/java/com/audiobrowser/browser/BrowserManager.kt +117 -448
- package/android/src/main/java/com/audiobrowser/browser/BrowserUrlResolution.kt +21 -60
- package/android/src/main/java/com/audiobrowser/browser/InertStyleDiagnostic.kt +20 -80
- package/android/src/main/java/com/audiobrowser/browser/JsonArtwork.kt +6 -10
- package/android/src/main/java/com/audiobrowser/browser/JsonModels.kt +7 -24
- package/android/src/main/java/com/audiobrowser/browser/RouteMatch.kt +2 -4
- package/android/src/main/java/com/audiobrowser/browser/SectionScope.kt +13 -31
- package/android/src/main/java/com/audiobrowser/browser/SimpleRouter.kt +12 -40
- package/android/src/main/java/com/audiobrowser/browser/StyleResolver.kt +15 -26
- package/android/src/main/java/com/audiobrowser/browser/TrackLoadHandler.kt +5 -15
- package/android/src/main/java/com/audiobrowser/extension/EnumExtensions.kt +1 -0
- package/android/src/main/java/com/audiobrowser/extension/NumberExt.kt +2 -0
- package/android/src/main/java/com/audiobrowser/extension/ResolvedTrackExt.kt +4 -8
- package/android/src/main/java/com/audiobrowser/extension/TappedTrack.kt +4 -6
- package/android/src/main/java/com/audiobrowser/extension/TrackIdentity.kt +3 -7
- package/android/src/main/java/com/audiobrowser/http/HttpClient.kt +13 -22
- package/android/src/main/java/com/audiobrowser/http/RequestConfigBuilder.kt +17 -38
- package/android/src/main/java/com/audiobrowser/model/IcyTitle.kt +5 -6
- package/android/src/main/java/com/audiobrowser/model/PlaybackMetadata.kt +4 -9
- package/android/src/main/java/com/audiobrowser/model/PlayerSetupOptions.kt +18 -29
- package/android/src/main/java/com/audiobrowser/model/PlayerUpdateOptions.kt +6 -16
- package/android/src/main/java/com/audiobrowser/player/AutomaticBufferManager.kt +15 -45
- package/android/src/main/java/com/audiobrowser/player/CapabilityControls.kt +23 -59
- package/android/src/main/java/com/audiobrowser/player/CrossOriginHeaderStripper.kt +14 -26
- package/android/src/main/java/com/audiobrowser/player/DynamicLoadControl.kt +15 -43
- package/android/src/main/java/com/audiobrowser/player/EnginePlayback.kt +4 -4
- package/android/src/main/java/com/audiobrowser/player/EqualizerController.kt +15 -21
- package/android/src/main/java/com/audiobrowser/player/InterceptingPlayer.kt +14 -31
- package/android/src/main/java/com/audiobrowser/player/LocalEngine.kt +8 -8
- package/android/src/main/java/com/audiobrowser/player/MediaFactory.kt +16 -27
- package/android/src/main/java/com/audiobrowser/player/MediaSessionCallback.kt +119 -237
- package/android/src/main/java/com/audiobrowser/player/MediaSessionCommandManager.kt +48 -145
- package/android/src/main/java/com/audiobrowser/player/NowPlayingUpdater.kt +39 -100
- package/android/src/main/java/com/audiobrowser/player/PlaybackErrorClassifier.kt +16 -26
- package/android/src/main/java/com/audiobrowser/player/PlaybackStateMachine.kt +22 -28
- package/android/src/main/java/com/audiobrowser/player/PlaybackStateStore.kt +28 -64
- package/android/src/main/java/com/audiobrowser/player/PlaybackTimer.kt +8 -4
- package/android/src/main/java/com/audiobrowser/player/Player.kt +117 -405
- package/android/src/main/java/com/audiobrowser/player/PlayerCapabilitiesExt.kt +1 -1
- package/android/src/main/java/com/audiobrowser/player/PlayerEngineFactory.kt +11 -19
- package/android/src/main/java/com/audiobrowser/player/PlayerListener.kt +30 -96
- package/android/src/main/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicy.kt +39 -95
- package/android/src/main/java/com/audiobrowser/player/ShuffleOrderLedBy.kt +7 -13
- package/android/src/main/java/com/audiobrowser/player/SleepTimer.kt +13 -30
- package/android/src/main/java/com/audiobrowser/player/SleepTimerManager.kt +7 -11
- package/android/src/main/java/com/audiobrowser/player/StuckRecoveryPolicy.kt +9 -22
- package/android/src/main/java/com/audiobrowser/player/TransformingDataSource.kt +22 -54
- package/android/src/main/java/com/audiobrowser/player/VolumeFader.kt +8 -15
- package/android/src/main/java/com/audiobrowser/remote/RemoteItem.kt +9 -8
- package/android/src/main/java/com/audiobrowser/remote/RemoteOutputsController.kt +13 -10
- package/android/src/main/java/com/audiobrowser/remote/RemotePlayback.kt +8 -8
- package/android/src/main/java/com/audiobrowser/remote/RemoteQueue.kt +12 -5
- package/android/src/main/java/com/audiobrowser/remote/RemoteSwitchingPlayer.kt +28 -48
- package/android/src/main/java/com/audiobrowser/sonos/DeviceDescriptionParser.kt +11 -19
- package/android/src/main/java/com/audiobrowser/sonos/DidlLite.kt +2 -2
- package/android/src/main/java/com/audiobrowser/sonos/SoapClient.kt +6 -6
- package/android/src/main/java/com/audiobrowser/sonos/SoapEnvelopes.kt +8 -9
- package/android/src/main/java/com/audiobrowser/sonos/SoapResponseParser.kt +11 -18
- package/android/src/main/java/com/audiobrowser/sonos/SonosDiscoverer.kt +10 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosOutputs.kt +10 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosPlayer.kt +21 -33
- package/android/src/main/java/com/audiobrowser/sonos/SonosRemote.kt +4 -6
- package/android/src/main/java/com/audiobrowser/sonos/SonosRouteProviderService.kt +9 -10
- package/android/src/main/java/com/audiobrowser/sonos/SonosStreamUri.kt +7 -7
- package/android/src/main/java/com/audiobrowser/sonos/SonosTransport.kt +5 -4
- package/android/src/main/java/com/audiobrowser/sonos/SsdpDiscovery.kt +8 -3
- package/android/src/main/java/com/audiobrowser/sonos/SsdpMessages.kt +4 -6
- package/android/src/main/java/com/audiobrowser/sonos/ZoneGroupState.kt +13 -11
- package/android/src/main/java/com/audiobrowser/tls/AiaCertChaser.kt +34 -71
- package/android/src/main/java/com/audiobrowser/tls/AiaChasingExtendedTrustManager.kt +20 -37
- package/android/src/main/java/com/audiobrowser/tls/AiaChasingTrustManager.kt +18 -27
- package/android/src/main/java/com/audiobrowser/tls/AiaTls.kt +14 -29
- package/android/src/main/java/com/audiobrowser/tls/CachingCertificateFetcher.kt +68 -133
- package/android/src/main/java/com/audiobrowser/util/ArtworkContentProvider.kt +10 -22
- package/android/src/main/java/com/audiobrowser/util/ArtworkRoutes.kt +6 -6
- package/android/src/main/java/com/audiobrowser/util/ArtworkUris.kt +4 -3
- package/android/src/main/java/com/audiobrowser/util/ArtworkVariant.kt +2 -13
- package/android/src/main/java/com/audiobrowser/util/Automotive.kt +2 -4
- package/android/src/main/java/com/audiobrowser/util/BatteryOptimizationHelper.kt +3 -9
- package/android/src/main/java/com/audiobrowser/util/BatteryWarningStore.kt +4 -14
- package/android/src/main/java/com/audiobrowser/util/BrowserPathHelper.kt +21 -85
- package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoader.kt +7 -7
- package/android/src/main/java/com/audiobrowser/util/CoilArtworkLoaderHolder.kt +5 -8
- package/android/src/main/java/com/audiobrowser/util/CoilBitmapLoader.kt +8 -24
- package/android/src/main/java/com/audiobrowser/util/EqualizerManager.kt +7 -39
- package/android/src/main/java/com/audiobrowser/util/MediaExtrasBuilder.kt +10 -14
- package/android/src/main/java/com/audiobrowser/util/MetadataAdapter.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/NetworkConnectivityMonitor.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/OutputMonitor.kt +21 -50
- package/android/src/main/java/com/audiobrowser/util/OutputSwitcher.kt +7 -20
- package/android/src/main/java/com/audiobrowser/util/PlayingStateFactory.kt +3 -5
- package/android/src/main/java/com/audiobrowser/util/RatingFavorites.kt +4 -5
- package/android/src/main/java/com/audiobrowser/util/StyleWire.kt +5 -5
- package/android/src/main/java/com/audiobrowser/util/SvgArtworkRenderer.kt +5 -9
- package/android/src/main/java/com/audiobrowser/util/SystemVolumeMonitor.kt +6 -9
- package/android/src/main/java/com/audiobrowser/util/TrackFactory.kt +25 -47
- package/android/src/nocast/java/com/audiobrowser/cast/CastSupport.kt +0 -2
- package/android/src/test/java/com/audiobrowser/ForegroundStartTest.kt +1 -2
- package/android/src/test/java/com/audiobrowser/LegacyRatingTest.kt +3 -3
- package/android/src/test/java/com/audiobrowser/ServiceBindingTest.kt +0 -13
- package/android/src/test/java/com/audiobrowser/ServiceTaskRemovedTest.kt +2 -3
- package/android/src/test/java/com/audiobrowser/TestFixtures.kt +5 -14
- package/android/src/test/java/com/audiobrowser/browser/BrowseArtworkRegistryTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerBuildApiRequestTest.kt +2 -8
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerFavoritesTest.kt +2 -12
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerLayerResolutionTest.kt +5 -28
- package/android/src/test/java/com/audiobrowser/browser/BrowserManagerTest.kt +11 -43
- package/android/src/test/java/com/audiobrowser/browser/BrowserUrlResolutionTest.kt +4 -13
- package/android/src/test/java/com/audiobrowser/browser/InertStyleDiagnosticTest.kt +2 -11
- package/android/src/test/java/com/audiobrowser/browser/JsonArtworkTest.kt +0 -2
- package/android/src/test/java/com/audiobrowser/browser/JsonStyleTest.kt +3 -8
- package/android/src/test/java/com/audiobrowser/browser/SectionScopeTest.kt +2 -14
- package/android/src/test/java/com/audiobrowser/browser/SimpleRouterTest.kt +1 -5
- package/android/src/test/java/com/audiobrowser/browser/StyleResolverTest.kt +2 -13
- package/android/src/test/java/com/audiobrowser/extension/TappedTrackTest.kt +1 -7
- package/android/src/test/java/com/audiobrowser/extension/TrackIdentityTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/http/RequestConfigBuilderTest.kt +8 -16
- package/android/src/test/java/com/audiobrowser/model/IcyTitleTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/player/BrowseTilesTest.kt +12 -29
- package/android/src/test/java/com/audiobrowser/player/CapabilityControlsTest.kt +3 -12
- package/android/src/test/java/com/audiobrowser/player/CrossOriginHeaderStripperTest.kt +0 -7
- package/android/src/test/java/com/audiobrowser/player/DynamicLoadControlTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/player/EqualizerControllerTest.kt +0 -9
- package/android/src/test/java/com/audiobrowser/player/LiveSeekCommandTest.kt +1 -2
- package/android/src/test/java/com/audiobrowser/player/MediaSessionSlotMappingTest.kt +0 -9
- package/android/src/test/java/com/audiobrowser/player/NowPlayingUpdaterTest.kt +15 -22
- package/android/src/test/java/com/audiobrowser/player/PlaybackErrorClassifierTest.kt +1 -24
- package/android/src/test/java/com/audiobrowser/player/PlaybackStateMachineTest.kt +0 -20
- package/android/src/test/java/com/audiobrowser/player/PlaybackStateStoreTrackJsonTest.kt +1 -6
- package/android/src/test/java/com/audiobrowser/player/PlaybackTimerTest.kt +2 -4
- package/android/src/test/java/com/audiobrowser/player/PlayerCastTest.kt +2 -2
- package/android/src/test/java/com/audiobrowser/player/PlayerEngineFactoryTest.kt +0 -3
- package/android/src/test/java/com/audiobrowser/player/PlayerInvalidTrackTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/player/PlayerSetupTest.kt +3 -2
- package/android/src/test/java/com/audiobrowser/player/PlayerSonosTest.kt +5 -1
- package/android/src/test/java/com/audiobrowser/player/PlayerSuppressionTest.kt +5 -7
- package/android/src/test/java/com/audiobrowser/player/RetryLoadErrorHandlingPolicyTest.kt +4 -35
- package/android/src/test/java/com/audiobrowser/player/SessionErrorMaskTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/player/ShuffleOrderLedByTest.kt +1 -8
- package/android/src/test/java/com/audiobrowser/player/StandardSkipTest.kt +4 -6
- package/android/src/test/java/com/audiobrowser/player/StuckRecoveryPolicyTest.kt +11 -11
- package/android/src/test/java/com/audiobrowser/player/TransformingDataSourceTest.kt +2 -23
- package/android/src/test/java/com/audiobrowser/remote/FakeRemote.kt +9 -10
- package/android/src/test/java/com/audiobrowser/remote/RemoteSwitchingPlayerTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/DeviceDescriptionParserTest.kt +1 -3
- package/android/src/test/java/com/audiobrowser/sonos/DidlLiteTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SoapClientTest.kt +0 -3
- package/android/src/test/java/com/audiobrowser/sonos/SoapEnvelopesTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SoapResponseParserTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosDiscovererTest.kt +2 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosPlayerTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosRemoteTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/sonos/SonosRoutesTest.kt +2 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosTransportTest.kt +2 -6
- package/android/src/test/java/com/audiobrowser/sonos/SsdpMessagesTest.kt +0 -2
- package/android/src/test/java/com/audiobrowser/tls/AiaCertChaserTest.kt +13 -37
- package/android/src/test/java/com/audiobrowser/tls/AiaChasingTrustManagerTest.kt +10 -24
- package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherCallSiteTest.kt +15 -39
- package/android/src/test/java/com/audiobrowser/tls/CachingCertificateFetcherTest.kt +4 -10
- package/android/src/test/java/com/audiobrowser/util/ArtworkContentProviderTest.kt +2 -11
- package/android/src/test/java/com/audiobrowser/util/ArtworkUrisTest.kt +0 -1
- package/android/src/test/java/com/audiobrowser/util/BrowserPathHelperTest.kt +0 -4
- package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderHolderTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/CoilArtworkLoaderTest.kt +0 -5
- package/android/src/test/java/com/audiobrowser/util/FakeImageLoader.kt +2 -2
- package/android/src/test/java/com/audiobrowser/util/MediaExtrasBuilderTest.kt +4 -12
- package/android/src/test/java/com/audiobrowser/util/OutputMonitorTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/PlayingStateFactoryTest.kt +0 -4
- package/android/src/test/java/com/audiobrowser/util/TrackFactoryBrowseTest.kt +1 -1
- package/android/src/test/java/com/audiobrowser/util/TrackFactoryMediaIdTest.kt +4 -6
- package/android/src/testCast/java/com/audiobrowser/cast/CastEndsTest.kt +1 -1
- package/android/src/testCast/java/com/audiobrowser/cast/SendingMediaItemConverterTest.kt +1 -0
- package/ios/AVPlayerEngine.swift +13 -21
- package/ios/AVPlayerEngineCallbacks.swift +2 -4
- package/ios/Browser/BrowseGate.swift +7 -8
- package/ios/Browser/BrowserConfig.swift +19 -34
- package/ios/Browser/BrowserError.swift +0 -1
- package/ios/Browser/BrowserManager.swift +29 -75
- package/ios/Browser/BrowserPathHelper.swift +13 -93
- package/ios/Browser/FavoriteSet.swift +7 -10
- package/ios/Browser/InertStyleDiagnostic.swift +17 -82
- package/ios/Browser/JsonModels.swift +11 -51
- package/ios/Browser/NavigationErrorState.swift +3 -2
- package/ios/Browser/PageResolver.swift +13 -23
- package/ios/Browser/RequestLayer.swift +16 -20
- package/ios/Browser/RequestPipeline.swift +33 -43
- package/ios/Browser/SearchDrillIn.swift +7 -13
- package/ios/Browser/SectionScope.swift +14 -26
- package/ios/Browser/SimpleRouter.swift +8 -15
- package/ios/Browser/StyleResolver.swift +12 -29
- package/ios/Browser/TabBarEntries.swift +6 -11
- package/ios/Browser/TrackIdTemplate.swift +6 -14
- package/ios/CarPlay/CPInterfaceController+Safe.swift +19 -28
- package/ios/CarPlay/CarPlayArtworkResolver.swift +5 -9
- package/ios/CarPlay/CarPlayController.swift +4 -4
- package/ios/CarPlay/CarPlayImageLoader.swift +11 -26
- package/ios/CarPlay/CarPlayListItemFactory.swift +30 -80
- package/ios/CarPlay/CarPlayNowPlayingManager.swift +19 -54
- package/ios/CarPlay/CarPlaySession+Navigator.swift +10 -10
- package/ios/CarPlay/CarPlaySession+PageLoader.swift +6 -5
- package/ios/CarPlay/CarPlaySession+Refresher.swift +2 -2
- package/ios/CarPlay/CarPlaySession+TabBar.swift +19 -26
- package/ios/CarPlay/CarPlaySession.swift +13 -17
- package/ios/CarPlay/CarPlayTemplates.swift +6 -7
- package/ios/CarPlay/IntentHandlers.swift +3 -5
- package/ios/CarPlay/MediaIntentCriteria.swift +15 -29
- package/ios/CarPlay/MediaIntentHandler.swift +4 -7
- package/ios/CarPlay/MediaIntentPlayback.swift +9 -8
- package/ios/CarPlay/NowPlayingButtonRules.swift +3 -4
- package/ios/CarPlay/SectionPresentation.swift +18 -28
- package/ios/CarPlay/TopTemplateReplacer.swift +8 -9
- package/ios/Extension/Capability+RemoteCommand.swift +3 -3
- package/ios/Extension/ChapterMetadata+AVFoundation.swift +2 -5
- package/ios/Extension/CxxVectorConformances.swift +4 -16
- package/ios/Extension/NavigationError+Conversion.swift +4 -7
- package/ios/Extension/PlayerCapabilities+Favorite.swift +0 -1
- package/ios/Extension/RequestConfig+Copying.swift +2 -6
- package/ios/Extension/ResolvedTrack+Copying.swift +2 -8
- package/ios/Extension/SearchParams+Query.swift +4 -4
- package/ios/Extension/Section+Copying.swift +3 -6
- package/ios/Extension/String+IcyCharset.swift +5 -5
- package/ios/Extension/TimedMetadata+AVFoundation.swift +6 -12
- package/ios/Extension/Track+AVPlayer.swift +1 -2
- package/ios/Extension/Track+Copying.swift +2 -8
- package/ios/Extension/Track+Identity.swift +4 -9
- package/ios/Extension/TrackMetadata+AVFoundation.swift +10 -13
- package/ios/Extension/UIApplication+ActiveScene.swift +6 -14
- package/ios/Extension/Variant+Artwork.swift +8 -22
- package/ios/Http/HttpClient.swift +3 -3
- package/ios/HybridAudioBrowser+Browser.swift +10 -16
- package/ios/HybridAudioBrowser+Options.swift +6 -9
- package/ios/HybridAudioBrowser+Player.swift +8 -16
- package/ios/HybridAudioBrowser+PlayerCallbacks.swift +4 -5
- package/ios/HybridAudioBrowser+Stubs.swift +5 -7
- package/ios/HybridAudioBrowser.swift +54 -79
- package/ios/Model/NitroTypeStubs.swift +15 -22
- package/ios/Model/PlayerUpdateOptions.swift +6 -21
- package/ios/Model/RemoteCommand.swift +2 -2
- package/ios/Model/TrackPlayerError.swift +9 -22
- package/ios/NowPlayingInfo/NowPlayingInfoController.swift +21 -40
- package/ios/NowPlayingInfo/SilentAudioPrimer.swift +10 -16
- package/ios/Observer/ItemObserver.swift +7 -5
- package/ios/Observer/PlayerObserver.swift +5 -5
- package/ios/PlaybackEvent.swift +2 -2
- package/ios/Player/AirPlayStallJudgement.swift +7 -9
- package/ios/Player/AudioSessionController.swift +14 -15
- package/ios/Player/DeferredSeek.swift +2 -2
- package/ios/Player/EndOfTrackJudgement.swift +6 -13
- package/ios/Player/ErrorStatus.swift +8 -7
- package/ios/Player/MediaLoader.swift +20 -24
- package/ios/Player/NowPlayingLines.swift +1 -4
- package/ios/Player/NowPlayingUpdater.swift +35 -61
- package/ios/Player/PersistedPlaybackState.swift +1 -2
- package/ios/Player/PlaybackFailure.swift +20 -24
- package/ios/Player/PlaybackPersistence.swift +5 -6
- package/ios/Player/PlaybackStateMachine.swift +8 -11
- package/ios/Player/PlaybackTimer.swift +8 -11
- package/ios/Player/Player.swift +6 -13
- package/ios/Player/PlayerEngine.swift +20 -20
- package/ios/Player/PlayerStatusTypes.swift +1 -2
- package/ios/Player/QueueManager.swift +23 -67
- package/ios/Player/RetryLoop.swift +39 -50
- package/ios/Player/ShuffleOrder.swift +17 -57
- package/ios/Player/SleepTimerManager.swift +13 -28
- package/ios/Player/VolumeFader.swift +16 -16
- package/ios/RemoteCommand/RemoteCommandCallbacks.swift +6 -16
- package/ios/RemoteCommand/RemoteCommandController.swift +8 -10
- package/ios/Tests/AirPlayStallJudgementTests.swift +4 -4
- package/ios/Tests/BrowserPathHelperTests.swift +3 -6
- package/ios/Tests/DeferredSeekTests.swift +1 -3
- package/ios/Tests/EmitterTests.swift +0 -1
- package/ios/Tests/EndOfTrackJudgementTests.swift +1 -6
- package/ios/Tests/FavoriteSetTests.swift +1 -0
- package/ios/Tests/GenerationMemoTests.swift +2 -2
- package/ios/Tests/InertStyleDiagnosticTests.swift +4 -10
- package/ios/Tests/JsonModelsTests.swift +5 -12
- package/ios/Tests/LRUCacheTests.swift +1 -5
- package/ios/Tests/MediaIntentCriteriaTests.swift +2 -7
- package/ios/Tests/MediaLoaderTests.swift +3 -12
- package/ios/Tests/ObserverTests.swift +3 -3
- package/ios/Tests/PlaybackErrorTests.swift +7 -9
- package/ios/Tests/PlaybackFailureTests.swift +9 -17
- package/ios/Tests/PlaybackPersistenceTests.swift +1 -0
- package/ios/Tests/PlaybackStateMachineTests.swift +1 -16
- package/ios/Tests/PlaybackTimerTests.swift +2 -3
- package/ios/Tests/PlayerPolicyTests.swift +10 -26
- package/ios/Tests/PlayerTests.swift +53 -88
- package/ios/Tests/PlayingStateTests.swift +0 -1
- package/ios/Tests/QueueManagerTests.swift +30 -80
- package/ios/Tests/RemoteCommandControllerTests.swift +5 -13
- package/ios/Tests/ResolvedTrackCopyingTests.swift +0 -2
- package/ios/Tests/RetryLoopTests.swift +12 -35
- package/ios/Tests/SearchDrillInTests.swift +4 -5
- package/ios/Tests/SectionPresentationTests.swift +3 -16
- package/ios/Tests/SectionScopeTests.swift +3 -6
- package/ios/Tests/SimpleRouterTests.swift +1 -5
- package/ios/Tests/SleepTimerManagerTests.swift +8 -11
- package/ios/Tests/StyleResolverTests.swift +4 -13
- package/ios/Tests/Support/ManualSleepTimerScheduler.swift +3 -8
- package/ios/Tests/Support/TestTypes.swift +5 -15
- package/ios/Tests/TabBarEntriesTests.swift +0 -2
- package/ios/Tests/TimedMetadataAVFoundationTests.swift +2 -3
- package/ios/Tests/TopTemplateReplacerTests.swift +1 -1
- package/ios/Tests/TrackIdTemplateTests.swift +2 -6
- package/ios/Tests/TrackMetadataAVFoundationTests.swift +1 -4
- package/ios/Tests/TrackSelectorTests.swift +3 -15
- package/ios/TrackSelector.swift +13 -25
- package/ios/Util/ArtworkFreshness.swift +6 -6
- package/ios/Util/ArtworkImageFetcher.swift +19 -20
- package/ios/Util/ConcurrentMap.swift +2 -2
- package/ios/Util/Emitter.swift +8 -13
- package/ios/Util/NetworkMonitor.swift +4 -6
- package/ios/Util/OutputPicker.swift +1 -1
- package/ios/Util/ReadyValue.swift +3 -2
- package/ios/Util/SFSymbolRenderer.swift +17 -30
- package/ios/Util/SVGProcessor.swift +5 -9
- package/package.json +1 -1
|
@@ -8,17 +8,15 @@ import os.log
|
|
|
8
8
|
final class RequestPipeline {
|
|
9
9
|
let logger = Logger(subsystem: "com.audiobrowser", category: "RequestPipeline")
|
|
10
10
|
private let httpClient = HttpClient()
|
|
11
|
-
/// The request/browse thunks resolve once per content generation.
|
|
12
11
|
private let layers = GenerationMemo<ResolvedLayers>()
|
|
13
12
|
|
|
14
|
-
/// Set by `BrowserManager`; a new config resolves the layers again.
|
|
15
13
|
var config = BrowserConfig() {
|
|
16
14
|
didSet { layers.invalidate() }
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
nonisolated init() {}
|
|
20
18
|
|
|
21
|
-
/// Resolves the request and browse layers again on next use
|
|
19
|
+
/// Resolves the request and browse layers again on next use, as after a locale change.
|
|
22
20
|
func invalidateLayers() {
|
|
23
21
|
layers.invalidate()
|
|
24
22
|
}
|
|
@@ -28,25 +26,25 @@ final class RequestPipeline {
|
|
|
28
26
|
let browse: TransformableRequestConfig?
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
/// The request and browse layers
|
|
32
|
-
///
|
|
33
|
-
///
|
|
34
|
-
/// again.
|
|
29
|
+
/// The request and browse layers: each resolver's result, else the static layer. A
|
|
30
|
+
/// successful run is kept until the next invalidation, and a failed one runs again on next
|
|
31
|
+
/// use. The resolvers run one after the other, request first, as on Android and web; an
|
|
32
|
+
/// invalidation while they run resolves them again.
|
|
35
33
|
func resolvedLayers() async throws -> ResolvedLayers {
|
|
36
34
|
try await layers.value { [weak self] in
|
|
37
35
|
guard let self else { throw CancellationError() }
|
|
38
|
-
// Read on every run: a retry after a config change must resolve the new config
|
|
36
|
+
// Read on every run: a retry after a config change must resolve the new config.
|
|
39
37
|
let config = self.config
|
|
40
|
-
//
|
|
41
|
-
//
|
|
38
|
+
// Double await: the TS side wraps a sync-or-async thunk in a JS promise, behind the
|
|
39
|
+
// bridge's promise.
|
|
42
40
|
let request = try await config.requestResolver?().await().await() ?? config.request
|
|
43
41
|
let browse = try await config.browseResolver?().await().await() ?? config.browse
|
|
44
42
|
return ResolvedLayers(request: request, browse: browse)
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
///
|
|
49
|
-
///
|
|
46
|
+
/// `layer` onto `base`: its transforms (async, then sync) when it has any, else its static
|
|
47
|
+
/// fields (`RequestLayer.apply`).
|
|
50
48
|
func applyLayer(
|
|
51
49
|
_ layer: (some TransformableLayer)?,
|
|
52
50
|
to base: RequestConfig,
|
|
@@ -63,14 +61,11 @@ final class RequestPipeline {
|
|
|
63
61
|
return try await RequestLayer.apply(RequestConfig(fieldsOf: layer), transforms: transforms, to: base)
|
|
64
62
|
}
|
|
65
63
|
|
|
66
|
-
///
|
|
67
|
-
///
|
|
68
|
-
///
|
|
69
|
-
///
|
|
70
|
-
///
|
|
71
|
-
/// query would otherwise be dropped). `routeConfig` is nil for the implicit
|
|
72
|
-
/// browse default; `kind` names the per-kind layer, nil for kinds with none. The request and
|
|
73
|
-
/// kind layers come from one resolution; `routeConfig` from the caller's config.
|
|
64
|
+
/// The HTTP request for an API-backed route: the request layer, then the `kind` layer (nil
|
|
65
|
+
/// for kinds with none), then `routeConfig` (nil for the implicit browse default).
|
|
66
|
+
/// `initialQuery` goes onto the request after the request layer, so it reaches the URL even
|
|
67
|
+
/// when a later layer's transforms replace that layer's static query. Throws
|
|
68
|
+
/// `invalidConfiguration` when no layer sets a base URL.
|
|
74
69
|
func buildApiRequest(
|
|
75
70
|
kind: KeyPath<ResolvedLayers, TransformableRequestConfig?>?,
|
|
76
71
|
_ routeConfig: TransformableRequestConfig?,
|
|
@@ -100,8 +95,6 @@ final class RequestPipeline {
|
|
|
100
95
|
)
|
|
101
96
|
}
|
|
102
97
|
|
|
103
|
-
/// Fetches a page object (`{title,path,children:[…]}`) through the request → browse → route
|
|
104
|
-
/// layers.
|
|
105
98
|
func fetchPage(
|
|
106
99
|
_ routeConfig: TransformableRequestConfig?,
|
|
107
100
|
path: String,
|
|
@@ -126,9 +119,9 @@ final class RequestPipeline {
|
|
|
126
119
|
return nitroResult
|
|
127
120
|
}
|
|
128
121
|
|
|
129
|
-
///
|
|
130
|
-
///
|
|
131
|
-
///
|
|
122
|
+
/// A search route's tracks, through the request layer and `searchConfig`. The search params
|
|
123
|
+
/// go in as `initialQuery`; the config's path seeds the base, since a layer's static path
|
|
124
|
+
/// never applies.
|
|
132
125
|
func fetchSearch(_ searchConfig: TransformableRequestConfig, params: SearchParams) async throws -> [Track] {
|
|
133
126
|
let request = try await buildApiRequest(
|
|
134
127
|
kind: nil, searchConfig, path: searchConfig.path ?? "", params: ["q": params.query],
|
|
@@ -141,9 +134,10 @@ final class RequestPipeline {
|
|
|
141
134
|
|
|
142
135
|
// MARK: - Media URL Resolution
|
|
143
136
|
|
|
144
|
-
/// The media request for `originalUrl`: the
|
|
145
|
-
///
|
|
146
|
-
///
|
|
137
|
+
/// The media request for `originalUrl`: the request layer, the media layer, then what
|
|
138
|
+
/// `media.resolve(track)` produces over them. `track` only feeds `resolve`; its own `request`
|
|
139
|
+
/// is not merged here. A failing layer
|
|
140
|
+
/// leaves the URL as it is, with no headers.
|
|
147
141
|
func resolveMediaUrl(_ originalUrl: String, track: Track? = nil) async -> MediaResolvedUrl {
|
|
148
142
|
let base: RequestConfig
|
|
149
143
|
do {
|
|
@@ -173,14 +167,13 @@ final class RequestPipeline {
|
|
|
173
167
|
}
|
|
174
168
|
}
|
|
175
169
|
|
|
176
|
-
///
|
|
177
|
-
///
|
|
170
|
+
/// What the `media` config's `resolve` and `resolveSync` produce for `track`; nil without a
|
|
171
|
+
/// track or a media config.
|
|
178
172
|
func resolveMediaTrackConfig(_ track: Track?) async throws -> RequestConfig? {
|
|
179
173
|
guard let track, let media = config.media else { return nil }
|
|
180
174
|
return try await resolved(media.resolve, media.resolveSync, for: track)
|
|
181
175
|
}
|
|
182
176
|
|
|
183
|
-
/// What a `resolve` (async) and `resolveSync` produce for `track`, the sync one winning.
|
|
184
177
|
private func resolved(
|
|
185
178
|
_ resolve: ((Track) -> Promise<Promise<RequestConfig>>)?,
|
|
186
179
|
_ resolveSync: ((Track) -> Promise<RequestConfig>)?,
|
|
@@ -195,8 +188,8 @@ final class RequestPipeline {
|
|
|
195
188
|
|
|
196
189
|
// MARK: - Artwork URL Resolution
|
|
197
190
|
|
|
198
|
-
/// The image source for `track`'s artwork: an SF Symbol rendered to a file
|
|
199
|
-
/// as is
|
|
191
|
+
/// The image source for `track`'s artwork: an SF Symbol rendered to a file; the artwork URL
|
|
192
|
+
/// as is when no artwork config applies; else the request layer and the artwork config, in
|
|
200
193
|
/// `RequestLayer.artwork`'s order. `perRouteConfig` replaces the global artwork config;
|
|
201
194
|
/// `imageContext` is the display size, nil at browse time. Nil when there is no artwork or a
|
|
202
195
|
/// callback fails.
|
|
@@ -242,7 +235,7 @@ final class RequestPipeline {
|
|
|
242
235
|
) else { return nil }
|
|
243
236
|
|
|
244
237
|
let uri = RequestLayer.buildUrl(request)
|
|
245
|
-
//
|
|
238
|
+
// The unfilled `{id}` stays in the URL, so the request fails visibly.
|
|
246
239
|
if RequestLayer.hasUnfilledIdToken(request) {
|
|
247
240
|
logger.warning("nowPlayingArtwork: track has no id — '{id}' left unfilled in \(uri)")
|
|
248
241
|
}
|
|
@@ -261,17 +254,14 @@ final class RequestPipeline {
|
|
|
261
254
|
|
|
262
255
|
// MARK: - Config Utilities
|
|
263
256
|
|
|
264
|
-
/// Awaits an
|
|
265
|
-
/// bridge
|
|
266
|
-
///
|
|
267
|
-
/// (single-awaiting an async callback hands a `Promise` downstream — the original
|
|
268
|
-
/// "empty config" bug), so it lives in exactly one place. Pairs with `awaitSyncConfig`.
|
|
257
|
+
/// Awaits an async config callback, which crosses the bridge as `Promise<Promise<…>>` (the
|
|
258
|
+
/// bridge hop, then the JS promise): a single await hands a `Promise` downstream. Copies the
|
|
259
|
+
/// result out.
|
|
269
260
|
func awaitAsyncConfig(_ promise: Promise<Promise<RequestConfig>>) async throws -> RequestConfig {
|
|
270
261
|
try await extractConfig(promise.await().await())
|
|
271
262
|
}
|
|
272
263
|
|
|
273
|
-
/// Awaits a
|
|
274
|
-
/// bridge await) and copies the result out. Pairs with `awaitAsyncConfig`.
|
|
264
|
+
/// Awaits a sync config callback (one bridge await) and copies the result out.
|
|
275
265
|
func awaitSyncConfig(_ promise: Promise<RequestConfig>) async throws -> RequestConfig {
|
|
276
266
|
try await extractConfig(promise.await())
|
|
277
267
|
}
|
|
@@ -295,8 +285,8 @@ extension TransformableRequestConfig: TransformableLayer {}
|
|
|
295
285
|
extension MediaRequestConfig: TransformableLayer {}
|
|
296
286
|
|
|
297
287
|
extension RequestPipeline: MediaResolving {
|
|
298
|
-
/// Runs
|
|
299
|
-
///
|
|
288
|
+
/// Runs for every playing track, id or not: an id-less track leaves `{id}` unfilled, so the
|
|
289
|
+
/// request fails visibly rather than being skipped.
|
|
300
290
|
func resolveNowPlayingArtwork(track: Track, imageContext: ImageContext?) async -> ImageSource? {
|
|
301
291
|
await resolveArtworkUrl(track: track, perRouteConfig: config.nowPlayingArtwork, imageContext: imageContext)
|
|
302
292
|
}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
/// A search result
|
|
4
|
-
///
|
|
5
|
-
/// fields keeps the drill-in decision free of the Nitro `Track` type so it can
|
|
6
|
-
/// be unit-tested.
|
|
3
|
+
/// A search result: `src` plays it, `path` browses it. Keeps the drill-in free of the Nitro
|
|
4
|
+
/// `Track` so it can be unit-tested.
|
|
7
5
|
protocol PlayableSearchItem {
|
|
8
6
|
var src: String? { get }
|
|
9
7
|
var path: String? { get }
|
|
10
8
|
}
|
|
11
9
|
|
|
12
10
|
enum SearchDrillIn {
|
|
13
|
-
///
|
|
11
|
+
/// The items a "play «X»" voice search plays, or nil when none is playable.
|
|
14
12
|
///
|
|
15
|
-
///
|
|
16
|
-
///
|
|
17
|
-
///
|
|
18
|
-
/// than skipping the page for a later inline station. Falls back to the flat
|
|
19
|
-
/// playable results when the first result is already playable or the drill-in
|
|
20
|
-
/// yields nothing. Returns nil when nothing is playable.
|
|
13
|
+
/// Only the first result is drilled into: when it is browsable but not playable, its playable
|
|
14
|
+
/// children win over later playable results, so the first station inside a place or genre page
|
|
15
|
+
/// plays. Falls back to the playable results when the drill-in yields none.
|
|
21
16
|
static func playable<Item: PlayableSearchItem>(
|
|
22
17
|
from children: [Item],
|
|
23
18
|
resolveChildren: sending (String) async throws -> [Item],
|
|
@@ -37,8 +32,7 @@ enum SearchDrillIn {
|
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
34
|
|
|
40
|
-
// The
|
|
41
|
-
// build. (The testable target builds without NitroModules and uses a stub item.)
|
|
35
|
+
// The test target builds without NitroModules and uses its own item.
|
|
42
36
|
#if canImport(NitroModules)
|
|
43
37
|
extension Track: PlayableSearchItem {}
|
|
44
38
|
#endif
|
|
@@ -1,27 +1,18 @@
|
|
|
1
|
-
// Queue scope is the tapped section, not the whole page
|
|
2
|
-
// playback context a listener expects is the list they tapped in — a page
|
|
3
|
-
// aggregating several sections must not leak next/previous across them.
|
|
4
|
-
// Sections are structural (ADR 0010), so scoping is a lookup, not a
|
|
5
|
-
// groupTitle-run derivation.
|
|
1
|
+
// Queue scope is the tapped section, not the whole page: ADR 0006.
|
|
6
2
|
enum SectionScope {
|
|
7
|
-
///
|
|
8
|
-
///
|
|
9
|
-
/// exact copy.
|
|
3
|
+
/// `tappedOffset` is the tapped child's offset in `section`, non-nil only when the stamped
|
|
4
|
+
/// index pinned that exact copy.
|
|
10
5
|
struct Scoped {
|
|
11
6
|
let section: Section
|
|
12
7
|
let tappedOffset: Int?
|
|
13
8
|
}
|
|
14
9
|
|
|
15
|
-
/// The section
|
|
16
|
-
/// identity: id when non-blank, else src), or nil when not found.
|
|
10
|
+
/// The section containing the track identity `trackId`, or nil when none does.
|
|
17
11
|
///
|
|
18
|
-
/// `tappedIndex`
|
|
19
|
-
///
|
|
20
|
-
///
|
|
21
|
-
///
|
|
22
|
-
/// doesn't (the list shifted), resolution falls back to the first section
|
|
23
|
-
/// containing the identity. A stale index can therefore never select a
|
|
24
|
-
/// different track — at worst a different copy of the same one.
|
|
12
|
+
/// `tappedIndex` is the flat page position (children concatenated in section order) and only
|
|
13
|
+
/// breaks ties: when the child there still has `trackId`, it pins the section and copy; otherwise
|
|
14
|
+
/// the first section containing `trackId` wins. A stale index can at worst pick another copy of
|
|
15
|
+
/// the same track, never a different track.
|
|
25
16
|
static func scoped(
|
|
26
17
|
in sections: [Section],
|
|
27
18
|
containing trackId: String,
|
|
@@ -48,10 +39,10 @@ enum SectionScope {
|
|
|
48
39
|
return nil
|
|
49
40
|
}
|
|
50
41
|
|
|
51
|
-
/// The queue a tap on the contextual `path` plays: the playable tracks
|
|
52
|
-
///
|
|
53
|
-
///
|
|
54
|
-
///
|
|
42
|
+
/// The queue a tap on the contextual `path` plays: the tapped section's playable tracks, at the
|
|
43
|
+
/// pinned copy, else the first identity match; only that track when `singleTrack`. Nil when the
|
|
44
|
+
/// identity is gone from the page or the tapped track is not playable, so the caller falls back
|
|
45
|
+
/// to the stored track.
|
|
55
46
|
static func queue(
|
|
56
47
|
in sections: [Section],
|
|
57
48
|
path: String,
|
|
@@ -77,17 +68,14 @@ enum SectionScope {
|
|
|
77
68
|
// MARK: - Page shape helpers (ADR 0010)
|
|
78
69
|
|
|
79
70
|
extension ResolvedTrack {
|
|
80
|
-
///
|
|
81
|
-
/// `children` is authoring sugar for one untitled section.
|
|
71
|
+
/// `sections` when present, else plain `children` as one untitled section.
|
|
82
72
|
var normalizedSections: [Section]? {
|
|
83
73
|
if let sections { return sections }
|
|
84
74
|
guard let children else { return nil }
|
|
85
75
|
return [.untitled(children)]
|
|
86
76
|
}
|
|
87
77
|
|
|
88
|
-
///
|
|
89
|
-
/// that defines contextual `__index` positions and the flat views (tabs,
|
|
90
|
-
/// search) of a sectioned page.
|
|
78
|
+
/// Children concatenated in section order: the order contextual `__index` positions count in.
|
|
91
79
|
var flattenedChildren: [Track]? {
|
|
92
80
|
normalizedSections.map { $0.flatMap(\.children) }
|
|
93
81
|
}
|
|
@@ -1,27 +1,19 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
/// Result of a successful route match.
|
|
4
3
|
struct RouteMatch {
|
|
5
|
-
///
|
|
6
|
-
/// For tail wildcards, the remaining path is stored in params["tail"]
|
|
4
|
+
/// `{name}` segments by name; a tail wildcard's remaining path under `tail`, absent when nothing remains.
|
|
7
5
|
let params: [String: String]
|
|
8
6
|
|
|
9
|
-
/// Specificity score (higher = more specific match)
|
|
10
7
|
let specificity: Int
|
|
11
8
|
}
|
|
12
9
|
|
|
13
|
-
/// Protocol for route entries that can be matched.
|
|
14
10
|
protocol RouteEntry {
|
|
15
11
|
var path: String { get }
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
/// Route pattern matching
|
|
19
|
-
///
|
|
20
|
-
///
|
|
21
|
-
/// - /artists - exact match
|
|
22
|
-
/// - /artists/{id} - parameter extraction
|
|
23
|
-
/// - /artists/* - wildcard match (matches any single segment)
|
|
24
|
-
/// - /files/** - tail wildcard (matches remaining path segments, captured as `tail`)
|
|
14
|
+
/// Route pattern matching: `/artists` exact, `/artists/{id}` a parameter, `/artists/*` any one
|
|
15
|
+
/// segment, `/files/**` the remaining segments (zero or more), captured as `tail` when there is
|
|
16
|
+
/// at least one.
|
|
25
17
|
///
|
|
26
18
|
/// The most specific route wins, the first on a tie: constant segments over parameters over
|
|
27
19
|
/// wildcards over the tail wildcard, then more segments.
|
|
@@ -31,8 +23,8 @@ enum SimpleRouter {
|
|
|
31
23
|
static let tabsRoutePath = "__tabs__"
|
|
32
24
|
static let searchRoutePath = "__search__"
|
|
33
25
|
|
|
34
|
-
/// The
|
|
35
|
-
///
|
|
26
|
+
/// The best match among the routes that are not tabs, search or the default, else the default
|
|
27
|
+
/// route with `path` as its `path` param.
|
|
36
28
|
static func browseRoute<T: RouteEntry>(for path: String, in routes: [T]) -> (route: T, match: RouteMatch)? {
|
|
37
29
|
let browseRoutes = routes.filter {
|
|
38
30
|
$0.path != tabsRoutePath && $0.path != searchRoutePath && $0.path != defaultRoutePath
|
|
@@ -44,7 +36,7 @@ enum SimpleRouter {
|
|
|
44
36
|
return (defaultRoute, RouteMatch(params: ["path": path], specificity: 0))
|
|
45
37
|
}
|
|
46
38
|
|
|
47
|
-
/// The most specific of `routes` matching `path`,
|
|
39
|
+
/// The most specific of `routes` matching `path`, the first on a tie; nil when none matches.
|
|
48
40
|
static func findBestMatch<T: RouteEntry>(path: String, routes: [T]) -> (route: T, match: RouteMatch)? {
|
|
49
41
|
var best: (route: T, match: RouteMatch)?
|
|
50
42
|
for route in routes {
|
|
@@ -71,6 +63,7 @@ enum SimpleRouter {
|
|
|
71
63
|
}
|
|
72
64
|
}
|
|
73
65
|
|
|
66
|
+
// 10x apart, so one stronger segment outweighs up to nine weaker ones.
|
|
74
67
|
var specificity: Int {
|
|
75
68
|
switch self {
|
|
76
69
|
case .constant: 1000
|
|
@@ -2,30 +2,13 @@
|
|
|
2
2
|
import NitroModules
|
|
3
3
|
#endif
|
|
4
4
|
|
|
5
|
-
///
|
|
6
|
-
///
|
|
7
|
-
///
|
|
8
|
-
/// - **Inherited item properties** resolve `track ?? section ?? page`,
|
|
9
|
-
/// per property — a track's own declaration wins over the blocks that
|
|
10
|
-
/// contain it.
|
|
11
|
-
/// - **Container properties and the positional `display`** resolve by scope
|
|
12
|
-
/// override: `section ?? page` — the page declares for its whole scope, a
|
|
13
|
-
/// section overrides for its own children. `display` is never inherited
|
|
14
|
-
/// item-to-container: each holder describes its own children, and a
|
|
15
|
-
/// track's `display` is the promise for the page *it* opens, not its
|
|
16
|
-
/// rendering inside this section.
|
|
17
|
-
///
|
|
18
|
-
/// Every key of `SectionStyle` must be read by `sectionStyle(section:page:)`
|
|
19
|
-
/// and every inherited key of `TrackStyle` by `trackStyle(track:section:)` —
|
|
20
|
-
/// Nitro flattens the spec's `extends`, so `src/style-resolution.test.ts`
|
|
21
|
-
/// enforces this completeness, not the type system.
|
|
5
|
+
/// Resolves style declarations to effective values (ADR 0011). Nitro flattens the spec's
|
|
6
|
+
/// `extends`, so nothing in the types makes these merges read a new style key:
|
|
7
|
+
/// `src/style-resolution.test.ts` does.
|
|
22
8
|
enum StyleResolver {
|
|
23
|
-
///
|
|
24
|
-
///
|
|
25
|
-
/// block; item resolution then only needs `track ?? section`.
|
|
9
|
+
/// A section's effective block: each key is the section's own value, else the page's,
|
|
10
|
+
/// `display` included.
|
|
26
11
|
static func sectionStyle(section: SectionStyle?, page: SectionStyle?) -> SectionStyle {
|
|
27
|
-
// Argument order is the generated init's (own properties before inherited
|
|
28
|
-
// ones — Nitro flattens `extends` own-props-first); the stub mirrors it.
|
|
29
12
|
SectionStyle(
|
|
30
13
|
gridWrap: section?.gridWrap ?? page?.gridWrap,
|
|
31
14
|
gridTile: section?.gridTile ?? page?.gridTile,
|
|
@@ -38,18 +21,18 @@ enum StyleResolver {
|
|
|
38
21
|
)
|
|
39
22
|
}
|
|
40
23
|
|
|
41
|
-
///
|
|
42
|
-
/// section block
|
|
24
|
+
/// A track's effective item properties: each key is the track's own value, else its
|
|
25
|
+
/// section's. Pass the section block `sectionStyle` returned, so the page's values reach
|
|
26
|
+
/// the track. `display` is always nil.
|
|
43
27
|
static func trackStyle(track: TrackStyle?, section: SectionStyle?) -> TrackStyle {
|
|
44
28
|
TrackStyle(
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
// for this item's own layout.
|
|
29
|
+
// A track's `display` describes the page it opens, not its own layout here, so it is
|
|
30
|
+
// never inherited onto an item.
|
|
48
31
|
display: nil,
|
|
49
32
|
artworkRendering: track?.artworkRendering ?? section?.artworkRendering,
|
|
50
33
|
imageShape: track?.imageShape ?? section?.imageShape,
|
|
51
|
-
// `'none'`
|
|
52
|
-
//
|
|
34
|
+
// `'none'` stays a value here; the renderer reads it as no accessory. As nil it would
|
|
35
|
+
// inherit the section's symbol.
|
|
53
36
|
accessorySymbol: track?.accessorySymbol ?? section?.accessorySymbol,
|
|
54
37
|
cardTint: track?.cardTint ?? section?.cardTint,
|
|
55
38
|
cardImage: track?.cardImage ?? section?.cardImage,
|
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
/// Compares the tab-list fields the CarPlay tab bar actually renders.
|
|
2
1
|
enum TabBarEntries {
|
|
3
|
-
/// Whether two tab lists produce
|
|
4
|
-
/// the
|
|
5
|
-
///
|
|
6
|
-
///
|
|
7
|
-
///
|
|
8
|
-
///
|
|
9
|
-
/// `disabled` counts even though it renders nothing itself: a disabled tab is
|
|
10
|
-
/// filtered out of the tab bar entirely (`showTabBar`), so a tab flipping it
|
|
11
|
-
/// with otherwise-identical fields changes which tabs exist. Omitting it here
|
|
12
|
-
/// swallowed the emit, and the tab never appeared or disappeared.
|
|
2
|
+
/// Whether two tab lists produce the same CarPlay tab-bar entries, so a re-query that
|
|
3
|
+
/// changes nothing the bar shows emits no `tabsChanged` and keeps the selection. Compares
|
|
4
|
+
/// title, path, artwork, the artwork source's uri and `disabled`; not the style, artwork
|
|
5
|
+
/// headers or other track fields that `applyTabBarEntry`'s artwork load (and its resolve
|
|
6
|
+
/// transform) can read.
|
|
13
7
|
static func same(_ old: [Track]?, _ new: [Track]) -> Bool {
|
|
14
8
|
guard let old, old.count == new.count else { return false }
|
|
15
9
|
return zip(old, new).allSatisfy {
|
|
16
10
|
$0.title == $1.title && $0.path == $1.path && $0.artwork == $1.artwork
|
|
17
11
|
&& $0.artworkSource?.uri == $1.artworkSource?.uri
|
|
12
|
+
// `showTabBar` drops disabled tabs, so flipping `disabled` changes which tabs exist.
|
|
18
13
|
&& $0.disabled == $1.disabled
|
|
19
14
|
}
|
|
20
15
|
}
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
-
/// `{id}`
|
|
4
|
-
///
|
|
5
|
-
/// `
|
|
6
|
-
///
|
|
7
|
-
/// A track without a non-blank id leaves the token LITERALLY in place — the request then
|
|
8
|
-
/// visibly 404s, which is intended (garbage in, garbage out with a self-describing error
|
|
9
|
-
/// trail; the caller logs a single warning when `containsToken` still matches after
|
|
10
|
-
/// substitution). Mirrors Android's `substituteTrackId` / `configContainsIdToken` in
|
|
11
|
-
/// `BrowserUrlResolution.kt` — keep the two in sync.
|
|
3
|
+
/// `{id}` substitution in request-config strings, so an artwork config like
|
|
4
|
+
/// `{ path: "/artwork/{id}" }` resolves per track. Mirrors Android's `substituteTrackId` and
|
|
5
|
+
/// `configContainsIdToken` in `BrowserUrlResolution.kt`; keep the two in sync.
|
|
12
6
|
enum TrackIdTemplate {
|
|
13
7
|
static let token = "{id}"
|
|
14
8
|
|
|
15
|
-
/// Replaces
|
|
16
|
-
///
|
|
9
|
+
/// Replaces every token with `id`. A nil or empty `id` returns `value` with the token left
|
|
10
|
+
/// in, on purpose: the request fails visibly and the caller warns via `containsToken`.
|
|
17
11
|
static func substitute(_ value: String?, id: String?) -> String? {
|
|
18
12
|
guard let id, !id.isEmpty else { return value }
|
|
19
13
|
return value?.replacingOccurrences(of: token, with: id)
|
|
20
14
|
}
|
|
21
15
|
|
|
22
|
-
///
|
|
16
|
+
/// `substitute` over each value of a query or header map.
|
|
23
17
|
static func substitute(_ values: [String: String]?, id: String?) -> [String: String]? {
|
|
24
18
|
guard let id, !id.isEmpty else { return values }
|
|
25
19
|
return values?.mapValues { $0.replacingOccurrences(of: token, with: id) }
|
|
26
20
|
}
|
|
27
21
|
|
|
28
|
-
/// Whether the value still carries the token (an unfilled `{id}`).
|
|
29
22
|
static func containsToken(_ value: String?) -> Bool {
|
|
30
23
|
value?.contains(token) == true
|
|
31
24
|
}
|
|
32
25
|
|
|
33
|
-
/// Whether any dictionary value still carries the token.
|
|
34
26
|
static func containsToken(_ values: [String: String]?) -> Bool {
|
|
35
27
|
values?.values.contains { $0.contains(token) } == true
|
|
36
28
|
}
|
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
import CarPlay
|
|
2
2
|
import os.log
|
|
3
3
|
|
|
4
|
-
/// Logged,
|
|
5
|
-
/// template-stack mutations.
|
|
4
|
+
/// Logged, guarded wrappers around `CPInterfaceController`'s template-stack mutations.
|
|
6
5
|
///
|
|
7
|
-
/// Per the SDK header,
|
|
8
|
-
///
|
|
9
|
-
///
|
|
10
|
-
///
|
|
11
|
-
///
|
|
12
|
-
/// preconditions are checked up front, the underlying call always gets a
|
|
13
|
-
/// completion, and every failure is logged, with an optional caller completion
|
|
14
|
-
/// for call sites that chain on the result.
|
|
6
|
+
/// Per the SDK header, a failed push/setRoot/present with a nil completion raises an
|
|
7
|
+
/// Objective-C exception (depth limit included) that takes down the whole app, not just the
|
|
8
|
+
/// CarPlay scene; pushing a template already in the hierarchy raises regardless. So every
|
|
9
|
+
/// stack mutation goes through here: raise-prone preconditions are checked first, the
|
|
10
|
+
/// underlying call always gets a completion, and every failure is logged.
|
|
15
11
|
///
|
|
16
|
-
/// A push onto a full stack replaces the top template (`TopTemplateReplacer`)
|
|
17
|
-
///
|
|
18
|
-
/// so none of them lands between its pop and its push.
|
|
12
|
+
/// A push onto a full stack replaces the top template (`TopTemplateReplacer`); every mutation
|
|
13
|
+
/// waits for a replacement to settle, so none lands between its pop and its push.
|
|
19
14
|
@MainActor
|
|
20
15
|
extension CPInterfaceController {
|
|
21
16
|
private static let stackLogger = Logger(subsystem: "com.audiobrowser", category: "TemplateStack")
|
|
@@ -24,10 +19,8 @@ extension CPInterfaceController {
|
|
|
24
19
|
String(describing: type(of: template))
|
|
25
20
|
}
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/// hierarchy depth limit") synchronously — even through the completion-based
|
|
30
|
-
/// push — taking down the whole app, not just the CarPlay scene.
|
|
22
|
+
// CarPlay's stack depth cap for audio apps, which the SDK does not expose. Exceeding it
|
|
23
|
+
// raises `NSGenericException` synchronously, even through the completion-based push.
|
|
31
24
|
private static let maximumStackDepth = 5
|
|
32
25
|
|
|
33
26
|
private static var topReplacerKey: UInt8 = 0
|
|
@@ -48,8 +41,8 @@ extension CPInterfaceController {
|
|
|
48
41
|
}
|
|
49
42
|
}
|
|
50
43
|
|
|
51
|
-
/// Pushes `template`, skipping
|
|
52
|
-
/// the
|
|
44
|
+
/// Pushes `template`, skipping one already in the hierarchy. At the depth limit it replaces
|
|
45
|
+
/// the top template.
|
|
53
46
|
func safePush(_ template: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) {
|
|
54
47
|
whenStackSettled { controller in
|
|
55
48
|
let templates = controller.templates
|
|
@@ -64,8 +57,8 @@ extension CPInterfaceController {
|
|
|
64
57
|
}
|
|
65
58
|
}
|
|
66
59
|
|
|
67
|
-
/// Replaces `expected`
|
|
68
|
-
///
|
|
60
|
+
/// Replaces `expected` while it is still the top template, restoring it if the push fails; a
|
|
61
|
+
/// no-op once the user has moved on.
|
|
69
62
|
func safeReplaceTop(_ expected: CPTemplate, with template: CPTemplate, animated: Bool) {
|
|
70
63
|
whenStackSettled { controller in
|
|
71
64
|
guard controller.topTemplate === expected else { return }
|
|
@@ -75,8 +68,6 @@ extension CPInterfaceController {
|
|
|
75
68
|
}
|
|
76
69
|
}
|
|
77
70
|
|
|
78
|
-
/// Pushes `template`, skipping the raise cases (already in the hierarchy,
|
|
79
|
-
/// stack at the depth limit).
|
|
80
71
|
fileprivate func guardedPush(_ template: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)?) {
|
|
81
72
|
guard !templates.contains(where: { $0 === template }) else {
|
|
82
73
|
Self.stackLogger.warning("push skipped: \(Self.name(of: template)) is already in the stack")
|
|
@@ -96,7 +87,7 @@ extension CPInterfaceController {
|
|
|
96
87
|
}
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
///
|
|
90
|
+
/// Skips the pop when only the root is left, which would raise.
|
|
100
91
|
fileprivate func guardedPop(animated: Bool, completion: ((Bool, Error?) -> Void)?) {
|
|
101
92
|
guard templates.count > 1 else {
|
|
102
93
|
Self.stackLogger.warning("pop skipped: already at the root template")
|
|
@@ -111,8 +102,8 @@ extension CPInterfaceController {
|
|
|
111
102
|
}
|
|
112
103
|
}
|
|
113
104
|
|
|
114
|
-
/// Pops back to `template`, skipping
|
|
115
|
-
///
|
|
105
|
+
/// Pops back to `template`, skipping one not in the hierarchy. Succeeds without popping
|
|
106
|
+
/// when it is already the top template.
|
|
116
107
|
func safePop(to template: CPTemplate, animated: Bool, completion: ((Bool, Error?) -> Void)? = nil) {
|
|
117
108
|
whenStackSettled { controller in
|
|
118
109
|
guard controller.templates.contains(where: { $0 === template }) else {
|
|
@@ -156,8 +147,8 @@ extension CPInterfaceController {
|
|
|
156
147
|
}
|
|
157
148
|
}
|
|
158
149
|
|
|
159
|
-
/// The guarded pop and push a replacement is made of, so a push that still
|
|
160
|
-
///
|
|
150
|
+
/// The guarded pop and push a replacement is made of, so a push that still cannot fit is
|
|
151
|
+
/// skipped and logged rather than raising.
|
|
161
152
|
@MainActor
|
|
162
153
|
private struct GuardedTemplateStack: TemplateStack {
|
|
163
154
|
let controller: CPInterfaceController
|