Bug 1178378 - Enable profile click action based on native accounts UI. r=nalexander, a=lizzard
authorvivek <vivekb.balakrishnan@gmail.com>
Tue, 22 Sep 2015 22:02:40 +0300
changeset 296192 d790b9a84515f61063a07fbf1c7e1fd02f573a6d
parent 296191 78d0438bcb818227de4b5fd263b631c786d10124
child 296193 02ccd14131b7d7a3a53ef1a8a4b748bd28c71b6e
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander, lizzard
bugs1178378
milestone43.0a2
Bug 1178378 - Enable profile click action based on native accounts UI. r=nalexander, a=lizzard
mobile/android/base/fxa/FxAccountConstants.java
mobile/android/base/fxa/activities/FxAccountStatusFragment.java
--- a/mobile/android/base/fxa/FxAccountConstants.java
+++ b/mobile/android/base/fxa/FxAccountConstants.java
@@ -27,17 +27,17 @@ public class FxAccountConstants {
   public static final String ACCOUNT_PROFILE_JSON_UPDATED_ACTION = "org.mozilla.gecko.fxa.profile.JSON.updated";
 
   // You must be at least 13 years old, on the day of creation, to create a Firefox Account.
   public static final int MINIMUM_AGE_TO_CREATE_AN_ACCOUNT = 13;
 
   // Key for avatar URI in profile JSON.
   public static final String KEY_PROFILE_JSON_AVATAR = "avatar";
   // Key for username in profile JSON.
-  public static final String KEY_PROFILE_JSON_USERNAME = "username";
+  public static final String KEY_PROFILE_JSON_USERNAME = "displayName";
 
   // You must wait 15 minutes after failing an age check before trying to create a different account.
   public static final long MINIMUM_TIME_TO_WAIT_AFTER_AGE_CHECK_FAILED_IN_MILLISECONDS = 15 * 60 * 1000;
 
   public static final String USER_AGENT = "Firefox-Android-FxAccounts/" + AppConstants.MOZ_APP_VERSION + " (" + AppConstants.MOZ_APP_DISPLAYNAME + ")";
 
   public static final String ACCOUNT_PICKLE_FILENAME = "fxa.account.json";
 
--- a/mobile/android/base/fxa/activities/FxAccountStatusFragment.java
+++ b/mobile/android/base/fxa/activities/FxAccountStatusFragment.java
@@ -236,16 +236,23 @@ public class FxAccountStatusFragment
    */
   @Override
   public void onResume() {
     super.onResume();
   }
 
   @Override
   public boolean onPreferenceClick(Preference preference) {
+    if (preference == profilePreference) {
+      if (!AppConstants.MOZ_ANDROID_NATIVE_ACCOUNT_UI) {
+        // There is no native equivalent, bind the click action to fire an intent.
+        ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), "about:accounts?action=avatar");
+      }
+    }
+
     if (preference == manageAccountPreference) {
       // There's no native equivalent, so no need to re-direct through an Intent filter.
       ActivityUtils.openURLInFennec(getActivity().getApplicationContext(), "about:accounts?action=manage");
       return true;
     }
 
     if (preference == needsPasswordPreference) {
       final Intent intent = new Intent(FxAccountConstants.ACTION_FXA_UPDATE_CREDENTIALS);