diff --git a/hooks/after_prepare/020_remove_code.js b/hooks/after_prepare/020_remove_code.js index 8b518ab85611d1ca8fb077fd24a1873e6d8ee0ce..89eb5b53b6d788b12387ab5261edecbdb795820f 100755 --- a/hooks/after_prepare/020_remove_code.js +++ b/hooks/after_prepare/020_remove_code.js @@ -1,7 +1,6 @@ #!/usr/bin/env node "use strict"; var gulp = require('gulp'); -var gutil = require('gulp-util'); var path = require("path"); var removeCode = require('gulp-remove-code'); var removeHtml = require('gulp-html-remove'); @@ -9,9 +8,7 @@ var es = require('event-stream'); var ngAnnotate = require('gulp-ng-annotate'); var htmlmin = require('gulp-htmlmin'); -var cmd = process.env.CORDOVA_CMDLINE; var rootdir = process.argv[2]; -var argv = require('yargs').argv; if (rootdir) { @@ -31,11 +28,18 @@ if (rootdir) { var pluginPath = path.join(wwwPath, 'plugins') + '/es'; + process.stdout.write('Removing unused code for device \n'); + + // Compute options {device-<platform>: true} + var platformDeviceRemoveOptions = {}; + platformDeviceRemoveOptions['device-' + platform] = true; + // Removing unused code for device... es.concat( // Remove unused HTML tags gulp.src([wwwPath + '/templates/**/*.html', pluginPath + '/templates/**/*.html']) .pipe(removeCode({device: true})) + .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true} .pipe(removeHtml('.hidden-xs.hidden-sm')) .pipe(removeHtml('.hidden-device')) .pipe(removeHtml('[remove-if][remove-if="device"]')) @@ -44,6 +48,7 @@ if (rootdir) { gulp.src(path.join(wwwPath, 'index.html')) .pipe(removeCode({device: true})) + .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true} .pipe(removeHtml('.hidden-xs.hidden-sm')) .pipe(removeHtml('.hidden-device')) .pipe(removeHtml('[remove-if][remove-if="device"]')) @@ -53,11 +58,13 @@ if (rootdir) { // Remove unused JS code + add ng annotations gulp.src([wwwPath + '/js/**/*.js']) .pipe(removeCode({device: true})) + .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true} .pipe(ngAnnotate({single_quotes: true})) .pipe(gulp.dest(wwwPath + '/dist/dist_js/app')), gulp.src([pluginPath + '/js/**/*.js']) .pipe(removeCode({device: true})) + .pipe(removeCode(platformDeviceRemoveOptions)) // = {device-<platform>: true} .pipe(ngAnnotate({single_quotes: true})) .pipe(gulp.dest(wwwPath + '/dist/dist_js/plugins')) ); diff --git a/hooks/after_prepare/021_template_cache.js b/hooks/after_prepare/021_template_cache.js index f7deb1f293f258d950730603cdd1103b15a3090b..13d7245bb59c2c657b1473dbdb5acaee3c212f60 100755 --- a/hooks/after_prepare/021_template_cache.js +++ b/hooks/after_prepare/021_template_cache.js @@ -1,13 +1,10 @@ #!/usr/bin/env node "use strict"; var gulp = require('gulp'); -var gutil = require('gulp-util'); var path = require("path"); var templateCache = require('gulp-angular-templatecache'); var es = require('event-stream'); -var cmd = process.env.CORDOVA_CMDLINE; var rootdir = process.argv[2]; -var argv = require('yargs').argv; if (rootdir) { diff --git a/hooks/after_prepare/022_translate.js b/hooks/after_prepare/022_translate.js index 354418e67d6521a67bd750dead9eb6bb17de9f63..ea6a784b5935f7d00ce18e1f2c3be50267bb782a 100755 --- a/hooks/after_prepare/022_translate.js +++ b/hooks/after_prepare/022_translate.js @@ -1,12 +1,9 @@ #!/usr/bin/env node "use strict"; var gulp = require('gulp'); -var gutil = require('gulp-util'); var path = require("path"); var es = require('event-stream'); -var cmd = process.env.CORDOVA_CMDLINE; var rootdir = process.argv[2]; -var argv = require('yargs').argv; var ngTranslate = require('gulp-angular-translate'); if (rootdir) { diff --git a/hooks/after_prepare/040_useref.js b/hooks/after_prepare/040_useref.js index dcc2b04641576efd68abcd58276917fa857877b9..848d77e70c86877b632e21768fd0d4ade3fd6420 100755 --- a/hooks/after_prepare/040_useref.js +++ b/hooks/after_prepare/040_useref.js @@ -1,7 +1,6 @@ #!/usr/bin/env node "use strict"; var gulp = require('gulp'); -var gutil = require('gulp-util'); var path = require("path"); var es = require('event-stream'); var useref = require('gulp-useref'); @@ -13,7 +12,6 @@ var revReplace = require('gulp-rev-replace'); var cmd = process.env.CORDOVA_CMDLINE; var rootdir = process.argv[2]; -var argv = require('yargs').argv; var skip = true; if (cmd.indexOf("--release") > -1 || cmd.indexOf("--useref") > -1) { diff --git a/hooks/after_prepare/050_clean_unused_directories.js b/hooks/after_prepare/050_clean_unused_directories.js index 99bd43fa5631ce1d1fa90e1490eeeb4b750419e3..049a7aa90abee76e2ee9ae5cb617ea37f9d7723a 100755 --- a/hooks/after_prepare/050_clean_unused_directories.js +++ b/hooks/after_prepare/050_clean_unused_directories.js @@ -47,7 +47,7 @@ if (rootdir && !skip) { '!'+path.join(wwwPath, 'lib'), '!'+path.join(wwwPath, 'lib', 'ionic'), '!'+path.join(wwwPath, 'lib', 'ionic', 'fonts'), - '!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', '*.*') + '!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', '**', '*') ]); } } diff --git a/hooks/before_prepare/02_jshint.js b/hooks/before_prepare/02_jshint.js index 9316017ff8543c474c83092c435c2910564ada64..992a2bfdf18f3acb49cfe0747a5b5d3c2cd8d56f 100755 --- a/hooks/before_prepare/02_jshint.js +++ b/hooks/before_prepare/02_jshint.js @@ -12,7 +12,7 @@ var foldersToProcess = [ 'js/services', 'plugins/es/js', 'plugins/es/js/controllers', - //'plugins/es/js/entities', + 'plugins/es/js/entities', 'plugins/es/js/services' ]; diff --git a/www/index.html b/www/index.html index aad157b31a7f9eee083ee0b5920ce5c9f0f284e8..266b86a43a46b90427308dd58bf89cc938f3133c 100644 --- a/www/index.html +++ b/www/index.html @@ -44,20 +44,23 @@ <script src="lib/ionic/js/angular/angular-bind-notifier.min.js"></script> <script src="lib/ionic/js/angular/angular-image-crop.js"></script> <script src="js/vendor/base58.js" async></script> - <!--removeIf(device)--> + <!--removeIf(device-android)--> + <!--removeIf(device-ios)--> <script src="js/vendor/nacl_factory.js" async></script> <script src="js/vendor/scrypt-em.js" async></script> <script src="js/vendor/base64.js" async></script> - <!--endRemoveIf(device)--> + <!--endRemoveIf(device-ios)--> + <!--endRemoveIf(device-android)--> <!--removeIf(no-device)--> <script src="js/vendor/sha256.min.js" async></script> + <script src="js/vendor/ng-cordova.min.js"></script> <!--endRemoveIf(no-device)--> + <!-- endbuild --> <!--removeIf(no-device)--> - <script src="js/vendor/ng-cordova.min.js"></script> <script src="cordova.js"></script> <!--endRemoveIf(no-device)--> - <!-- endbuild --> + <!-- build:js dist_js/cesium.js --> <!-- services --> <script src="dist/dist_js/app/services/settings-services.js"></script> diff --git a/www/js/config.js b/www/js/config.js index 640b786a5f07a08b05346c8842a0cbd9f272b618..f6c8b636e5d9a51255362c0b52750277cddb2887 100644 --- a/www/js/config.js +++ b/www/js/config.js @@ -45,7 +45,7 @@ angular.module("cesium.config", []) } }, "version": "0.9.31", - "build": "2017-02-15T17:48:36.110Z", + "build": "2017-02-16T07:14:45.254Z", "newIssueUrl": "https://github.com/duniter/cesium/issues/new?labels=bug" }) diff --git a/www/js/services/crypto-services.js b/www/js/services/crypto-services.js index 8897f093fde4f5c8183bd996c9bff09c5e29fdfe..d1a32cac7018c6064bb8ff0647dfb8dfe9e8bfd7 100644 --- a/www/js/services/crypto-services.js +++ b/www/js/services/crypto-services.js @@ -14,7 +14,9 @@ angular.module('cesium.crypto.services', ['ngResource', 'cesium.device.services' var that = this; this.copy = function(source) { + console.debug('Copying object:' + (typeof source)); _.forEach(_.keys(source), function(key) { + console.debug('copying key:' + key + ' of type ' + (typeof source[key])); that[key] = source[key]; }); }; @@ -612,11 +614,13 @@ angular.module('cesium.crypto.services', ['ngResource', 'cesium.device.services' var serviceImpl; - // Use cordova implementation, when exists - if (Device.enable && window.plugins && !window.plugins.MiniSodium) { + // Use Cordova plugin implementation, when exists + if (Device.enable && window.plugins && window.plugins.MiniSodium && crypto && crypto.getRandomValues) { + console.debug('[crypto] Loading Cordova MiniSodium implementation...'); serviceImpl = new CordovaServiceFactory(); } else { + console.debug('[crypto] Loading FullJS implementation...'); serviceImpl = new FullJSServiceFactory(); } diff --git a/www/plugins/es/js/entities/comment.js b/www/plugins/es/js/entities/comment.js index c425106882cb6261423de6d8a2a411fd7a4a80cc..86c240aa973172fd7a9877747a21cd2c342d9c05 100644 --- a/www/plugins/es/js/entities/comment.js +++ b/www/plugins/es/js/entities/comment.js @@ -116,6 +116,6 @@ function Comment(id, json) { // Init from json if (json && typeof json === "object") { - that.copyFromJson(json) + that.copyFromJson(json); } } diff --git a/www/plugins/es/js/entities/notification.js b/www/plugins/es/js/entities/notification.js index 1df01c299604034a51a24252f7eed5c909f2c0c5..c7b553154be00d28f1d11d603396e7295041fdb2 100644 --- a/www/plugins/es/js/entities/notification.js +++ b/www/plugins/es/js/entities/notification.js @@ -32,6 +32,8 @@ function Notification(json, markAsReadCallback) { } }; + var pubkeys; + // Membership if (json.code.startsWith('MEMBER_')) { that.avatarIcon = 'ion-person'; @@ -42,7 +44,7 @@ function Notification(json, markAsReadCallback) { else if (json.code.startsWith('TX_')) { that.avatarIcon = 'ion-card'; that.icon = (json.code == 'TX_SENT') ? 'ion-paper-airplane dark' : 'ion-archive balanced'; - var pubkeys = json.params.length > 0 ? json.params[0] : null; + pubkeys = json.params.length > 0 ? json.params[0] : null; if (pubkeys && pubkeys.indexOf(',') == -1) { that.pubkey = pubkeys; } @@ -62,7 +64,7 @@ function Notification(json, markAsReadCallback) { else if (json.code.startsWith('MESSAGE_')) { that.avatarIcon = 'ion-email'; that.icon = 'ion-email dark'; - var pubkeys = json.params.length > 0 ? json.params[0] : null; + pubkeys = json.params.length > 0 ? json.params[0] : null; if (pubkeys && pubkeys.indexOf(',') == -1) { that.pubkey = pubkeys; }