Modern Apps git

← Modern-Apps.git

youpipe: open youtube video links

Commit
29a8586ffa6b28f37525cfdaa308590d2f7772f5
Author
Vayun <[email protected]>
When
2026-01-30 04:13 UTC (10 months ago)
Parents
834e075

Diff

youpipe/src/main/AndroidManifest.xml
diff --git a/youpipe/src/main/AndroidManifest.xml b/youpipe/src/main/AndroidManifest.xmlindex 8fd81c957d..fb982ffc31 100644--- a/youpipe/src/main/AndroidManifest.xml+++ b/youpipe/src/main/AndroidManifest.xml@@ -17,6 +17,19 @@             android:supportsPictureInPicture="true"             android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation"             android:theme="@style/Theme.General">+            <intent-filter android:autoVerify="true">+                <!-- open youtube.com -->+                <action android:name="android.intent.action.VIEW" />++                <category android:name="android.intent.category.DEFAULT" />+                <category android:name="android.intent.category.BROWSABLE" />+                <data android:scheme="https" />+                <data android:scheme="http" />+                <data android:host="www.youtube.com" />+                <data android:host="youtube.com" />+                <data android:host="m.youtube.com" />+                <data android:host="youtu.be" />+            </intent-filter>             <intent-filter>                 <action android:name="android.intent.action.MAIN" /> 
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 252bf2f60b..e59eb2cd71 100644--- a/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt+++ b/youpipe/src/main/java/com/vayunmathur/youpipe/MainActivity.kt@@ -1,5 +1,6 @@ package com.vayunmathur.youpipe +import android.net.Uri import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent@@ -32,12 +33,21 @@ class MainActivity : ComponentActivity() {         NewPipe.init(MyDownloader())         setContent {             DynamicTheme {-                Navigation(viewModel)+                Navigation(getRoute(intent.data), viewModel)             }         }     } } +fun getRoute(uri: Uri?): Route {+    if(uri != null) {+        if("watch" in uri.pathSegments) {+            return Route.VideoPage(uri.toString())+        }+    }+    return Route.SubscriptionsPage+}+ @Serializable sealed interface Route: NavKey {     @Serializable@@ -57,8 +67,8 @@ sealed interface Route: NavKey { }  @Composable-fun Navigation(viewModel: DatabaseViewModel) {-    val backStack = rememberNavBackStack<Route>(Route.SearchPage)//Route.ChannelPage("https://www.youtube.com/channel/UC9RM-iSvTu1uPJb8X5yp3EQ"))+fun Navigation(initialRoute: Route, viewModel: DatabaseViewModel) {+    val backStack = rememberNavBackStack(initialRoute)     MainNavigation(backStack) {         entry<Route.SearchPage> {             SearchPage(backStack)