Skip to content
This repository has been archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
feat: add helper method for opening chooser
Browse files Browse the repository at this point in the history
  • Loading branch information
dic1911 committed Feb 15, 2024
1 parent f43b71b commit 23aa155
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package app.revanced.integrations.twitter.patches.hook.patch.browserchooser

import android.content.Context
import android.content.Intent
import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFucker


object BrowserChooserHook {
fun open(context: Context, intent: Intent) = TwiFucker.openWithChooser(context, intent)
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package app.revanced.integrations.twitter.patches.hook.twifucker

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.util.Log
import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFuckerUtils.forEach
import app.revanced.integrations.twitter.patches.hook.twifucker.TwiFuckerUtils.forEachIndexed
Expand Down Expand Up @@ -212,6 +215,17 @@ internal object TwiFucker {
json.jsonGetData()?.dataCheckAndRemove()
}

fun openWithChooser(context: Context, intent: Intent) {
context.startActivity(
Intent.createChooser(
Intent(
"android.intent.action.VIEW",
Uri.parse(intent.dataString)
), ""
)
)
}

private fun JSONObject.filterInstructions(action: (JSONArray) -> Unit) {
jsonGetInstructions()?.forEach { instruction ->
instruction.instructionCheckAndRemove(action)
Expand Down

0 comments on commit 23aa155

Please sign in to comment.