From 596dbde5b61878648f5316b607785b03642db216 Mon Sep 17 00:00:00 2001 From: Manuel Martin Date: Tue, 12 Nov 2019 23:45:43 +0100 Subject: [PATCH] Avoid opening the success tab if the account is existing/restored (#2232) --- .../org/mozilla/vrbrowser/browser/Accounts.kt | 1 - .../org/mozilla/vrbrowser/browser/Services.kt | 1 - .../mozilla/vrbrowser/ui/widgets/Windows.java | 35 ++++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/Accounts.kt b/app/src/common/shared/org/mozilla/vrbrowser/browser/Accounts.kt index e84f4ea97..e8a46ba94 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/Accounts.kt +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/Accounts.kt @@ -23,7 +23,6 @@ import mozilla.components.service.fxa.sync.SyncStatusObserver import mozilla.components.service.fxa.sync.getLastSynced import mozilla.components.support.base.log.logger.Logger import org.mozilla.vrbrowser.VRBrowserApplication -import org.mozilla.vrbrowser.browser.engine.SessionStore import org.mozilla.vrbrowser.utils.SystemUtils import java.util.concurrent.CompletableFuture import java.util.concurrent.ExecutionException diff --git a/app/src/common/shared/org/mozilla/vrbrowser/browser/Services.kt b/app/src/common/shared/org/mozilla/vrbrowser/browser/Services.kt index 2d459de5b..59ba9a251 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/browser/Services.kt +++ b/app/src/common/shared/org/mozilla/vrbrowser/browser/Services.kt @@ -28,7 +28,6 @@ import org.mozilla.geckoview.AllowOrDeny import org.mozilla.geckoview.GeckoResult import org.mozilla.geckoview.GeckoSession import org.mozilla.vrbrowser.R -import org.mozilla.vrbrowser.browser.engine.SessionStore class Services(context: Context, places: Places): GeckoSession.NavigationDelegate { companion object { diff --git a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java index 2b3b5bd6b..c88be3487 100644 --- a/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java +++ b/app/src/common/shared/org/mozilla/vrbrowser/ui/widgets/Windows.java @@ -34,7 +34,6 @@ import java.io.Writer; import java.lang.reflect.Type; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -891,22 +890,24 @@ public void onLoggedOut() { @Override public void onAuthenticated(@NotNull OAuthAccount oAuthAccount, @NotNull AuthType authType) { - Session session = mFocusedWindow.getSession(); - addTab(mFocusedWindow, mAccounts.getConnectionSuccessURL()); - onTabsClose(new ArrayList<>(Collections.singletonList(session))); - - switch (mAccounts.getLoginOrigin()) { - case BOOKMARKS: - getFocusedWindow().switchBookmarks(); - break; - - case HISTORY: - getFocusedWindow().switchHistory(); - break; - - case SETTINGS: - mWidgetManager.getTray().toggleSettingsDialog(SettingsWidget.SettingDialog.FXA); - break; + if (authType != AuthType.Existing.INSTANCE) { + Session session = mFocusedWindow.getSession(); + addTab(mFocusedWindow, mAccounts.getConnectionSuccessURL()); + onTabsClose(new ArrayList<>(Collections.singletonList(session))); + + switch (mAccounts.getLoginOrigin()) { + case BOOKMARKS: + getFocusedWindow().switchBookmarks(); + break; + + case HISTORY: + getFocusedWindow().switchHistory(); + break; + + case SETTINGS: + mWidgetManager.getTray().toggleSettingsDialog(SettingsWidget.SettingDialog.FXA); + break; + } } }