From 307c6e56c7212047018c7b57fc91adbb2bdd83f2 Mon Sep 17 00:00:00 2001 From: Matthew Finkel Date: Thu, 29 Nov 2018 23:44:43 +0000 Subject: [PATCH] Bug 28640 - Try showing the homepage after the Distribution loads --- .../java/org/mozilla/gecko/BrowserApp.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java index 04bde0da3c5ba..0ff57527ae471 100644 --- a/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java +++ b/mobile/android/base/java/org/mozilla/gecko/BrowserApp.java @@ -2938,6 +2938,28 @@ public class BrowserApp extends GeckoApp Telemetry.sendUIEvent(TelemetryContract.Event.CANCEL, method, "firstrun-pane"); + // This is a little hacky, but this ensures about:tor (or whichever homepage + // is configured) shows when the user closes the FirstRun panels. + String homepageUrl = Tabs.getHomepage(BrowserApp.this); + + // If the homepage is already open in one of the tabs, then switch to that tab. + int homepage_index = Tabs.getInstance().isOpen(homepageUrl); + if (homepage_index != Tabs.INVALID_TAB_ID) { + Tabs.getInstance().selectTab(homepage_index); + return true; + } + + // Open in the currently selected tab by default + int tab_flags = Tabs.LOADURL_NONE; + + // If there's more than one tab open, then the user opened at least one of them. + // Don't modify their tabs and open a new tab for the homepage. + if (Tabs.getInstance().getDisplayCount() > 1) { + tab_flags = Tabs.LOADURL_NEW_TAB; + } + + Tabs.getInstance().loadUrl(homepageUrl, tab_flags); + return true; } -- GitLab