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

Handle non existing deeplink app #355

Merged
merged 6 commits into from
Sep 10, 2024
Merged
Changes from 4 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
Expand Up @@ -52,6 +52,7 @@ class AuthorizingPaymentActivity : AppCompatActivity() {
private val uiCustomization: UiCustomization by lazy { intent.parcelable(EXTRA_UI_CUSTOMIZATION) ?: UiCustomization.default }
private lateinit var threeDSRequestorAppURL: String
private var isWebViewSetup = false
private var isDeepLinkSuccOpened = false
private lateinit var externalActivityLauncher: ActivityResultLauncher<Intent>

private val viewModel: AuthorizingPaymentViewModel by viewModels {
Expand Down Expand Up @@ -253,12 +254,14 @@ class AuthorizingPaymentActivity : AppCompatActivity() {
}

private fun openDeepLink(uri: Uri) {
try {
val externalIntent = Intent(Intent.ACTION_VIEW, uri)
externalActivityLauncher.launch(externalIntent)
} catch (e: ActivityNotFoundException) {
finishActivityWithFailure(OmiseException(OmiseSDKError.OPEN_DEEP_LINK_FAILED.value, e))
}
isDeepLinkSuccOpened =
try {
val externalIntent = Intent(Intent.ACTION_VIEW, uri)
externalActivityLauncher.launch(externalIntent)
true
} catch (e: ActivityNotFoundException) {
false
}
}

private fun setupActionBarTitle() {
Expand Down Expand Up @@ -303,7 +306,9 @@ class AuthorizingPaymentActivity : AppCompatActivity() {
data: Intent?,
) {
if (requestCode == REQUEST_EXTERNAL_CODE) {
finishActivityWithSuccessful(data)
if (isDeepLinkSuccOpened) {
AnasNaouchi marked this conversation as resolved.
Show resolved Hide resolved
finishActivityWithSuccessful(data)
}
}
}

Expand Down
Loading