Modern Apps git

← Modern-Apps.git

youpipe: fix all lint findings

Commit
34842bef1684f9440aa892317169af502ffc5f0f
Author
Vayun Mathur <[email protected]>
When
2026-11-17 04:21 UTC (19 days ago)
Parents
cef18a3
Fix every lint error and warning reported for the youpipe module's own sources by :youpipe:lintDev, now 0 errors / 0 warnings for youpipe/** (remaining report entries are transitive library findings owned by other clusters).

PackageStructure: moved util/ view model, extensions, workers and playback service to platform/, Extractor/MyDownloader/NativeExtractor and all of util/sabr/ to network/ and network/sabr/, Recommender to domain/, and tv/ to ui/tv/. MainActivity.kt split into Route.kt, Navigation.kt, ui/PipMode.kt and platform/StartupPage.kt. Manifest FQNs updated (.ui.tv.TvMainActivity, .platform.PlaybackService) and roughly 420 references plus unit/androidTest imports rewritten; stale youpipe.util imports for decodeHtml, SponsorSegment, videoIDtoURL, RecSource and RecommendationPreset pointed at their new network/domain homes and duplicate imports removed. Split 12 extra public composables into their own files, plus TvPlayerEffects.kt/TvVideoDialogs.kt for the FileLength errors that moving tv/ under ui/ newly triggered.

Converted 7 strings to plurals with per-locale CLDR quantities; deleted verified-unused lock_controls, unlock_controls and cast_to_tv everywhere (no code, getIdentifier or screenshot references). Fixed RestrictedApi (TV remote keys via onPreviewKeyEvent at the TV root instead of a dispatchKeyEvent override), PiP source-rect hint, VectorRaster, DiscouragedApi fixed-landscape, ModifierParameter/ModifierFactoryExtensionFunction, LocalContext reads and autoboxing state.

Suppression (1, genuine false positive): @SuppressLint(StaticFieldLeak) on network/sabr/SharedWebViewRuntime with comment — the WebView is created from applicationContext, so no Activity is retained; the runtime is a process-lifetime SABR token minter by design. Exception marker (1): // PACKAGE STRUCTURE EXCEPTION (JNI) on nativeext/YouPipeNative.kt — its FQN is frozen by the Rust JNI symbol names; moving it would break native linkage. No lint config or baseline changed; no rule-bug categories.

Verified: ./gradlew :youpipe:lintDev (0 own-module errors/warnings) and :youpipe:testDevUnitTest green (505 tests).

Diff

youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceDownloadTest.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceDownloadTest.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceDownloadTest.ktindex 77992d0eb2..cd3124470c 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceDownloadTest.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceDownloadTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry
youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceFixtures.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceFixtures.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceFixtures.ktindex 4042e6d4bd..b9710fc775 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceFixtures.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceFixtures.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import java.nio.ByteBuffer import java.nio.ByteOrder
youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintExtraTest.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintExtraTest.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintExtraTest.ktindex 7ac8973f12..4aec502443 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintExtraTest.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintExtraTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry
youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintTest.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintTest.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintTest.ktindex 5850afe01f..942ab70d4d 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintTest.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceMintTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry
youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceRuntimeTest.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceRuntimeTest.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceRuntimeTest.ktindex 994a6ea1a5..4f9c8ce16f 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceRuntimeTest.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1DeviceRuntimeTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.platform.app.InstrumentationRegistry
youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1MuxerDeviceTest.kt
diff --git a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1MuxerDeviceTest.kt b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1MuxerDeviceTest.ktindex cacb0a7c2a..6cb3efdcf7 100644--- a/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1MuxerDeviceTest.kt+++ b/youpipe/src/androidTest/java/com/vayunmathur/youpipe/util/sabr/SabrSlice1MuxerDeviceTest.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.media.MediaCodec import android.media.MediaFormat
youpipe/src/main/AndroidManifest.xml
diff --git a/youpipe/src/main/AndroidManifest.xml b/youpipe/src/main/AndroidManifest.xmlindex 5df73a3535..0cb75a6345 100644--- a/youpipe/src/main/AndroidManifest.xml+++ b/youpipe/src/main/AndroidManifest.xml@@ -82,11 +82,10 @@           entries that confuse launcher resolution (the tvlauncher HOME lesson).         -->         <activity-            android:name=".tv.TvMainActivity"+            android:name=".ui.tv.TvMainActivity"             android:configChanges="mcc|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|keyboardHidden|layoutDirection|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"             android:exported="true"             android:launchMode="singleTask"-            android:screenOrientation="landscape"             android:theme="@style/Theme.General">             <intent-filter>                 <action android:name="android.intent.action.MAIN" />@@ -121,7 +120,7 @@         </activity-alias>          <service-            android:name=".util.PlaybackService"+            android:name=".platform.PlaybackService"             android:foregroundServiceType="mediaPlayback"             android:stopWithTask="true"             android:exported="false">
youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.ktindex 073479df48..bb1955662f 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt@@ -1,89 +1,18 @@ package com.vayunmathur.youpipe -import android.content.Context-import android.content.ContextWrapper import android.content.Intent import android.content.res.Configuration-import androidx.activity.ComponentActivity import androidx.activity.viewModels import androidx.compose.runtime.Composable-import androidx.compose.runtime.DisposableEffect-import androidx.compose.runtime.getValue-import androidx.compose.runtime.mutableStateOf-import androidx.compose.runtime.remember-import androidx.compose.runtime.setValue-import androidx.compose.ui.platform.LocalContext-import androidx.core.app.PictureInPictureModeChangedInfo-import androidx.core.util.Consumer-import com.vayunmathur.library.util.NavKey import com.vayunmathur.library.ui.MaActivity-import com.vayunmathur.library.util.OfflineAware-import com.vayunmathur.library.ui.IconHistory-import com.vayunmathur.library.ui.IconHome-import com.vayunmathur.library.ui.IconSave-import com.vayunmathur.library.ui.IconSubscriptions-import com.vayunmathur.library.ui.IconSettings-import com.vayunmathur.library.ui.RouteTab-import com.vayunmathur.library.ui.TabbedPagerScaffold import com.vayunmathur.library.util.DataStoreUtils-import com.vayunmathur.library.util.DialogPage-import com.vayunmathur.library.util.MainNavigation-import com.vayunmathur.library.util.MorphPage-import com.vayunmathur.library.util.SiblingPage-import com.vayunmathur.library.util.rememberNavBackStack-import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.library.util.OfflineAware import com.vayunmathur.youpipe.data.SubscriptionRepository-import com.vayunmathur.youpipe.ui.ChannelPage-import com.vayunmathur.youpipe.ui.DownloadedVideosPage-import com.vayunmathur.youpipe.ui.HistoryPage-import com.vayunmathur.youpipe.ui.PlaylistDetailPage-import com.vayunmathur.youpipe.ui.SavedPage-import com.vayunmathur.youpipe.util.PlaybackService-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.YouPipeViewModelFactory-import com.vayunmathur.youpipe.ui.SearchPage-import com.vayunmathur.youpipe.ui.SettingsPage-import com.vayunmathur.youpipe.ui.GeneralSettingsPage-import com.vayunmathur.youpipe.ui.SponsorBlockSettingsPage-import com.vayunmathur.youpipe.ui.RecommendationsSettingsPage-import com.vayunmathur.youpipe.ui.DataSettingsPage-import com.vayunmathur.youpipe.ui.ManageInterestsPage-import com.vayunmathur.youpipe.ui.SubscriptionVideosPage-import com.vayunmathur.youpipe.ui.SubscriptionsPage-import com.vayunmathur.youpipe.ui.VideoPage-import com.vayunmathur.youpipe.ui.dialogs.CreateSubscriptionCategory-import com.vayunmathur.youpipe.ui.dialogs.CreatePlaylist-import com.vayunmathur.youpipe.ui.dialogs.AddToPlaylist-import com.vayunmathur.youpipe.ui.dialogs.AddToWatchLater-import kotlinx.serialization.Serializable-import com.vayunmathur.youpipe.util.parseSharedVideoId--internal fun Context.findActivity(): ComponentActivity {-    var context = this-    while (context is ContextWrapper) {-        if (context is ComponentActivity) return context-        context = context.baseContext-    }-    throw IllegalStateException("Picture in picture should be called in the context of an Activity")-}--@Composable-fun rememberIsInPipMode(): Boolean {-    val activity = LocalContext.current.findActivity()-    var pipMode by remember { mutableStateOf(activity.isInPictureInPictureMode) }-    DisposableEffect(activity) {-        val observer = Consumer<PictureInPictureModeChangedInfo> { info ->-            pipMode = info.isInPictureInPictureMode-        }-        activity.addOnPictureInPictureModeChangedListener(-            observer-        )-        onDispose { activity.removeOnPictureInPictureModeChangedListener(observer) }-    }-    return pipMode-}--+import com.vayunmathur.youpipe.network.parseSharedVideoId+import com.vayunmathur.youpipe.platform.DEFAULT_PAGE_KEY+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModelFactory+import com.vayunmathur.youpipe.platform.defaultBackStack  /** Main Activity: a ma activity implementation for main activity. */ class MainActivity : MaActivity() {@@ -166,209 +95,3 @@ class MainActivity : MaActivity() {         super.onDestroy()     } }--// --- Default startup page ("Open to" setting) -----/**- * The sibling tab route for a legacy tab index (deep-link / default-page- * `initialTab`): the index now only chooses the start route, never live- * pager state. Out-of-range indices fall back to Home.- */-fun tabRoute(initialTab: Int): Route = when (initialTab) {-    1 -> Route.Subscriptions-    2 -> Route.History-    3 -> Route.Saved-    4 -> Route.Settings-    else -> Route.Home-}--/** DataStore key holding the persisted default-page choice. */-const val DEFAULT_PAGE_KEY = "default_page"--const val DEFAULT_PAGE_HOME = "home"-const val DEFAULT_PAGE_SUBSCRIPTIONS = "subscriptions"-const val DEFAULT_PAGE_ALL_SUBSCRIPTIONS = "all_subscriptions"-const val DEFAULT_PAGE_HISTORY = "history"-const val DEFAULT_PAGE_DOWNLOADS = "downloads"-const val DEFAULT_PAGE_SAVED = "saved"-const val DEFAULT_PAGE_SETTINGS = "settings"--/**- * Ordered options for the "Open to" picker: (persisted key, label string res).- * Stable string keys are used instead of [Route] objects so the choice- * serializes cleanly and survives refactors.- */-val DEFAULT_PAGE_OPTIONS: List<Pair<String, Int>> = listOf(-    DEFAULT_PAGE_HOME to UiR.string.home,-    DEFAULT_PAGE_SUBSCRIPTIONS to R.string.title_subscriptions,-    DEFAULT_PAGE_ALL_SUBSCRIPTIONS to R.string.label_all_subscriptions,-    DEFAULT_PAGE_HISTORY to R.string.title_history,-    DEFAULT_PAGE_SAVED to UiR.string.saved,-    DEFAULT_PAGE_SETTINGS to UiR.string.settings,-)--/** Map a persisted default-page key to the initial backstack to launch with. */-fun defaultBackStack(key: String?): List<Route> = when (key) {-    DEFAULT_PAGE_SUBSCRIPTIONS -> listOf(tabRoute(1))-    // Seed the Subscriptions root beneath the all-subscriptions feed so Back-    // returns to the Subscriptions list instead of exiting the app.-    DEFAULT_PAGE_ALL_SUBSCRIPTIONS ->-        listOf(tabRoute(1), Route.SubscriptionVideosPage(null))-    DEFAULT_PAGE_HISTORY -> listOf(tabRoute(2))-    // Both the legacy "downloads" key and the new "saved" key open the Saved hub.-    DEFAULT_PAGE_DOWNLOADS, DEFAULT_PAGE_SAVED -> listOf(tabRoute(3))-    DEFAULT_PAGE_SETTINGS -> listOf(tabRoute(4))-    else -> listOf(tabRoute(0)) // home / unset / unknown-}--/** Contract for route. */-@Serializable-sealed interface Route: NavKey {-    /** Home tab (search / recommendations feed). */-    @Serializable-    data object Home : Route--    /** Subscriptions tab. */-    @Serializable-    data object Subscriptions : Route--    /** Watch-history tab. */-    @Serializable-    data object History : Route--    /** Saved (playlists / downloads hub) tab. */-    @Serializable-    data object Saved : Route--    /** Settings tab. */-    @Serializable-    data object Settings : Route--    /** Immutable value describing video page; carries videoID. */-    @Serializable-    data class VideoPage(val videoID: Long) : Route--    /** Immutable value describing channel page; carries channelID. */-    @Serializable-    data class ChannelPage(val channelID: String): Route--    /** Immutable value describing subscription videos page; carries category. */-    @Serializable-    data class SubscriptionVideosPage(val category: String?): Route--    /** Immutable value describing create subscription category; carries id. */-    @Serializable-    data class CreateSubscriptionCategory(val id: String?): Route--    /** Singleton holding downloads state and operations. */-    @Serializable-    data object Downloads: Route--    /** Immutable value describing playlist detail; carries playlistId. */-    @Serializable-    data class PlaylistDetail(val playlistId: Long): Route--    /** Singleton holding create playlist state and operations. */-    @Serializable-    data object CreatePlaylist: Route--    /** Immutable value describing add to playlist; carries videoID, includeWatchLater. */-    @Serializable-    data class AddToPlaylist(val videoID: Long, val includeWatchLater: Boolean = true): Route--    /** Immutable value describing add to watch later; carries videoID. */-    @Serializable-    data class AddToWatchLater(val videoID: Long): Route--    /** Singleton holding settings general state and operations. */-    @Serializable-    data object SettingsGeneral: Route--    /** Singleton holding settings sponsor block state and operations. */-    @Serializable-    data object SettingsSponsorBlock: Route--    /** Singleton holding settings recommendations state and operations. */-    @Serializable-    data object SettingsRecommendations: Route--    /** Singleton holding settings data state and operations. */-    @Serializable-    data object SettingsData: Route--    /** Singleton holding manage interests state and operations. */-    @Serializable-    data object ManageInterests: Route-}--@Composable-fun Navigation(initialBackStack: List<Route>, ypvm: YouPipeViewModel) {-    val backStack = rememberNavBackStack(initialBackStack)-    val tabs = listOf<RouteTab<Route>>(-        RouteTab(Route.Home, "Home", { IconHome() }),-        RouteTab(Route.Subscriptions, "Subscriptions", { IconSubscriptions() }),-        RouteTab(Route.History, "History", { IconHistory() }),-        RouteTab(Route.Saved, "Saved", { IconSave() }),-        RouteTab(Route.Settings, "Settings", { IconSettings() }),-    )-    // Route-backed tabs: selecting a tab resets the stack to that sibling-    // (see TabbedPagerScaffold), and MainNavigation renders the top route —-    // a tab with SiblingPage() crossfade, or a detail/settings sub-route-    // pushed over it with no tab selected.-    TabbedPagerScaffold(backStack = backStack, tabs = tabs) {-        MainNavigation(backStack) {-        entry<Route.Home>(metadata = SiblingPage()) { SearchPage(backStack, ypvm) }-        entry<Route.Subscriptions>(metadata = SiblingPage()) { SubscriptionsPage(backStack, ypvm) }-        entry<Route.History>(metadata = SiblingPage()) { HistoryPage(backStack, ypvm) }-        entry<Route.Saved>(metadata = SiblingPage()) { SavedPage(backStack, ypvm) }-        entry<Route.Settings>(metadata = SiblingPage()) { SettingsPage(backStack, ypvm) }-        // Morph, not Fullscreen: the feed row's title travels into the title under the player, and-        // a morph only works against a crossfade - the immersive scale would move the target while-        // the title is still on its way to it.-        entry<Route.VideoPage>(metadata = MorphPage()) {-            VideoPage(backStack, ypvm, it.videoID)-        }-        // Morph: a subscription row carries its avatar and name up into the header here. The other-        // ways in - a search result, a video's author line - are unkeyed and simply crossfade.-        entry<Route.ChannelPage>(metadata = MorphPage()) {-            ChannelPage(backStack, ypvm, it.channelID)-        }-        entry<Route.SubscriptionVideosPage> {-            SubscriptionVideosPage(backStack, ypvm, it.category)-        }-        entry<Route.CreateSubscriptionCategory>(metadata = DialogPage()) {-            CreateSubscriptionCategory(backStack, ypvm, it.id)-        }-        entry<Route.Downloads> {-            DownloadedVideosPage(backStack, ypvm)-        }-        entry<Route.PlaylistDetail>(metadata = MorphPage()) {-            PlaylistDetailPage(backStack, ypvm, it.playlistId)-        }-        entry<Route.CreatePlaylist>(metadata = DialogPage()) {-            CreatePlaylist(backStack, ypvm)-        }-        entry<Route.AddToPlaylist>(metadata = DialogPage()) {-            AddToPlaylist(backStack, ypvm, it.videoID, it.includeWatchLater)-        }-        entry<Route.AddToWatchLater>(metadata = DialogPage()) {-            AddToWatchLater(backStack, ypvm, it.videoID)-        }-        entry<Route.SettingsGeneral> {-            GeneralSettingsPage(backStack, ypvm)-        }-        entry<Route.SettingsSponsorBlock> {-            SponsorBlockSettingsPage(backStack, ypvm)-        }-        entry<Route.SettingsRecommendations> {-            RecommendationsSettingsPage(backStack, ypvm)-        }-        entry<Route.SettingsData> {-            DataSettingsPage(backStack, ypvm)-        }-        entry<Route.ManageInterests> {-            ManageInterestsPage(backStack, ypvm)-        }-        }-    }-}
youpipe/src/main/java/com/vayunmathur/youpipe/Navigation.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/Navigation.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/Navigation.ktnew file mode 100644index 0000000000..2c5f52f6b0--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/Navigation.kt@@ -0,0 +1,107 @@+package com.vayunmathur.youpipe++import androidx.compose.runtime.Composable+import com.vayunmathur.library.ui.IconHistory+import com.vayunmathur.library.ui.IconHome+import com.vayunmathur.library.ui.IconSave+import com.vayunmathur.library.ui.IconSettings+import com.vayunmathur.library.ui.IconSubscriptions+import com.vayunmathur.library.ui.RouteTab+import com.vayunmathur.library.ui.TabbedPagerScaffold+import com.vayunmathur.library.util.DialogPage+import com.vayunmathur.library.util.MainNavigation+import com.vayunmathur.library.util.MorphPage+import com.vayunmathur.library.util.SiblingPage+import com.vayunmathur.library.util.rememberNavBackStack+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.ui.ChannelPage+import com.vayunmathur.youpipe.ui.DataSettingsPage+import com.vayunmathur.youpipe.ui.DownloadedVideosPage+import com.vayunmathur.youpipe.ui.GeneralSettingsPage+import com.vayunmathur.youpipe.ui.HistoryPage+import com.vayunmathur.youpipe.ui.ManageInterestsPage+import com.vayunmathur.youpipe.ui.PlaylistDetailPage+import com.vayunmathur.youpipe.ui.RecommendationsSettingsPage+import com.vayunmathur.youpipe.ui.SavedPage+import com.vayunmathur.youpipe.ui.SearchPage+import com.vayunmathur.youpipe.ui.SettingsPage+import com.vayunmathur.youpipe.ui.SponsorBlockSettingsPage+import com.vayunmathur.youpipe.ui.SubscriptionVideosPage+import com.vayunmathur.youpipe.ui.SubscriptionsPage+import com.vayunmathur.youpipe.ui.VideoPage+import com.vayunmathur.youpipe.ui.dialogs.AddToPlaylist+import com.vayunmathur.youpipe.ui.dialogs.AddToWatchLater+import com.vayunmathur.youpipe.ui.dialogs.CreatePlaylist+import com.vayunmathur.youpipe.ui.dialogs.CreateSubscriptionCategory++@Composable+fun Navigation(initialBackStack: List<Route>, ypvm: YouPipeViewModel) {+    val backStack = rememberNavBackStack(initialBackStack)+    val tabs = listOf<RouteTab<Route>>(+        RouteTab(Route.Home, "Home", { IconHome() }),+        RouteTab(Route.Subscriptions, "Subscriptions", { IconSubscriptions() }),+        RouteTab(Route.History, "History", { IconHistory() }),+        RouteTab(Route.Saved, "Saved", { IconSave() }),+        RouteTab(Route.Settings, "Settings", { IconSettings() }),+    )+    // Route-backed tabs: selecting a tab resets the stack to that sibling+    // (see TabbedPagerScaffold), and MainNavigation renders the top route —+    // a tab with SiblingPage() crossfade, or a detail/settings sub-route+    // pushed over it with no tab selected.+    TabbedPagerScaffold(backStack = backStack, tabs = tabs) {+        MainNavigation(backStack) {+        entry<Route.Home>(metadata = SiblingPage()) { SearchPage(backStack, ypvm) }+        entry<Route.Subscriptions>(metadata = SiblingPage()) { SubscriptionsPage(backStack, ypvm) }+        entry<Route.History>(metadata = SiblingPage()) { HistoryPage(backStack, ypvm) }+        entry<Route.Saved>(metadata = SiblingPage()) { SavedPage(backStack, ypvm) }+        entry<Route.Settings>(metadata = SiblingPage()) { SettingsPage(backStack, ypvm) }+        // Morph, not Fullscreen: the feed row's title travels into the title under the player, and+        // a morph only works against a crossfade - the immersive scale would move the target while+        // the title is still on its way to it.+        entry<Route.VideoPage>(metadata = MorphPage()) {+            VideoPage(backStack, ypvm, it.videoID)+        }+        // Morph: a subscription row carries its avatar and name up into the header here. The other+        // ways in - a search result, a video's author line - are unkeyed and simply crossfade.+        entry<Route.ChannelPage>(metadata = MorphPage()) {+            ChannelPage(backStack, ypvm, it.channelID)+        }+        entry<Route.SubscriptionVideosPage> {+            SubscriptionVideosPage(backStack, ypvm, it.category)+        }+        entry<Route.CreateSubscriptionCategory>(metadata = DialogPage()) {+            CreateSubscriptionCategory(backStack, ypvm, it.id)+        }+        entry<Route.Downloads> {+            DownloadedVideosPage(backStack, ypvm)+        }+        entry<Route.PlaylistDetail>(metadata = MorphPage()) {+            PlaylistDetailPage(backStack, ypvm, it.playlistId)+        }+        entry<Route.CreatePlaylist>(metadata = DialogPage()) {+            CreatePlaylist(backStack, ypvm)+        }+        entry<Route.AddToPlaylist>(metadata = DialogPage()) {+            AddToPlaylist(backStack, ypvm, it.videoID, it.includeWatchLater)+        }+        entry<Route.AddToWatchLater>(metadata = DialogPage()) {+            AddToWatchLater(backStack, ypvm, it.videoID)+        }+        entry<Route.SettingsGeneral> {+            GeneralSettingsPage(backStack, ypvm)+        }+        entry<Route.SettingsSponsorBlock> {+            SponsorBlockSettingsPage(backStack, ypvm)+        }+        entry<Route.SettingsRecommendations> {+            RecommendationsSettingsPage(backStack, ypvm)+        }+        entry<Route.SettingsData> {+            DataSettingsPage(backStack, ypvm)+        }+        entry<Route.ManageInterests> {+            ManageInterestsPage(backStack, ypvm)+        }+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/Route.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/Route.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/Route.ktnew file mode 100644index 0000000000..ab3a24a78f--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/Route.kt@@ -0,0 +1,84 @@+package com.vayunmathur.youpipe++import com.vayunmathur.library.util.NavKey+import kotlinx.serialization.Serializable++/** Contract for route. */+@Serializable+sealed interface Route : NavKey {+    /** Home tab (search / recommendations feed). */+    @Serializable+    data object Home : Route++    /** Subscriptions tab. */+    @Serializable+    data object Subscriptions : Route++    /** Watch-history tab. */+    @Serializable+    data object History : Route++    /** Saved (playlists / downloads hub) tab. */+    @Serializable+    data object Saved : Route++    /** Settings tab. */+    @Serializable+    data object Settings : Route++    /** Immutable value describing video page; carries videoID. */+    @Serializable+    data class VideoPage(val videoID: Long) : Route++    /** Immutable value describing channel page; carries channelID. */+    @Serializable+    data class ChannelPage(val channelID: String): Route++    /** Immutable value describing subscription videos page; carries category. */+    @Serializable+    data class SubscriptionVideosPage(val category: String?): Route++    /** Immutable value describing create subscription category; carries id. */+    @Serializable+    data class CreateSubscriptionCategory(val id: String?): Route++    /** Singleton holding downloads state and operations. */+    @Serializable+    data object Downloads: Route++    /** Immutable value describing playlist detail; carries playlistId. */+    @Serializable+    data class PlaylistDetail(val playlistId: Long): Route++    /** Singleton holding create playlist state and operations. */+    @Serializable+    data object CreatePlaylist: Route++    /** Immutable value describing add to playlist; carries videoID, includeWatchLater. */+    @Serializable+    data class AddToPlaylist(val videoID: Long, val includeWatchLater: Boolean = true): Route++    /** Immutable value describing add to watch later; carries videoID. */+    @Serializable+    data class AddToWatchLater(val videoID: Long): Route++    /** Singleton holding settings general state and operations. */+    @Serializable+    data object SettingsGeneral: Route++    /** Singleton holding settings sponsor block state and operations. */+    @Serializable+    data object SettingsSponsorBlock: Route++    /** Singleton holding settings recommendations state and operations. */+    @Serializable+    data object SettingsRecommendations: Route++    /** Singleton holding settings data state and operations. */+    @Serializable+    data object SettingsData: Route++    /** Singleton holding manage interests state and operations. */+    @Serializable+    data object ManageInterests: Route+}
youpipe/src/main/java/com/vayunmathur/youpipe/YouPipeApplication.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/YouPipeApplication.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/YouPipeApplication.ktindex fde3dfb559..be7ed2dd55 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/YouPipeApplication.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/YouPipeApplication.kt@@ -7,9 +7,9 @@ import com.vayunmathur.library.network.NetworkClient import com.vayunmathur.library.network.TrustBundle import com.vayunmathur.library.util.DataStoreUtils import com.vayunmathur.youpipe.data.RemoteImageFetchers-import com.vayunmathur.youpipe.util.MyDownloader-import com.vayunmathur.youpipe.util.sabr.LocalDomPoTokenProvider-import com.vayunmathur.youpipe.util.youtubeLocalization+import com.vayunmathur.youpipe.network.MyDownloader+import com.vayunmathur.youpipe.network.sabr.LocalDomPoTokenProvider+import com.vayunmathur.youpipe.platform.youtubeLocalization import org.schabi.newpipe.extractor.NewPipe  /** You Pipe Application: a application implementation for you pipe application. */
youpipe/src/main/java/com/vayunmathur/youpipe/data/RecommendationImpression.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/data/RecommendationImpression.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/data/RecommendationImpression.ktindex d2d2c14496..92d69f318e 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/data/RecommendationImpression.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/data/RecommendationImpression.kt@@ -11,7 +11,7 @@ import kotlin.time.Instant  * A record that a video was shown in the recommendation feed. Used to drive the  * feedback loop: rarely-shown channels earn an exploration bonus, while channels  * shown many times but never watched are demoted, and recently-shown videos are- * suppressed on refresh. [source] is stored as the [com.vayunmathur.youpipe.util.RecSource]+ * suppressed on refresh. [source] is stored as the [com.vayunmathur.youpipe.domain.RecSource]  * name.  */ @Entity
youpipe/src/main/java/com/vayunmathur/youpipe/data/SubscriptionRepository.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/data/SubscriptionRepository.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/data/SubscriptionRepository.ktindex 66f4d22733..e62fd8c168 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/data/SubscriptionRepository.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/data/SubscriptionRepository.kt@@ -8,9 +8,9 @@ import kotlinx.coroutines.flow.Flow  * Single source of truth for all YouPipe persisted data.  *  * Owns the one [SubscriptionDatabase] instance (via [RoomRepository]) and is the- * only place the 12 DAOs are touched. The [com.vayunmathur.youpipe.util.YouPipeViewModel],- * [com.vayunmathur.youpipe.util.DownloadWorker], and- * [com.vayunmathur.youpipe.util.SubscriptionFetchTask] all read/write through here+ * only place the 12 DAOs are touched. The [com.vayunmathur.youpipe.platform.YouPipeViewModel],+ * [com.vayunmathur.youpipe.platform.DownloadWorker], and+ * [com.vayunmathur.youpipe.platform.SubscriptionFetchTask] all read/write through here  * so they share one live, invalidation-backed view of the data.  *  * Read access is exposed as cold [Flow]s (consumers apply `stateIn`/`map` as before).
youpipe/src/main/java/com/vayunmathur/youpipe/domain/Recommender.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/Recommender.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/domain/Recommender.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/Recommender.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/domain/Recommender.ktindex b26b449937..1b458f20a6 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/Recommender.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/domain/Recommender.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.domain  import com.vayunmathur.youpipe.data.HistoryVideo import com.vayunmathur.youpipe.data.RecommendationPreferences
youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/YouPipeNative.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/YouPipeNative.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/YouPipeNative.ktindex b88b54dd19..c91b5e4092 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/YouPipeNative.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/YouPipeNative.kt@@ -1,3 +1,4 @@+// PACKAGE STRUCTURE EXCEPTION (JNI) package com.vayunmathur.youpipe.nativeext  /**
youpipe/src/main/java/com/vayunmathur/youpipe/network/Extractor.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/Extractor.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/Extractor.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/Extractor.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/Extractor.ktindex f83088d064..6c1e943434 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/Extractor.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/Extractor.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.network import androidx.core.net.toUri import androidx.core.text.HtmlCompat import com.vayunmathur.library.network.NetworkClient
youpipe/src/main/java/com/vayunmathur/youpipe/network/MyDownloader.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/MyDownloader.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/MyDownloader.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/MyDownloader.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/MyDownloader.ktindex a4cc908972..a10ece694f 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/MyDownloader.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/MyDownloader.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.network  import com.vayunmathur.library.network.NetworkClient import kotlinx.coroutines.runBlocking
youpipe/src/main/java/com/vayunmathur/youpipe/network/NativeExtractor.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/NativeExtractor.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/NativeExtractor.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/NativeExtractor.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/NativeExtractor.ktindex 1dd4d2c711..b8732e8b7a 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/nativeext/NativeExtractor.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/NativeExtractor.kt@@ -1,10 +1,11 @@-package com.vayunmathur.youpipe.nativeext+package com.vayunmathur.youpipe.network  import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable import kotlinx.serialization.json.Json+import com.vayunmathur.youpipe.nativeext.YouPipeNative  /**  * Kotlin-facing API of the Rust extractor.
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenGenerator.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenGenerator.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenGenerator.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenGenerator.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenGenerator.ktindex 4f9a508d5e..925d9c3bc7 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenGenerator.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenGenerator.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.content.Context import org.schabi.newpipe.extractor.NewPipe
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenProvider.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenProvider.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenProvider.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenProvider.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenProvider.ktindex 8a39127892..22cc503248 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/LocalDomPoTokenProvider.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/LocalDomPoTokenProvider.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.content.Context import com.vayunmathur.library.log.Log
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrAttestationRetryHandler.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrAttestationRetryHandler.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrAttestationRetryHandler.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrAttestationRetryHandler.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrAttestationRetryHandler.ktindex 12de74a8c9..3ed0214900 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrAttestationRetryHandler.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrAttestationRetryHandler.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import org.schabi.newpipe.extractor.services.youtube.sabrng.YoutubeSabrSession import org.schabi.newpipe.extractor.services.youtube.sabrng.exception.SabrAttestationException
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrDownloadException.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrDownloadException.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrDownloadException.ktsimilarity index 88%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrDownloadException.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrDownloadException.ktindex b93320ac33..cf50ac085a 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrDownloadException.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrDownloadException.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import java.io.IOException 
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrFfmpegMuxer.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrFfmpegMuxer.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrFfmpegMuxer.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrFfmpegMuxer.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrFfmpegMuxer.ktindex 2449325028..3971f3be92 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrFfmpegMuxer.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrFfmpegMuxer.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.media.MediaCodec import android.media.MediaExtractor
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrLocalDomPoTokenUtil.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrLocalDomPoTokenUtil.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrLocalDomPoTokenUtil.ktsimilarity index 97%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrLocalDomPoTokenUtil.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrLocalDomPoTokenUtil.ktindex 9c4771951d..a98b898fd1 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrLocalDomPoTokenUtil.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrLocalDomPoTokenUtil.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.buildJsonObject
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDashMediaSource.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDashMediaSource.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDashMediaSource.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDashMediaSource.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDashMediaSource.ktindex bb913e75c5..01e0c5b46b 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDashMediaSource.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDashMediaSource.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.content.Context import android.os.Handler
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDownloadHelper.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDownloadHelper.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDownloadHelper.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDownloadHelper.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDownloadHelper.ktindex b092d0d05f..49bdbf5a19 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgDownloadHelper.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgDownloadHelper.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.content.Context import com.vayunmathur.library.log.Log
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSegmentDataSource.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSegmentDataSource.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSegmentDataSource.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSegmentDataSource.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSegmentDataSource.ktindex 9489d7f375..2252a4d3ba 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSegmentDataSource.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSegmentDataSource.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import android.net.Uri import androidx.annotation.OptIn
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSession.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSession.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSession.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSession.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSession.ktindex 59bef2e13a..1055a81fec 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSession.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSession.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import com.vayunmathur.library.log.Log import org.schabi.newpipe.extractor.exceptions.ExtractionException
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSessionStore.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSessionStore.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSessionStore.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSessionStore.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSessionStore.ktindex e6ea1feeaf..9fd0b230bd 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSessionStore.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSessionStore.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import com.vayunmathur.library.log.Log import org.schabi.newpipe.extractor.localization.Localization
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSourceSpec.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSourceSpec.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSourceSpec.ktsimilarity index 97%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSourceSpec.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSourceSpec.ktindex d6c3c55a6a..7763315b82 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrNgSourceSpec.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrNgSourceSpec.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import org.schabi.newpipe.extractor.localization.Localization import org.schabi.newpipe.extractor.services.youtube.sabrng.YoutubeSabrFormatTimeline
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrRequestCoordinator.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrRequestCoordinator.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrRequestCoordinator.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrRequestCoordinator.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrRequestCoordinator.ktindex fab77e0ee3..4e93155fa3 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SabrRequestCoordinator.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SabrRequestCoordinator.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import org.schabi.newpipe.extractor.exceptions.ExtractionException import org.schabi.newpipe.extractor.services.youtube.sabrng.YoutubeSabrRequest
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SharedWebViewRuntime.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SharedWebViewRuntime.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SharedWebViewRuntime.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SharedWebViewRuntime.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SharedWebViewRuntime.ktindex c82a489615..b486e4f8a1 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/SharedWebViewRuntime.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/SharedWebViewRuntime.kt@@ -1,6 +1,6 @@ @file:OptIn(kotlin.uuid.ExperimentalUuidApi::class) -package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import kotlin.uuid.Uuid import android.annotation.SuppressLint@@ -35,6 +35,7 @@ import java.util.concurrent.atomic.AtomicReference  * a stable JavaScript bridge. Callers keep their own JS namespaces and serialize their public entry  * points on the caller side.  */[email protected]("StaticFieldLeak") class SharedWebViewRuntime private constructor(context: Context) {      /** Contract for initialization failure callback. */@@ -533,6 +534,10 @@ class SharedWebViewRuntime private constructor(context: Context) {     }      /** Shared constants and helpers for SharedWebViewRuntime. */+    // StaticFieldLeak is a false positive here: the WebView is created from the application+    // context (createWebView uses appContext), so no Activity is retained; the runtime is a+    // process-lifetime SABR token minter shared by every session by design.+    @android.annotation.SuppressLint("StaticFieldLeak")     companion object {         const val BRIDGE_NAME = "PipePipeWebViewBridge" 
youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/YoutubePageAttestationBootstrap.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/YoutubePageAttestationBootstrap.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/YoutubePageAttestationBootstrap.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/YoutubePageAttestationBootstrap.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/YoutubePageAttestationBootstrap.ktindex d376ff528b..80ee58377e 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/sabr/YoutubePageAttestationBootstrap.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/network/sabr/YoutubePageAttestationBootstrap.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util.sabr+package com.vayunmathur.youpipe.network.sabr  import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonObject
youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadManager.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadManager.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadManager.ktsimilarity index 97%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadManager.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadManager.ktindex 049024e6d1..e7bc735aa8 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadManager.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadManager.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import android.content.Context import androidx.work.WorkManager
youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadWorker.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadWorker.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadWorker.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadWorker.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadWorker.ktindex 5c51f83598..d11625c2a8 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/DownloadWorker.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/DownloadWorker.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import android.content.Context import com.vayunmathur.library.log.Log@@ -12,7 +12,7 @@ import androidx.work.WorkerParameters import com.vayunmathur.youpipe.data.DownloadedVideo import com.vayunmathur.youpipe.data.SubscriptionRepository import com.vayunmathur.youpipe.ui.VideoInfo-import com.vayunmathur.youpipe.util.sabr.SabrNgDownloadHelper+import com.vayunmathur.youpipe.network.sabr.SabrNgDownloadHelper import com.vayunmathur.library.network.NetworkClient import com.vayunmathur.library.network.NetworkDataStream import org.schabi.newpipe.extractor.ServiceList
youpipe/src/main/java/com/vayunmathur/youpipe/platform/PlaybackService.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/PlaybackService.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/PlaybackService.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/PlaybackService.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/PlaybackService.ktindex 4c2b572fae..baebfcc4f2 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/PlaybackService.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/PlaybackService.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform import android.content.Intent import androidx.annotation.OptIn import androidx.core.net.toUri@@ -22,9 +22,9 @@ import com.google.common.util.concurrent.Futures import com.google.common.util.concurrent.ListenableFuture import com.vayunmathur.library.log.Log import com.vayunmathur.youpipe.platform.CastAudioTap-import com.vayunmathur.youpipe.util.sabr.LocalDomPoTokenProvider-import com.vayunmathur.youpipe.util.sabr.SabrNgDashMediaSource-import com.vayunmathur.youpipe.util.sabr.SabrNgSessionStore+import com.vayunmathur.youpipe.network.sabr.LocalDomPoTokenProvider+import com.vayunmathur.youpipe.network.sabr.SabrNgDashMediaSource+import com.vayunmathur.youpipe.network.sabr.SabrNgSessionStore import org.schabi.newpipe.extractor.localization.Localization import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isAndroidStreamingUrl import org.schabi.newpipe.extractor.services.youtube.YoutubeParsingHelper.isIosStreamingUrl@@ -166,7 +166,7 @@ class PlaybackService : MediaSessionService() {         val tokenMinter: (Boolean) -> ByteArray? = { force ->             provider.getPoTokenBytes(videoId, force)         }-        val specSupplier: () -> com.vayunmathur.youpipe.util.sabr.SabrNgSourceSpec = {+        val specSupplier: () -> com.vayunmathur.youpipe.network.sabr.SabrNgSourceSpec = {             val poToken = tokenMinter(false)             SabrNgSessionStore.createSourceSpec(                 videoId, vitag, vAudioItag, vAudioTrackId, info, poToken,
youpipe/src/main/java/com/vayunmathur/youpipe/platform/StartupPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/platform/StartupPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/StartupPage.ktnew file mode 100644index 0000000000..eb0fcc3d5b--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/StartupPage.kt@@ -0,0 +1,59 @@+package com.vayunmathur.youpipe.platform++import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.youpipe.R+import com.vayunmathur.youpipe.Route++// --- Default startup page ("Open to" setting) ---++/**+ * The sibling tab route for a legacy tab index (deep-link / default-page+ * `initialTab`): the index now only chooses the start route, never live+ * pager state. Out-of-range indices fall back to Home.+ */+fun tabRoute(initialTab: Int): Route = when (initialTab) {+    1 -> Route.Subscriptions+    2 -> Route.History+    3 -> Route.Saved+    4 -> Route.Settings+    else -> Route.Home+}++/** DataStore key holding the persisted default-page choice. */+const val DEFAULT_PAGE_KEY = "default_page"++const val DEFAULT_PAGE_HOME = "home"+const val DEFAULT_PAGE_SUBSCRIPTIONS = "subscriptions"+const val DEFAULT_PAGE_ALL_SUBSCRIPTIONS = "all_subscriptions"+const val DEFAULT_PAGE_HISTORY = "history"+const val DEFAULT_PAGE_DOWNLOADS = "downloads"+const val DEFAULT_PAGE_SAVED = "saved"+const val DEFAULT_PAGE_SETTINGS = "settings"++/**+ * Ordered options for the "Open to" picker: (persisted key, label string res).+ * Stable string keys are used instead of [Route] objects so the choice+ * serializes cleanly and survives refactors.+ */+val DEFAULT_PAGE_OPTIONS: List<Pair<String, Int>> = listOf(+    DEFAULT_PAGE_HOME to UiR.string.home,+    DEFAULT_PAGE_SUBSCRIPTIONS to R.string.title_subscriptions,+    DEFAULT_PAGE_ALL_SUBSCRIPTIONS to R.string.label_all_subscriptions,+    DEFAULT_PAGE_HISTORY to R.string.title_history,+    DEFAULT_PAGE_SAVED to UiR.string.saved,+    DEFAULT_PAGE_SETTINGS to UiR.string.settings,+)++/** Map a persisted default-page key to the initial backstack to launch with. */+fun defaultBackStack(key: String?): List<Route> = when (key) {+    DEFAULT_PAGE_SUBSCRIPTIONS -> listOf(tabRoute(1))+    // Seed the Subscriptions root beneath the all-subscriptions feed so Back+    // returns to the Subscriptions list instead of exiting the app.+    DEFAULT_PAGE_ALL_SUBSCRIPTIONS ->+        listOf(tabRoute(1), Route.SubscriptionVideosPage(null))+    DEFAULT_PAGE_HISTORY -> listOf(tabRoute(2))+    // Both the legacy "downloads" key and the new "saved" key open the Saved hub.+    DEFAULT_PAGE_DOWNLOADS, DEFAULT_PAGE_SAVED -> listOf(tabRoute(3))+    DEFAULT_PAGE_SETTINGS -> listOf(tabRoute(4))+    else -> listOf(tabRoute(0)) // home / unset / unknown+}
youpipe/src/main/java/com/vayunmathur/youpipe/platform/SubscriptionFetchTask.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/SubscriptionFetchTask.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/SubscriptionFetchTask.ktsimilarity index 96%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/SubscriptionFetchTask.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/SubscriptionFetchTask.ktindex 17264c83ab..09e833f671 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/SubscriptionFetchTask.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/SubscriptionFetchTask.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import android.content.Context import com.vayunmathur.library.log.Log@@ -10,6 +10,8 @@ import com.vayunmathur.youpipe.data.SubscriptionRepository import com.vayunmathur.youpipe.data.SubscriptionVideo import kotlin.time.Duration.Companion.minutes import kotlinx.coroutines.CancellationException+import com.vayunmathur.youpipe.network.getChannelInfo+import com.vayunmathur.youpipe.network.getChannelVideos  /**  * FIXED: The constructor must match (Context, WorkerParameters) exactly. Removed 'val' from context
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeImportExport.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeImportExport.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeImportExport.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeImportExport.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeImportExport.ktindex ebdb4df1a2..f3c4389ab7 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeImportExport.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeImportExport.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import android.app.Application import android.net.Uri@@ -20,6 +20,9 @@ import kotlinx.serialization.json.jsonPrimitive import java.util.zip.ZipInputStream import kotlin.time.Clock import kotlin.time.Instant+import com.vayunmathur.youpipe.network.decodeHtml+import com.vayunmathur.youpipe.network.getChannelInfoFromURL+import com.vayunmathur.youpipe.network.videoURLtoID  private const val TAG = "YouPipeViewModel" 
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipePlaylistOps.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipePlaylistOps.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipePlaylistOps.ktsimilarity index 98%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipePlaylistOps.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipePlaylistOps.ktindex 2434714eeb..38d3015ec0 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipePlaylistOps.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipePlaylistOps.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import androidx.lifecycle.viewModelScope import com.vayunmathur.youpipe.data.Playlist
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendationSettings.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendationSettings.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendationSettings.ktsimilarity index 97%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendationSettings.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendationSettings.ktindex cc977a5f44..1ea6bf540d 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendationSettings.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendationSettings.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import androidx.lifecycle.viewModelScope import com.vayunmathur.youpipe.data.ChannelPreference@@ -6,6 +6,8 @@ import com.vayunmathur.youpipe.data.KeywordPreference import com.vayunmathur.youpipe.data.RecommendationPreferences import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch+import com.vayunmathur.youpipe.domain.RecSource+import com.vayunmathur.youpipe.domain.RecommendationPreset  private const val TAG = "YouPipeViewModel" 
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendations.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendations.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendations.ktsimilarity index 93%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendations.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendations.ktindex 32ef4b37fe..bd39c6881e 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeRecommendations.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeRecommendations.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import com.vayunmathur.library.log.Log import androidx.lifecycle.viewModelScope@@ -18,6 +18,21 @@ import org.schabi.newpipe.extractor.channel.ChannelInfoItem import kotlin.random.Random import kotlin.time.Clock import kotlin.time.Instant+import com.vayunmathur.youpipe.domain.Candidate+import com.vayunmathur.youpipe.domain.ChannelImpressionStat+import com.vayunmathur.youpipe.domain.ChannelPref+import com.vayunmathur.youpipe.domain.ContentFilters+import com.vayunmathur.youpipe.domain.InterestProfile+import com.vayunmathur.youpipe.domain.RankedVideo+import com.vayunmathur.youpipe.domain.RecSource+import com.vayunmathur.youpipe.domain.RecommendationWeights+import com.vayunmathur.youpipe.domain.buildInterestProfile+import com.vayunmathur.youpipe.domain.channelNameMatches+import com.vayunmathur.youpipe.network.channelURLtoID+import com.vayunmathur.youpipe.network.getChannelVideos+import com.vayunmathur.youpipe.network.getTrendingVideos+import com.vayunmathur.youpipe.domain.rankRecommendations+import com.vayunmathur.youpipe.network.searchVideos  private const val TAG = "YouPipeViewModel" 
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeUiContract.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeUiContract.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeUiContract.ktsimilarity index 99%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeUiContract.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeUiContract.ktindex c6da66e4df..0775314371 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeUiContract.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeUiContract.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import com.vayunmathur.youpipe.ui.AudioStream import com.vayunmathur.youpipe.ui.Comment
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeVideoLoading.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeVideoLoading.ktsimilarity index 96%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeVideoLoading.ktindex 4cfdf4ebd0..6938b45d9f 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeVideoLoading.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeVideoLoading.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import com.vayunmathur.library.log.Log import androidx.lifecycle.viewModelScope@@ -24,6 +24,11 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem import org.schabi.newpipe.extractor.stream.SubtitlesStream import kotlin.time.Clock import kotlin.time.toKotlinInstant+import com.vayunmathur.youpipe.network.channelURLtoID+import com.vayunmathur.youpipe.network.decodeHtml+import com.vayunmathur.youpipe.network.getSponsorSegments+import com.vayunmathur.youpipe.network.toVideoInfo+import com.vayunmathur.youpipe.network.videoIDtoURL  private const val TAG = "YouPipeViewModel" private const val MILLIS_PER_SECOND = 1000L@@ -265,10 +270,7 @@ private fun registerSabrInfo(     videoId: String,     sabrVideoOnly: List<org.schabi.newpipe.extractor.stream.VideoStream>, ) {-    // Register SABR session metadata for the playback service if present.-    // NOTE: do NOT prewarm the content PoToken here — doing so regressed SABR-    // bootstrap (403 on init range / "no exact indexes"). The token is minted-    // at play time by createSourceSpec, which is the known-working ordering.+    // Register SABR session metadata for the playback service if present. The content PoToken is minted at play time by createSourceSpec; prewarming it here regressed SABR bootstrap.     if (sabrVideoOnly.isEmpty()) return     sabrVideoOnly.firstOrNull {         it.getDeliveryMethodInfo() is@@ -276,7 +278,7 @@ private fun registerSabrInfo(     }?.let {         val sabrInfo = it.getDeliveryMethodInfo() as             org.schabi.newpipe.extractor.services.youtube.sabrng.YoutubeSabrInfo-        com.vayunmathur.youpipe.util.sabr.SabrNgSessionStore.putExtractorInfo(+        com.vayunmathur.youpipe.network.sabr.SabrNgSessionStore.putExtractorInfo(             videoId, sabrInfo         )     }
youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeViewModel.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeViewModel.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeViewModel.ktsimilarity index 96%rename from youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeViewModel.ktrename to youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeViewModel.ktindex e3af6acc68..902bffbdc0 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/util/YouPipeViewModel.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/platform/YouPipeViewModel.kt@@ -1,4 +1,4 @@-package com.vayunmathur.youpipe.util+package com.vayunmathur.youpipe.platform  import android.app.Application import android.net.Uri@@ -10,8 +10,8 @@ import androidx.lifecycle.viewModelScope import androidx.work.WorkInfo import androidx.work.WorkManager import com.vayunmathur.library.util.DataStoreUtils-import com.vayunmathur.youpipe.DEFAULT_PAGE_HOME-import com.vayunmathur.youpipe.DEFAULT_PAGE_KEY+import com.vayunmathur.youpipe.platform.DEFAULT_PAGE_HOME+import com.vayunmathur.youpipe.platform.DEFAULT_PAGE_KEY import com.vayunmathur.youpipe.data.CachedRelatedVideo import com.vayunmathur.youpipe.data.ChannelPreference import com.vayunmathur.youpipe.data.DownloadedVideo@@ -78,6 +78,20 @@ import kotlin.time.Duration.Companion.days import kotlin.time.Duration.Companion.minutes import kotlin.time.Instant import kotlin.time.toKotlinInstant+import com.vayunmathur.youpipe.domain.InterestProfile+import com.vayunmathur.youpipe.domain.RankedVideo+import com.vayunmathur.youpipe.domain.RecommendationWeights+import com.vayunmathur.youpipe.network.SponsorSegment+import com.vayunmathur.youpipe.domain.buildInterestProfile+import com.vayunmathur.youpipe.network.channelURLtoID+import com.vayunmathur.youpipe.network.decodeHtml+import com.vayunmathur.youpipe.network.getChannelInfo+import com.vayunmathur.youpipe.network.getChannelVideos+import com.vayunmathur.youpipe.network.getDeArrowBranding+import com.vayunmathur.youpipe.network.toVideoInfo+import com.vayunmathur.youpipe.network.videoURLtoID+import com.vayunmathur.youpipe.network.trustedThumbnailUrl+import com.vayunmathur.youpipe.network.trustedTitle  /**  * Single ViewModel for the YouPipe app.
youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelHeader.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelHeader.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelHeader.ktnew file mode 100644index 0000000000..719edb6518--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelHeader.kt@@ -0,0 +1,94 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.aspectRatio+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.shape.CircleShape+import androidx.compose.foundation.shape.RoundedCornerShape+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.DropdownMenu+import com.vayunmathur.library.ui.DropdownMenuItem+import com.vayunmathur.library.ui.HorizontalDivider+import com.vayunmathur.library.ui.IconMoreVert+import com.vayunmathur.library.ui.IconButton+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.ListItemDefaults+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.OutlinedButton+import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.Surface+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.isExpandedWidth+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.library.util.sharedContainer+import com.vayunmathur.library.util.sharedContent+import com.vayunmathur.library.util.sharedText+import com.vayunmathur.library.image.compose.AsyncImage+import com.vayunmathur.library.image.ImageRequest+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.youpipe.R+import com.vayunmathur.youpipe.Route+import com.vayunmathur.youpipe.data.Subscription+import com.vayunmathur.youpipe.platform.VideoRowState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.network.decodeHtml+import kotlinx.serialization.Serializable+import kotlin.time.Instant+++/**+ * The channel's identity block, and the far end of the morph that starts at a subscription row.+ *+ * Keyed on the container rather than on the avatar alone: an avatar gliding out of a row while the+ * name beside it cuts reads worse than no morph at all. The avatar is nested inside so its pixels+ * keep their identity across the size change - 24dp in the row, 52dp here.+ */+@Composable+fun ChannelHeader(channelInfo: ChannelInfo) {+    val context = LocalContext.current+    ListItem(modifier = Modifier.sharedContainer("youpipe-channel-${channelInfo.channelID}"), overlineContent = {++    }, supportingContent = {+        Text(stringResource(R.string.subscribers_count, countString(context, channelInfo.subscribers)))+    }, leadingContent = {+        AsyncImage(+            model = ImageRequest.Builder(context)+                .data(channelInfo.avatar)+                .memoryCacheKey("channel-avatar-${channelInfo.channelID}")+                .build(),+            contentDescription = null,+            Modifier.sharedContent("youpipe-channel-avatar-${channelInfo.channelID}")+                .size(52.dp)+                .clip(CircleShape)+        )+    }) {+        Text(channelInfo.name.decodeHtml(), style = MaterialTheme.typography.titleLarge)+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelPage.ktindex 65fad5b675..9bc706062a 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelPage.kt@@ -57,9 +57,9 @@ import com.vayunmathur.library.ui.invisibleClickable import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route import com.vayunmathur.youpipe.data.Subscription-import com.vayunmathur.youpipe.util.VideoRowState-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.decodeHtml+import com.vayunmathur.youpipe.platform.VideoRowState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.network.decodeHtml import kotlinx.serialization.Serializable import kotlin.time.Instant @@ -137,33 +137,3 @@ fun ChannelPage(         }     } }--/**- * The channel's identity block, and the far end of the morph that starts at a subscription row.- *- * Keyed on the container rather than on the avatar alone: an avatar gliding out of a row while the- * name beside it cuts reads worse than no morph at all. The avatar is nested inside so its pixels- * keep their identity across the size change - 24dp in the row, 52dp here.- */-@Composable-fun ChannelHeader(channelInfo: ChannelInfo) {-    val context = LocalContext.current-    ListItem(modifier = Modifier.sharedContainer("youpipe-channel-${channelInfo.channelID}"), overlineContent = {--    }, supportingContent = {-        Text(stringResource(R.string.subscribers_count, countString(context, channelInfo.subscribers)))-    }, leadingContent = {-        AsyncImage(-            model = ImageRequest.Builder(context)-                .data(channelInfo.avatar)-                .memoryCacheKey("channel-avatar-${channelInfo.channelID}")-                .build(),-            contentDescription = null,-            Modifier.sharedContent("youpipe-channel-avatar-${channelInfo.channelID}")-                .size(52.dp)-                .clip(CircleShape)-        )-    }) {-        Text(channelInfo.name.decodeHtml(), style = MaterialTheme.typography.titleLarge)-    }-}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelRow.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelRow.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelRow.ktnew file mode 100644index 0000000000..cd21ab3b9d--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ChannelRow.kt@@ -0,0 +1,89 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.text.input.rememberTextFieldState+import androidx.compose.foundation.text.input.setTextAndPlaceCursorAtEnd+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.shape.CircleShape+import com.vayunmathur.library.ui.EmptyState+import com.vayunmathur.library.ui.CircularProgressIndicator+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.ListItemDefaults+import com.vayunmathur.library.ui.MaterialTheme+import androidx.compose.material3.ExpandedFullScreenSearchBar+import androidx.compose.material3.SearchBar+import androidx.compose.material3.rememberSearchBarState+import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.SearchBarDefaults+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.isExpandedWidth+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.snapshotFlow+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalResources+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.image.compose.AsyncImage+import com.vayunmathur.library.image.ImageRequest+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.youpipe.R+import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.youpipe.Route+import com.vayunmathur.youpipe.platform.SearchActions+import com.vayunmathur.youpipe.platform.SearchResultRow+import com.vayunmathur.youpipe.platform.SearchUiState+import com.vayunmathur.youpipe.platform.VideoRowState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.resolveWatchUrl+import com.vayunmathur.youpipe.platform.blockChannel+import com.vayunmathur.youpipe.platform.boostChannel+import com.vayunmathur.youpipe.platform.loadRecommendations+import com.vayunmathur.youpipe.platform.pinChannel+import com.vayunmathur.youpipe.platform.removeInterest+import kotlinx.coroutines.launch+++@Composable+fun ChannelRow(channel: SearchResultRow.Channel, onClick: () -> Unit) {+    ListItem(modifier = Modifier.clickable(onClick = onClick), overlineContent = {++    }, supportingContent = {+        Text(channel.subscribers)+    }, leadingContent = {+        Box(+            Modifier.size(50.dp)+                .clip(CircleShape)+                .background(MaterialTheme.colorScheme.surfaceVariant)+        ) {+            if (channel.avatarURL.isNotEmpty()) {+                AsyncImage(+                    model = ImageRequest.Builder(LocalContext.current)+                        .data(channel.avatarURL)+                        .memoryCacheKey("channel-avatar-${channel.channelID}")+                        .build(),+                    contentDescription = null,+                    Modifier.fillMaxSize()+                )+            }+        }+    }, colors = ListItemDefaults.colors(containerColor = Color.Transparent)) {+        Text(channel.name, style = MaterialTheme.typography.titleMedium)+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentItem.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentItem.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentItem.ktnew file mode 100644index 0000000000..092d799d6a--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentItem.kt@@ -0,0 +1,49 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.IconThumbDown+import com.vayunmathur.library.ui.IconThumbUp+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.ui.isExpandedWidth+import com.vayunmathur.youpipe.platform.VideoRowState+++@Composable+fun CommentItem(c: Comment) {+    ListItem(modifier = Modifier, overlineContent = {+        Text(c.author)+    }, supportingContent = {+        Column {+            Spacer(Modifier.height(4.dp))+            Row(verticalAlignment = Alignment.CenterVertically) {+                IconThumbUp(Modifier.size(16.dp))+                Spacer(Modifier.width(6.dp))+                Text(c.likes.toString())+                Spacer(Modifier.width(16.dp))+                IconThumbDown(Modifier.size(16.dp))+            }+        }+    }) {+        LinkifiedText(c.text)+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentsSection.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentsSection.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentsSection.ktnew file mode 100644index 0000000000..47b20cbdf3--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/CommentsSection.kt@@ -0,0 +1,38 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.IconThumbDown+import com.vayunmathur.library.ui.IconThumbUp+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.ui.isExpandedWidth+import com.vayunmathur.youpipe.platform.VideoRowState+++@Composable+fun CommentsSection(comments: List<Comment>) {+    LazyColumn {+        items(comments, key = { "${it.author}|${it.text.hashCode()}" }) {+            CommentItem(it)+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/DataSettingsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DataSettingsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DataSettingsPage.ktindex db05d6d2ea..63d4c1f3ff 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DataSettingsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DataSettingsPage.kt@@ -28,11 +28,11 @@ import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.exportSubscriptions-import com.vayunmathur.youpipe.util.importNewPipe-import com.vayunmathur.youpipe.util.importYouTubeTakeout-import com.vayunmathur.youpipe.util.restoreSubscriptions+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.exportSubscriptions+import com.vayunmathur.youpipe.platform.importNewPipe+import com.vayunmathur.youpipe.platform.importYouTubeTakeout+import com.vayunmathur.youpipe.platform.restoreSubscriptions  @OptIn(ExperimentalMaterial3Api::class) @Composable
youpipe/src/main/java/com/vayunmathur/youpipe/ui/DownloadedVideosPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DownloadedVideosPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DownloadedVideosPage.ktindex 7d51358395..68e053b40e 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DownloadedVideosPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/DownloadedVideosPage.kt@@ -41,8 +41,8 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.DownloadManager-import com.vayunmathur.youpipe.util.YouPipeViewModel+import com.vayunmathur.youpipe.platform.DownloadManager+import com.vayunmathur.youpipe.platform.YouPipeViewModel import com.vayunmathur.library.image.compose.AsyncImage import com.vayunmathur.library.image.ImageRequest import androidx.compose.foundation.shape.RoundedCornerShape@@ -244,27 +244,3 @@ private fun DownloadedGrid(         }     } }--@Composable-fun SelectionIndicator(isSelected: Boolean) {-    Box(-        modifier = Modifier-            .padding(start = 16.dp)-            .size(24.dp)-            .clip(CircleShape)-            .background(if (isSelected) MaterialTheme.colorScheme.primary else Color.Transparent)-            .border(-                width = 2.dp,-                color = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline,-                shape = CircleShape-            ),-        contentAlignment = Alignment.Center-    ) {-        if (isSelected) {-            IconCheck(-                modifier = Modifier.size(16.dp),-                tint = MaterialTheme.colorScheme.onPrimary-            )-        }-    }-}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedGrid.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedGrid.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedGrid.ktindex a7ef4b4a64..9ff8b806f2 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedGrid.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedGrid.kt@@ -11,10 +11,8 @@ import androidx.compose.ui.unit.dp import com.vayunmathur.library.ui.adaptiveGridCells import com.vayunmathur.library.ui.invisibleClickable import com.vayunmathur.library.ui.isExpandedWidth-import com.vayunmathur.youpipe.util.VideoRowState+import com.vayunmathur.youpipe.platform.VideoRowState -import com.vayunmathur.library.ui.adaptiveGridCells-import com.vayunmathur.library.ui.isExpandedWidth  /**  * A video feed that is a single column on phones and an adaptive grid on expanded widths.@@ -46,27 +44,3 @@ fun <T : Any> FeedGrid(         }     } }--/**- * One video in a feed grid: a thumbnail stacked over its title and stats, opening [openVideo].- *- * The compact feed keeps calling [VideoRow] directly so its shared-element title key stays- * single-origin (see the `titleSharedKey` note there); the grid is only ever composed on- * expanded widths, so keying its own rows cannot collide with the phone list.- */-@Composable-fun FeedVideoRow(-    row: VideoRowState,-    openVideo: (Long) -> Unit,-    titleSharedKey: Any? = null,-    overflowActions: List<Pair<String, () -> Unit>> = emptyList(),-    modifier: Modifier = Modifier,-) {-    VideoRow(-        row = row,-        modifier = modifier.invisibleClickable { openVideo(row.videoID) },-        overflowActions = overflowActions,-        titleSharedKey = titleSharedKey,-        vertical = true,-    )-}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedVideoRow.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedVideoRow.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedVideoRow.ktnew file mode 100644index 0000000000..daeb4fb025--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/FeedVideoRow.kt@@ -0,0 +1,38 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.ui.isExpandedWidth+import com.vayunmathur.youpipe.platform.VideoRowState+++/**+ * One video in a feed grid: a thumbnail stacked over its title and stats, opening [openVideo].+ *+ * The compact feed keeps calling [VideoRow] directly so its shared-element title key stays+ * single-origin (see the `titleSharedKey` note there); the grid is only ever composed on+ * expanded widths, so keying its own rows cannot collide with the phone list.+ */+@Composable+fun FeedVideoRow(+    row: VideoRowState,+    openVideo: (Long) -> Unit,+    modifier: Modifier = Modifier,+    titleSharedKey: Any? = null,+    overflowActions: List<Pair<String, () -> Unit>> = emptyList(),+) {+    VideoRow(+        row = row,+        modifier = modifier.invisibleClickable { openVideo(row.videoID) },+        overflowActions = overflowActions,+        titleSharedKey = titleSharedKey,+        vertical = true,+    )+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/GeneralSettingsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/GeneralSettingsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/GeneralSettingsPage.ktindex 6097b5174b..33d8c57560 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/GeneralSettingsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/GeneralSettingsPage.kt@@ -27,11 +27,11 @@ import com.vayunmathur.library.ui.SettingsSwitchRow import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack-import com.vayunmathur.youpipe.DEFAULT_PAGE_OPTIONS+import com.vayunmathur.youpipe.platform.DEFAULT_PAGE_OPTIONS import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.YouPipeViewModel.Companion.YOUTUBE_LANGUAGES+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModel.Companion.YOUTUBE_LANGUAGES  @OptIn(ExperimentalMaterial3Api::class) @Composable
youpipe/src/main/java/com/vayunmathur/youpipe/ui/HistoryPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/HistoryPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/HistoryPage.ktindex 19448269ee..8d93483fa1 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/HistoryPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/HistoryPage.kt@@ -29,7 +29,7 @@ import com.vayunmathur.library.ui.IconDelete import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModel  @OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class) @Composable@@ -46,7 +46,7 @@ fun HistoryPage(backStack: NavBackStack<Route>, youPipeViewModel: YouPipeViewMod     // No top bar at all: clearing all history lives in Settings, and deleting a     // selection is a FAB, so the list keeps the full height of the screen.     // On expanded widths the list is a LazyVerticalGrid — which LazyListScaffold cannot-    // host — so that path uses a RAW SCAFFOLD EXCEPTION below.+    // host — so that path uses a raw-scaffold exception below.     if (isExpandedWidth()) {         // RAW SCAFFOLD EXCEPTION: an adaptive video grid (LazyVerticalGrid of         // adaptiveGridCells) with a selection FAB and no top bar. No shared scaffold
youpipe/src/main/java/com/vayunmathur/youpipe/ui/LockScreenOrientation.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/LockScreenOrientation.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/LockScreenOrientation.ktnew file mode 100644index 0000000000..53c6922083--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/LockScreenOrientation.kt@@ -0,0 +1,63 @@+package com.vayunmathur.youpipe.ui+import android.app.Activity+import android.content.pm.ActivityInfo+import android.content.res.Configuration+import kotlinx.coroutines.flow.first+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Modifier+import androidx.compose.ui.platform.LocalConfiguration+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalResources+import androidx.compose.ui.platform.LocalView+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import androidx.compose.ui.window.Dialog+import androidx.core.view.WindowCompat+import androidx.core.view.WindowInsetsCompat+import androidx.core.view.WindowInsetsControllerCompat+import com.vayunmathur.library.ui.Button+import com.vayunmathur.library.ui.Card+import com.vayunmathur.library.ui.ExternalIntents+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.youpipe.R+import com.vayunmathur.youpipe.Route+import com.vayunmathur.youpipe.ui.findActivity+import com.vayunmathur.youpipe.platform.CastPlayback+import com.vayunmathur.youpipe.ui.rememberIsInPipMode+import com.vayunmathur.youpipe.platform.VideoDetailActions+import com.vayunmathur.youpipe.platform.VideoDetailUiState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.applyDownloadedStreams+import com.vayunmathur.youpipe.platform.clearVideoError+import com.vayunmathur.youpipe.platform.loadVideo+import com.vayunmathur.youpipe.network.videoIDtoURL+import com.vayunmathur.youpipe.platform.DownloadManager+import kotlin.time.Instant+++@Composable+fun LockScreenOrientation(orientation: Int) {+    val context = LocalContext.current+    DisposableEffect(orientation) {+        val activity = context.findActivity()+        val originalOrientation = activity.requestedOrientation+        activity.requestedOrientation = orientation++        onDispose {+            // Restore original orientation when leaving the screen+            activity.requestedOrientation = originalOrientation+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/ManageInterestsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ManageInterestsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ManageInterestsPage.ktindex 7200723841..b08269db52 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ManageInterestsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/ManageInterestsPage.kt@@ -20,12 +20,12 @@ import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.clearChannelPreference-import com.vayunmathur.youpipe.util.decodeHtml-import com.vayunmathur.youpipe.util.pinChannel-import com.vayunmathur.youpipe.util.removeInterest-import com.vayunmathur.youpipe.util.unmuteKeyword+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.clearChannelPreference+import com.vayunmathur.youpipe.network.decodeHtml+import com.vayunmathur.youpipe.platform.pinChannel+import com.vayunmathur.youpipe.platform.removeInterest+import com.vayunmathur.youpipe.platform.unmuteKeyword  @OptIn(ExperimentalMaterial3Api::class) @Composable
youpipe/src/main/java/com/vayunmathur/youpipe/ui/PipMode.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PipMode.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PipMode.ktnew file mode 100644index 0000000000..ca1f46549b--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PipMode.kt@@ -0,0 +1,41 @@+package com.vayunmathur.youpipe.ui++import android.content.Context+import android.content.ContextWrapper+import androidx.activity.ComponentActivity+import androidx.compose.runtime.Composable+import androidx.compose.runtime.DisposableEffect+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.platform.LocalContext+import androidx.core.app.PictureInPictureModeChangedInfo+import androidx.core.util.Consumer++internal fun Context.findActivity(): ComponentActivity {+    var context = this+    while (context is ContextWrapper) {+        if (context is ComponentActivity) return context+        context = context.baseContext+    }+    throw IllegalStateException("Picture in picture should be called in the context of an Activity")+}++@Composable+fun rememberIsInPipMode(): Boolean {+    val activity = LocalContext.current.findActivity()+    var pipMode by remember { mutableStateOf(activity.isInPictureInPictureMode) }+    DisposableEffect(activity) {+        val observer = Consumer<PictureInPictureModeChangedInfo> { info ->+            pipMode = info.isInPictureInPictureMode+        }+        activity.addOnPictureInPictureModeChangedListener(+            observer+        )+        onDispose { activity.removeOnPictureInPictureModeChangedListener(observer) }+    }+    return pipMode+}++
youpipe/src/main/java/com/vayunmathur/youpipe/ui/PlaylistDetailPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PlaylistDetailPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PlaylistDetailPage.ktindex 802f4fb648..6c8ea6cb97 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PlaylistDetailPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/PlaylistDetailPage.kt@@ -49,8 +49,8 @@ import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.library.util.sharedText import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipePlaylistOps-import com.vayunmathur.youpipe.util.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipePlaylistOps+import com.vayunmathur.youpipe.platform.YouPipeViewModel  /**  * The videos inside one playlist. Items can be reordered by drag handle (persisted via
youpipe/src/main/java/com/vayunmathur/youpipe/ui/RecommendationsSettingsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RecommendationsSettingsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RecommendationsSettingsPage.ktindex a411d5ef13..777a3cb3e4 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RecommendationsSettingsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RecommendationsSettingsPage.kt@@ -32,20 +32,20 @@ import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.RecSource-import com.vayunmathur.youpipe.util.RecommendationPreset-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.resetAlgorithm-import com.vayunmathur.youpipe.util.setDiscoveryFamiliar-import com.vayunmathur.youpipe.util.setFocusedDiverse-import com.vayunmathur.youpipe.util.setFreshEvergreen-import com.vayunmathur.youpipe.util.setHideLive-import com.vayunmathur.youpipe.util.setHidePaid-import com.vayunmathur.youpipe.util.setHideShorts-import com.vayunmathur.youpipe.util.setMaxDuration-import com.vayunmathur.youpipe.util.setMinDuration-import com.vayunmathur.youpipe.util.setPreset-import com.vayunmathur.youpipe.util.toggleSource+import com.vayunmathur.youpipe.domain.RecSource+import com.vayunmathur.youpipe.domain.RecommendationPreset+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.resetAlgorithm+import com.vayunmathur.youpipe.platform.setDiscoveryFamiliar+import com.vayunmathur.youpipe.platform.setFocusedDiverse+import com.vayunmathur.youpipe.platform.setFreshEvergreen+import com.vayunmathur.youpipe.platform.setHideLive+import com.vayunmathur.youpipe.platform.setHidePaid+import com.vayunmathur.youpipe.platform.setHideShorts+import com.vayunmathur.youpipe.platform.setMaxDuration+import com.vayunmathur.youpipe.platform.setMinDuration+import com.vayunmathur.youpipe.platform.setPreset+import com.vayunmathur.youpipe.platform.toggleSource  private val SOURCE_TOGGLES = listOf(     RecSource.RELATED to R.string.label_source_related,
youpipe/src/main/java/com/vayunmathur/youpipe/ui/RelatedVideosSection.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RelatedVideosSection.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RelatedVideosSection.ktnew file mode 100644index 0000000000..b6cc57a5f5--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/RelatedVideosSection.kt@@ -0,0 +1,57 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Column+import androidx.compose.foundation.layout.PaddingValues+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.Spacer+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.height+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.width+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.runtime.Composable+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.ui.IconThumbDown+import com.vayunmathur.library.ui.IconThumbUp+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.ui.isExpandedWidth+import com.vayunmathur.youpipe.platform.VideoRowState+++@Composable+fun RelatedVideosSection(relatedVideos: List<VideoRowState>, onOpenVideo: (Long) -> Unit) {+    if (isExpandedWidth()) {+        // The side-by-side pane is narrow, but on a very wide window it still fits two+        // stacked cards across — so this also adapts rather than fixing one column.+        LazyVerticalGrid(+            columns = adaptiveGridCells(280.dp),+            contentPadding = PaddingValues(8.dp),+            verticalArrangement = Arrangement.spacedBy(8.dp),+            horizontalArrangement = Arrangement.spacedBy(8.dp),+        ) {+            items(relatedVideos, { it.videoID }) { row ->+                VideoRow(+                    row = row,+                    modifier = Modifier.invisibleClickable { onOpenVideo(row.videoID) },+                    vertical = true,+                )+            }+        }+        return+    }+    LazyColumn(contentPadding = PaddingValues(8.dp), verticalArrangement = Arrangement.spacedBy(8.dp)) {+        items(relatedVideos, { it.videoID }) { row ->+            VideoRow(row, Modifier.invisibleClickable { onOpenVideo(row.videoID) })+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SavedPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SavedPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SavedPage.ktindex da9f67c765..bd9af75f78 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SavedPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SavedPage.kt@@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.graphicsLayer import androidx.compose.ui.hapticfeedback.HapticFeedbackType import androidx.compose.ui.platform.LocalHapticFeedback+import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex@@ -40,7 +41,7 @@ import com.vayunmathur.library.util.sharedText import com.vayunmathur.youpipe.R import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModel  /**  * The Saved library: a list of playlists. The first two rows are always pinned —@@ -119,7 +120,7 @@ fun SavedPage(backStack: NavBackStack<Route>, youPipeViewModel: YouPipeViewModel                     leadingContent = { IconDownload() },                     content = { Text(stringResource(R.string.title_downloads)) },                     supportingContent = {-                        Text(stringResource(R.string.playlist_video_count, downloadedVideos.size))+                        Text(pluralStringResource(R.plurals.playlist_video_count, downloadedVideos.size, downloadedVideos.size))                     },                     modifier = Modifier.clickable { backStack.add(Route.Downloads) },                 )@@ -137,7 +138,7 @@ fun SavedPage(backStack: NavBackStack<Route>, youPipeViewModel: YouPipeViewModel                             )                         },                         supportingContent = {-                            Text(stringResource(R.string.playlist_video_count, counts[watchLater.id] ?: 0))+                            Text(pluralStringResource(R.plurals.playlist_video_count, counts[watchLater.id] ?: 0, counts[watchLater.id] ?: 0))                         },                         modifier = Modifier.clickable {                             backStack.add(Route.PlaylistDetail(watchLater.id))@@ -168,7 +169,7 @@ fun SavedPage(backStack: NavBackStack<Route>, youPipeViewModel: YouPipeViewModel                                 )                             },                             supportingContent = {-                                Text(stringResource(R.string.playlist_video_count, counts[playlist.id] ?: 0))+                                Text(pluralStringResource(R.plurals.playlist_video_count, counts[playlist.id] ?: 0, counts[playlist.id] ?: 0))                             },                             trailingContent = {                                 if (localData.size > 1) {
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchPage.ktindex cd17abc3bc..b90d6f7898 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchPage.kt@@ -47,17 +47,17 @@ import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.library.ui.R as UiR import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.SearchActions-import com.vayunmathur.youpipe.util.SearchResultRow-import com.vayunmathur.youpipe.util.SearchUiState-import com.vayunmathur.youpipe.util.VideoRowState-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.resolveWatchUrl-import com.vayunmathur.youpipe.util.blockChannel-import com.vayunmathur.youpipe.util.boostChannel-import com.vayunmathur.youpipe.util.loadRecommendations-import com.vayunmathur.youpipe.util.pinChannel-import com.vayunmathur.youpipe.util.removeInterest+import com.vayunmathur.youpipe.platform.SearchActions+import com.vayunmathur.youpipe.platform.SearchResultRow+import com.vayunmathur.youpipe.platform.SearchUiState+import com.vayunmathur.youpipe.platform.VideoRowState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.resolveWatchUrl+import com.vayunmathur.youpipe.platform.blockChannel+import com.vayunmathur.youpipe.platform.boostChannel+import com.vayunmathur.youpipe.platform.loadRecommendations+import com.vayunmathur.youpipe.platform.pinChannel+import com.vayunmathur.youpipe.platform.removeInterest import kotlinx.coroutines.launch  /**@@ -158,185 +158,3 @@ fun SearchPage(         },     ) }--/**- * Stateless home screen.- *- * Everything the user taps inside the screen goes through [actions]. A preview can hand it a- * freshly-remembered stack.- */-@Composable-fun SearchScreen(-    state: SearchUiState,-    actions: SearchActions,-) {-    val searchBarState = rememberSearchBarState()-    val textFieldState = rememberTextFieldState(initialText = state.query)-    val scope = rememberCoroutineScope()--    fun collapseSearch() {-        scope.launch { searchBarState.animateToCollapsed() }-    }--    // Text field -> ViewModel: forward edits. Keyed on the query too so the-    // comparison never goes stale; the guard drops the initial emission.-    LaunchedEffect(textFieldState, state.query) {-        snapshotFlow { textFieldState.text.toString() }.collect { text ->-            if (text != state.query) actions.setSearchQuery(text)-        }-    }-    // ViewModel -> text field: reflect external query changes.-    LaunchedEffect(state.query) {-        if (textFieldState.text.toString() != state.query) {-            textFieldState.setTextAndPlaceCursorAtEnd(state.query)-        }-    }--    val inputField: @Composable () -> Unit = {-        SearchBarDefaults.InputField(-            textFieldState = textFieldState,-            searchBarState = searchBarState,-            onSearch = { query ->-                // The field already holds `query`; make sure the ViewModel sees the-                // exact submitted text before submit reads it.-                actions.setSearchQuery(query)-                // Only collapse when the submit actually navigated somewhere — a-                // plain search has to leave the overlay up to show its results.-                if (actions.submitSearch()) collapseSearch()-            },-            placeholder = { Text(stringResource(UiR.string.search)) },-        )-    }--    // RAW SCAFFOLD EXCEPTION: the top chrome is a Material3 SearchBar (not a-    // TopAppBar) whose expanded state overlays the whole screen with search-    // results/suggestions, and the body is a 3-way branch (loading spinner /-    // empty state / recommendation feed). No shared scaffold models a SearchBar-    // app bar plus this branching content.-    Scaffold(-        topBar = {-            SearchBar(-                state = searchBarState,-                inputField = inputField,-                modifier = Modifier.statusBarsPadding().fillMaxWidth(),-            )-            ExpandedFullScreenSearchBar(-                state = searchBarState,-                inputField = inputField,-            ) {-                LazyColumn {-                    if (state.results.isNotEmpty()) {-                        items(state.results, key = {-                            when (it) {-                                is SearchResultRow.Video -> "v-${it.video.videoID}"-                                is SearchResultRow.Channel -> "c-${it.channelID}"-                            }-                        }) { item ->-                            when (item) {-                                is SearchResultRow.Video -> VideoRow(-                                    row = item.video,-                                    modifier = Modifier.clickable {-                                        collapseSearch()-                                        actions.openVideo(item.video.videoID)-                                    },-                                )-                                is SearchResultRow.Channel -> ChannelRow(item) {-                                    actions.openChannel(item.channelID)-                                }-                            }-                        }-                    } else {-                        items(state.suggestions, key = { it }) { suggestion ->-                            Text(-                                text = suggestion,-                                modifier = Modifier-                                    .fillMaxWidth()-                                    .clickable {-                                        textFieldState.setTextAndPlaceCursorAtEnd(suggestion)-                                        actions.setSearchQuery(suggestion)-                                        if (actions.submitSearch()) collapseSearch()-                                    }-                                    .padding(12.dp)-                            )-                        }-                    }-                }-            }-        },-    ) { paddingValues ->-        if (state.recommendationsLoading) {-            Box(Modifier.fillMaxSize().padding(paddingValues), contentAlignment = Alignment.Center) {-                CircularProgressIndicator()-            }-        } else if (state.recommendations.isEmpty()) {-            EmptyState(-                title = stringResource(R.string.empty_recommendations),-                modifier = Modifier.fillMaxSize().padding(paddingValues),-            )-        } else if (isExpandedWidth()) {-            FeedGrid(-                rows = state.recommendations,-                key = { it.videoID },-                modifier = Modifier.fillMaxSize().padding(paddingValues),-            ) { row ->-                FeedVideoRow(-                    row = row,-                    openVideo = actions::openVideo,-                    titleSharedKey = "youpipe-video-title-${row.videoID}",-                    overflowActions = listOf(-                        stringResource(R.string.action_not_interested) to { actions.notInterested(row.channelKey) },-                        stringResource(R.string.action_more_like_this) to { actions.moreLikeThis(row.channelKey) },-                        stringResource(R.string.action_pin_channel) to { actions.pinChannel(row.channelKey) },-                        stringResource(R.string.action_block_channel) to { actions.blockChannel(row.channelKey) },-                    ),-                )-            }-        } else {-            LazyColumn(modifier = Modifier.fillMaxSize().padding(paddingValues)) {-                items(state.recommendations, key = { it.videoID }) { row ->-                    VideoRow(-                        row = row,-                        modifier = Modifier.invisibleClickable { actions.openVideo(row.videoID) },-                        // Only the feed is keyed, not the search overlay above it: both are composed-                        // at once, and a video in each would give one key two origins.-                        titleSharedKey = "youpipe-video-title-${row.videoID}",-                        overflowActions = listOf(-                            stringResource(R.string.action_not_interested) to { actions.notInterested(row.channelKey) },-                            stringResource(R.string.action_more_like_this) to { actions.moreLikeThis(row.channelKey) },-                            stringResource(R.string.action_pin_channel) to { actions.pinChannel(row.channelKey) },-                            stringResource(R.string.action_block_channel) to { actions.blockChannel(row.channelKey) },-                        ),-                    )-                }-            }-        }-    }-}--@Composable-fun ChannelRow(channel: SearchResultRow.Channel, onClick: () -> Unit) {-    ListItem(modifier = Modifier.clickable(onClick = onClick), overlineContent = {--    }, supportingContent = {-        Text(channel.subscribers)-    }, leadingContent = {-        Box(-            Modifier.size(50.dp)-                .clip(CircleShape)-                .background(MaterialTheme.colorScheme.surfaceVariant)-        ) {-            if (channel.avatarURL.isNotEmpty()) {-                AsyncImage(-                    model = ImageRequest.Builder(LocalContext.current)-                        .data(channel.avatarURL)-                        .memoryCacheKey("channel-avatar-${channel.channelID}")-                        .build(),-                    contentDescription = null,-                    Modifier.fillMaxSize()-                )-            }-        }-    }, colors = ListItemDefaults.colors(containerColor = Color.Transparent)) {-        Text(channel.name, style = MaterialTheme.typography.titleMedium)-    }-}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchScreen.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchScreen.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchScreen.ktnew file mode 100644index 0000000000..a66b033b6b--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SearchScreen.kt@@ -0,0 +1,215 @@+package com.vayunmathur.youpipe.ui+import androidx.compose.foundation.background+import androidx.compose.foundation.clickable+import androidx.compose.foundation.text.input.rememberTextFieldState+import androidx.compose.foundation.text.input.setTextAndPlaceCursorAtEnd+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.fillMaxSize+import androidx.compose.foundation.layout.fillMaxWidth+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.layout.statusBarsPadding+import androidx.compose.foundation.lazy.LazyColumn+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.shape.CircleShape+import com.vayunmathur.library.ui.EmptyState+import com.vayunmathur.library.ui.CircularProgressIndicator+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.ListItemDefaults+import com.vayunmathur.library.ui.MaterialTheme+import androidx.compose.material3.ExpandedFullScreenSearchBar+import androidx.compose.material3.SearchBar+import androidx.compose.material3.rememberSearchBarState+import com.vayunmathur.library.ui.Scaffold+import com.vayunmathur.library.ui.SearchBarDefaults+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.isExpandedWidth+import androidx.compose.runtime.Composable+import androidx.compose.runtime.LaunchedEffect+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.remember+import androidx.compose.runtime.rememberCoroutineScope+import androidx.compose.runtime.snapshotFlow+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.draw.clip+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.platform.LocalContext+import androidx.compose.ui.platform.LocalResources+import androidx.compose.ui.res.stringResource+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.image.compose.AsyncImage+import com.vayunmathur.library.image.ImageRequest+import com.vayunmathur.library.ui.invisibleClickable+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.youpipe.R+import com.vayunmathur.library.ui.R as UiR+import com.vayunmathur.youpipe.Route+import com.vayunmathur.youpipe.platform.SearchActions+import com.vayunmathur.youpipe.platform.SearchResultRow+import com.vayunmathur.youpipe.platform.SearchUiState+import com.vayunmathur.youpipe.platform.VideoRowState+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.resolveWatchUrl+import com.vayunmathur.youpipe.platform.blockChannel+import com.vayunmathur.youpipe.platform.boostChannel+import com.vayunmathur.youpipe.platform.loadRecommendations+import com.vayunmathur.youpipe.platform.pinChannel+import com.vayunmathur.youpipe.platform.removeInterest+import kotlinx.coroutines.launch+++/**+ * Stateless home screen.+ *+ * Everything the user taps inside the screen goes through [actions]. A preview can hand it a+ * freshly-remembered stack.+ */+@Composable+fun SearchScreen(+    state: SearchUiState,+    actions: SearchActions,+) {+    val searchBarState = rememberSearchBarState()+    val textFieldState = rememberTextFieldState(initialText = state.query)+    val scope = rememberCoroutineScope()++    fun collapseSearch() {+        scope.launch { searchBarState.animateToCollapsed() }+    }++    // Text field -> ViewModel: forward edits. Keyed on the query too so the+    // comparison never goes stale; the guard drops the initial emission.+    LaunchedEffect(textFieldState, state.query) {+        snapshotFlow { textFieldState.text.toString() }.collect { text ->+            if (text != state.query) actions.setSearchQuery(text)+        }+    }+    // ViewModel -> text field: reflect external query changes.+    LaunchedEffect(state.query) {+        if (textFieldState.text.toString() != state.query) {+            textFieldState.setTextAndPlaceCursorAtEnd(state.query)+        }+    }++    val inputField: @Composable () -> Unit = {+        SearchBarDefaults.InputField(+            textFieldState = textFieldState,+            searchBarState = searchBarState,+            onSearch = { query ->+                // The field already holds `query`; make sure the ViewModel sees the+                // exact submitted text before submit reads it.+                actions.setSearchQuery(query)+                // Only collapse when the submit actually navigated somewhere — a+                // plain search has to leave the overlay up to show its results.+                if (actions.submitSearch()) collapseSearch()+            },+            placeholder = { Text(stringResource(UiR.string.search)) },+        )+    }++    // RAW SCAFFOLD EXCEPTION: the top chrome is a Material3 SearchBar (not a+    // TopAppBar) whose expanded state overlays the whole screen with search+    // results/suggestions, and the body is a 3-way branch (loading spinner /+    // empty state / recommendation feed). No shared scaffold models a SearchBar+    // app bar plus this branching content.+    Scaffold(+        topBar = {+            SearchBar(+                state = searchBarState,+                inputField = inputField,+                modifier = Modifier.statusBarsPadding().fillMaxWidth(),+            )+            ExpandedFullScreenSearchBar(+                state = searchBarState,+                inputField = inputField,+            ) {+                LazyColumn {+                    if (state.results.isNotEmpty()) {+                        items(state.results, key = {+                            when (it) {+                                is SearchResultRow.Video -> "v-${it.video.videoID}"+                                is SearchResultRow.Channel -> "c-${it.channelID}"+                            }+                        }) { item ->+                            when (item) {+                                is SearchResultRow.Video -> VideoRow(+                                    row = item.video,+                                    modifier = Modifier.clickable {+                                        collapseSearch()+                                        actions.openVideo(item.video.videoID)+                                    },+                                )+                                is SearchResultRow.Channel -> ChannelRow(item) {+                                    actions.openChannel(item.channelID)+                                }+                            }+                        }+                    } else {+                        items(state.suggestions, key = { it }) { suggestion ->+                            Text(+                                text = suggestion,+                                modifier = Modifier+                                    .fillMaxWidth()+                                    .clickable {+                                        textFieldState.setTextAndPlaceCursorAtEnd(suggestion)+                                        actions.setSearchQuery(suggestion)+                                        if (actions.submitSearch()) collapseSearch()+                                    }+                                    .padding(12.dp)+                            )+                        }+                    }+                }+            }+        },+    ) { paddingValues ->+        if (state.recommendationsLoading) {+            Box(Modifier.fillMaxSize().padding(paddingValues), contentAlignment = Alignment.Center) {+                CircularProgressIndicator()+            }+        } else if (state.recommendations.isEmpty()) {+            EmptyState(+                title = stringResource(R.string.empty_recommendations),+                modifier = Modifier.fillMaxSize().padding(paddingValues),+            )+        } else if (isExpandedWidth()) {+            FeedGrid(+                rows = state.recommendations,+                key = { it.videoID },+                modifier = Modifier.fillMaxSize().padding(paddingValues),+            ) { row ->+                FeedVideoRow(+                    row = row,+                    openVideo = actions::openVideo,+                    titleSharedKey = "youpipe-video-title-${row.videoID}",+                    overflowActions = listOf(+                        stringResource(R.string.action_not_interested) to { actions.notInterested(row.channelKey) },+                        stringResource(R.string.action_more_like_this) to { actions.moreLikeThis(row.channelKey) },+                        stringResource(R.string.action_pin_channel) to { actions.pinChannel(row.channelKey) },+                        stringResource(R.string.action_block_channel) to { actions.blockChannel(row.channelKey) },+                    ),+                )+            }+        } else {+            LazyColumn(modifier = Modifier.fillMaxSize().padding(paddingValues)) {+                items(state.recommendations, key = { it.videoID }) { row ->+                    VideoRow(+                        row = row,+                        modifier = Modifier.invisibleClickable { actions.openVideo(row.videoID) },+                        // Only the feed is keyed, not the search overlay above it: both are composed+                        // at once, and a video in each would give one key two origins.+                        titleSharedKey = "youpipe-video-title-${row.videoID}",+                        overflowActions = listOf(+                            stringResource(R.string.action_not_interested) to { actions.notInterested(row.channelKey) },+                            stringResource(R.string.action_more_like_this) to { actions.moreLikeThis(row.channelKey) },+                            stringResource(R.string.action_pin_channel) to { actions.pinChannel(row.channelKey) },+                            stringResource(R.string.action_block_channel) to { actions.blockChannel(row.channelKey) },+                        ),+                    )+                }+            }+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SelectionIndicator.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SelectionIndicator.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SelectionIndicator.ktnew file mode 100644index 0000000000..ae7b060dcc--- /dev/null+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SelectionIndicator.kt@@ -0,0 +1,74 @@+package com.vayunmathur.youpipe.ui+import com.vayunmathur.youpipe.R+import androidx.compose.foundation.ExperimentalFoundationApi+import androidx.compose.foundation.background+import androidx.compose.foundation.border+import androidx.compose.foundation.combinedClickable+import androidx.compose.foundation.layout.Arrangement+import androidx.compose.foundation.layout.Box+import androidx.compose.foundation.layout.Row+import androidx.compose.foundation.layout.padding+import androidx.compose.foundation.layout.size+import androidx.compose.foundation.lazy.grid.LazyVerticalGrid+import androidx.compose.foundation.lazy.grid.items+import androidx.compose.foundation.lazy.items+import androidx.compose.foundation.shape.CircleShape+import com.vayunmathur.library.ui.CircularProgressIndicator+import com.vayunmathur.library.ui.ExperimentalMaterial3Api+import com.vayunmathur.library.ui.IconCheck+import com.vayunmathur.library.ui.IconClose+import com.vayunmathur.library.ui.IconDelete+import com.vayunmathur.library.ui.IconNavigation+import com.vayunmathur.library.ui.IconButton+import com.vayunmathur.library.ui.LazyListScaffold+import com.vayunmathur.library.ui.ListItem+import com.vayunmathur.library.ui.MaterialTheme+import com.vayunmathur.library.ui.Text+import com.vayunmathur.library.ui.TopAppBar+import com.vayunmathur.library.ui.adaptiveGridCells+import com.vayunmathur.library.ui.appBarScrollBehavior+import com.vayunmathur.library.ui.isExpandedWidth+import androidx.compose.runtime.Composable+import androidx.compose.runtime.collectAsState+import androidx.compose.runtime.getValue+import androidx.compose.runtime.mutableStateOf+import androidx.compose.runtime.remember+import androidx.compose.runtime.setValue+import androidx.compose.ui.Alignment+import androidx.compose.ui.Modifier+import androidx.compose.ui.graphics.Color+import androidx.compose.ui.unit.dp+import com.vayunmathur.library.util.NavBackStack+import com.vayunmathur.youpipe.Route+import com.vayunmathur.youpipe.platform.DownloadManager+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.library.image.compose.AsyncImage+import com.vayunmathur.library.image.ImageRequest+import androidx.compose.foundation.shape.RoundedCornerShape+import androidx.compose.ui.draw.clip+import androidx.compose.ui.res.stringResource+++@Composable+fun SelectionIndicator(isSelected: Boolean) {+    Box(+        modifier = Modifier+            .padding(start = 16.dp)+            .size(24.dp)+            .clip(CircleShape)+            .background(if (isSelected) MaterialTheme.colorScheme.primary else Color.Transparent)+            .border(+                width = 2.dp,+                color = if (isSelected) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.outline,+                shape = CircleShape+            ),+        contentAlignment = Alignment.Center+    ) {+        if (isSelected) {+            IconCheck(+                modifier = Modifier.size(16.dp),+                tint = MaterialTheme.colorScheme.onPrimary+            )+        }+    }+}
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SettingsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SettingsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SettingsPage.ktindex efdad46701..11398738bc 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SettingsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SettingsPage.kt@@ -7,6 +7,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier+import androidx.compose.ui.res.pluralStringResource import androidx.compose.ui.res.stringResource import com.vayunmathur.library.ui.AppScaffold import com.vayunmathur.library.ui.ExperimentalMaterial3Api@@ -16,9 +17,9 @@ import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.RecommendationPreset-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.YouPipeViewModel.Companion.ALL_SPONSOR_CATEGORIES+import com.vayunmathur.youpipe.domain.RecommendationPreset+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModel.Companion.ALL_SPONSOR_CATEGORIES  @OptIn(ExperimentalMaterial3Api::class) @Composable@@ -48,8 +49,9 @@ fun SettingsPage(             )             SettingsRow(                 title = stringResource(R.string.settings_sponsorblock),-                supportingText = stringResource(-                    R.string.settings_sponsorblock_summary,+                supportingText = pluralStringResource(+                    R.plurals.settings_sponsorblock_summary,+                    blockedCount,                     blockedCount,                     ALL_SPONSOR_CATEGORIES.size,                 ),
youpipe/src/main/java/com/vayunmathur/youpipe/ui/SponsorBlockSettingsPage.kt
diff --git a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SponsorBlockSettingsPage.kt b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SponsorBlockSettingsPage.ktindex 2a91136c99..70480c54e1 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SponsorBlockSettingsPage.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/ui/SponsorBlockSettingsPage.kt@@ -18,9 +18,9 @@ import com.vayunmathur.library.ui.appBarScrollBehavior import com.vayunmathur.library.util.NavBackStack import com.vayunmathur.youpipe.R import com.vayunmathur.youpipe.Route-import com.vayunmathur.youpipe.util.YouPipeViewModel-import com.vayunmathur.youpipe.util.YouPipeViewModel.Companion.ALL_SPONSOR_CATEGORIES-import com.vayunmathur.youpipe.util.YouPipeViewModel.Companion.SPONSOR_CATEGORY_LABELS+import com.vayunmathur.youpipe.platform.YouPipeViewModel+import com.vayunmathur.youpipe.platform.YouPipeViewModel.Companion.ALL_SPONSOR_CATEGORIES+import com.vayunmathur.youpipe.platform.YouPipeViewModel.Companion.SPONSOR_CATEGORY_LABELS  @OptIn(ExperimentalMaterial3Api::class) @Composable
a/youpipe/src/main/
diff --git a/youpipe/src/main/

Diff truncated.