Bug 798358 - Use learnmore link for addons on about:home. r=mfinkle
authorWes Johnston <wjohnston@mozilla.com>
Thu, 10 Jan 2013 11:00:59 -0800
changeset 138119 af29f5b97e59e1f1daa3dc0eb794ee21530d2cc6
parent 138118 5e5c123ad9e34fc557aa5dba0c835a5ca6468cda
child 138120 f011e4187ec52b3bccbd98e48b84728b6da4191f
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs798358
milestone23.0a1
Bug 798358 - Use learnmore link for addons on about:home. r=mfinkle
mobile/android/app/recommended-addons.json
mobile/android/base/widget/AddonsSection.java
mobile/android/components/AddonUpdateService.js
toolkit/mozapps/extensions/AddonRepository.jsm
toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
--- a/mobile/android/app/recommended-addons.json
+++ b/mobile/android/app/recommended-addons.json
@@ -1,15 +1,15 @@
 {
     "addons": [{
         "id": "fullscreen@mbrubeck.limpet.net",
         "name": "Full Screen",
         "version": "3.4",
         "iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/252/252573-32.png?modified=1354183977",
-        "homepageURL": "https://addons.mozilla.org/en-US/android/addon/full-screen-252573/?src=api"
+        "learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/full-screen-252573/?src=api"
     }, {
         "id": "cloudviewer@starkravingfinkle.org",
         "name": "Cloud Viewer",
         "version": "2.1",
         "iconURL": "https://addons.cdn.mozilla.net/img/uploads/addon_icons/295/295895-32.png?modified=1353947644",
-        "homepageURL": "https://addons.mozilla.org/en-US/android/addon/cloud-viewer/?src=api"
+        "learnmoreURL": "https://addons.mozilla.org/en-US/android/addon/cloud-viewer/?src=api"
     }]
 }
--- a/mobile/android/base/widget/AddonsSection.java
+++ b/mobile/android/base/widget/AddonsSection.java
@@ -199,17 +199,19 @@ public class AddonsSection extends About
 
         Drawable drawable = mContext.getResources().getDrawable(R.drawable.ic_addons_empty);
         drawable.setBounds(sIconBounds);
         row.setCompoundDrawables(drawable, null, null, null);
 
         String iconUrl = addonJSON.getString("iconURL");
         String pageUrl = getPageUrlFromIconUrl(iconUrl);
 
-        final String homepageUrl = addonJSON.getString("homepageURL");
+        // homepageURL may point to non-AMO installs. For now we use learnmoreURL instead
+        // which is more likely to point to a mobile AMO page
+        final String homepageUrl = addonJSON.getString("learnmoreURL");
         row.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (mUriLoadListener != null)
                     mUriLoadListener.onAboutHomeUriLoad(homepageUrl);
             }
         });
         row.setOnKeyListener(GamepadUtils.getClickDispatcher());
--- a/mobile/android/components/AddonUpdateService.js
+++ b/mobile/android/components/AddonUpdateService.js
@@ -170,17 +170,17 @@ var RecommendedSearchResults = {
         addons: []
       };
 
       addons.forEach(function(aAddon) {
         json.addons.push({
           id: aAddon.id,
           name: aAddon.name,
           version: aAddon.version,
-          homepageURL: aAddon.homepageURL,
+          learnmoreURL: aAddon.learnmoreURL,
           iconURL: aAddon.iconURL
         })
       });
 
       let file = self._getFile();
       self._writeFile(file, JSON.stringify(json));
     });
   },
--- a/toolkit/mozapps/extensions/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/AddonRepository.jsm
@@ -217,16 +217,21 @@ AddonSearchResult.prototype = {
   screenshots: null,
 
   /**
    * The homepage for the add-on
    */
   homepageURL: null,
 
   /**
+   * The homepage for the add-on
+   */
+  learnmoreURL: null,
+
+  /**
    * The support URL for the add-on
    */
   supportURL: null,
 
   /**
    * The contribution url of the add-on
    */
   contributionURL: null,
@@ -1068,17 +1073,18 @@ this.AddonRepository = {
 
             if (previewNode.getAttribute("primary") == 1)
               addon.screenshots.unshift(screenshot);
             else
               addon.screenshots.push(screenshot);
           }
           break;
         case "learnmore":
-          addon.homepageURL = addon.homepageURL || this._getTextContent(node);
+          addon.learnmoreURL = this._getTextContent(node);
+          addon.homepageURL = addon.homepageURL || addon.learnmoreURL;
           break;
         case "contribution_data":
           let meetDevelopers = this._getDescendantTextContent(node, "meet_developers");
           let suggestedAmount = this._getDescendantTextContent(node, "suggested_amount");
           if (meetDevelopers != null) {
             addon.contributionURL = meetDevelopers;
             addon.contributionAmount = suggestedAmount;
           }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
@@ -67,16 +67,17 @@ var GET_RESULTS = [{
                             thumbnailHeight: 150,
                             caption:         "Caption 1 - 1"
                           }, {
                             url:          BASE_URL + "/full2-1.png",
                             thumbnailURL: BASE_URL + "/thumbnail2-1.png",
                             caption:      "Caption 2 - 1"
                           }],
   homepageURL:            BASE_URL + "/learnmore1.html",
+  learnmoreURL:           BASE_URL + "/learnmore1.html",
   supportURL:             BASE_URL + "/support1.html",
   contributionURL:        BASE_URL + "/meetDevelopers1.html",
   contributionAmount:     "$11.11",
   averageRating:          4,
   reviewCount:            1111,
   reviewURL:              BASE_URL + "/review1.html",
   totalDownloads:         2222,
   weeklyDownloads:        3333,
@@ -146,16 +147,17 @@ var SEARCH_RESULTS = [{
                             thumbnailURL: BASE_URL + "/thumbnail1-2.png"
                           }, {
                             url:          BASE_URL + "/full2-2.png",
                             thumbnailURL: BASE_URL + "/thumbnail2-2.png",
                             caption:      "Caption 2"
                           }],
   homepageURL:            BASE_URL + "/learnmore2.html",
   supportURL:             BASE_URL + "/support2.html",
+  learnmoreURL:           BASE_URL + "/learnmore2.html",
   contributionURL:        BASE_URL + "/meetDevelopers2.html",
   contributionAmount:     null,
   repositoryStatus:       4,
   sourceURI:              BASE_URL + "/test2.xpi"
 }, {
   id:                     "test3@tests.mozilla.org",
   type:                   "theme",
   version:                "1.3",
@@ -185,16 +187,17 @@ var SEARCH_RESULTS = [{
                             caption:      "Caption 2 - 3"
                           }, {
                             url:          BASE_URL + "/full3-3.png",
                             thumbnailURL: BASE_URL + "/thumbnail3-3.png",
                             caption:      "Caption 3 - 3"
                           }],
   homepageURL:            BASE_URL + "/homepage3.html",
   supportURL:             BASE_URL + "/support3.html",
+  learnmoreURL:           BASE_URL + "/learnmore3.html",
   contributionURL:        BASE_URL + "/meetDevelopers3.html",
   contributionAmount:     "$11.11",
   averageRating:          2,
   reviewCount:            1111,
   reviewURL:              BASE_URL + "/review3.html",
   totalDownloads:         2222,
   weeklyDownloads:        3333,
   dailyUsers:             4444,