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

Commit

Permalink
FxA (#1973)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
keianhzo authored and MortimerGoro committed Oct 25, 2019
1 parent 5d5ca7c commit e9e348a
Show file tree
Hide file tree
Showing 59 changed files with 3,146 additions and 398 deletions.
6 changes: 6 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,15 @@ dependencies {
implementation deps.android_components.browser_search
implementation deps.android_components.browser_storage
implementation deps.android_components.browser_domains
implementation deps.android_components.service_accounts
implementation deps.android_components.ui_autocomplete
implementation deps.android_components.concept_fetch
implementation deps.android_components.lib_fetch
implementation deps.android_components.support_rustlog
implementation deps.android_components.support_rusthttp

// TODO this should not be necessary at all, see Services.kt
implementation deps.work.runtime

// Kotlin dependency
implementation deps.kotlin.stdlib
Expand Down
18 changes: 15 additions & 3 deletions app/src/common/shared/org/mozilla/vrbrowser/VRBrowserActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
import org.mozilla.vrbrowser.crashreporting.CrashReporterService;
import org.mozilla.vrbrowser.crashreporting.GlobalExceptionHandler;
import org.mozilla.vrbrowser.geolocation.GeolocationWrapper;
import org.mozilla.vrbrowser.ui.widgets.prompts.ConfirmPromptWidget;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.input.MotionEventGenerator;
import org.mozilla.vrbrowser.search.SearchEngineWrapper;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
Expand All @@ -67,7 +65,9 @@
import org.mozilla.vrbrowser.ui.widgets.WindowWidget;
import org.mozilla.vrbrowser.ui.widgets.Windows;
import org.mozilla.vrbrowser.ui.widgets.dialogs.CrashDialogWidget;
import org.mozilla.vrbrowser.ui.widgets.prompts.ConfirmPromptWidget;
import org.mozilla.vrbrowser.utils.ConnectivityReceiver;
import org.mozilla.vrbrowser.utils.DeviceType;
import org.mozilla.vrbrowser.utils.LocaleUtils;
import org.mozilla.vrbrowser.utils.ServoUtils;
import org.mozilla.vrbrowser.utils.SystemUtils;
Expand Down Expand Up @@ -212,6 +212,7 @@ protected void onCreate(Bundle savedInstanceState) {

Bundle extras = getIntent() != null ? getIntent().getExtras() : null;
SessionStore.get().setContext(this, extras);
SessionStore.get().initializeServices();
SessionStore.get().initializeStores(this);

// Create broadcast receiver for getting crash messages from crash process
Expand Down Expand Up @@ -387,7 +388,13 @@ protected void onResume() {
widget.onResume();
}
handleConnectivityChange();
mConnectivityReceiver.register(this, () -> runOnUiThread(() -> handleConnectivityChange()));
mConnectivityReceiver.register(this, () -> runOnUiThread(this::handleConnectivityChange));

// If we're signed-in, poll for any new device events (e.g. received tabs) on activity resume.
// There's no push support right now, so this helps with the perception of speedy tab delivery.
((VRBrowserApplication)getApplicationContext()).getAccounts().refreshDevicesAsync();
((VRBrowserApplication)getApplicationContext()).getAccounts().pollForEventsAsync();

super.onResume();
}

Expand Down Expand Up @@ -1401,6 +1408,11 @@ public WindowWidget getFocusedWindow() {
return mWindows.getFocusedWindow();
}

@Override
public TrayWidget getTray() {
return mTray;
}

private native void addWidgetNative(int aHandle, WidgetPlacement aPlacement);
private native void updateWidgetNative(int aHandle, WidgetPlacement aPlacement);
private native void updateVisibleWidgetsNative();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import android.content.Context;
import android.content.res.Configuration;

import org.mozilla.vrbrowser.browser.Accounts;
import org.mozilla.vrbrowser.browser.Places;
import org.mozilla.vrbrowser.browser.Services;
import org.mozilla.vrbrowser.db.AppDatabase;
import org.mozilla.vrbrowser.db.DataRepository;
import org.mozilla.vrbrowser.telemetry.TelemetryWrapper;
Expand All @@ -20,7 +22,9 @@ public class VRBrowserApplication extends Application {

private AppExecutors mAppExecutors;
private BitmapCache mBitmapCache;
private Services mServices;
private Places mPlaces;
private Accounts mAccounts;

@Override
public void onCreate() {
Expand All @@ -29,6 +33,8 @@ public void onCreate() {
mAppExecutors = new AppExecutors();
mPlaces = new Places(this);
mBitmapCache = new BitmapCache(this, mAppExecutors.diskIO(), mAppExecutors.mainThread());
mServices = new Services(this, mPlaces);
mAccounts = new Accounts(this);

TelemetryWrapper.init(this);
}
Expand All @@ -45,6 +51,10 @@ public void onConfigurationChanged(Configuration newConfig) {
LocaleUtils.setLocale(this);
}

public Services getServices() {
return mServices;
}

public Places getPlaces() {
return mPlaces;
}
Expand All @@ -64,4 +74,8 @@ public DataRepository getRepository() {
public BitmapCache getBitmapCache() {
return mBitmapCache;
}

public Accounts getAccounts() {
return mAccounts;
}
}
Loading

0 comments on commit e9e348a

Please sign in to comment.