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

[DX-2600] fix: custom tabs dismiss callback triggered before redirect #153

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ src/Packages/Passport/Runtime/Assets/ImmutableAndroid.androidlib/**/*.meta

# WebView.bundle
src/Packages/Passport/Runtime/ThirdParty/Gree/Assets/Plugins/WebView.bundle/**/*.meta

*.idea
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -95,7 +97,17 @@ private void launchCustomTabs() {
@Override
public void onNavigationEvent(int navigationEvent, @Nullable Bundle extras) {
if (navigationEvent == CustomTabsCallback.TAB_HIDDEN && callbackInstance != null) {
callbackInstance.onCustomTabsDismissed(uri.toString());
// Adding some delay before calling onCustomTabsDismissed as sometimes this gets called
// before the PKCE deeplink is triggered (by 100ms). This means pkceCompletionSource will be
// set to null before the SDK can use it to notify the consumer of the PKCE result.
// See PassportImpl.OnLoginPKCEDismissed and PassportImpl.OnDeepLinkActivated
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(new Runnable() {
@Override
public void run() {
callbackInstance.onCustomTabsDismissed(uri.toString());
}
}, 1000);
}
}
});
Expand Down
Loading