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
|
@@ -12,29 +12,20 @@ import com.margelo.nitro.audiobrowser.RequestConfig
|
|
|
12
12
|
import com.margelo.nitro.audiobrowser.Track
|
|
13
13
|
import timber.log.Timber
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* `RequestPipeline.swift`. Owns how a Track's `src` / `artwork` becomes a fetchable request:
|
|
18
|
-
* request layer (shared, incl. its transform) → kind config (media / artwork / nowPlayingArtwork) →
|
|
19
|
-
* per-Track Resolve, with transform-wins semantics centralised in [RequestConfigBuilder].
|
|
20
|
-
*/
|
|
15
|
+
// The Android side of iOS `RequestPipeline.swift` and the web stub's `RequestConfigBuilder`: keep
|
|
16
|
+
// the layer order the same on all three.
|
|
21
17
|
|
|
22
18
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
19
|
+
* Layers the request config, then `media`, over [originalUrl] and runs `media.resolve` for [track].
|
|
20
|
+
* Returns null when neither a request layer nor a media config is set; the caller then plays
|
|
21
|
+
* [originalUrl] as is.
|
|
26
22
|
*/
|
|
27
23
|
suspend fun BrowserManager.resolveMediaUrl(originalUrl: String, track: Track): MediaRequestConfig? {
|
|
28
24
|
val mediaConfig = config.media
|
|
29
|
-
//
|
|
30
|
-
// is set — a resolver-only consumer still needs its baseUrl/headers/transform
|
|
31
|
-
// applied to media URLs.
|
|
25
|
+
// A resolver-only request layer counts: its baseUrl still has to reach a relative src.
|
|
32
26
|
val hasRequestLayer = config.request != null || config.requestResolver != null
|
|
33
27
|
if (mediaConfig == null && !hasRequestLayer) return null
|
|
34
28
|
|
|
35
|
-
// Layered: request (shared, incl. its transform) → media. The request layer runs
|
|
36
|
-
// for media even when no media-specific config is present (so a relative src
|
|
37
|
-
// still gets baseUrl).
|
|
38
29
|
val requestConfig = resolvedRequestConfig()
|
|
39
30
|
var base =
|
|
40
31
|
RequestConfig(
|
|
@@ -71,11 +62,11 @@ suspend fun BrowserManager.resolveMediaUrl(originalUrl: String, track: Track): M
|
|
|
71
62
|
}
|
|
72
63
|
|
|
73
64
|
/**
|
|
74
|
-
* Resolves
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
65
|
+
* Resolves [track]'s artwork into an [ImageSource]: request layer, artwork config ([perRouteConfig]
|
|
66
|
+
* replaces `config.artwork`, it does not merge), `resolve`, image query params from [imageContext],
|
|
67
|
+
* transform, then `{id}`. With no artwork config the track's artwork URL is returned untouched.
|
|
68
|
+
* Returns null when there is no artwork, when `resolve`/`resolveSync` yields nothing for a track
|
|
69
|
+
* without an artwork URL (even if the config has a static path), or when any callback throws.
|
|
79
70
|
*/
|
|
80
71
|
suspend fun BrowserManager.resolveArtworkUrl(
|
|
81
72
|
track: Track,
|
|
@@ -83,20 +74,15 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
83
74
|
imageContext: ImageContext? = null,
|
|
84
75
|
): ImageSource? {
|
|
85
76
|
val effectiveArtworkConfig = perRouteConfig ?: config.artwork
|
|
86
|
-
// Treat empty string as null for artwork
|
|
87
77
|
val trackArtwork = track.artwork?.url?.takeIf { it.isNotEmpty() }
|
|
88
78
|
|
|
89
|
-
// If no artwork config and no track.artwork, nothing to transform
|
|
90
79
|
if (effectiveArtworkConfig == null && trackArtwork == null) return null
|
|
91
80
|
|
|
92
|
-
// If no artwork config, just return the original artwork URL as a simple ImageSource
|
|
93
81
|
if (effectiveArtworkConfig == null) {
|
|
94
82
|
return trackArtwork?.let { ImageSource(uri = it, method = null, headers = null, body = null) }
|
|
95
83
|
}
|
|
96
84
|
|
|
97
85
|
return try {
|
|
98
|
-
// Base via the shared request layer (its transform runs for artwork too),
|
|
99
|
-
// with the track's artwork as the path when present.
|
|
100
86
|
var mergedConfig =
|
|
101
87
|
RequestConfig(
|
|
102
88
|
method = null,
|
|
@@ -115,8 +101,6 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
115
101
|
mergedConfig = mergedConfig.copy(path = trackArtwork)
|
|
116
102
|
}
|
|
117
103
|
|
|
118
|
-
// Per-track resolution — async `resolve` first, then `resolveSync` merged over
|
|
119
|
-
// it (sync winning) via the tested helper. Matches the web stub.
|
|
120
104
|
val asyncResolved =
|
|
121
105
|
effectiveArtworkConfig.resolve?.let {
|
|
122
106
|
RequestConfigBuilder.awaitAsyncConfig(it.invoke(track))
|
|
@@ -127,9 +111,6 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
127
111
|
}
|
|
128
112
|
val resolvedConfig = RequestConfigBuilder.composeResolved(asyncResolved, syncResolved)
|
|
129
113
|
|
|
130
|
-
// A resolver ran but produced nothing AND there's no artwork URL either → no
|
|
131
|
-
// artwork (matches the web stub; with a track artwork present the static/url
|
|
132
|
-
// flow continues).
|
|
133
114
|
if (
|
|
134
115
|
(effectiveArtworkConfig.resolve != null || effectiveArtworkConfig.resolveSync != null) &&
|
|
135
116
|
resolvedConfig == null &&
|
|
@@ -138,7 +119,6 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
138
119
|
return null
|
|
139
120
|
}
|
|
140
121
|
|
|
141
|
-
// Artwork config's static fields (not resolve/transform — those run separately).
|
|
142
122
|
mergedConfig =
|
|
143
123
|
RequestConfigBuilder.mergeConfig(
|
|
144
124
|
mergedConfig,
|
|
@@ -146,11 +126,10 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
146
126
|
)
|
|
147
127
|
resolvedConfig?.let { mergedConfig = RequestConfigBuilder.mergeConfig(mergedConfig, it) }
|
|
148
128
|
|
|
149
|
-
//
|
|
129
|
+
// Before the transform, so the transform can override the size params.
|
|
150
130
|
mergedConfig =
|
|
151
131
|
applyImageQueryParams(mergedConfig, effectiveArtworkConfig.imageQueryParams, imageContext)
|
|
152
132
|
|
|
153
|
-
// Transform (async first, then sync), receiving the image context.
|
|
154
133
|
var transformedConfig = mergedConfig
|
|
155
134
|
effectiveArtworkConfig.transform?.let {
|
|
156
135
|
transformedConfig =
|
|
@@ -165,16 +144,14 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
165
144
|
)
|
|
166
145
|
}
|
|
167
146
|
|
|
168
|
-
// `{id}`
|
|
169
|
-
//
|
|
170
|
-
// with a single warning logged below once the URL is built. Mirrors iOS substituteTrackId.
|
|
147
|
+
// A track without an id leaves `{id}` in the URL on purpose: the request then fails visibly,
|
|
148
|
+
// and the warning below says why.
|
|
171
149
|
track.id
|
|
172
150
|
?.takeIf { it.isNotEmpty() }
|
|
173
151
|
?.let { transformedConfig = substituteTrackId(transformedConfig, it) }
|
|
174
152
|
val hasUnfilledIdToken = configContainsIdToken(transformedConfig)
|
|
175
153
|
|
|
176
154
|
val uri = RequestConfigBuilder.buildUrl(transformedConfig)
|
|
177
|
-
// If URI is empty, there's no valid artwork path
|
|
178
155
|
if (uri.isEmpty()) return null
|
|
179
156
|
|
|
180
157
|
if (hasUnfilledIdToken) {
|
|
@@ -194,15 +171,14 @@ suspend fun BrowserManager.resolveArtworkUrl(
|
|
|
194
171
|
)
|
|
195
172
|
} catch (e: Exception) {
|
|
196
173
|
Timber.e(e, "Failed to transform artwork URL for track: ${track.title}")
|
|
197
|
-
// On error, return null to clear artwork and avoid broken images
|
|
198
174
|
null
|
|
199
175
|
}
|
|
200
176
|
}
|
|
201
177
|
|
|
202
178
|
/**
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
179
|
+
* Re-resolves an artwork [uri] registered in [BrowserManager.artworkResolutions] from its track,
|
|
180
|
+
* with the display size in [imageContext], rather than transforming the already-transformed URI.
|
|
181
|
+
* Returns null for an unregistered [uri].
|
|
206
182
|
*/
|
|
207
183
|
suspend fun BrowserManager.displayArtworkSource(
|
|
208
184
|
uri: String,
|
|
@@ -213,12 +189,10 @@ suspend fun BrowserManager.displayArtworkSource(
|
|
|
213
189
|
}
|
|
214
190
|
|
|
215
191
|
/**
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
* transform rather than static config are out of reach here, which is the documented limit. Returns
|
|
221
|
-
* null when there are no headers to add.
|
|
192
|
+
* For an artwork [uri] no track can be found for (evicted from the registry, or restored after
|
|
193
|
+
* process death): fetches [uri] as is, adding only the static headers of the request and artwork
|
|
194
|
+
* configs. No transform or resolve runs, so headers a transform adds are missing. Returns null when
|
|
195
|
+
* there are no headers to add.
|
|
222
196
|
*/
|
|
223
197
|
suspend fun BrowserManager.unattributedArtworkSource(uri: String): ImageSource? {
|
|
224
198
|
var merged =
|
|
@@ -243,7 +217,6 @@ suspend fun BrowserManager.unattributedArtworkSource(uri: String): ImageSource?
|
|
|
243
217
|
return ImageSource(uri = uri, method = null, headers = headers, body = null)
|
|
244
218
|
}
|
|
245
219
|
|
|
246
|
-
/** Folds [imageContext] width/height into the query under the configured param names. */
|
|
247
220
|
private fun applyImageQueryParams(
|
|
248
221
|
config: RequestConfig,
|
|
249
222
|
imageQueryParams: ImageQueryParams?,
|
|
@@ -261,14 +234,8 @@ private fun applyImageQueryParams(
|
|
|
261
234
|
return config.copy(query = (config.query ?: emptyMap()) + contextQuery)
|
|
262
235
|
}
|
|
263
236
|
|
|
264
|
-
/** The `{id}` template token — see [substituteTrackId] / [configContainsIdToken]. */
|
|
265
237
|
private const val ID_TOKEN = "{id}"
|
|
266
238
|
|
|
267
|
-
/**
|
|
268
|
-
* Replaces the `{id}` token with the track id in a request config's path, query values, and header
|
|
269
|
-
* values. Used so a `nowPlayingArtwork` like `{ path: "/artwork/{id}" }` resolves. Configs without
|
|
270
|
-
* the token are returned unchanged. Mirrors the iOS `substituteTrackId` helper.
|
|
271
|
-
*/
|
|
272
239
|
private fun substituteTrackId(config: RequestConfig, id: String): RequestConfig {
|
|
273
240
|
fun sub(s: String?): String? = s?.replace(ID_TOKEN, id)
|
|
274
241
|
fun subMap(m: Map<String, String>?): Map<String, String>? =
|
|
@@ -280,17 +247,11 @@ private fun substituteTrackId(config: RequestConfig, id: String): RequestConfig
|
|
|
280
247
|
)
|
|
281
248
|
}
|
|
282
249
|
|
|
283
|
-
/**
|
|
284
|
-
* Whether the config still carries an unfilled `{id}` token in its path, query values, or header
|
|
285
|
-
* values (checked AFTER substitution, so it matches exactly when the track had no non-blank id and
|
|
286
|
-
* the config uses the token). Mirrors iOS `TrackIdTemplate.containsToken`.
|
|
287
|
-
*/
|
|
288
250
|
private fun configContainsIdToken(config: RequestConfig): Boolean =
|
|
289
251
|
config.path?.contains(ID_TOKEN) == true ||
|
|
290
252
|
config.query?.values?.any { it.contains(ID_TOKEN) } == true ||
|
|
291
253
|
config.headers?.values?.any { it.contains(ID_TOKEN) } == true
|
|
292
254
|
|
|
293
|
-
/** Builds a headers map, merging explicit headers with userAgent and contentType. */
|
|
294
255
|
private fun buildHeadersMap(
|
|
295
256
|
headers: Map<String, String>?,
|
|
296
257
|
userAgent: String?,
|
|
@@ -10,32 +10,14 @@ import com.margelo.nitro.audiobrowser.TrackStyle
|
|
|
10
10
|
import timber.log.Timber
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* not invalid, they are *inert*, the way `grid-template` on a non-grid element is inert in CSS.
|
|
17
|
-
* This is the recovery: at page resolution every declaration its own block makes unreadable is
|
|
18
|
-
* reported once, with the effective context and the fix.
|
|
19
|
-
*
|
|
20
|
-
* The line it draws, and never crosses: only **structural** inertness — a declaration the resolved
|
|
21
|
-
* block itself renders unreadable, on every surface (`gridWrap` outside a grid, `cardTint` with no
|
|
22
|
-
* card treatment in scope). *Surface* inertness is never reported, because declarations are
|
|
23
|
-
* aspirational: `imageShape` on Android Auto, or a card treatment on a pre-26 CarPlay, is intended
|
|
24
|
-
* usage — the renderer drops what it can't draw.
|
|
25
|
-
*
|
|
26
|
-
* Runs where every page passes regardless of its source (static config, route callback, or fetched
|
|
27
|
-
* browse JSON), and only on a cache miss, so a mistake is reported once per resolution rather than
|
|
28
|
-
* once per serve. Mirrors `ios/Browser/InertStyleDiagnostic.swift`.
|
|
29
|
-
*
|
|
30
|
-
* Debug builds only: [warn] is the whole seam, so a release build never even walks the page (the
|
|
31
|
-
* trade is that a page served only to a release build — an internal track, production browse JSON —
|
|
32
|
-
* reports nothing; reproduce it against a debug build).
|
|
13
|
+
* Reports the style declarations on a resolved page that can never render on any surface (ADR
|
|
14
|
+
* 0011). Only structural inertness: a surface dropping a property it can't draw is intended usage,
|
|
15
|
+
* not a finding. Mirrors `ios/Browser/InertStyleDiagnostic.swift`.
|
|
33
16
|
*/
|
|
34
17
|
object InertStyleDiagnostic {
|
|
35
18
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* of build-configuration knowledge.
|
|
19
|
+
* Logs every finding; a no-op in release builds, so a page only a release build serves reports
|
|
20
|
+
* nothing until reproduced against a debug build.
|
|
39
21
|
*/
|
|
40
22
|
fun warn(path: String, pageStyle: SectionStyle?, sections: List<Section>) {
|
|
41
23
|
if (!BuildConfig.DEBUG) return
|
|
@@ -43,14 +25,12 @@ object InertStyleDiagnostic {
|
|
|
43
25
|
}
|
|
44
26
|
|
|
45
27
|
/**
|
|
46
|
-
* The
|
|
47
|
-
*
|
|
48
|
-
* Two keys of the block are deliberately absent — `display` and `artworkRendering`, dispositioned
|
|
49
|
-
* below instead.
|
|
28
|
+
* The keys with an inertness rule. `src/style-resolution.test.ts` reads the entry keys: every key
|
|
29
|
+
* of the spec's style block is here, in [ALWAYS_RENDERABLE] or in [POSITIONAL].
|
|
50
30
|
*/
|
|
51
31
|
private enum class Property(val key: String, val isItemProperty: Boolean) {
|
|
52
|
-
//
|
|
53
|
-
//
|
|
32
|
+
// Item properties inherit `track ?? section ?? page`, so tracks may declare them too; container
|
|
33
|
+
// properties resolve `section ?? page` and never reach an item.
|
|
54
34
|
GRID_WRAP("gridWrap", isItemProperty = false),
|
|
55
35
|
GRID_TILE("gridTile", isItemProperty = false),
|
|
56
36
|
IMAGE_SHAPE("imageShape", isItemProperty = true),
|
|
@@ -58,10 +38,6 @@ object InertStyleDiagnostic {
|
|
|
58
38
|
CARD_TINT("cardTint", isItemProperty = true),
|
|
59
39
|
CARD_IMAGE("cardImage", isItemProperty = true);
|
|
60
40
|
|
|
61
|
-
/**
|
|
62
|
-
* Whether a value of this property, resolved into [context], has any rendering to affect. Each
|
|
63
|
-
* branch is the spec's own "inert unless" clause.
|
|
64
|
-
*/
|
|
65
41
|
fun isInert(context: Context): Boolean =
|
|
66
42
|
when (this) {
|
|
67
43
|
GRID_WRAP,
|
|
@@ -72,7 +48,6 @@ object InertStyleDiagnostic {
|
|
|
72
48
|
CARD_IMAGE -> !context.isCard
|
|
73
49
|
}
|
|
74
50
|
|
|
75
|
-
/** The rule the declaration falls foul of, stated positively. */
|
|
76
51
|
val rule: String
|
|
77
52
|
get() =
|
|
78
53
|
when (this) {
|
|
@@ -107,11 +82,9 @@ object InertStyleDiagnostic {
|
|
|
107
82
|
CARD_IMAGE -> style?.cardImage != null
|
|
108
83
|
}
|
|
109
84
|
|
|
110
|
-
// Nitro flattens the spec's `extends`, so
|
|
111
|
-
// the same key set rather than one interface.
|
|
85
|
+
// Nitro flattens the spec's `extends`, so SectionStyle and TrackStyle share no type to look up.
|
|
112
86
|
fun declaredIn(style: TrackStyle?): Boolean =
|
|
113
87
|
when (this) {
|
|
114
|
-
// Container properties have no Track slot to be declared in.
|
|
115
88
|
GRID_WRAP,
|
|
116
89
|
GRID_TILE -> false
|
|
117
90
|
IMAGE_SHAPE -> style?.imageShape != null
|
|
@@ -121,35 +94,20 @@ object InertStyleDiagnostic {
|
|
|
121
94
|
}
|
|
122
95
|
}
|
|
123
96
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
* inert only in the one position that opens no page (see [playableDisplayFinding]). Declared here
|
|
128
|
-
* so the spec-level completeness test can hold this file to the whole vocabulary: every key of
|
|
129
|
-
* the block is a rule, always renderable, or positional, and a newly added property is a decision
|
|
130
|
-
* rather than an omission.
|
|
131
|
-
*/
|
|
97
|
+
// Unused in code: `src/style-resolution.test.ts` reads these lists to check that every key of
|
|
98
|
+
// the block is dispositioned. `artworkRendering` renders in every layout; `display` is inert only
|
|
99
|
+
// on a playable track (see [playableDisplayFinding]).
|
|
132
100
|
val ALWAYS_RENDERABLE = listOf("artworkRendering")
|
|
133
101
|
|
|
134
102
|
val POSITIONAL = listOf("display")
|
|
135
103
|
|
|
136
|
-
|
|
137
|
-
* A section's effective container context: the two container values every inertness condition is
|
|
138
|
-
* stated against.
|
|
139
|
-
*
|
|
140
|
-
* Folded through [StyleResolver] rather than re-deriving the scope override: the diagnostic
|
|
141
|
-
* predicts what a renderer will do with these declarations, so it has to resolve them the way the
|
|
142
|
-
* renderers do.
|
|
143
|
-
*/
|
|
104
|
+
// Folds through StyleResolver so it predicts what the renderers resolve.
|
|
144
105
|
private class Context(section: SectionStyle?, page: SectionStyle?) {
|
|
145
106
|
private val folded = StyleResolver.sectionStyle(section, page)
|
|
146
107
|
val isGrid = folded.display == StyleDisplay.GRID
|
|
147
108
|
val tile = folded.gridTile ?: GridTile.PLAIN
|
|
148
109
|
|
|
149
|
-
|
|
150
|
-
* Whether the card treatment is what this container renders — the `card*` family's condition.
|
|
151
|
-
* Exhaustive, like [isShaped]: a new tile kind has to be ruled on here.
|
|
152
|
-
*/
|
|
110
|
+
// Exhaustive, like isShaped, so a new tile kind has to be ruled on here.
|
|
153
111
|
val isCard: Boolean
|
|
154
112
|
get() =
|
|
155
113
|
isGrid &&
|
|
@@ -160,7 +118,6 @@ object InertStyleDiagnostic {
|
|
|
160
118
|
GridTile.CONDENSED -> false
|
|
161
119
|
}
|
|
162
120
|
|
|
163
|
-
/** Whether this container renders a tile family with a shape and an accessory slot. */
|
|
164
121
|
val isShaped: Boolean
|
|
165
122
|
get() =
|
|
166
123
|
isGrid &&
|
|
@@ -171,29 +128,21 @@ object InertStyleDiagnostic {
|
|
|
171
128
|
GridTile.CARD -> false
|
|
172
129
|
}
|
|
173
130
|
|
|
174
|
-
|
|
175
|
-
* The effective style, for the message — in the wire spelling the author types ([toWireString]
|
|
176
|
-
* is the decoder's own mapping). `gridTile` is quoted only where a grid gives it meaning:
|
|
177
|
-
* naming it on a list would be advice to fix the wrong property.
|
|
178
|
-
*/
|
|
131
|
+
// gridTile is named only in a grid: on a list it would point at the wrong property to fix.
|
|
179
132
|
val described: String
|
|
180
133
|
get() = if (!isGrid) "display 'list'" else "display 'grid', gridTile '${tile.toWireString()}'"
|
|
181
134
|
}
|
|
182
135
|
|
|
183
136
|
/**
|
|
184
|
-
* Every inert declaration on a resolved page, as ready
|
|
185
|
-
* set is testable off-device; the caller logs.
|
|
137
|
+
* Every inert declaration on a resolved page, as log-ready messages.
|
|
186
138
|
*
|
|
187
|
-
* @param path the resolved path, named in every message.
|
|
188
139
|
* @param pageStyle the page's own block (`ResolvedTrack.style`).
|
|
189
|
-
* @param sections the page's
|
|
190
|
-
*
|
|
191
|
-
* merges them.
|
|
140
|
+
* @param sections the page's sections with their blocks unfolded: each finding names the level
|
|
141
|
+
* that declared it.
|
|
192
142
|
*/
|
|
193
143
|
fun findings(path: String, pageStyle: SectionStyle?, sections: List<Section>): List<String> {
|
|
194
144
|
val findings = mutableListOf<String>()
|
|
195
|
-
// A page
|
|
196
|
-
// section it reaches, however many others ignore it.
|
|
145
|
+
// A page declaration is live if it renders in any section that inherits it.
|
|
197
146
|
val pageReached = mutableSetOf<Property>()
|
|
198
147
|
val pageRendered = mutableSetOf<Property>()
|
|
199
148
|
|
|
@@ -210,7 +159,6 @@ object InertStyleDiagnostic {
|
|
|
210
159
|
message(property, path, sectionLabel, "its effective style is ${context.described}")
|
|
211
160
|
}
|
|
212
161
|
} else if (property.declaredIn(pageStyle)) {
|
|
213
|
-
// The section takes the page's value (nothing closer overrode it).
|
|
214
162
|
pageReached += property
|
|
215
163
|
if (!inert) pageRendered += property
|
|
216
164
|
}
|
|
@@ -241,10 +189,6 @@ object InertStyleDiagnostic {
|
|
|
241
189
|
return findings
|
|
242
190
|
}
|
|
243
191
|
|
|
244
|
-
/**
|
|
245
|
-
* `display` is positional, so it is never inert *in* a container — but on a track that renders
|
|
246
|
-
* playable (`src` wins the rendering) it promises the layout of a page that never opens.
|
|
247
|
-
*/
|
|
248
192
|
private fun playableDisplayFinding(section: Section, path: String, label: String): String? {
|
|
249
193
|
val tracks = section.children.count { it.src != null && it.style?.display != null }
|
|
250
194
|
if (tracks == 0) return null
|
|
@@ -268,10 +212,6 @@ object InertStyleDiagnostic {
|
|
|
268
212
|
hint = property.hint,
|
|
269
213
|
)
|
|
270
214
|
|
|
271
|
-
/**
|
|
272
|
-
* The one message skeleton — every finding names the page, the declaration, who declared it, why
|
|
273
|
-
* it can't render, and what to do about it.
|
|
274
|
-
*/
|
|
275
215
|
private fun message(
|
|
276
216
|
path: String,
|
|
277
217
|
owner: String,
|
|
@@ -16,14 +16,10 @@ import kotlinx.serialization.json.jsonObject
|
|
|
16
16
|
import kotlinx.serialization.json.jsonPrimitive
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* A track's `artwork`
|
|
19
|
+
* A track's `artwork` in a browse response: a URL string, or `{ light, dark }` URLs.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* Android Auto is dark-only and never renders the light variant, but it is still parsed rather than
|
|
25
|
-
* discarded: the same payload feeds the JS side, and dropping half of it here would make the
|
|
26
|
-
* platforms disagree about what the server actually sent.
|
|
21
|
+
* Android Auto renders only the dark variant, but both are kept: the JS side reads the same
|
|
22
|
+
* payload.
|
|
27
23
|
*/
|
|
28
24
|
@Serializable(with = JsonArtworkSerializer::class)
|
|
29
25
|
sealed class JsonArtwork {
|
|
@@ -31,7 +27,6 @@ sealed class JsonArtwork {
|
|
|
31
27
|
|
|
32
28
|
data class Variants(val light: String, val dark: String) : JsonArtwork()
|
|
33
29
|
|
|
34
|
-
/** The Nitro union this maps onto, one case per case. */
|
|
35
30
|
fun toNitro(): Variant_String_ArtworkVariants =
|
|
36
31
|
when (this) {
|
|
37
32
|
is Single -> Variant_String_ArtworkVariants.First(url)
|
|
@@ -40,8 +35,9 @@ sealed class JsonArtwork {
|
|
|
40
35
|
}
|
|
41
36
|
|
|
42
37
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
38
|
+
* Decodes by JSON shape, as the wire has no type tag: a primitive is a URL, an object must hold
|
|
39
|
+
* both `light` and `dark`. Anything else throws, which fails the whole response, not just the
|
|
40
|
+
* artwork.
|
|
45
41
|
*/
|
|
46
42
|
object JsonArtworkSerializer : KSerializer<JsonArtwork> {
|
|
47
43
|
override val descriptor: SerialDescriptor = buildClassSerialDescriptor("JsonArtwork")
|
|
@@ -20,13 +20,6 @@ import kotlinx.serialization.json.JsonObject
|
|
|
20
20
|
import kotlinx.serialization.json.JsonPrimitive
|
|
21
21
|
import kotlinx.serialization.json.booleanOrNull
|
|
22
22
|
|
|
23
|
-
/**
|
|
24
|
-
* JSON serializable models for parsing API responses. These will be converted to Nitro types after
|
|
25
|
-
* parsing. Legacy `groupTitle`/`imageRow` keys in payloads are simply unknown to these models and
|
|
26
|
-
* decode as ignored dead weight (ADR 0010).
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/** JSON model for a track's per-request HTTP override (identity/auth/signed-url). */
|
|
30
23
|
@Serializable
|
|
31
24
|
data class JsonTrackRequest(
|
|
32
25
|
val userAgent: String? = null,
|
|
@@ -36,7 +29,6 @@ data class JsonTrackRequest(
|
|
|
36
29
|
fun toNitro(): TrackRequest = TrackRequest(userAgent, headers, query)
|
|
37
30
|
}
|
|
38
31
|
|
|
39
|
-
/** JSON model for a page section (ADR 0010). */
|
|
40
32
|
@Serializable
|
|
41
33
|
data class JsonSection(
|
|
42
34
|
val title: String? = null,
|
|
@@ -91,33 +83,24 @@ data class JsonTrack(
|
|
|
91
83
|
val icyCharset: String? = null,
|
|
92
84
|
)
|
|
93
85
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
* `style` rides the models as a raw [JsonElement] and maps leniently here — tolerant decoding by
|
|
98
|
-
* design (ADR 0011): a stale value (the retired string vocabulary), a wrong-typed field, or an
|
|
99
|
-
* unknown enum value is "no declaration", never a parse failure. A typed field would fail the whole
|
|
100
|
-
* page, since this decoder is otherwise strict.
|
|
101
|
-
*/
|
|
86
|
+
// `style` stays a raw JsonElement and maps leniently here (ADR 0011): a stale, wrong-typed or
|
|
87
|
+
// unknown value is no declaration. A typed field would fail the whole page, as the decoder is
|
|
88
|
+
// otherwise strict.
|
|
102
89
|
private fun JsonObject.stringField(key: String): String? =
|
|
103
90
|
(get(key) as? JsonPrimitive)?.takeIf { it.isString }?.content
|
|
104
91
|
|
|
105
|
-
|
|
92
|
+
// booleanOrNull alone accepts a quoted "false"; that is wrong-typed, so no declaration.
|
|
106
93
|
private fun JsonObject.booleanField(key: String): Boolean? =
|
|
107
94
|
(get(key) as? JsonPrimitive)?.takeIf { !it.isString }?.booleanOrNull
|
|
108
95
|
|
|
109
|
-
|
|
110
|
-
* A block that resolves to no declarations at all — `{}` or all-unknown values — maps to null, so
|
|
111
|
-
* "no declaration" has one shape on every platform (iOS makes the same collapse).
|
|
112
|
-
*/
|
|
96
|
+
// A block with no declarations maps to null, as on iOS, so "no declaration" has one shape.
|
|
113
97
|
private fun JsonElement?.toTrackStyle(): TrackStyle? =
|
|
114
98
|
(this as? JsonObject)?.let { obj ->
|
|
115
99
|
TrackStyle(
|
|
116
100
|
display = obj.stringField("display").toStyleDisplay(),
|
|
117
101
|
artworkRendering = obj.stringField("artworkRendering").toArtworkRendering(),
|
|
118
102
|
imageShape = obj.stringField("imageShape").toImageShape(),
|
|
119
|
-
// 'none' is a
|
|
120
|
-
// only emptiness collapses.
|
|
103
|
+
// 'none' is a real value (the inheritance escape); only emptiness collapses.
|
|
121
104
|
accessorySymbol = obj.stringField("accessorySymbol")?.takeIf { it.isNotEmpty() },
|
|
122
105
|
cardTint = obj.stringField("cardTint")?.takeIf { it.isNotEmpty() },
|
|
123
106
|
cardImage = obj.stringField("cardImage").toCardImage(),
|
|
@@ -168,7 +151,7 @@ fun JsonResolvedTrack.toNitro(): ResolvedTrack {
|
|
|
168
151
|
subtitle = subtitle,
|
|
169
152
|
artwork = artwork?.toNitro(),
|
|
170
153
|
artworkSource = null,
|
|
171
|
-
// Containers carry no per-track
|
|
154
|
+
// Containers carry no per-track request override, as on iOS.
|
|
172
155
|
request = null,
|
|
173
156
|
artist = artist,
|
|
174
157
|
albumPath = albumPath,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
package com.audiobrowser.browser
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param params Extracted path parameters (e.g., {id} → "123")
|
|
7
|
-
* @param specificity Score for route priority - higher means more specific
|
|
4
|
+
* A pattern that matched a path: its `{param}` values by name, and a [specificity] score where the
|
|
5
|
+
* highest wins (rules in [SimpleRouter]).
|
|
8
6
|
*/
|
|
9
7
|
data class RouteMatch(val params: Map<String, String>, val specificity: Int)
|
|
@@ -6,28 +6,20 @@ import com.margelo.nitro.audiobrowser.Section
|
|
|
6
6
|
import com.margelo.nitro.audiobrowser.Track
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* next/previous across them. Sections are structural (ADR 0010), so scoping is a lookup, not a
|
|
12
|
-
* groupTitle-run derivation.
|
|
9
|
+
* The queue is the tapped section, not the whole page, so next/previous never crosses sections
|
|
10
|
+
* (docs/adr/0006-queue-scope-is-the-tapped-section.md).
|
|
13
11
|
*/
|
|
14
12
|
object SectionScope {
|
|
15
|
-
/**
|
|
16
|
-
* The section containing the tapped identity, plus the tapped child's offset within it — non-null
|
|
17
|
-
* only when the stamped flat index pinned the exact copy.
|
|
18
|
-
*/
|
|
13
|
+
/** [tappedOffset] is the tapped child's index in [section], null when no index pinned it. */
|
|
19
14
|
data class Scoped(val section: Section, val tappedOffset: Int?)
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
|
-
* The section of [sections]
|
|
23
|
-
* non-blank, else src), or null when not found.
|
|
17
|
+
* The section of [sections] holding [trackId] (a track identity), or null when none does.
|
|
24
18
|
*
|
|
25
|
-
* [tappedIndex]
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* A stale index can therefore never select a different track — at worst a different copy of the
|
|
30
|
-
* same one.
|
|
19
|
+
* [tappedIndex] is the flat position stamped into the contextual path (children concatenated in
|
|
20
|
+
* section order). It only breaks ties: when the child there still has [trackId], it pins that
|
|
21
|
+
* section and copy; otherwise (the list shifted, or the index is out of range) the first section
|
|
22
|
+
* holding [trackId] is returned, unpinned. A stale index never selects a different track.
|
|
31
23
|
*/
|
|
32
24
|
fun scoped(sections: List<Section>, trackId: String, tappedIndex: Int? = null): Scoped? {
|
|
33
25
|
if (tappedIndex != null && tappedIndex >= 0) {
|
|
@@ -54,31 +46,21 @@ object SectionScope {
|
|
|
54
46
|
|
|
55
47
|
// Page shape helpers (ADR 0010)
|
|
56
48
|
|
|
57
|
-
/**
|
|
58
|
-
* One untitled section — the canonical wrap of a flat track list (`children` authoring sugar,
|
|
59
|
-
* search results — ADR 0010).
|
|
60
|
-
*/
|
|
49
|
+
/** One untitled section: how a flat track list (`children` sugar, search results) is wrapped. */
|
|
61
50
|
fun untitledSection(children: Array<Track>): Section =
|
|
62
51
|
Section(title = null, style = null, path = null, children = children)
|
|
63
52
|
|
|
64
|
-
/**
|
|
65
|
-
* The canonical sectioned shape: `sections` wins when present; plain `children` is authoring sugar
|
|
66
|
-
* for one untitled section.
|
|
67
|
-
*/
|
|
53
|
+
/** The page as sections: `sections` when present, else `children` as one untitled section. */
|
|
68
54
|
val ResolvedTrack.normalizedSections: List<Section>?
|
|
69
55
|
get() = sections?.toList() ?: children?.let { listOf(untitledSection(it)) }
|
|
70
56
|
|
|
71
57
|
/**
|
|
72
|
-
* [normalizedSections] with the page
|
|
73
|
-
*
|
|
74
|
-
* section blocks — a page is a Track that is also the container of its sections.
|
|
58
|
+
* [normalizedSections] with the page's style folded into each section's, property by property (ADR
|
|
59
|
+
* 0011), so callers see only effective section styles.
|
|
75
60
|
*/
|
|
76
61
|
fun ResolvedTrack.styleResolvedSections(): List<Section>? =
|
|
77
62
|
normalizedSections?.map { it.copy(style = StyleResolver.sectionStyle(it.style, style)) }
|
|
78
63
|
|
|
79
|
-
/**
|
|
80
|
-
* The page's children concatenated in section order — the flattening that defines contextual
|
|
81
|
-
* `__index` positions and the flat views (tabs, search) of a sectioned page.
|
|
82
|
-
*/
|
|
64
|
+
/** The page's children in section order: the positions a contextual `__index` counts in. */
|
|
83
65
|
val ResolvedTrack.flattenedChildren: List<Track>?
|
|
84
66
|
get() = normalizedSections?.flatMap { it.children.asList() }
|