Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

Commit e9e348a

Browse files
keianhzoMortimerGoro
authored andcommitted
FxA (#1973)
* Combined PR: FxA+Sync+Send Tab integration & Bookmarks navigation (#1417) * Closes #1395: Ability to navigate in and out of folders * Closes #1395: Add "Desktop Bookmarks" virtual folder when at the top level * Closes #717: FxA, Sync and Send Tab integrations This PR integrates FxA account manager and adds just enough code to allow signing-in via settings, signing out, synchronizing bookmarks and receiving tabs sent from other Firefox devices. TODO: - bookmarks UI needs folder support - better account management UI, currently there are just sign-in/sign-out buttons - megazord configuration? * Notify any BookmarkStore listeners of changes after sync is finished This makes sure we see synced bookmarks in the library right after signing-in. * Add history storage and configure it to be synchronized * Rebase fixes * Added support for Account settings and history/bookmarks updates * Added profile picture to the settings icon * Support for going back to sign in origin after login * Updated to AC v15 for the latest FxA API * Use SyncEnginesStorage to update SyncEngines * Rebase updates and improved library panels scroll performance * Folders support * Set production client Id * Remove unnecessary executePendingBindings * Refactoring * Always sync after signing in and remember sync status Some refactoring too * Style updates * Support responsive UI * Rebase updates * PR review updates #1 * PR review #2 * Rebase updates * Style updates from #2022 * Rebase fixes * Fixes tabs polling
1 parent 5d5ca7c commit e9e348a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3146
-398
lines changed

app/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,15 @@ dependencies {
443443
implementation deps.android_components.browser_search
444444
implementation deps.android_components.browser_storage
445445
implementation deps.android_components.browser_domains
446+
implementation deps.android_components.service_accounts
446447
implementation deps.android_components.ui_autocomplete
447448
implementation deps.android_components.concept_fetch
448449
implementation deps.android_components.lib_fetch
450+
implementation deps.android_components.support_rustlog
451+
implementation deps.android_components.support_rusthttp
452+
453+
// TODO this should not be necessary at all, see Services.kt
454+
implementation deps.work.runtime
449455

450456
// Kotlin dependency
451457
implementation deps.kotlin.stdlib

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
import org.mozilla.vrbrowser.crashreporting.CrashReporterService;
5050
import org.mozilla.vrbrowser.crashreporting.GlobalExceptionHandler;
5151
import org.mozilla.vrbrowser.geolocation.GeolocationWrapper;
52-
import org.mozilla.vrbrowser.ui.widgets.prompts.ConfirmPromptWidget;
53-
import org.mozilla.vrbrowser.utils.DeviceType;
5452
import org.mozilla.vrbrowser.input.MotionEventGenerator;
5553
import org.mozilla.vrbrowser.search.SearchEngineWrapper;
5654
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
@@ -67,7 +65,9 @@
6765
import org.mozilla.vrbrowser.ui.widgets.WindowWidget;
6866
import org.mozilla.vrbrowser.ui.widgets.Windows;
6967
import org.mozilla.vrbrowser.ui.widgets.dialogs.CrashDialogWidget;
68+
import org.mozilla.vrbrowser.ui.widgets.prompts.ConfirmPromptWidget;
7069
import org.mozilla.vrbrowser.utils.ConnectivityReceiver;
70+
import org.mozilla.vrbrowser.utils.DeviceType;
7171
import org.mozilla.vrbrowser.utils.LocaleUtils;
7272
import org.mozilla.vrbrowser.utils.ServoUtils;
7373
import org.mozilla.vrbrowser.utils.SystemUtils;
@@ -212,6 +212,7 @@ protected void onCreate(Bundle savedInstanceState) {
212212

213213
Bundle extras = getIntent() != null ? getIntent().getExtras() : null;
214214
SessionStore.get().setContext(this, extras);
215+
SessionStore.get().initializeServices();
215216
SessionStore.get().initializeStores(this);
216217

217218
// Create broadcast receiver for getting crash messages from crash process
@@ -387,7 +388,13 @@ protected void onResume() {
387388
widget.onResume();
388389
}
389390
handleConnectivityChange();
390-
mConnectivityReceiver.register(this, () -> runOnUiThread(() -> handleConnectivityChange()));
391+
mConnectivityReceiver.register(this, () -> runOnUiThread(this::handleConnectivityChange));
392+
393+
// If we're signed-in, poll for any new device events (e.g. received tabs) on activity resume.
394+
// There's no push support right now, so this helps with the perception of speedy tab delivery.
395+
((VRBrowserApplication)getApplicationContext()).getAccounts().refreshDevicesAsync();
396+
((VRBrowserApplication)getApplicationContext()).getAccounts().pollForEventsAsync();
397+
391398
super.onResume();
392399
}
393400

@@ -1401,6 +1408,11 @@ public WindowWidget getFocusedWindow() {
14011408
return mWindows.getFocusedWindow();
14021409
}
14031410

1411+
@Override
1412+
public TrayWidget getTray() {
1413+
return mTray;
1414+
}
1415+
14041416
private native void addWidgetNative(int aHandle, WidgetPlacement aPlacement);
14051417
private native void updateWidgetNative(int aHandle, WidgetPlacement aPlacement);
14061418
private native void updateVisibleWidgetsNative();

app/src/common/shared/org/mozilla/vrbrowser/VRBrowserApplication.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
import android.content.Context;
1010
import android.content.res.Configuration;
1111

12+
import org.mozilla.vrbrowser.browser.Accounts;
1213
import org.mozilla.vrbrowser.browser.Places;
14+
import org.mozilla.vrbrowser.browser.Services;
1315
import org.mozilla.vrbrowser.db.AppDatabase;
1416
import org.mozilla.vrbrowser.db.DataRepository;
1517
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
@@ -20,7 +22,9 @@ public class VRBrowserApplication extends Application {
2022

2123
private AppExecutors mAppExecutors;
2224
private BitmapCache mBitmapCache;
25+
private Services mServices;
2326
private Places mPlaces;
27+
private Accounts mAccounts;
2428

2529
@Override
2630
public void onCreate() {
@@ -29,6 +33,8 @@ public void onCreate() {
2933
mAppExecutors = new AppExecutors();
3034
mPlaces = new Places(this);
3135
mBitmapCache = new BitmapCache(this, mAppExecutors.diskIO(), mAppExecutors.mainThread());
36+
mServices = new Services(this, mPlaces);
37+
mAccounts = new Accounts(this);
3238

3339
TelemetryWrapper.init(this);
3440
}
@@ -45,6 +51,10 @@ public void onConfigurationChanged(Configuration newConfig) {
4551
LocaleUtils.setLocale(this);
4652
}
4753

54+
public Services getServices() {
55+
return mServices;
56+
}
57+
4858
public Places getPlaces() {
4959
return mPlaces;
5060
}
@@ -64,4 +74,8 @@ public DataRepository getRepository() {
6474
public BitmapCache getBitmapCache() {
6575
return mBitmapCache;
6676
}
77+
78+
public Accounts getAccounts() {
79+
return mAccounts;
80+
}
6781
}

0 commit comments

Comments
 (0)