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

View File

@ -1,11 +1,14 @@
package com.github.libretube
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
class RouterActivity : AppCompatActivity() {
val TAG = "RouterActivity"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
when (intent?.action) {
@ -19,8 +22,12 @@ class RouterActivity : AppCompatActivity() {
private fun handleSendText(intent: Intent) {
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)
}
}
}