From 2ebf1aaf63959e4bad3652c4c1f4c40c914865cf Mon Sep 17 00:00:00 2001 From: Antoine Robiez Date: Mon, 15 Apr 2024 20:08:35 +0200 Subject: [PATCH] Handling deeplinks on Android --- androidApp/src/main/AndroidManifest.xml | 2 +- .../src/main/java/fr/paug/androidmakers/MainActivity.kt | 8 +------- .../commonMain/kotlin/com/androidmakers/ui/MainLayout.kt | 5 ++--- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/androidApp/src/main/AndroidManifest.xml b/androidApp/src/main/AndroidManifest.xml index eb269c07..e9a2fbdb 100644 --- a/androidApp/src/main/AndroidManifest.xml +++ b/androidApp/src/main/AndroidManifest.xml @@ -50,7 +50,7 @@ diff --git a/androidApp/src/main/java/fr/paug/androidmakers/MainActivity.kt b/androidApp/src/main/java/fr/paug/androidmakers/MainActivity.kt index 4adc0913..ce0ac2f4 100644 --- a/androidApp/src/main/java/fr/paug/androidmakers/MainActivity.kt +++ b/androidApp/src/main/java/fr/paug/androidmakers/MainActivity.kt @@ -40,11 +40,7 @@ import kotlinx.coroutines.launch import org.koin.compose.KoinContext class MainActivity : AppCompatActivity() { - private var deeplink: String? = null - override fun onNewIntent(intent: Intent?) { - super.onNewIntent(intent) - deeplink = intent?.data.toString() - } + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -182,5 +178,3 @@ class MainActivity : AppCompatActivity() { const val REQ_SIGNIN = 33 } } - - diff --git a/shared/ui/src/commonMain/kotlin/com/androidmakers/ui/MainLayout.kt b/shared/ui/src/commonMain/kotlin/com/androidmakers/ui/MainLayout.kt index ea4cde10..653f605a 100644 --- a/shared/ui/src/commonMain/kotlin/com/androidmakers/ui/MainLayout.kt +++ b/shared/ui/src/commonMain/kotlin/com/androidmakers/ui/MainLayout.kt @@ -11,7 +11,6 @@ import com.androidmakers.ui.common.navigation.MainNavigationRoute import com.androidmakers.ui.speakers.SpeakerDetailsRoute import com.androidmakers.ui.speakers.SpeakerDetailsViewModel import fr.androidmakers.domain.model.SpeakerId -import fr.androidmakers.domain.model.User import moe.tlaster.precompose.koin.koinViewModel import moe.tlaster.precompose.navigation.NavHost import moe.tlaster.precompose.navigation.Navigator @@ -81,7 +80,7 @@ private fun MainNavHost( scene( route = "${MainNavigationRoute.SESSION_DETAIL.name}/{sessionId}", swipeProperties = SwipeProperties(), - deepLinks = listOf("https://androidmakers.droidcon.com/agenda/{sessionId}") + deepLinks = listOf("https://androidmakers.fr/session/{sessionId}") ) { val sessionId = it.path("sessionId") @@ -95,7 +94,7 @@ private fun MainNavHost( scene( route = "${MainNavigationRoute.SPEAKER_DETAIL.name}/{speakerId}", - deepLinks = listOf("https://androidmakers.droidcon.com/speakers/{speakerId}"), + deepLinks = listOf("https://androidmakers.fr/speaker/{speakerId}"), swipeProperties = SwipeProperties(), ) { backstackEntry -> val speakerId = backstackEntry.path("speakerId")