This commit is contained in:
Bnyro 2022-06-01 07:45:02 +02:00
parent 4531cd6def
commit 78767b35d7

View File

@ -11,17 +11,14 @@ class RouterActivity : AppCompatActivity() {
val TAG = "RouterActivity" val TAG = "RouterActivity"
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// Check if Intent Action is ACTION_SEND if (checkHost(intent)) {
if (intent?.action == Intent.ACTION_SEND) {
if (intent.type == "text/plain" && checkHost(intent)) {
// start the main activity using the given URI as data if the host is known // start the main activity using the given URI as data if the host is known
handleSendText(intent) handleSendText(intent)
} else { } else {
// start app as normal if wrong intent type // start app as normal if URI not in host list
restartMainActivity(this) restartMainActivity(this)
} }
} }
}
private fun checkHost(intent: Intent): Boolean { private fun checkHost(intent: Intent): Boolean {
// check whether the host is known, current solution to replace the broken intent filter // check whether the host is known, current solution to replace the broken intent filter