diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index ab2d565b3f..8c94bce2ac 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -76,8 +76,6 @@ @@ -86,8 +84,7 @@ - - + - - - - diff --git a/features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt b/features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt index 8eea4c814f..4c88f32afd 100644 --- a/features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt +++ b/features/call/src/main/kotlin/io/element/android/features/call/ui/ElementCallActivity.kt @@ -17,6 +17,7 @@ package io.element.android.features.call.ui import android.Manifest +import android.app.Activity import android.content.Context import android.content.Intent import android.content.Intent.FLAG_ACTIVITY_NEW_TASK @@ -35,6 +36,7 @@ import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember +import androidx.core.app.ActivityOptionsCompat import androidx.core.content.IntentCompat import com.bumble.appyx.core.integrationpoint.NodeComponentActivity import io.element.android.compound.theme.ElementTheme @@ -47,6 +49,7 @@ import io.element.android.features.call.di.CallBindings import io.element.android.features.call.utils.CallIntentDataParser import io.element.android.features.preferences.api.store.AppPreferencesStore import io.element.android.libraries.architecture.bindings +import io.element.android.libraries.core.bool.orFalse import javax.inject.Inject class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator { @@ -63,6 +66,26 @@ class ElementCallActivity : NodeComponentActivity(), CallScreenNavigator { } context.startActivity(intent) } + + /** + * Eventually start the ElementCallActivity, and return 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