Bug 1113613: Show the telefonica logo only on first use. r=NiKo`
authorRomain Gauthier <romain.gauthier@monkeypatch.me>
Thu, 08 Jan 2015 15:00:12 +0100
changeset 248535 e8a928acfdabaf81a59b7b883e41d63f67e5d9a6
parent 248534 cd908a8fb224713a2d07f06496ce7a234d70ccca
child 248536 470845ebf534b3032bea84fe524f5e930bd37c69
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNiKo
bugs1113613
milestone37.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1113613: Show the telefonica logo only on first use. r=NiKo`
browser/app/profile/firefox.js
browser/components/loop/content/js/panel.js
browser/components/loop/content/js/panel.jsx
browser/components/loop/test/desktop-local/panel_test.js
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1639,16 +1639,17 @@ pref("shumway.disabled", true);
 // The maximum amount of decoded image data we'll willingly keep around (we
 // might keep around more than this, but we'll try to get down to this value).
 // (This is intentionally on the high side; see bug 746055.)
 pref("image.mem.max_decoded_image_kb", 256000);
 
 pref("loop.enabled", true);
 pref("loop.server", "https://loop.services.mozilla.com/v0");
 pref("loop.seenToS", "unseen");
+pref("loop.showPartnerLogo", true);
 pref("loop.gettingStarted.seen", false);
 pref("loop.gettingStarted.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/hello/start/");
 pref("loop.gettingStarted.resumeOnFirstJoin", false);
 pref("loop.learnMoreUrl", "https://www.firefox.com/hello/");
 pref("loop.legal.ToS_url", "https://www.mozilla.org/about/legal/terms/firefox-hello/");
 pref("loop.legal.privacy_url", "https://www.mozilla.org/privacy/firefox-hello/");
 pref("loop.do_not_disturb", false);
 pref("loop.ringtone", "chrome://browser/content/loop/shared/sounds/ringtone.ogg");
--- a/browser/components/loop/content/js/panel.js
+++ b/browser/components/loop/content/js/panel.js
@@ -196,44 +196,56 @@ loop.panel = (function(_, mozL10n) {
   });
 
   var ToSView = React.createClass({displayName: "ToSView",
     getInitialState: function() {
       var getPref = navigator.mozLoop.getLoopPref.bind(navigator.mozLoop);
 
       return {
         seenToS: getPref("seenToS"),
-        gettingStartedSeen: getPref("gettingStarted.seen")
+        gettingStartedSeen: getPref("gettingStarted.seen"),
+        showPartnerLogo: getPref("showPartnerLogo")
       };
     },
 
+    renderPartnerLogo: function() {
+      if (!this.state.showPartnerLogo) {
+        return null;
+      }
+
+      var locale = mozL10n.getLanguage();
+      navigator.mozLoop.setLoopPref('showPartnerLogo', false);
+      return (
+        React.createElement("p", {id: "powered-by", className: "powered-by"}, 
+          mozL10n.get("powered_by_beforeLogo"), 
+          React.createElement("img", {id: "powered-by-logo", className: locale}), 
+          mozL10n.get("powered_by_afterLogo")
+        )
+      );
+    },
+
     render: function() {
       if (!this.state.gettingStartedSeen || this.state.seenToS == "unseen") {
-        var locale = mozL10n.getLanguage();
         var terms_of_use_url = navigator.mozLoop.getLoopPref('legal.ToS_url');
         var privacy_notice_url = navigator.mozLoop.getLoopPref('legal.privacy_url');
         var tosHTML = mozL10n.get("legal_text_and_links3", {
           "clientShortname": mozL10n.get("clientShortname2"),
           "terms_of_use": React.renderToStaticMarkup(
             React.createElement("a", {href: terms_of_use_url, target: "_blank"}, 
               mozL10n.get("legal_text_tos")
             )
           ),
           "privacy_notice": React.renderToStaticMarkup(
             React.createElement("a", {href: privacy_notice_url, target: "_blank"}, 
               mozL10n.get("legal_text_privacy")
             )
           ),
         });
         return React.createElement("div", {id: "powered-by-wrapper"}, 
-          React.createElement("p", {id: "powered-by"}, 
-            mozL10n.get("powered_by_beforeLogo"), 
-            React.createElement("img", {id: "powered-by-logo", className: locale}), 
-            mozL10n.get("powered_by_afterLogo")
-          ), 
+          this.renderPartnerLogo(), 
           React.createElement("p", {className: "terms-service", 
              dangerouslySetInnerHTML: {__html: tosHTML}})
          );
       } else {
         return React.createElement("div", null);
       }
     }
   });
