diff --git a/.gitignore b/.gitignore index 11a47b5cc..beeb52122 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,8 @@ i18n/crowdin_api_key.txt src/js/translations.js # cordova +plugins +platforms cordova/project-*/* cordova/*.keystore @@ -89,13 +91,15 @@ Session.vim src/sass/*.css .sass-cache -# copay public -public/css/* -public/lib/* -public/js/* -public/fonts +# copay www +www/css/* +www/lib/* +www/js/* +www/fonts ## templates +/config.xml +/ionic.config.json /appConfig.json externalServices.json cordova/Makefile @@ -104,8 +108,8 @@ app-template/bpapp cordova/ProjectMakefile cordova/config.xml cordova/wp/Package.appxmanifest -public/img/logo-negative.svg -public/img/logo.svg +www/img/logo-negative.svg +www/img/logo.svg src/js/appConfig.js src/js/externalServices.js @@ -116,8 +120,8 @@ app-template/bpapp cordova/ProjectMakefile cordova/config.xml cordova/wp/Package.appxmanifest -public/img/logo-negative.svg -public/img/logo.svg +www/img/logo-negative.svg +www/img/logo.svg src/js/appConfig.js cordova/android/res/ @@ -127,7 +131,3 @@ cordova/wp/*.jpg cordova/ios/splash/ cordova/ios/icons/ cordova/project/ - - - - diff --git a/Gruntfile.js b/Gruntfile.js index 36610478e..7d4225089 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -34,17 +34,23 @@ module.exports = function(grunt) { wpcopy: { command: 'make -C cordova wp-copy', }, + ios-debug: { + command: 'npm run build:ios', + }, ios: { - command: 'make -C cordova ios', + command: 'npm run build:ios-release', }, xcode: { - command: 'open cordova/project-ios/platforms/ios/*.xcodeproj', + command: 'npm run open:ios', + }, + android-debug: { + command: 'npm run build:android', }, android: { - command: 'make -C cordova android', + command: 'npm run build:android-release', }, androidrun: { - command: 'make -C cordova androidrun', + command: 'npm run run:android && npm run log:android', }, androidbuild: { command: 'cd cordova/project && cordova build android --release', @@ -125,7 +131,7 @@ module.exports = function(grunt) { 'angular-pbkdf2/angular-pbkdf2.js', 'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js' ], - dest: 'public/lib/angular.js' + dest: 'www/lib/angular.js' }, js: { src: [ @@ -144,11 +150,11 @@ module.exports = function(grunt) { 'bower_components/trezor-connect/login.js', 'node_modules/cordova-plugin-qrscanner/dist/cordova-plugin-qrscanner-lib.min.js' ], - dest: 'public/js/copay.js' + dest: 'www/js/copay.js' }, css: { src: ['src/sass/*.css', 'src/css/*.css'], - dest: 'public/css/copay.css' + dest: 'www/css/copay.css' } }, uglify: { @@ -157,8 +163,8 @@ module.exports = function(grunt) { }, prod: { files: { - 'public/js/copay.js': ['public/js/copay.js'], - 'public/lib/angular.js': ['public/lib/angular.js'] + 'www/js/copay.js': ['www/js/copay.js'], + 'www/lib/angular.js': ['www/lib/angular.js'] } } }, @@ -166,8 +172,8 @@ module.exports = function(grunt) { pot: { files: { 'i18n/po/template.pot': [ - 'public/index.html', - 'public/views/**/*.html', + 'www/index.html', + 'www/views/**/*.html', 'src/js/routes.js', 'src/js/services/*.js', 'src/js/controllers/**/*.js' @@ -190,19 +196,19 @@ module.exports = function(grunt) { expand: true, flatten: true, src: 'bower_components/ionic/release/fonts/ionicons.*', - dest: 'public/fonts/' + dest: 'www/fonts/' }, ionic_js: { expand: true, flatten: true, src: 'bower_components/ionic/release/js/ionic.bundle.min.js', - dest: 'public/lib/' + dest: 'www/lib/' }, linux: { files: [{ expand: true, cwd: 'webkitbuilds/', - src: ['.desktop', '../public/img/icons/favicon.ico', '../public/img/icons/icon-256.png'], + src: ['.desktop', '../www/img/icons/favicon.ico', '../www/img/icons/icon-256.png'], dest: 'webkitbuilds/Copay/linux64/', flatten: true, filter: 'isFile' @@ -224,10 +230,10 @@ module.exports = function(grunt) { platforms: ['win64', 'osx64', 'linux64'], buildDir: './webkitbuilds', version: '0.16.0', - macIcns: './public/img/icons/icon.icns', - exeIco: './public/img/icons/icon.ico' + macIcns: './www/img/icons/icon.icns', + exeIco: './www/img/icons/icon.ico' }, - src: ['./package.json', './public/**/*'] + src: ['./package.json', './www/**/*'] }, compress: { linux: { @@ -261,12 +267,12 @@ module.exports = function(grunt) { grunt.registerTask('wp', ['prod', 'exec:wp']); grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']); grunt.registerTask('wp-init', ['default', 'exec:wpinit']); - grunt.registerTask('ios', ['prod', 'exec:ios']); - grunt.registerTask('ios-debug', ['default', 'exec:ios']); + grunt.registerTask('ios', ['exec:ios']); + grunt.registerTask('ios-debug', ['exec:ios-debug']); grunt.registerTask('ios-run', ['exec:xcode']); grunt.registerTask('cordovaclean', ['exec:cordovaclean']); - grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']); - grunt.registerTask('android', ['prod', 'exec:android']); + grunt.registerTask('android-debug', ['exec:android-debug', 'exec:androidrun']); + grunt.registerTask('android', ['exec:android-release']); grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']); grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']); diff --git a/Makefile b/Makefile deleted file mode 100644 index c45efca58..000000000 --- a/Makefile +++ /dev/null @@ -1 +0,0 @@ -VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js` diff --git a/app-template/Makefile b/app-template/Makefile index 3a1c121ca..c4ce002e4 100644 --- a/app-template/Makefile +++ b/app-template/Makefile @@ -7,31 +7,11 @@ all: clean: rm -Rf $(WORKDIR)* - -$(WORKDIR)android $(WORKDIR)ios: config.xml - cordova create $@ com.bitpay.*BUNDLENAME* "*USERVISIBLENAME*" || echo "Project Path Existed" - cp ProjectMakefile $@/Makefile - rm -r $@/www && ln -sF ../../public $@/www - cp config.xml $@/config.xml - make -C $@ $(subst $(WORKDIR),, $@) - -ios: $(WORKDIR)ios - make -C $(WORKDIR)ios build-ios - -android: project-android - mkdir -p android/platforms/android/res/xml/ - mkdir -p $(WORKDIR)android/scripts - cp -R scripts/* $(WORKDIR)android/scripts - cp android/build-extras.gradle $(WORKDIR)android/platforms/android/build-extras.gradle - cp android/project.properties $(WORKDIR)android/platforms/android/project.properties - cp -R android/res/* $(WORKDIR)android/platforms/android/res - make -C $(WORKDIR)android build-android - wp-init: config.xml cordova create $(WORKDIR)$@ com.bitpay.*BUNDLENAME* "*USERVISIBLENAME*" || echo "Project Path Existed" cp ProjectMakefile $(WORKDIR)$@/Makefile mkdir -p $(WORKDIR)$@/www - cp -Rf ../public/* $(WORKDIR)$@/www + cp -Rf ../www/* $(WORKDIR)$@/www cp config.xml $(WORKDIR)$@/config.xml make -C $(WORKDIR)$@ $(subst $(WORKDIR),, $(WORKDIR)$@) @@ -43,10 +23,5 @@ wp-copy: cp -rvf wp/SplashScreenImage.jpg $(WORKDIR)wp/platforms/wp8/ cp -rvf wp/ApplicationIcon.png $(WORKDIR)wp/platforms/wp8/ cp -rvf wp/Background.png $(WORKDIR)wp/platforms/wp8/ - cp -rvf ../public/* $(WORKDIR)wp/www + cp -rvf ../www/* $(WORKDIR)wp/www wp/fix-svg.sh - - -androidrun: - make -C $(WORKDIR)android run - adb logcat | grep chromium diff --git a/app-template/ProjectMakefile b/app-template/ProjectMakefile index 1cf67c91d..ee503f461 100644 --- a/app-template/ProjectMakefile +++ b/app-template/ProjectMakefile @@ -5,21 +5,13 @@ plugins: cordova prepare rm -rf platforms/android/res/values-es -ios-platform android-platform wp8-platform: +wp8-platform: cordova platforms add $(subst -platform,,$@) || echo "Platform already added" -ios: ios-platform plugins - cordova plugin add https://github.com/tjwoon/csZBar.git - cordova plugin add phonegap-plugin-push@1.5.3 - -android: android-platform plugins - cordova plugin add https://github.com/jrontend/phonegap-plugin-barcodescanner - cordova plugin add phonegap-plugin-push@1.2.3 - wp: wp8-platform plugins cordova plugin add https://github.com/jrontend/phonegap-plugin-barcodescanner -build-ios build-android build-wp8: +build-wp8: cordova build $(subst build-,,$@) run: diff --git a/app-template/apply.js b/app-template/apply.js index 7c17ff1ce..ab705912b 100755 --- a/app-template/apply.js +++ b/app-template/apply.js @@ -5,10 +5,11 @@ // var templates = { - 'package.json': '/', 'Makefile': 'cordova/', 'ProjectMakefile': 'cordova/', 'config.xml': 'cordova/', + 'config-template.xml': '/', + 'ionic.config.json': '/', 'Package.appxmanifest': 'cordova/wp/', '.desktop': 'webkitbuilds/', 'setup-win.iss': 'webkitbuilds/', @@ -60,6 +61,9 @@ Object.keys(templates).forEach(function(k) { process.exit(1); } + if(k === 'config-template.xml'){ + k = 'config.xml'; + } fs.writeFileSync('../' + targetDir + k, content, 'utf8'); }); @@ -113,7 +117,7 @@ function copyDir(from, to, cb) { } -copyDir(configDir + '/img/', '../public/img/', function() { +copyDir(configDir + '/img/', '../www/img/', function() { copyDir(configDir + '/androidRes/', '../cordova/android/res/', function() { copyDir(configDir + '/iosIcons/', '../cordova/ios/icons/', function() { copyDir(configDir + '/iosSplash/', '../cordova/ios/splash/', function() { diff --git a/app-template/config-template.xml b/app-template/config-template.xml new file mode 100644 index 000000000..83e00b2ee --- /dev/null +++ b/app-template/config-template.xml @@ -0,0 +1,82 @@ + + + *USERVISIBLENAME* + + *PURPOSELINE* + + + BitPay Inc. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app-template/ionic.config.json b/app-template/ionic.config.json new file mode 100644 index 000000000..a4147056b --- /dev/null +++ b/app-template/ionic.config.json @@ -0,0 +1,4 @@ +{ + "name": "*USERVISIBLENAME*", + "app_id": "com.bitpay.*BUNDLENAME*" +} diff --git a/app-template/package.json b/app-template/package.json index 8dc7f749c..d62d1ff5d 100644 --- a/app-template/package.json +++ b/app-template/package.json @@ -11,10 +11,10 @@ "multisignature", "bitcore" ], - "main": "public/index.html", + "main": "www/index.html", "window": { "title": "*USERVISIBLENAME* - *PURPOSELINE*", - "icon": "./public/img/icons/icon-256.png", + "icon": "./www/img/icons/icon-256.png", "toolbar": false, "show": true, "visible": true, diff --git a/app-template/setup-win.iss b/app-template/setup-win.iss index 0cb3cba5c..d9f6eaa30 100755 --- a/app-template/setup-win.iss +++ b/app-template/setup-win.iss @@ -34,7 +34,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{ [Files] Source: "*PACKAGENAME*\win64\*PACKAGENAME*.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "*PACKAGENAME*\win64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "../public/img/icons/favicon.ico"; DestDir: "{app}"; DestName: "icon.ico"; Flags: ignoreversion +Source: "../www/img/icons/favicon.ico"; DestDir: "{app}"; DestName: "icon.ico"; Flags: ignoreversion ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Icons] diff --git a/app.js b/app.js deleted file mode 100644 index b4909fd2d..000000000 --- a/app.js +++ /dev/null @@ -1,13 +0,0 @@ -var express = require('express'); -var path = require('path'); -var app = express(); -app.use(express.static(__dirname + '/public')); - -var port = process.env.PORT || 3000; -app.listen(port); -console.log("App listening on port " + port); - -app.get('*', function(req, res) { - res.sendFile(path.join(__dirname, 'public')); -}); - diff --git a/chrome-app/Makefile b/chrome-app/Makefile index d862e8c9c..70fc175ff 100644 --- a/chrome-app/Makefile +++ b/chrome-app/Makefile @@ -9,16 +9,16 @@ BASE=$(CURDIR) all: $(ZIPFILE) -dir: +dir: rm -rf $(BUILDDIR) mkdir -p $(BUILDDIR) cp manifest.json $(BUILDDIR)/manifest.json cp -vf $(INITIAL) $(BUILDDIR) files: - cd ../public && rsync -rLRv --exclude-from $(BASE)/exclude $(INCLUDE) $(BASE)/$(BUILDDIR) && cd - + cd ../www && rsync -rLRv --exclude-from $(BASE)/exclude $(INCLUDE) $(BASE)/$(BUILDDIR) && cd - cd .. && rsync -rLRv ./bower_components/trezor-connect/chrome/* $(BASE)/$(BUILDDIR)/ && cd - - + $(ZIPFILE): dir files cd $(BUILDDIR) diff --git a/package.json b/package.json index 443069cd0..278d07ef4 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,4 @@ - { - "//":"PLEASE! Do not edit this file directly", - "//":" Modify it at app-template/", - - "name": "bitpay-wallet", - "description": "Secure Bitcoin Storage", +{ "author": "BitPay", "version": "0.14.0", "keywords": [ @@ -14,27 +9,6 @@ "multisignature", "bitcore" ], - "main": "public/index.html", - "window": { - "title": "BitPay Wallet - Secure Bitcoin Storage", - "icon": "./public/img/icons/icon-256.png", - "toolbar": false, - "show": true, - "visible": true, - "resizable": true, - "frame": true, - "width": 400, - "height": 600, - "position": "center", - "fullscreen": false - }, - "webkit": { - "page-cache": false, - "java": false, - "plugin": false - }, - "dom_storage_quota": 200, - "id": "jid1-x7bV5evAaI1P9Q", "homepage": "https://github.com/bitpay/copay", "license": "MIT", "repository": { @@ -85,22 +59,41 @@ "mocha": "^2.4.5", "pbkdf2": "^3.0.4", "phantomjs-prebuilt": "^2.1.7", - "shelljs": "^0.3.0", - "xcode": "^0.8.2" + "shelljs": "^0.3.0" }, "scripts": { - "preinstall": "bower install && npm i fs-extra", - "build": "grunt", - "apply:copay": "cd app-template && node apply.js", - "apply:bitpay-wallet": "cd app-template && node apply.js bitpay-wallet", - "start": "npm run build && node app.js", - "watch": "grunt watch", - "test": "./node_modules/.bin/grunt test-coveralls", - "clean": "git clean -dfx", - "start:ios": "npm run build && cd cordova && trash project-ios && make ios && open project-ios/platforms/ios/BitPay\\ Wallet.xcodeproj", - "start:android": "npm run build && cd cordova && trash project-android && make android && open -a /Applications/Android\\ Studio.app project-android/platforms/android" + "preinstall": "bower install && npm i fs-extra", + "postinstall": "npm run apply:bitpay && cordova prepare", + "start": "npm run build:www && ionic serve --nolivereload --nogulp", + "start:ios": "npm run build:www && npm run build:ios && npm run open:ios", + "start:android": "npm run build:www && npm run build:android && npm run open:android", + "watch": "grunt watch", + "build:www": "grunt", + "build:www-release": "grunt prod", + "build:ios": "cordova prepare ios && cordova build ios --debug", + "build:android": "cordova prepare android && cordova build android --debug", + "build:ios-release": "cordova prepare ios && cordova build ios --release", + "build:android-release": "cordova prepare android && cordova build android --release", + "open:ios": "open platforms/ios/*.xcodeproj", + "open:android": "open -a open -a /Applications/Android\\ Studio.app platforms/android", + "final:www": "npm run clean && npm run build:www-release", + "final:ios": "npm run final:www && npm run build:ios-release && npm run open:ios", + "final:android": "npm run final:www && npm run build:android-release && npm run open:android", + "final:all-mac": "npm run final:www npm run build:ios-release npm run build:android-release && npm run open:ios && npm run open:android", + "run:android": "cordova run android --device", + "log:android": "adb logcat | grep chromium", + "apply:copay": "cd app-template && node apply.js", + "apply:bitpay": "cd app-template && node apply.js bitpay-wallet", + "test": "./node_modules/.bin/grunt test-coveralls", + "clean": "git clean -dfx && npm install" }, "devDependencies": { - "trash-cli": "^1.4.0" + "androidmanifest": "^2.0.0", + "cordova": "^5.4.1", + "globby": "^6.0.0", + "ionic": "^2.1.0", + "plist": "^2.0.1", + "trash-cli": "^1.4.0", + "xcode": "^0.8.2" } } diff --git a/cordova/scripts/afterRun.js b/util/hooks/android/prohibit-cloud-backups-in-android-manifest.js similarity index 100% rename from cordova/scripts/afterRun.js rename to util/hooks/android/prohibit-cloud-backups-in-android-manifest.js