From d49f2dac760c0b62741911a620ad0d656dd9ab8d Mon Sep 17 00:00:00 2001 From: Wes Johnston Date: Thu, 10 Jan 2013 11:00:59 -0800 Subject: [PATCH] Bug 798358 - Use learnmore link for addons on about:home. r=mfinkle --- mobile/android/app/recommended-addons.json | 4 ++-- mobile/android/base/widget/AddonsSection.java | 4 +++- mobile/android/components/AddonUpdateService.js | 2 +- toolkit/mozapps/extensions/AddonRepository.jsm | 8 +++++++- .../extensions/test/xpcshell/test_AddonRepository.js | 3 +++ 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mobile/android/app/recommended-addons.json b/mobile/android/app/recommended-addons.json index dbebbe19acc8..1883ea4451b9 100644 --- a/mobile/android/app/recommended-addons.json +++ b/mobile/android/app/recommended-addons.json @@ -4,12 +4,12 @@ "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" }] } diff --git a/mobile/android/base/widget/AddonsSection.java b/mobile/android/base/widget/AddonsSection.java index 10995f68b5e8..a313e91ac927 100644 --- a/mobile/android/base/widget/AddonsSection.java +++ b/mobile/android/base/widget/AddonsSection.java @@ -204,7 +204,9 @@ public class AddonsSection extends AboutHomeSection { 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 = jsonobj.getString("learnmoreURL"); row.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/mobile/android/components/AddonUpdateService.js b/mobile/android/components/AddonUpdateService.js index f8edf178e47e..138c156fc564 100644 --- a/mobile/android/components/AddonUpdateService.js +++ b/mobile/android/components/AddonUpdateService.js @@ -175,7 +175,7 @@ var RecommendedSearchResults = { id: aAddon.id, name: aAddon.name, version: aAddon.version, - homepageURL: aAddon.homepageURL, + learnmoreURL: aAddon.learnmoreURL, iconURL: aAddon.iconURL }) }); diff --git a/toolkit/mozapps/extensions/AddonRepository.jsm b/toolkit/mozapps/extensions/AddonRepository.jsm index 0c15282c9197..0541621eac87 100644 --- a/toolkit/mozapps/extensions/AddonRepository.jsm +++ b/toolkit/mozapps/extensions/AddonRepository.jsm @@ -221,6 +221,11 @@ AddonSearchResult.prototype = { */ homepageURL: null, + /** + * The homepage for the add-on + */ + learnmoreURL: null, + /** * The support URL for the add-on */ @@ -1073,7 +1078,8 @@ this.AddonRepository = { } 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"); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js index 3417353a2e4c..b71cb2b7d835 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js @@ -72,6 +72,7 @@ var GET_RESULTS = [{ 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", @@ -151,6 +152,7 @@ var SEARCH_RESULTS = [{ }], homepageURL: BASE_URL + "/learnmore2.html", supportURL: BASE_URL + "/support2.html", + learnmoreURL: BASE_URL + "/learnmore2.html", contributionURL: BASE_URL + "/meetDevelopers2.html", contributionAmount: null, repositoryStatus: 4, @@ -190,6 +192,7 @@ var SEARCH_RESULTS = [{ }], 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,