--- a/browser/components/loop/content/js/panel.jsx
+++ b/browser/components/loop/content/js/panel.jsx
@@ -196,44 +196,56 @@ loop.panel = (function(_, mozL10n) {
   });
 
   var ToSView = React.createClass({
     getInitialState: function() {
       var getPref = navigator.mozLoop.getLoopPref.bind(navigator.mozLoop);
 
       return {
         seenToS: getPref("seenToS"),
-        gettingStartedSeen: getPref("gettingStarted.seen")
+        gettingStartedSeen: getPref("gettingStarted.seen"),
+        showPartnerLogo: getPref("showPartnerLogo")
       };
     },
 
+    renderPartnerLogo: function() {
+      if (!this.state.showPartnerLogo) {
+        return null;
+      }
+
+      var locale = mozL10n.getLanguage();
+      navigator.mozLoop.setLoopPref('showPartnerLogo', false);
+      return (
+        <p id="powered-by" className="powered-by">
+          {mozL10n.get("powered_by_beforeLogo")}
+          <img id="powered-by-logo" className={locale} />
+          {mozL10n.get("powered_by_afterLogo")}
+        </p>
+      );
+    },
+
     render: function() {
       if (!this.state.gettingStartedSeen || this.state.seenToS == "unseen") {
-        var locale = mozL10n.getLanguage();
         var terms_of_use_url = navigator.mozLoop.getLoopPref('legal.ToS_url');
         var privacy_notice_url = navigator.mozLoop.getLoopPref('legal.privacy_url');
         var tosHTML = mozL10n.get("legal_text_and_links3", {
           "clientShortname": mozL10n.get("clientShortname2"),
           "terms_of_use": React.renderToStaticMarkup(
             <a href={terms_of_use_url} target="_blank">
               {mozL10n.get("legal_text_tos")}
             </a>
           ),
           "privacy_notice": React.renderToStaticMarkup(
             <a href={privacy_notice_url} target="_blank">
               {mozL10n.get("legal_text_privacy")}
             </a>
           ),
         });
         return <div id="powered-by-wrapper">
-          <p id="powered-by">
-            {mozL10n.get("powered_by_beforeLogo")}
-            <img id="powered-by-logo" className={locale} />
-            {mozL10n.get("powered_by_afterLogo")}
-          </p>
+          {this.renderPartnerLogo()}
           <p className="terms-service"
              dangerouslySetInnerHTML={{__html: tosHTML}}></p>
          </div>;
       } else {
         return <div />;
       }
     }
   });
--- a/browser/components/loop/test/desktop-local/panel_test.js
+++ b/browser/components/loop/test/desktop-local/panel_test.js
@@ -1047,10 +1047,26 @@ describe("loop.panel", function() {
            }[key];
          };
          var view = TestUtils.renderIntoDocument(
            React.createElement(loop.panel.ToSView));
 
          TestUtils.findRenderedDOMComponentWithClass(view, "terms-service");
        });
 
+    it("should render the telefonica logo after the first time use",
+       function() {
+         navigator.mozLoop.getLoopPref = function(key) {
+           return {
+             "gettingStarted.seen": false,
+             "seenToS": "unseen",
+             "showPartnerLogo": false
+           }[key];
+         };
+
+         var view = TestUtils.renderIntoDocument(
+           React.createElement(loop.panel.ToSView));
+
+         expect(view.getDOMNode().querySelector(".powered-by")).eql(null);
+       });
+
   });
 });