зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1568605 - Send corrent Leanplum events during signin, signup and reconnect r=nalexander
This patch augments FxA messages sent to native code with just enough information that we are able to differentiate between "signin", "signup" and "reconnect" events. Corresponding Leanplum events are sent on the receiving end of the FxA messages. Differential Revision: https://phabricator.services.mozilla.com/D39989 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
878ff4c77b
Коммит
eaeb821d6a
|
@ -92,6 +92,7 @@ public class AccountsHelper implements BundleEventListener {
|
|||
AndroidFxAccount fxAccount = null;
|
||||
try {
|
||||
final GeckoBundle json = message.getBundle("json");
|
||||
final String action = json.getString("action");
|
||||
final String email = json.getString("email");
|
||||
final String uid = json.getString("uid");
|
||||
final boolean verified = json.getBoolean("verified", false);
|
||||
|
@ -137,6 +138,15 @@ public class AccountsHelper implements BundleEventListener {
|
|||
Log.e(LOGTAG, "Got exception storing selected engines; ignoring.", e);
|
||||
}
|
||||
}
|
||||
|
||||
// We could be either signing-up for an account, or logging into one.
|
||||
// Send a correct telemetry event.
|
||||
if (action.equals("signin")) {
|
||||
MmaDelegate.track(MmaDelegate.USER_SIGNED_IN_TO_FXA);
|
||||
} else if (action.equals("signup")) {
|
||||
MmaDelegate.track(MmaDelegate.USER_SIGNED_UP_FOR_FXA);
|
||||
}
|
||||
|
||||
} catch (URISyntaxException | GeneralSecurityException |
|
||||
UnsupportedEncodingException e) {
|
||||
Log.w(LOGTAG, "Got exception creating Firefox Account from JSON; ignoring.", e);
|
||||
|
@ -147,8 +157,6 @@ public class AccountsHelper implements BundleEventListener {
|
|||
}
|
||||
}
|
||||
|
||||
MmaDelegate.track(MmaDelegate.USER_SIGNED_IN_TO_FXA);
|
||||
|
||||
if (callback != null) {
|
||||
callback.sendSuccess(fxAccount != null);
|
||||
}
|
||||
|
@ -163,6 +171,7 @@ public class AccountsHelper implements BundleEventListener {
|
|||
}
|
||||
|
||||
final GeckoBundle json = message.getBundle("json");
|
||||
final String action = json.getString("action");
|
||||
final String email = json.getString("email");
|
||||
final String uid = json.getString("uid");
|
||||
|
||||
|
@ -204,7 +213,11 @@ public class AccountsHelper implements BundleEventListener {
|
|||
// upload a fresh client record.
|
||||
fxAccount.requestImmediateSync(null, null, false);
|
||||
|
||||
MmaDelegate.track(MmaDelegate.USER_SIGNED_IN_TO_FXA);
|
||||
// 'UpdateFirefoxAccountFromJSON' message will be sent during a password change as well
|
||||
// during a reconnect, so we need to ensure we don't fire-off false sign-in telemtry events.
|
||||
if (action.equals("reconnect")) {
|
||||
MmaDelegate.track(MmaDelegate.USER_RECONNECTED_TO_FXA);
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback.sendSuccess(true);
|
||||
|
|
|
@ -55,6 +55,8 @@ public class MmaDelegate {
|
|||
public static final String ONBOARDING_REMOTE_VALUES = "E_Onboarding_With_Remote_Values";
|
||||
|
||||
public static final String USER_SIGNED_IN_TO_FXA = "E_User_Signed_In_To_FxA";
|
||||
public static final String USER_SIGNED_UP_FOR_FXA = "E_User_Signed_Up_For_FxA";
|
||||
public static final String USER_RECONNECTED_TO_FXA = "E_User_Reconnected_To_FxA";
|
||||
public static final String USER_FINISHED_SYNC = "E_User_Finished_Sync";
|
||||
|
||||
private static final String LAUNCH_BUT_NOT_DEFAULT_BROWSER = "E_Launch_But_Not_Default_Browser";
|
||||
|
|
|
@ -311,6 +311,15 @@ this.FxAccountsWebChannel.prototype = {
|
|||
Accounts.getFirefoxAccount()
|
||||
.then(account => {
|
||||
if (!account) {
|
||||
// This is how way we can determine if we're logging-in or signin-up.
|
||||
// A choice of what to sync is only presented to the user during signup.
|
||||
// A more robust approach is tracked in https://github.com/mozilla/fxa/issues/1998
|
||||
if ("offeredSyncEngines" in data) {
|
||||
data.action = "signup";
|
||||
} else {
|
||||
data.action = "signin";
|
||||
}
|
||||
|
||||
return Accounts.createFirefoxAccountFromJSON(data).then(
|
||||
success => {
|
||||
if (!success) {
|
||||
|
@ -326,6 +335,10 @@ this.FxAccountsWebChannel.prototype = {
|
|||
}
|
||||
);
|
||||
}
|
||||
|
||||
// If we already had an Android Account, which means we're re-connecting to an existing account.
|
||||
data.action = "reconnect";
|
||||
|
||||
return Accounts.updateFirefoxAccountFromJSON(data).then(
|
||||
success => {
|
||||
if (!success) {
|
||||
|
@ -367,6 +380,10 @@ this.FxAccountsWebChannel.prototype = {
|
|||
"Can't change password of non-existent Firefox Account!"
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure to differentiate this action from other actions that send a 'updateFirefoxAccountFromJSON' message.
|
||||
data.action = "passwordChange";
|
||||
|
||||
return Accounts.updateFirefoxAccountFromJSON(data);
|
||||
})
|
||||
.then(success => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче