Skip to content

Commit

Permalink
Handling deeplinks on Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Robiez committed Apr 15, 2024
1 parent f001545 commit 2ebf1aa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="androidmakers.droidcon.com"
android:host="androidmakers.fr"
android:scheme="https" />
</intent-filter>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -182,5 +178,3 @@ class MainActivity : AppCompatActivity() {
const val REQ_SIGNIN = 33
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String>("sessionId")
Expand All @@ -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<String>("speakerId")
Expand Down

0 comments on commit 2ebf1aa

Please sign in to comment.