cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] cordova-windows git commit: CB-8946: Added the "WindowsToastCapable" preference to indicate that the app can support toasts. This is to support the Local Notifications plugin.
Date Tue, 12 May 2015 21:13:57 GMT
Repository: cordova-windows
Updated Branches:
  refs/heads/master 76b129eaa -> e5f54f2ef


CB-8946: Added the "WindowsToastCapable" preference to indicate that the
app can support toasts.  This is to support the Local Notifications
plugin.


Project: http://git-wip-us.apache.org/repos/asf/cordova-windows/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-windows/commit/5f72b571
Tree: http://git-wip-us.apache.org/repos/asf/cordova-windows/tree/5f72b571
Diff: http://git-wip-us.apache.org/repos/asf/cordova-windows/diff/5f72b571

Branch: refs/heads/master
Commit: 5f72b571ebabd1924049f544fc6bfe4a554ae4fc
Parents: 973b45a
Author: Rob Paveza <Rob.Paveza@microsoft.com>
Authored: Tue May 5 10:40:27 2015 -0700
Committer: Rob Paveza <Rob.Paveza@microsoft.com>
Committed: Tue May 5 10:40:27 2015 -0700

----------------------------------------------------------------------
 template/cordova/lib/prepare.js | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/5f72b571/template/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/template/cordova/lib/prepare.js b/template/cordova/lib/prepare.js
index 7bec13d..d884cb7 100644
--- a/template/cordova/lib/prepare.js
+++ b/template/cordova/lib/prepare.js
@@ -86,6 +86,7 @@ function updateManifestFile (config, manifestPath, namespacePrefix) {
     sortCapabilities(manifest);
     applyAccessRules(config, manifest);
     applyBackgroundColor(config, manifest, namespacePrefix);
+    applyToastCapability(config, manifest, namespacePrefix);
 
 
     //Write out manifest
@@ -386,3 +387,24 @@ function applyBackgroundColor (config, manifest, xmlnsPrefix) {
         visualElems.attrib.BackgroundColor = refineColor(bgColor);
     }
 }
+
+/**
+ * Applies the ToastCapable attribute to the VisualElements tag
+ * @param config {ConfigParser} The configuration reader
+ * @param manifest {et.ElementTree} The manifest file
+ * @namespacePrefix {String} The XML namespace for the VisualElements tag, in the form 'm2:'
+ */
+function applyToastCapability(config, manifest, namespacePrefix) {
+    var isToastCapable = config.getPreference('WindowsToastCapable');
+    isToastCapable = (isToastCapable && isToastCapable.toString().toLowerCase() ===
'true');
+    
+    var visualElementsName = './/' + namespacePrefix + 'VisualElements';
+    var visualElems = manifest.find(visualElementsName);
+    
+    if (isToastCapable) {
+        visualElems.attrib.ToastCapable = 'true';
+    }
+    else {
+        delete visualElems.attrib.ToastCapable;
+    } 
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message