basic functionality restored

This commit is contained in:
Bnyro 2022-05-29 15:22:35 +02:00
parent a29800606e
commit 06688c6faf
2 changed files with 15 additions and 5 deletions

View File

@ -142,8 +142,7 @@ class MainActivity : AppCompatActivity() {
override fun onStart() { override fun onStart() {
super.onStart() super.onStart()
val action: String? = intent?.action val data: Uri? = intent?.data
val data: Uri? = z
Log.d(TAG, "dafaq" + data.toString()) Log.d(TAG, "dafaq" + data.toString())
if (data != null) { if (data != null) {
@ -155,12 +154,15 @@ class MainActivity : AppCompatActivity() {
data.path!!.contains("/c/") || data.path!!.contains("/c/") ||
data.path!!.contains("/user/") data.path!!.contains("/user/")
) { ) {
Log.i(TAG, "URI Type: Channel")
var channel = data.path var channel = data.path
channel = channel!!.replace("/c/", "") channel = channel!!.replace("/c/", "")
channel = channel.replace("/user/", "") channel = channel.replace("/user/", "")
Log.i(TAG, channel)
val bundle = bundleOf("channel_id" to channel) val bundle = bundleOf("channel_id" to channel)
navController.navigate(R.id.channel, bundle) navController.navigate(R.id.channel, bundle)
} else if (data.path!!.contains("/playlist")) { } else if (data.path!!.contains("/playlist")) {
Log.i(TAG, "URI Type: Playlist")
var playlist = data.query!! var playlist = data.query!!
if (playlist.contains("&")) { if (playlist.contains("&")) {
var playlists = playlist.split("&") var playlists = playlist.split("&")
@ -178,6 +180,7 @@ class MainActivity : AppCompatActivity() {
data.path!!.contains("/embed/") || data.path!!.contains("/embed/") ||
data.path!!.contains("/v/") data.path!!.contains("/v/")
) { ) {
Log.i(TAG, "URI Type: Video")
val watch = data.path!! val watch = data.path!!
.replace("/shorts/", "") .replace("/shorts/", "")
.replace("/v/", "") .replace("/v/", "")

View File

@ -1,11 +1,14 @@
package com.github.libretube package com.github.libretube
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
class RouterActivity : AppCompatActivity() { class RouterActivity : AppCompatActivity() {
val TAG = "RouterActivity"
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
when (intent?.action) { when (intent?.action) {
@ -19,8 +22,12 @@ class RouterActivity : AppCompatActivity() {
private fun handleSendText(intent: Intent) { private fun handleSendText(intent: Intent) {
intent.getStringExtra(Intent.EXTRA_TEXT)?.let { intent.getStringExtra(Intent.EXTRA_TEXT)?.let {
Log.i(it,it) Log.i(TAG, it)
val pm: PackageManager = this.packageManager
val intent = pm.getLaunchIntentForPackage(this.packageName)
intent?.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK
intent?.data = Uri.parse(it)
this.startActivity(intent)
} }
} }
} }