From b37f22e80fde7c1920a33d6413024a421e33e4bc Mon Sep 17 00:00:00 2001 From: mrodriguez Date: Wed, 10 Jun 2015 17:08:23 -0300 Subject: [PATCH 1/5] Fixed breaking changes with cordova v5.1.1 in the Windows platform: - Fixed hook scripts to set the wrapper.html file as the manifest's StartPage - Added new default images for sizes 44x44 and 71x71 --- assets/defaultImages/windows/44x44.png | Bin 0 -> 1837 bytes assets/defaultImages/windows/71x71.png | Bin 0 -> 3247 bytes plugin.xml | 7 +-- ...rFile.js => replaceWindowsWrapperFiles.js} | 56 ++++++++++++++++-- scripts/rollbackWindowsWrapperFiles.js | 11 +++- ...js => updateConfigurationBeforePrepare.js} | 2 +- scripts/updateConfigurationAfterBuild.js | 43 -------------- scripts/updateConfigurationAfterPrepare.js | 52 +++++++++++++--- ...js => updateConfigurationBeforePrepare.js} | 4 +- 9 files changed, 109 insertions(+), 66 deletions(-) create mode 100644 assets/defaultImages/windows/44x44.png create mode 100644 assets/defaultImages/windows/71x71.png rename scripts/{replaceWindowsWrapperFile.js => replaceWindowsWrapperFiles.js} (61%) rename scripts/test/{updateConfiguration.js => updateConfigurationBeforePrepare.js} (96%) delete mode 100644 scripts/updateConfigurationAfterBuild.js rename scripts/{updateConfiguration.js => updateConfigurationBeforePrepare.js} (96%) diff --git a/assets/defaultImages/windows/44x44.png b/assets/defaultImages/windows/44x44.png new file mode 100644 index 0000000000000000000000000000000000000000..71e8bcc660111cd5412f570fe6f810c0b6bb9e32 GIT binary patch literal 1837 zcmV+|2h#Y7P)fFDZ*Bk+2_Yi@000VfMObu0Z*X~XX=iA30IUzpIsgCw4s=CWbVG7w zVRUJ4ZXk4NZDjy8_YVmG000SeMObuGZ)S9NVRB^vU2y+80000BbVXQnL}_zlY+-3_ zWpV(wz_gD5000PdMObuKVRCM1Zf5|%8|H@q000McMObuGZ*_8GWdQa6gX;hQ00?wN zSad^gZEa<4bO83umcIZ100wkLSaeirbZlh+sP57y000H}NklF90u_J zxu?CQ6%d#x0t)Lux4E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v35!yzdliL+8;I5F4FDJbY}AAaR#!oX1LgrCUNU*|$Mo8@bzFV@6rrt61CJj4 ziF|!;4J;y0PXT#){^e@qQ)>`1^wlRcHF;Z8Qu0t=-wFUw06;4a46Kx_Uw?>Ry}HSr bxWV!d8Cj(q1%|TF00000NkvXXu0mjfKZ8Jx literal 0 HcmV?d00001 diff --git a/assets/defaultImages/windows/71x71.png b/assets/defaultImages/windows/71x71.png new file mode 100644 index 0000000000000000000000000000000000000000..c5b2fd72c1cb3f11f6641f7720cd816c1fe1def2 GIT binary patch literal 3247 zcmbuB`8U-67sucBj4VTzkTqMD#xfd{E!*G|*@+?BU~Iz}LSxHE$ud3^l3mCyWlPq| z)`;w6Z>-ssy~cNZzUTWFe1EvFdtQ(Gy!Ulp=iGD8ePUvaUj?qv5ZU6w#Oq?5)FTw>%febhUBVC3$dJu<-fLK|x@4rab26rnE=Yhcj zrB!|U6m$_sK{}`a7cANjhsO8<9E`%E6b?G)+8DnOEZW@z2UM{3!6}sGUy4OJolAvq zXde^+J!EC1L>SK_<`_5JeJ3mmu=hJVmoxoa939}|?L?7cfrj?lBnrN8j;)=rzGz=} zpq+2|F@-VwH$M>Tf&%u>qSyZ?)5iGtpnP$_L0?)Mh0&kOEYLV_6i~7?Btdy1)IjH! zMR3+;R)`5FLZG{?O=Y%Y0Zf;8L4@8pKctGime#0~sZ(*#8z)wUc&#KnYpo>E5tr#< za;bBuM665HYRpSb^AdLl5wyC?p@*!VSSZAh3Ja#1HAumCg){7Ey9LVgA@+BYGK9x;1CgG0v_ zOT5N{ClwXDd$_L?sJ>DGtnHvk8b?4Vs^+OyaPUL_;o^u#z_wzCCT(F@T(J72vtL+=EEfgBD|5H0<|V7b1T1@_qpKcXs>3W zeK|x+h`IY;hCizLH3Yh4()6i=A!$XKaH#3(*d|Pn-8t+iv^$C>y#Dy-Q$`+I;G(3C zqvMmO&k6plDfL^^~K)18z=k5&geCf$4PgT6yE~%IGs+0K>DKH*Z>v*JH7x-%x>~vlF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r9XjmV?1!e*ZpD zAP^M^mjkA19HWw6Ho}r)XWcaG=4uzTwY>5AvBS}|-?~zzm^dRp%O7OyRyK%-RM@5# zKSjm+tn{lZ?8sB80s2C4q;}1iN|jQ1B_#84v^?iS6GqJ#nFlqeeDK&B!FPFiqg~8= z^?vH=`?ES(9cyl42|P7l$(`KR!3Dx5mm&Z-TPnMs?ffyvhrSF%qntemCYT$#ZeqU_ YVOlNy#-VNWd{+kybd7bYv>YG)2Zu%p?f?J) literal 0 HcmV?d00001 diff --git a/plugin.xml b/plugin.xml index 0ac6bfa..484c3e4 100644 --- a/plugin.xml +++ b/plugin.xml @@ -12,9 +12,10 @@ - + - + + @@ -37,8 +38,6 @@ - - diff --git a/scripts/replaceWindowsWrapperFile.js b/scripts/replaceWindowsWrapperFiles.js similarity index 61% rename from scripts/replaceWindowsWrapperFile.js rename to scripts/replaceWindowsWrapperFiles.js index 3c313b2..042a1d7 100644 --- a/scripts/replaceWindowsWrapperFile.js +++ b/scripts/replaceWindowsWrapperFiles.js @@ -3,6 +3,7 @@ var fs = require('fs'), path = require('path'), url = require('url'), + etree, projectRoot; var logger = { @@ -39,12 +40,53 @@ function copyFile(source, target, callback) { rd.pipe(wr); }; +function updateManifestFile(manifestPath) { + var contents = fs.readFileSync(manifestPath, 'utf-8'); + if(contents) { + //Windows is the BOM. Skip the Byte Order Mark. + contents = contents.substring(contents.indexOf('<')); + } + + var startPage = "www/wrapper.html"; + var manifest = new etree.ElementTree(etree.XML(contents)); + var appNode = manifest.find('.//Application'); + + appNode.attrib.StartPage = startPage; + + // Write out manifest + fs.writeFileSync(manifestPath, manifest.write({indent: 4}), 'utf-8'); +} + +function updateWindowsManifests() { + var MANIFEST_WINDOWS8 = 'package.windows80.appxmanifest', + MANIFEST_WINDOWS = 'package.windows.appxmanifest', + MANIFEST_PHONE = 'package.phone.appxmanifest', + MANIFEST_WINDOWS10 = 'package.windows10.appxmanifest'; + + // Apply appxmanifest changes + [ MANIFEST_WINDOWS, + MANIFEST_WINDOWS8, + MANIFEST_PHONE, + MANIFEST_WINDOWS10 ].forEach( + function(manifestFile) { + updateManifestFile(path.join(projectRoot, "platforms", "windows", manifestFile)); + }); +} + module.exports = function (context) { + projectRoot = context.opts.projectRoot; + + // if the windows folder does not exist, cancell the script + var windowsPath = path.join(projectRoot, "platforms","windows"); + if (!fs.existsSync(windowsPath)) { + return; + } + + etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); + // move contents of the assets folder to the windows platform dir var Q = context.requireCordovaModule('q'); - // create a parser for the Cordova configuration - projectRoot = context.opts.projectRoot; var filename = "wrapper"; var sourcePath = path.resolve(__dirname, "..", "assets", "windows", "wrapper.html"); @@ -56,7 +98,7 @@ module.exports = function (context) { copyFile(sourcePath, destPath, function (err) { if (err) { console.error(err); - return task.reject(); + return task.reject(err); } console.log("Finished copying wrapper html file for the windows platform."); @@ -69,7 +111,7 @@ module.exports = function (context) { copyFile(sourcePath, destPath, function (err) { if (err) { console.error(err); - return task.reject(); + return task.reject(err); } console.log("Finished copying wrapper js file for the windows platform."); @@ -82,11 +124,13 @@ module.exports = function (context) { copyFile(sourcePath, destPath, function (err) { if (err) { console.error(err); - return task.reject(); + return task.reject(err); } console.log("Finished copying wrapper css file for the windows platform."); - + + updateWindowsManifests(); + task.resolve(); }); }); diff --git a/scripts/rollbackWindowsWrapperFiles.js b/scripts/rollbackWindowsWrapperFiles.js index 6d41c12..7e47be4 100644 --- a/scripts/rollbackWindowsWrapperFiles.js +++ b/scripts/rollbackWindowsWrapperFiles.js @@ -52,11 +52,18 @@ function configureParser(context) { module.exports = function (context) { // If the plugin is not being removed, cancel the script if (context.opts.plugins.indexOf(context.opts.plugin.id) == -1) { - return; + return; } - Q = context.requireCordovaModule('q'); var projectRoot = context.opts.projectRoot; + + // if the windows folder does not exist, cancell the script + var windowsPath = path.join(projectRoot, "platforms","windows"); + if (!fs.existsSync(windowsPath)) { + return; + } + + Q = context.requireCordovaModule('q'); var task = Q.defer(); var destPath = path.join(projectRoot, "platforms", "windows", "www", "wrapper.html"); diff --git a/scripts/test/updateConfiguration.js b/scripts/test/updateConfigurationBeforePrepare.js similarity index 96% rename from scripts/test/updateConfiguration.js rename to scripts/test/updateConfigurationBeforePrepare.js index e284c9a..db6ff93 100644 --- a/scripts/test/updateConfiguration.js +++ b/scripts/test/updateConfigurationBeforePrepare.js @@ -1,7 +1,7 @@ 'use strict'; process.env.NODE_ENV = 'test'; -var updateConfiguration = require('../updateConfiguration'); +var updateConfiguration = require('../updateConfigurationBeforePrepare'); var tu = require('./test-utils'); var assert = require('assert'); diff --git a/scripts/updateConfigurationAfterBuild.js b/scripts/updateConfigurationAfterBuild.js deleted file mode 100644 index eb778ff..0000000 --- a/scripts/updateConfigurationAfterBuild.js +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env node - -var createConfigParser = require('./createConfigParser'), - fs = require('fs'), - path = require('path'), - windowsConfig, - projectRoot, - etree; - -var logger = { - log: function () { - if (process.env.NODE_ENV !== 'test') { - console.log.apply(this, arguments) - } - } -}; - -// Configure Cordova configuration parser -function configureParser(context) { - var cordova_util = context.requireCordovaModule('cordova-lib/src/cordova/util'), - ConfigParser = context.requireCordovaModule('cordova-lib/src/configparser/ConfigParser'); - etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); - - var windowsDir = path.join(projectRoot, 'platforms', 'windows'); - if (fs.existsSync(windowsDir)) { - var windowsXml = cordova_util.projectConfig(windowsDir); - windowsConfig = createConfigParser(windowsXml, etree, ConfigParser); - } -} - -module.exports = function (context) { - // create a parser for the Cordova configuration - projectRoot = context.opts.projectRoot; - configureParser(context); - - if (windowsConfig) { - logger.log('Removing default images from windows configuration...'); - windowsConfig.removeElements('.//icon[@hap-default-image=\'yes\']'); - windowsConfig.removeElements('.//splash[@hap-default-image=\'yes\']'); - - windowsConfig.write(); - } -} diff --git a/scripts/updateConfigurationAfterPrepare.js b/scripts/updateConfigurationAfterPrepare.js index c16d97b..02bc7a5 100644 --- a/scripts/updateConfigurationAfterPrepare.js +++ b/scripts/updateConfigurationAfterPrepare.js @@ -4,7 +4,9 @@ var createConfigParser = require('./createConfigParser'), fs = require('fs'), path = require('path'), config, - windowsConfig, + windowsConfig, + androidConfig, + iosConfig, projectRoot, etree; @@ -24,22 +26,37 @@ function configureParser(context) { var xml = cordova_util.projectConfig(projectRoot); config = createConfigParser(xml, etree, ConfigParser); - + var windowsDir = path.join(projectRoot, 'platforms', 'windows'); if (fs.existsSync(windowsDir)) { var windowsXml = cordova_util.projectConfig(windowsDir); windowsConfig = createConfigParser(windowsXml, etree, ConfigParser); } + + var androidDir = path.join(projectRoot, 'platforms', 'android', 'res', 'xml'); + if (fs.existsSync(androidDir)) { + var androidXml = cordova_util.projectConfig(androidDir); + androidConfig = createConfigParser(androidXml, etree, ConfigParser); + } + + var iosProjectName = config.name(); + if (iosProjectName) { + var iosDir = path.join(projectRoot, 'platforms', 'ios', iosProjectName); + if (fs.existsSync(iosDir)) { + var iosXml = cordova_util.projectConfig(iosDir); + iosConfig = createConfigParser(iosXml, etree, ConfigParser); + } + } } module.exports = function (context) { - logger.log('Removing default images from cordova configuration...'); - // create a parser for the Cordova configuration projectRoot = context.opts.projectRoot; configureParser(context); - // Remove default images from configuration file + logger.log('Removing default images from Cordova configuration...'); + + // Remove default images from root configuration file config.removeElements('.//icon[@hap-default-image=\'yes\']'); config.removeElements('.//splash[@hap-default-image=\'yes\']'); @@ -47,9 +64,26 @@ module.exports = function (context) { config.write(); if (windowsConfig) { - // Patch for windows: restoring the start page to index.html - logger.log('Restoring local start page in windows configuration...'); - windowsConfig.setAttribute('content', 'src', 'wrapper.html'); - windowsConfig.write(); + // Remove default images from windows configuration file + windowsConfig.removeElements('.//icon[@hap-default-image=\'yes\']'); + windowsConfig.removeElements('.//splash[@hap-default-image=\'yes\']'); + + windowsConfig.write(); + } + + if (androidConfig) { + // Remove default images from android configuration file + androidConfig.removeElements('.//icon[@hap-default-image=\'yes\']'); + androidConfig.removeElements('.//splash[@hap-default-image=\'yes\']'); + + androidConfig.write(); + } + + if (iosConfig) { + // Remove default images from ios configuration file + iosConfig.removeElements('.//icon[@hap-default-image=\'yes\']'); + iosConfig.removeElements('.//splash[@hap-default-image=\'yes\']'); + + iosConfig.write(); } } diff --git a/scripts/updateConfiguration.js b/scripts/updateConfigurationBeforePrepare.js similarity index 96% rename from scripts/updateConfiguration.js rename to scripts/updateConfigurationBeforePrepare.js index 9e20cc1..a19c453 100644 --- a/scripts/updateConfiguration.js +++ b/scripts/updateConfigurationBeforePrepare.js @@ -116,7 +116,7 @@ function configureParser(context) { etree = context.requireCordovaModule('cordova-lib/node_modules/elementtree'); var xml = cordova_util.projectConfig(projectRoot); - config = createConfigParser(xml, etree, ConfigParser); + config = createConfigParser(xml, etree, ConfigParser); } function processAccessRules(manifest) { @@ -539,8 +539,10 @@ function processAndroidIcons(manifestIcons, outputConfiguration, previousIndent) function processWindowsIcons(manifestIcons) { var iconSizes = [ "30x30", + "44x44", "106x106", "70x70", + "71x71", "170x170", "150x150", "360x360", From 670f5dcb340197a6eacad2d7a11989c2f3ba2d3a Mon Sep 17 00:00:00 2001 From: mrodriguez Date: Wed, 10 Jun 2015 18:54:23 -0300 Subject: [PATCH 2/5] Specified version of supported platforms (android=4.0.2. ios=3.8.0, windows=4.0.0) --- plugin.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin.xml b/plugin.xml index 484c3e4..c7b0f31 100644 --- a/plugin.xml +++ b/plugin.xml @@ -21,6 +21,12 @@ + + + + + + From ed333c547b2741993d242cd092fc0df2e0a37e2c Mon Sep 17 00:00:00 2001 From: f2bo Date: Wed, 10 Jun 2015 19:50:53 -0300 Subject: [PATCH 3/5] Added handler for the hardware back button in the Windows platform --- src/windows/HostedWebAppPluginProxy.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/windows/HostedWebAppPluginProxy.js b/src/windows/HostedWebAppPluginProxy.js index 0ca856a..cf26e25 100644 --- a/src/windows/HostedWebAppPluginProxy.js +++ b/src/windows/HostedWebAppPluginProxy.js @@ -167,6 +167,21 @@ function hideExtendedSplashScreen(e) { extendedSplashScreen.style.display = "none"; } +// handle the hardware backbutton +function navigateBack(e) { + if (!_mainView.canGoBack) { + return false; + } + + try { + _mainView.goBack(); + } catch (err) { + return false; + } + + return true; +} + module.exports = { // loads the W3C manifest file and parses it loadManifest: function (successCallback, errorCallback, args) { @@ -235,4 +250,5 @@ module.exports.loadManifest( _mainView.addEventListener("MSWebViewDOMContentLoaded", hideExtendedSplashScreen, false); cordova.fireDocumentEvent("webviewCreated", { webView: _mainView }); + WinJS.Application.onbackclick = navigateBack; }); From c3c29f93ecff836d98db8dc2ac24b45b68a56448 Mon Sep 17 00:00:00 2001 From: mrodriguez Date: Thu, 11 Jun 2015 15:24:41 -0300 Subject: [PATCH 4/5] Changed plugin id to v0.1.1 --- plugin.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.xml b/plugin.xml index c7b0f31..623f83f 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,7 +1,7 @@ + version="0.1.1"> HostedWebApp Hosted Web App Plugin MIT License From 1b2f08a954883bc9530f6f4a75fe2a98462f4734 Mon Sep 17 00:00:00 2001 From: mrodriguez Date: Tue, 16 Jun 2015 15:42:19 -0300 Subject: [PATCH 5/5] Changed package version to 0.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0ff9550..df0e32e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cordova-plugin-hostedwebapp", - "version": "0.1.0", + "version": "0.1.1", "description": "Hosted Web App Plugin", "cordova": { "id": "cordova-plugin-hostedwebapp",