Bug 962644 - Part 1: conditionally open FxA or legacy Sync UI from Fennec. r=nalexander

This commit is contained in:
Richard Newman 2014-01-31 16:02:42 -08:00
parent e13b123e74
commit a7202fb8d9

View File

@ -15,6 +15,8 @@ import android.preference.Preference;
import android.util.AttributeSet;
class SyncPreference extends Preference {
private static final boolean DEFAULT_TO_FXA = false;
private Context mContext;
public SyncPreference(Context context, AttributeSet attrs) {
@ -40,6 +42,21 @@ class SyncPreference extends Preference {
@Override
protected void onClick() {
openSync11Settings();
// If we're not defaulting to FxA, just do what we've always done.
if (!DEFAULT_TO_FXA) {
openSync11Settings();
return;
}
// If there's a legacy Sync account (or a pickled one on disk),
// open the settings page.
if (SyncAccounts.syncAccountsExist(mContext)) {
SyncAccounts.openSyncSettings(mContext);
return;
}
// Otherwise, launch the FxA "Get started" activity, which will
// dispatch to the right location.
launchFxASetup();
}
}