[gnome-shell/T29763: 170/249] payg: Show image-specific instructions for PAYG, if available



commit e7f14449a1652b1ebecd01d720b9e17c38273480
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Apr 4 12:37:51 2018 +0100

    payg: Show image-specific instructions for PAYG, if available
    
    Look for possible overrides in the vendor-customer-support.ini
    file and use them in the unlock dialog accordingly if available,
    falling back to the defaul text otherwise.
    
    https://phabricator.endlessm.com/T21864

 js/ui/paygUnlockDialog.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/paygUnlockDialog.js b/js/ui/paygUnlockDialog.js
index f4704b9d4f..5c52db8153 100644
--- a/js/ui/paygUnlockDialog.js
+++ b/js/ui/paygUnlockDialog.js
@@ -266,9 +266,13 @@ var PaygUnlockDialog = GObject.registerClass({
         this._buttonBox = this._createButtonsArea();
         promptBox.add_child(this._buttonBox);
 
+        // Use image-specific instructions if present, or the fallback text otherwise.
+        let instructionsLine1 = Main.customerSupport.paygInstructionsLine1
+            ? Main.customerSupport.paygInstructionsLine1 : _('Don’t have an unlock code? That’s OK!');
+
         let helpLineMain = new St.Label({
             style_class: 'unlock-dialog-payg-help-main',
-            text: _('Don’t have an unlock code? That’s OK!'),
+            text: instructionsLine1,
             x_align: Clutter.ActorAlign.START,
         });
         helpLineMain.clutter_text.line_wrap = true;
@@ -276,9 +280,25 @@ var PaygUnlockDialog = GObject.registerClass({
 
         promptBox.add_child(helpLineMain);
 
+        // Default to the fallback text, before figuring out whether
+        // we can show something more image-specific to the user.
+        let instructionsLine2;
+        if (Main.customerSupport.paygInstructionsLine2) {
+            // Overrides for the entire line take priority over everything else.
+            instructionsLine2 = Main.customerSupport.paygInstructionsLine2;
+        } else if (Main.customerSupport.paygContactName && Main.customerSupport.paygContactNumber) {
+            // The second possible override is to use the template text below
+            // with the contact's name and phone number, if BOTH are present.
+            instructionsLine2 = _('Talk to your sales representative to purchase a new code. Call or text %s 
at %s')
+                .format(Main.customerSupport.paygContactName, Main.customerSupport.paygContactNumber);
+        } else {
+            // No overrides present, default to fallback text.
+            instructionsLine2 = _('Talk to your sales representative to purchase a new code.');
+        }
+
         let helpLineSub = new St.Label({
             style_class: 'unlock-dialog-payg-help-sub',
-            text: _('Talk to your sales representative to purchase a new code.'),
+            text: instructionsLine2,
             x_align: Clutter.ActorAlign.START,
         });
         helpLineSub.clutter_text.line_wrap = true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]