Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix : [딥 링크] 이후 뒤로 가기시 홈이 아닌 티켓 탭이 나오는 현상 수정 #252

Merged
merged 3 commits into from
Dec 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nexters.boolti.presentation.screen.home

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.widget.Toast
Expand Down Expand Up @@ -77,6 +78,8 @@ fun HomeScreen(

var dialog: GiftStatus? by rememberSaveable { mutableStateOf(null) }

removeInvalidDeepLink(LocalContext.current)

LaunchedEffect(Unit) {
viewModel.events.collect { event ->
when (event) {
Expand Down Expand Up @@ -206,6 +209,19 @@ fun HomeScreen(
}
}

/**
* issue #209를 해결하기 위한 메서드.
* 처리하지 말아야 할 deep link가 부적절한 destination과 match되는 것을 방지하기 위함.
*/
private fun removeInvalidDeepLink(context: Context) {
runCatching {
val intent = context.requireActivity().intent
if (intent.action == null) return
val deepLink = intent.action!!
if (!deepLink.contains("home")) intent.setAction(null)
}
}

@Stable
private enum class Destination(
val route: String,
Expand Down
Loading