Explicitly set domain for external link handling.
And revert change: let ElementCallActivity handle again `call.element.io` links.
This commit is contained in:
parent
474a1412ed
commit
f0dd3fec21
4 changed files with 11 additions and 43 deletions
|
|
@ -84,7 +84,9 @@
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
|
|
||||||
<data android:scheme="https" />
|
<data android:scheme="https" />
|
||||||
<data android:host="*.element.io" />
|
<data android:host="app.element.io" />
|
||||||
|
<data android:host="develop.element.io" />
|
||||||
|
<data android:host="staging.element.io" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<!--
|
<!--
|
||||||
matrix.to links
|
matrix.to links
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ import io.element.android.compound.theme.ElementTheme
|
||||||
import io.element.android.compound.theme.Theme
|
import io.element.android.compound.theme.Theme
|
||||||
import io.element.android.compound.theme.isDark
|
import io.element.android.compound.theme.isDark
|
||||||
import io.element.android.compound.theme.mapToTheme
|
import io.element.android.compound.theme.mapToTheme
|
||||||
import io.element.android.features.call.ui.ElementCallActivity
|
|
||||||
import io.element.android.features.lockscreen.api.handleSecureFlag
|
import io.element.android.features.lockscreen.api.handleSecureFlag
|
||||||
import io.element.android.features.lockscreen.api.isLocked
|
import io.element.android.features.lockscreen.api.isLocked
|
||||||
import io.element.android.libraries.architecture.bindings
|
import io.element.android.libraries.architecture.bindings
|
||||||
|
|
@ -59,13 +58,6 @@ class MainActivity : NodeActivity() {
|
||||||
Timber.tag(loggerTag.value).w("onCreate, with savedInstanceState: ${savedInstanceState != null}")
|
Timber.tag(loggerTag.value).w("onCreate, with savedInstanceState: ${savedInstanceState != null}")
|
||||||
installSplashScreen()
|
installSplashScreen()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
if (ElementCallActivity.maybeStart(this, intent)) {
|
|
||||||
Timber.tag(loggerTag.value).w("Starting Element Call Activity")
|
|
||||||
if (savedInstanceState == null) {
|
|
||||||
finish()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
appBindings = bindings()
|
appBindings = bindings()
|
||||||
appBindings.lockScreenService().handleSecureFlag(this)
|
appBindings.lockScreenService().handleSecureFlag(this)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
|
|
@ -149,12 +141,6 @@ class MainActivity : NodeActivity() {
|
||||||
override fun onNewIntent(intent: Intent) {
|
override fun onNewIntent(intent: Intent) {
|
||||||
super.onNewIntent(intent)
|
super.onNewIntent(intent)
|
||||||
Timber.tag(loggerTag.value).w("onNewIntent")
|
Timber.tag(loggerTag.value).w("onNewIntent")
|
||||||
|
|
||||||
if (ElementCallActivity.maybeStart(this, intent)) {
|
|
||||||
Timber.tag(loggerTag.value).w("Starting Element Call Activity")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the mainNode is not init yet, keep the intent for later.
|
// If the mainNode is not init yet, keep the intent for later.
|
||||||
// It can happen when the activity is killed by the system. The methods are called in this order :
|
// It can happen when the activity is killed by the system. The methods are called in this order :
|
||||||
// onCreate(savedInstanceState=true) -> onNewIntent -> onResume -> onMainNodeInit
|
// onCreate(savedInstanceState=true) -> onNewIntent -> onResume -> onMainNodeInit
|
||||||
|
|
|
||||||
|
|
@ -34,10 +34,15 @@
|
||||||
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
|
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
|
||||||
android:launchMode="singleTask">
|
android:launchMode="singleTask">
|
||||||
|
|
||||||
<!--
|
<intent-filter android:autoVerify="true">
|
||||||
Note: intent-filter for https://call.element.io link is now managed by the MainActivity.
|
<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:host="call.element.io" />
|
||||||
|
</intent-filter>
|
||||||
<!-- Custom scheme to handle urls from other domains in the format: element://call?url=https%3A%2F%2Felement.io -->
|
<!-- Custom scheme to handle urls from other domains in the format: element://call?url=https%3A%2F%2Felement.io -->
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package io.element.android.features.call.ui
|
package io.element.android.features.call.ui
|
||||||
|
|
||||||
import android.Manifest
|
import android.Manifest
|
||||||
import android.app.Activity
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
|
|
@ -36,7 +35,6 @@ import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.core.app.ActivityOptionsCompat
|
|
||||||
import androidx.core.content.IntentCompat
|
import androidx.core.content.IntentCompat
|
||||||
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
|
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
|
||||||
import io.element.android.compound.theme.ElementTheme
|
import io.element.android.compound.theme.ElementTheme
|
||||||
|
|
@ -49,7 +47,6 @@ import io.element.android.features.call.di.CallBindings
|
||||||
import io.element.android.features.call.utils.CallIntentDataParser
|
import io.element.android.features.call.utils.CallIntentDataParser
|
||||||
import io.element.android.features.preferences.api.store.AppPreferencesStore
|
import io.element.android.features.preferences.api.store.AppPreferencesStore
|
||||||
import io.element.android.libraries.architecture.bindings
|
import io.element.android.libraries.architecture.bindings
|
||||||
import io.element.android.libraries.core.bool.orFalse
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator {
|
class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator {
|
||||||
|
|
@ -66,28 +63,6 @@ class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator {
|
||||||
}
|
}
|
||||||
context.startActivity(intent)
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Starts the [ElementCallActivity] if the intent contains a valid URL,
|
|
||||||
* and returns true if it's the case.
|
|
||||||
*/
|
|
||||||
fun maybeStart(
|
|
||||||
activity: Activity,
|
|
||||||
intent: Intent?,
|
|
||||||
): Boolean {
|
|
||||||
return intent?.data
|
|
||||||
?.takeIf { uri -> uri.scheme == "https" && uri.host == "call.element.io" }
|
|
||||||
?.let { uri ->
|
|
||||||
val callIntent = Intent(activity, ElementCallActivity::class.java).apply {
|
|
||||||
data = uri
|
|
||||||
}
|
|
||||||
// Disable animation since MainActivity has already been animated.
|
|
||||||
val options = ActivityOptionsCompat.makeCustomAnimation(activity, 0, 0)
|
|
||||||
activity.startActivity(callIntent, options.toBundle())
|
|
||||||
true
|
|
||||||
}
|
|
||||||
.orFalse()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject lateinit var callIntentDataParser: CallIntentDataParser
|
@Inject lateinit var callIntentDataParser: CallIntentDataParser
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue