mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
DROID-2323 Deep links | Tech | Clear launching intent (#1371)
This commit is contained in:
parent
c61b15d464
commit
b2dd0265b6
2 changed files with 22 additions and 2 deletions
|
@ -306,6 +306,12 @@ class MainActivity : AppCompatActivity(R.layout.activity_main), AppNavigation.Pr
|
|||
Intent.ACTION_VIEW -> {
|
||||
val data = intent.dataString
|
||||
if (data != null && DefaultDeepLinkResolver.isDeepLink(data)) {
|
||||
// Clearing intent to only handle it once:
|
||||
with(intent) {
|
||||
setAction(null)
|
||||
setData(null)
|
||||
putExtras(Bundle())
|
||||
}
|
||||
vm.onNewDeepLink(DefaultDeepLinkResolver.resolve(data))
|
||||
} else {
|
||||
intent.extras?.getString(DefaultAppActionManager.ACTION_CREATE_NEW_TYPE_KEY)?.let {
|
||||
|
|
|
@ -135,10 +135,18 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
} else {
|
||||
deepLink = null
|
||||
}
|
||||
Timber.d("Deep link: ${deepLink}")
|
||||
if (!deepLink.isNullOrEmpty()) {
|
||||
// Clearing intent to only handle it once:
|
||||
with(requireNotNull(intent)) {
|
||||
setAction(null)
|
||||
setData(null)
|
||||
putExtras(Bundle())
|
||||
}
|
||||
}
|
||||
Timber.d("Deep link is empty: ${deepLink.isNullOrEmpty()}")
|
||||
findNavController().navigate(
|
||||
R.id.action_splashFragment_to_authStart,
|
||||
OnboardingFragment.args(deepLink)
|
||||
args = OnboardingFragment.args(deepLink)
|
||||
)
|
||||
}
|
||||
is SplashViewModel.Command.NavigateToMigration -> {
|
||||
|
@ -152,6 +160,12 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>(R.layout.fragment_spl
|
|||
if (intent != null && intent.action == Intent.ACTION_VIEW) {
|
||||
val data = intent.dataString
|
||||
if (data != null && DefaultDeepLinkResolver.isDeepLink(data)) {
|
||||
// Clearing intent to only handle it once:
|
||||
with(intent) {
|
||||
setAction(null)
|
||||
setData(null)
|
||||
putExtras(Bundle())
|
||||
}
|
||||
vm.onDeepLinkLaunch(data)
|
||||
} else {
|
||||
val bundle = intent.extras
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue