Skip to content

Commit 6e7bbd6

Browse files
committed
Explicitly set domain for external link handling.
And revert change: let ElementCallActivity handle again `call.element.io` links.
1 parent 86838e7 commit 6e7bbd6

File tree

4 files changed

+11
-43
lines changed

4 files changed

+11
-43
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
<category android:name="android.intent.category.BROWSABLE" />
8585

8686
<data android:scheme="https" />
87-
<data android:host="*.element.io" />
87+
<data android:host="app.element.io" />
88+
<data android:host="develop.element.io" />
89+
<data android:host="staging.element.io" />
8890
</intent-filter>
8991
<!--
9092
matrix.to links

app/src/main/kotlin/io/element/android/x/MainActivity.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import io.element.android.compound.theme.ElementTheme
3939
import io.element.android.compound.theme.Theme
4040
import io.element.android.compound.theme.isDark
4141
import io.element.android.compound.theme.mapToTheme
42-
import io.element.android.features.call.ui.ElementCallActivity
4342
import io.element.android.features.lockscreen.api.handleSecureFlag
4443
import io.element.android.features.lockscreen.api.isLocked
4544
import io.element.android.libraries.architecture.bindings
@@ -59,13 +58,6 @@ class MainActivity : NodeActivity() {
5958
Timber.tag(loggerTag.value).w("onCreate, with savedInstanceState: ${savedInstanceState != null}")
6059
installSplashScreen()
6160
super.onCreate(savedInstanceState)
62-
if (ElementCallActivity.maybeStart(this, intent)) {
63-
Timber.tag(loggerTag.value).w("Starting Element Call Activity")
64-
if (savedInstanceState == null) {
65-
finish()
66-
return
67-
}
68-
}
6961
appBindings = bindings()
7062
appBindings.lockScreenService().handleSecureFlag(this)
7163
enableEdgeToEdge()
@@ -149,12 +141,6 @@ class MainActivity : NodeActivity() {
149141
override fun onNewIntent(intent: Intent) {
150142
super.onNewIntent(intent)
151143
Timber.tag(loggerTag.value).w("onNewIntent")
152-
153-
if (ElementCallActivity.maybeStart(this, intent)) {
154-
Timber.tag(loggerTag.value).w("Starting Element Call Activity")
155-
return
156-
}
157-
158144
// If the mainNode is not init yet, keep the intent for later.
159145
// It can happen when the activity is killed by the system. The methods are called in this order :
160146
// onCreate(savedInstanceState=true) -> onNewIntent -> onResume -> onMainNodeInit

features/call/src/main/AndroidManifest.xml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@
3434
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode"
3535
android:launchMode="singleTask">
3636

37-
<!--
38-
Note: intent-filter for https://call.element.io link is now managed by the MainActivity.
39-
-->
37+
<intent-filter android:autoVerify="true">
38+
<action android:name="android.intent.action.VIEW" />
39+
<category android:name="android.intent.category.DEFAULT" />
40+
<category android:name="android.intent.category.BROWSABLE" />
4041

42+
<data android:scheme="https" />
43+
44+
<data android:host="call.element.io" />
45+
</intent-filter>
4146
<!-- Custom scheme to handle urls from other domains in the format: element://call?url=https%3A%2F%2Felement.io -->
4247
<intent-filter>
4348
<action android:name="android.intent.action.VIEW" />

features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package io.element.android.features.call.ui
1818

1919
import android.Manifest
20-
import android.app.Activity
2120
import android.content.Context
2221
import android.content.Intent
2322
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
@@ -36,7 +35,6 @@ import androidx.compose.runtime.collectAsState
3635
import androidx.compose.runtime.getValue
3736
import androidx.compose.runtime.mutableStateOf
3837
import androidx.compose.runtime.remember
39-
import androidx.core.app.ActivityOptionsCompat
4038
import androidx.core.content.IntentCompat
4139
import com.bumble.appyx.core.integrationpoint.NodeComponentActivity
4240
import io.element.android.compound.theme.ElementTheme
@@ -49,7 +47,6 @@ import io.element.android.features.call.di.CallBindings
4947
import io.element.android.features.call.utils.CallIntentDataParser
5048
import io.element.android.features.preferences.api.store.AppPreferencesStore
5149
import io.element.android.libraries.architecture.bindings
52-
import io.element.android.libraries.core.bool.orFalse
5350
import javax.inject.Inject
5451

5552
class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator {
@@ -66,28 +63,6 @@ class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator {
6663
}
6764
context.startActivity(intent)
6865
}
69-
70-
/**
71-
* Starts the [ElementCallActivity] if the intent contains a valid URL,
72-
* and returns true if it's the case.
73-
*/
74-
fun maybeStart(
75-
activity: Activity,
76-
intent: Intent?,
77-
): Boolean {
78-
return intent?.data
79-
?.takeIf { uri -> uri.scheme == "https" && uri.host == "call.element.io" }
80-
?.let { uri ->
81-
val callIntent = Intent(activity, ElementCallActivity::class.java).apply {
82-
data = uri
83-
}
84-
// Disable animation since MainActivity has already been animated.
85-
val options = ActivityOptionsCompat.makeCustomAnimation(activity, 0, 0)
86-
activity.startActivity(callIntent, options.toBundle())
87-
true
88-
}
89-
.orFalse()
90-
}
9166
}
9267

9368
@Inject lateinit var callIntentDataParser: CallIntentDataParser

0 commit comments

Comments
 (0)