diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-09-26 00:47:11 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-09-26 00:47:11 +0200 |
| commit | 6a9186aea6b85beef28e3eb765fbf2322a1c7890 (patch) | |
| tree | a4a2ad8fcaa8783b4ed3643e950a003c2c0f9de6 | |
| parent | b6a9175ffeb718994d6e68c4e3e783449c4f34cd (diff) | |
wtf broken
32 files changed, 441 insertions, 21 deletions
diff --git a/StoneIsland/config.xml b/StoneIsland/config.xml index da6b1387..5126ce0e 100755 --- a/StoneIsland/config.xml +++ b/StoneIsland/config.xml @@ -1,6 +1,6 @@ <?xml version='1.0' encoding='utf-8'?> <widget android-versionCode="6090" id="us.okfoc.stoneisland" version="0.9.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> - <name>Stone Island</name> + <name>StoneIsland</name> <description> Stone Island </description> @@ -41,7 +41,25 @@ <preference name="BackupWebStorage" value="local" /> <preference name="KeyboardDisplayRequiresUserAction" value="false" /> </platform> - <plugin name="cordova-plugin-statusbar" spec="^2.2.3" /> + <plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" /> + <plugin name="cordova-plugin-x-socialsharing" spec="~5.1.3" /> + <plugin name="cordova-plugin-customurlscheme" spec="~4.2.0"> + <variable name="URL_SCHEME" value="stoneisland" /> + </plugin> <plugin name="cordova-plugin-whitelist" spec="1" /> - <plugin name="cordova-plugin-firebase" spec="^0.1.24" /> + <plugin name="cordova-plugin-console" spec="~1.0.4" /> + <plugin name="cordova-plugin-device" spec="~1.1.3" /> + <plugin name="cordova-plugin-network-information" spec="~1.3.0" /> + <plugin name="cordova-plugin-dialogs" spec="~1.3.0" /> + <plugin name="cordova-plugin-splashscreen" spec="~4.0.0" /> + <plugin name="cordova-plugin-geolocation" spec="~2.4.0" /> + <plugin name="ionic-plugin-keyboard" spec="~2.2.1" /> + <plugin name="phonegap-plugin-push" spec="~1.9.2"> + <variable name="SENDER_ID" value="XXXXXXX" /> + </plugin> + <plugin name="cordova-plugin-statusbar" spec="~2.2.3" /> + <plugin name="cordova-plugin-firebase" spec="~0.1.24" /> + <plugin name="cordova-plugin-app-name" spec="~1.0.4"> + <variable name="APP_NAME" value="Stone Island" /> + </plugin> </widget> diff --git a/StoneIsland/package-lock.json b/StoneIsland/package-lock.json index bd618007..7de9b28c 100644 --- a/StoneIsland/package-lock.json +++ b/StoneIsland/package-lock.json @@ -1040,6 +1040,14 @@ } } }, + "cordova-plugin-app-name": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cordova-plugin-app-name/-/cordova-plugin-app-name-1.0.4.tgz", + "integrity": "sha1-FruwzRrwdAumNH66QPIgM0HU+z0=", + "requires": { + "xml2js": "0.4.19" + } + }, "cordova-plugin-firebase": { "version": "0.1.24", "resolved": "https://registry.npmjs.org/cordova-plugin-firebase/-/cordova-plugin-firebase-0.1.24.tgz", @@ -4674,6 +4682,22 @@ "os-homedir": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz" } }, + "xml2js": { + "version": "0.4.19", + "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.4.19.tgz", + "integrity": "sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q==", + "requires": { + "sax": "https://registry.npmjs.org/sax/-/sax-1.1.4.tgz", + "xmlbuilder": "9.0.4" + }, + "dependencies": { + "xmlbuilder": { + "version": "9.0.4", + "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-9.0.4.tgz", + "integrity": "sha1-UZy0ymhtAFqEINNJbz8MruzKWA8=" + } + } + }, "xmlbuilder": { "version": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-4.0.0.tgz", "integrity": "sha1-mLj2UcowqmJANvEn0RzGbce5B6M=", diff --git a/StoneIsland/package.json b/StoneIsland/package.json index 455528cc..5228669d 100644 --- a/StoneIsland/package.json +++ b/StoneIsland/package.json @@ -6,6 +6,7 @@ "dependencies": { "cordova": "^6.4.0", "cordova-ios": "^4.3.1", + "cordova-plugin-app-name": "^1.0.4", "cordova-plugin-firebase": "^0.1.24", "cordova-plugin-statusbar": "^2.2.3", "cordova-plugin-whitelist": "1", @@ -22,7 +23,10 @@ "plugins": { "cordova-plugin-whitelist": {}, "cordova-plugin-statusbar": {}, - "cordova-plugin-firebase": {} + "cordova-plugin-firebase": {}, + "cordova-plugin-app-name": { + "APP_NAME": "Stone Island" + } } } }
\ No newline at end of file diff --git a/StoneIsland/platforms/android/android.json b/StoneIsland/platforms/android/android.json index c87b55d4..11c3ca04 100755 --- a/StoneIsland/platforms/android/android.json +++ b/StoneIsland/platforms/android/android.json @@ -210,6 +210,16 @@ } ] } + }, + "config.xml": { + "parents": { + "/*": [ + { + "xml": "<preference name=\"AppName\" value=\"Stone Island\" />", + "count": 1 + } + ] + } } } }, @@ -263,6 +273,10 @@ }, "cordova-plugin-firebase": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-app-name": { + "APP_NAME": "Stone Island", + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": {}, @@ -404,6 +418,7 @@ "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" } }
\ No newline at end of file diff --git a/StoneIsland/platforms/android/assets/www/cordova_plugins.js b/StoneIsland/platforms/android/assets/www/cordova_plugins.js index f462f716..ea5e1643 100755 --- a/StoneIsland/platforms/android/assets/www/cordova_plugins.js +++ b/StoneIsland/platforms/android/assets/www/cordova_plugins.js @@ -139,7 +139,8 @@ module.exports.metadata = "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/android/platform_www/cordova_plugins.js b/StoneIsland/platforms/android/platform_www/cordova_plugins.js index f462f716..ea5e1643 100755 --- a/StoneIsland/platforms/android/platform_www/cordova_plugins.js +++ b/StoneIsland/platforms/android/platform_www/cordova_plugins.js @@ -139,7 +139,8 @@ module.exports.metadata = "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/android/res/xml/config.xml b/StoneIsland/platforms/android/res/xml/config.xml index 57fa94d1..3125e402 100644 --- a/StoneIsland/platforms/android/res/xml/config.xml +++ b/StoneIsland/platforms/android/res/xml/config.xml @@ -77,4 +77,5 @@ <param name="android-package" value="org.apache.cordova.firebase.FirebasePlugin" /> <param name="onload" value="true" /> </feature> + <preference name="AppName" value="Stone Island" /> </widget> diff --git a/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate Binary files differindex 06f45880..7d29ed0f 100644 --- a/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate +++ b/StoneIsland/platforms/ios/Stone Island.xcworkspace/xcuserdata/user.xcuserdatad/UserInterfaceState.xcuserstate diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist b/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist index 5516ebf3..0d23216d 100644 --- a/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist @@ -2,5 +2,39 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> + <key>AD_UNIT_ID_FOR_BANNER_TEST</key> + <string>ca-app-pub-3940256099942544/2934735716</string> + <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key> + <string>ca-app-pub-3940256099942544/4411468910</string> + <key>CLIENT_ID</key> + <string>426306878988-nuqlbd4k944sk5mm63vdubdptb3cpkmt.apps.googleusercontent.com</string> + <key>REVERSED_CLIENT_ID</key> + <string>com.googleusercontent.apps.426306878988-nuqlbd4k944sk5mm63vdubdptb3cpkmt</string> + <key>API_KEY</key> + <string>AIzaSyAp9tJ_gK45ZhRDiaKOCgvsztQMbhsD_Ms</string> + <key>GCM_SENDER_ID</key> + <string>426306878988</string> + <key>PLIST_VERSION</key> + <string>1</string> + <key>BUNDLE_ID</key> + <string>us.okfoc.stoneisland</string> + <key>PROJECT_ID</key> + <string>stone-island</string> + <key>STORAGE_BUCKET</key> + <string>stone-island.appspot.com</string> + <key>IS_ADS_ENABLED</key> + <true></true> + <key>IS_ANALYTICS_ENABLED</key> + <false></false> + <key>IS_APPINVITE_ENABLED</key> + <true></true> + <key>IS_GCM_ENABLED</key> + <true></true> + <key>IS_SIGNIN_ENABLED</key> + <true></true> + <key>GOOGLE_APP_ID</key> + <string>1:426306878988:ios:0efb92963073829a</string> + <key>DATABASE_URL</key> + <string>https://stone-island.firebaseio.com</string> </dict> </plist>
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/Resources/GoogleService-Info.plist b/StoneIsland/platforms/ios/Stone Island/Resources/Resources/GoogleService-Info.plist new file mode 100644 index 00000000..0d23216d --- /dev/null +++ b/StoneIsland/platforms/ios/Stone Island/Resources/Resources/GoogleService-Info.plist @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>AD_UNIT_ID_FOR_BANNER_TEST</key> + <string>ca-app-pub-3940256099942544/2934735716</string> + <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key> + <string>ca-app-pub-3940256099942544/4411468910</string> + <key>CLIENT_ID</key> + <string>426306878988-nuqlbd4k944sk5mm63vdubdptb3cpkmt.apps.googleusercontent.com</string> + <key>REVERSED_CLIENT_ID</key> + <string>com.googleusercontent.apps.426306878988-nuqlbd4k944sk5mm63vdubdptb3cpkmt</string> + <key>API_KEY</key> + <string>AIzaSyAp9tJ_gK45ZhRDiaKOCgvsztQMbhsD_Ms</string> + <key>GCM_SENDER_ID</key> + <string>426306878988</string> + <key>PLIST_VERSION</key> + <string>1</string> + <key>BUNDLE_ID</key> + <string>us.okfoc.stoneisland</string> + <key>PROJECT_ID</key> + <string>stone-island</string> + <key>STORAGE_BUCKET</key> + <string>stone-island.appspot.com</string> + <key>IS_ADS_ENABLED</key> + <true></true> + <key>IS_ANALYTICS_ENABLED</key> + <false></false> + <key>IS_APPINVITE_ENABLED</key> + <true></true> + <key>IS_GCM_ENABLED</key> + <true></true> + <key>IS_SIGNIN_ENABLED</key> + <true></true> + <key>GOOGLE_APP_ID</key> + <string>1:426306878988:ios:0efb92963073829a</string> + <key>DATABASE_URL</key> + <string>https://stone-island.firebaseio.com</string> +</dict> +</plist>
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist index 22781695..016faa32 100644 --- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist +++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist @@ -5,7 +5,7 @@ <key>CFBundleDevelopmentRegion</key> <string>English</string> <key>CFBundleDisplayName</key> - <string>${PRODUCT_NAME}</string> + <string>Stone Island</string> <key>CFBundleExecutable</key> <string>${EXECUTABLE_NAME}</string> <key>CFBundleIcons</key> @@ -17,7 +17,7 @@ <key>CFBundleInfoDictionaryVersion</key> <string>6.0</string> <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> + <string>Stone Island</string> <key>CFBundlePackageType</key> <string>APPL</string> <key>CFBundleShortVersionString</key> diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml index d955ecf8..46a44916 100755 --- a/StoneIsland/platforms/ios/Stone Island/config.xml +++ b/StoneIsland/platforms/ios/Stone Island/config.xml @@ -51,7 +51,11 @@ <param name="ios-package" value="CDVStatusBar" /> <param name="onload" value="true" /> </feature> - <name>Stone Island</name> + <feature name="FirebasePlugin"> + <param name="ios-package" value="FirebasePlugin" /> + <param name="onload" value="true" /> + </feature> + <name>StoneIsland</name> <description> Stone Island </description> @@ -90,8 +94,4 @@ <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="ShowSplashScreenSpinner" value="false" /> <preference name="AutoHideSplashScreen" value="false" /> - <feature name="FirebasePlugin"> - <param name="ios-package" value="FirebasePlugin" /> - <param name="onload" value="true" /> - </feature> </widget> diff --git a/StoneIsland/platforms/ios/ios.json b/StoneIsland/platforms/ios/ios.json index 9596fcd6..2db25e88 100644 --- a/StoneIsland/platforms/ios/ios.json +++ b/StoneIsland/platforms/ios/ios.json @@ -98,6 +98,18 @@ "xml": "<true />", "count": 1 } + ], + "CFBundleName": [ + { + "xml": "<string>Stone Island</string>", + "count": 1 + } + ], + "CFBundleDisplayName": [ + { + "xml": "<string>Stone Island</string>", + "count": 1 + } ] } }, @@ -190,6 +202,10 @@ }, "cordova-plugin-firebase": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-app-name": { + "APP_NAME": "Stone Island", + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": {}, @@ -357,6 +373,7 @@ "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" } }
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js index e39888f0..9005406d 100644 --- a/StoneIsland/platforms/ios/platform_www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/platform_www/cordova_plugins.js @@ -165,7 +165,8 @@ module.exports.metadata = "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/cordova_plugins.js b/StoneIsland/platforms/ios/www/cordova_plugins.js index e39888f0..9005406d 100644 --- a/StoneIsland/platforms/ios/www/cordova_plugins.js +++ b/StoneIsland/platforms/ios/www/cordova_plugins.js @@ -165,7 +165,8 @@ module.exports.metadata = "ionic-plugin-keyboard": "2.2.1", "phonegap-plugin-push": "1.9.2", "cordova-plugin-statusbar": "2.2.3", - "cordova-plugin-firebase": "0.1.24" + "cordova-plugin-firebase": "0.1.24", + "cordova-plugin-app-name": "1.0.4" }; // BOTTOM OF METADATA });
\ No newline at end of file diff --git a/StoneIsland/platforms/ios/www/js/lib/_router.js b/StoneIsland/platforms/ios/www/js/lib/_router.js index 9927712a..43438854 100755 --- a/StoneIsland/platforms/ios/www/js/lib/_router.js +++ b/StoneIsland/platforms/ios/www/js/lib/_router.js @@ -87,6 +87,9 @@ var SiteRouter = Router.extend({ else { app.view = app[name] } + + window.FirebasePlugin && window.FirebasePlugin.setScreenName(name) + app.header.set_back( !! app.view.back ) app.view.show() }.bind(this) diff --git a/StoneIsland/platforms/ios/www/js/lib/etc/push.js b/StoneIsland/platforms/ios/www/js/lib/etc/push.js index 14236728..00a2e839 100755 --- a/StoneIsland/platforms/ios/www/js/lib/etc/push.js +++ b/StoneIsland/platforms/ios/www/js/lib/etc/push.js @@ -105,8 +105,8 @@ var push = (function(){ return sdk.cms() + '/_services/push/' + key } push.got_push_notification = function(push_obj) { - console.log('We received this push notification: ' + JSON.stringify(push_obj)); - window.zsazsa = push_obj + // console.log('We received this push notification: ' + JSON.stringify(push_obj)); + app.blog.refresh() push_obj.additionalData = push_obj.additionalData || {} @@ -119,10 +119,10 @@ var push = (function(){ catch (e) { } - if (is_hub || push_obj.additionalData.url)) { + if (is_hub) { app.intro.$alert.show().html("[ HUB UPDATED ]") } - else { + else if (! push_obj.additionalData.url) { auth.clear_cart() app.intro.$alert.show().html("[ STORE UPDATED ]") } diff --git a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js index 6a61be1b..2743946a 100755 --- a/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js +++ b/StoneIsland/platforms/ios/www/js/lib/products/ProductView.js @@ -167,6 +167,8 @@ var ProductView = ScrollableView.extend({ this.$price.html(price) this.$body.html(body) + window.FirebasePlugin && window.FirebasePlugin.setScreenName('product:' + code) + this.$productHeader.toggleClass("wide", title.length > 48) var fits_large = !! this.fitLargeCodes[this.code] diff --git a/StoneIsland/platforms/ios/www/js/sdk/auth.js b/StoneIsland/platforms/ios/www/js/sdk/auth.js index fa8dd71c..bcfb2d3a 100755 --- a/StoneIsland/platforms/ios/www/js/sdk/auth.js +++ b/StoneIsland/platforms/ios/www/js/sdk/auth.js @@ -51,6 +51,9 @@ var auth = sdk.auth = (function(){ localStorage.setItem("yoox.access_token", access_token) localStorage.setItem("yoox.user_id", user_id) + + window.FirebasePlugin && window.FirebasePlugin.setUserId(user_id) + cb && cb() } auth.get_user = function(cb){ @@ -63,6 +66,7 @@ var auth = sdk.auth = (function(){ auth.user_id = -1 localStorage.removeItem("yoox.access_token") localStorage.removeItem("yoox.user_id") + cb && cb() } diff --git a/StoneIsland/plugins/android.json b/StoneIsland/plugins/android.json index 67cc3c41..6ad5cf91 100755 --- a/StoneIsland/plugins/android.json +++ b/StoneIsland/plugins/android.json @@ -53,6 +53,10 @@ }, "cordova-plugin-firebase": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-app-name": { + "APP_NAME": "Stone Island", + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": { diff --git a/StoneIsland/plugins/cordova-plugin-app-name/LICENSE b/StoneIsland/plugins/cordova-plugin-app-name/LICENSE new file mode 100644 index 00000000..3b7b70c7 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 blakgeek + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/StoneIsland/plugins/cordova-plugin-app-name/README.md b/StoneIsland/plugins/cordova-plugin-app-name/README.md new file mode 100644 index 00000000..a8680f30 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/README.md @@ -0,0 +1,26 @@ +# cordova-plugin-app-name +I created this plugin to address the issue of spaces in the names of my Cordova apps. + +## How does it work? +It adds an after_prepare hook that changes the value of app_name in strings.xml for Android and updates the "Project Name" and +"Project Display Name" in the plist for iOS. + +## How do I install it? + +If you're like me and using [Cordova CLI](http://cordova.apache.org/): +``` +cordova plugin add cordova-plugin-app-name --variable APP_NAME="Look <Ma> I Got Spaces and Stuff!" +``` + +or + +``` +phonegap local plugin add cordova-plugin-app-name --variable APP_NAME="Look <Ma> I Got Spaces and Stuff!" +``` + +## How do I use it? +Um ... See above :) + + + + diff --git a/StoneIsland/plugins/cordova-plugin-app-name/package.json b/StoneIsland/plugins/cordova-plugin-app-name/package.json new file mode 100644 index 00000000..5db6bb73 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/package.json @@ -0,0 +1,66 @@ +{ + "_from": "cordova-plugin-app-name", + "_id": "cordova-plugin-app-name@1.0.4", + "_inBundle": false, + "_integrity": "sha1-FruwzRrwdAumNH66QPIgM0HU+z0=", + "_location": "/cordova-plugin-app-name", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "cordova-plugin-app-name", + "name": "cordova-plugin-app-name", + "escapedName": "cordova-plugin-app-name", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#USER", + "/" + ], + "_resolved": "https://registry.npmjs.org/cordova-plugin-app-name/-/cordova-plugin-app-name-1.0.4.tgz", + "_shasum": "16bbb0cd1af0740ba6347eba40f2203341d4fb3d", + "_spec": "cordova-plugin-app-name", + "_where": "/Users/user/Sites/stone-island/StoneIsland/node_modules", + "bugs": { + "url": "https://github.com/blakgeek/cordova-plugin-app-name/issues" + }, + "bundleDependencies": false, + "cordova": { + "id": "cordova-plugin-app-name", + "platforms": [ + "ios", + "android" + ] + }, + "dependencies": { + "xml2js": "^0.4.16" + }, + "deprecated": false, + "description": "A Cordova/PhoneGap plugin that allows you to give you app a name with spaces and special characters and stuff.", + "devDependencies": { + "libxmljs": "^0.18.4" + }, + "homepage": "https://github.com/blakgeek/cordova-plugin-app-name", + "keywords": [ + "ecosystem:cordova", + "cordova-android", + "cordova-ios", + "cordova:plugin", + "spaces", + "app", + "name", + "rename" + ], + "license": "MIT", + "name": "cordova-plugin-app-name", + "repository": { + "type": "git", + "url": "git+https://github.com/blakgeek/cordova-plugin-app-name.git" + }, + "scripts": { + "postversion": "node scripts/sync-plugin-version.js; git add plugin.xml; git commit plugin.xml -m \"v${npm_package_version}\"" + }, + "version": "1.0.4" +} diff --git a/StoneIsland/plugins/cordova-plugin-app-name/plugin.xml b/StoneIsland/plugins/cordova-plugin-app-name/plugin.xml new file mode 100644 index 00000000..6e7c5480 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/plugin.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-app-name" version="1.0.4"> + <name>App Namer</name> + <author>Carlos "blakgeek" Lawton</author> + <description> + Cordova/Phonegap plugin that allows you to put spaces in the display name of your app. + </description> + <keywords>cordova, ios, app, name, spaces</keywords> + <license>MIT</license> + <engines> + <engine name="cordova" version=">=3.0.0"/> + </engines> + + <preference name="APP_NAME"/> + <hook type="after_prepare" src="src/rename-app.js"/> + + <platform name="android"> + <config-file target="config.xml" parent="/*"> + <preference name="AppName" value="$APP_NAME"/> + </config-file> + </platform> + + <platform name="ios"> + <config-file target="*-Info.plist" parent="CFBundleName"> + <string>$APP_NAME</string> + </config-file> + <config-file target="*-Info.plist" parent="CFBundleDisplayName"> + <string>$APP_NAME</string> + </config-file> + </platform> +</plugin> diff --git a/StoneIsland/plugins/cordova-plugin-app-name/scripts/npm-install.js b/StoneIsland/plugins/cordova-plugin-app-name/scripts/npm-install.js new file mode 100644 index 00000000..710905cf --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/scripts/npm-install.js @@ -0,0 +1,8 @@ +var exec = require('child_process').execSync; + +module.exports = function(context) { + + exec('npm install', { + cwd: context.opts.plugin.pluginInfo.dir + }); +};
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-app-name/scripts/sync-plugin-version.js b/StoneIsland/plugins/cordova-plugin-app-name/scripts/sync-plugin-version.js new file mode 100644 index 00000000..e3295cc9 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/scripts/sync-plugin-version.js @@ -0,0 +1,12 @@ +var fs = require('fs'); +var libxml = require('libxmljs'); +var version = process.env.npm_package_version; +var content = fs.readFileSync('plugin.xml'); +var xml = libxml.parseXmlString(content); +xml.get('/p:plugin', { + 'p': 'http://apache.org/cordova/ns/plugins/1.0' +}).attr({ + 'version': version +}); + +fs.writeFileSync('plugin.xml', xml.toString()); diff --git a/StoneIsland/plugins/cordova-plugin-app-name/src/rename-app.js b/StoneIsland/plugins/cordova-plugin-app-name/src/rename-app.js new file mode 100755 index 00000000..3eb4d211 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-app-name/src/rename-app.js @@ -0,0 +1,63 @@ +#!/usr/bin/env node + +var fs = require('fs'); +var path = require("path"); +var xml2js = require('xml2js'); +var parser = new xml2js.Parser(); +var builder = new xml2js.Builder({ + xmldec: { + version: '1.0', + encoding: 'UTF-8' + } +}); + +module.exports = function (context) { + + if(context.opts.platforms.indexOf('android') === -1) return; + + console.log('Attempting to set app name'); + + var projectRoot = context.opts.projectRoot; + var configPath = path.join(projectRoot, 'platforms', 'android', 'res', 'xml', 'config.xml'); + var stringsPath = path.join(projectRoot, 'platforms', 'android', 'res', 'values', 'strings.xml'); + var stringsXml, name; + + // make sure the android config file exists + try { + fs.accessSync(configPath, fs.F_OK); + } catch(e) { + return; + } + + name = getConfigParser(context, configPath).getPreference('AppName'); + + if (name) { + stringsXml = fs.readFileSync(stringsPath, 'UTF-8'); + parser.parseString(stringsXml, function (err, data) { + + data.resources.string.forEach(function (string) { + + if (string.$.name === 'app_name') { + + console.log('Setting App Name: ', name); + string._ = name; + } + }); + + fs.writeFileSync(stringsPath, builder.buildObject(data)); + + }); + } +}; + +function getConfigParser(context, config) { + var semver = context.requireCordovaModule('semver'); + + if (semver.lt(context.opts.cordova.version, '5.4.0')) { + ConfigParser = context.requireCordovaModule('cordova-lib/src/ConfigParser/ConfigParser'); + } else { + ConfigParser = context.requireCordovaModule('cordova-common/src/ConfigParser/ConfigParser'); + } + + return new ConfigParser(config); +} diff --git a/StoneIsland/plugins/fetch.json b/StoneIsland/plugins/fetch.json index e1f47bbb..4d0eafbb 100755 --- a/StoneIsland/plugins/fetch.json +++ b/StoneIsland/plugins/fetch.json @@ -122,5 +122,15 @@ }, "is_top_level": true, "variables": {} + }, + "cordova-plugin-app-name": { + "source": { + "type": "registry", + "id": "cordova-plugin-app-name" + }, + "is_top_level": true, + "variables": { + "APP_NAME": "Stone Island" + } } }
\ No newline at end of file diff --git a/StoneIsland/plugins/ios.json b/StoneIsland/plugins/ios.json index ad839f95..7ac7caec 100644 --- a/StoneIsland/plugins/ios.json +++ b/StoneIsland/plugins/ios.json @@ -50,6 +50,10 @@ }, "cordova-plugin-firebase": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-app-name": { + "APP_NAME": "Stone Island", + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": { diff --git a/StoneIsland/www/js/lib/_router.js b/StoneIsland/www/js/lib/_router.js index 9927712a..43438854 100755 --- a/StoneIsland/www/js/lib/_router.js +++ b/StoneIsland/www/js/lib/_router.js @@ -87,6 +87,9 @@ var SiteRouter = Router.extend({ else { app.view = app[name] } + + window.FirebasePlugin && window.FirebasePlugin.setScreenName(name) + app.header.set_back( !! app.view.back ) app.view.show() }.bind(this) diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index 6a61be1b..2743946a 100755 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -167,6 +167,8 @@ var ProductView = ScrollableView.extend({ this.$price.html(price) this.$body.html(body) + window.FirebasePlugin && window.FirebasePlugin.setScreenName('product:' + code) + this.$productHeader.toggleClass("wide", title.length > 48) var fits_large = !! this.fitLargeCodes[this.code] diff --git a/StoneIsland/www/js/sdk/auth.js b/StoneIsland/www/js/sdk/auth.js index fa8dd71c..bcfb2d3a 100755 --- a/StoneIsland/www/js/sdk/auth.js +++ b/StoneIsland/www/js/sdk/auth.js @@ -51,6 +51,9 @@ var auth = sdk.auth = (function(){ localStorage.setItem("yoox.access_token", access_token) localStorage.setItem("yoox.user_id", user_id) + + window.FirebasePlugin && window.FirebasePlugin.setUserId(user_id) + cb && cb() } auth.get_user = function(cb){ @@ -63,6 +66,7 @@ var auth = sdk.auth = (function(){ auth.user_id = -1 localStorage.removeItem("yoox.access_token") localStorage.removeItem("yoox.user_id") + cb && cb() } |
