diff --git a/.gitignore b/.gitignore index 0a7848506..7294d7d4d 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,7 @@ version.js android/package android/*.apk +android/*.keystore coverage/ diff --git a/README.md b/README.md index 598627475..9d7d1e3bd 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,32 @@ One solution is to use Copay with a Python version manager for 2.6. # Development +## Android APK + +System Requirements + +* Download [Android SDK](http://developer.android.com/sdk/index.html) +* Download and install [Crosswalk 8](https://crosswalk-project.org/#documentation/getting_started) (Use Linux setup for OSX) + +Add to your ~/.bash_profile or ~/.bashrc + +``` +export CROSSWALK="" +``` + +To build the APK run the script: + +``` +sh android/build.sh [-d] +``` +- The -d flag will package the apk in debug mode, allowing [remote debugging chrome](https://developer.chrome.com/devtools/docs/remote-debugging) +- The APK file is in **android/Copay_VERSION_arm.apk** + +To install the APK in your device run: + +``` +adb install -r Copay_VERSION_arm.apk +``` ## Google Chrome Extension diff --git a/TODO.md b/TODO.md index 209b292e1..bc9a34c43 100644 --- a/TODO.md +++ b/TODO.md @@ -30,33 +30,6 @@ It was developed to be run on OSX. The outputs are copied to the dist directory DMG is created with hdiutil EXE is created with makensis (brew install makensis) -## Android APK - -System Requirements - -* Download [Android SDK](http://developer.android.com/sdk/index.html) -* Download and install [Crosswalk](https://crosswalk-project.org/#documentation/getting_started) (Use Linux setup for OSX) - -Add to your ~/.bash_profile or ~/.bashrc - -``` -export CROSSWALK="" -``` - -To build the APK run the script: - -``` -sh android/build.sh [-d] -``` -- The -d flag will package the apk in debug mode, allowing [remote debugging chrome](https://developer.chrome.com/devtools/docs/remote-debugging) -- The APK file is in **android/Copay_VERSION_arm.apk** - -To install the APK in your device run: - -``` -adb install -r Copay_VERSION_arm.apk -``` - # Development diff --git a/android/build.sh b/android/build.sh index 111389d45..313aa0320 100644 --- a/android/build.sh +++ b/android/build.sh @@ -26,6 +26,16 @@ then DEBUG="--enable-remote-debugging" fi +if [[ $# -eq 1 && ! $1 = "-d" ]] +then + if [ ! -f $BUILDDIR/copay.keystore ] + then + echo "${OpenColor}${Red}* Can't build production app without a keystore${CloseColor}" + exit 1 + fi + PRODUCTION="--keystore-path=$BUILDDIR/copay.keystore --keystore-alias=copay_play --keystore-passcode=$1" +fi + # Move to the build directory cd $BUILDDIR @@ -48,13 +58,13 @@ checkOK echo "${OpenColor}${Green}* Copying all app files...${CloseColor}" sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json cd $BUILDDIR/.. -cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./android/icon.png} $APPDIR +cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./android/icon.png,./android/logo.png} $APPDIR checkOK # Building the APK echo "${OpenColor}${Green}* Building APK file...${CloseColor}" cd $CROSSWALK -python make_apk.py --manifest=$APPDIR/manifest.json --target-dir=$BUILDDIR --arch=arm $DEBUG +python make_apk.py --manifest=$APPDIR/manifest.json --package=com.bitpay.copay --arch=arm --target-dir=$BUILDDIR $DEBUG $PRODUCTION checkOK cd $BUILDDIR diff --git a/android/icon.png b/android/icon.png index 2a2a9bda9..84f38c3b6 100644 Binary files a/android/icon.png and b/android/icon.png differ diff --git a/android/logo.png b/android/logo.png new file mode 100644 index 000000000..1a324a9af Binary files /dev/null and b/android/logo.png differ diff --git a/android/manifest.json b/android/manifest.json index 88f9b2025..ff5336880 100644 --- a/android/manifest.json +++ b/android/manifest.json @@ -1,12 +1,21 @@ { "name": "Copay", "version": "APP_VERSION", - "app": { - "launch":{ - "local_path": "index.html" - } + "start_url": "index.html", + "permissions": [ + "Vibration" + ], + "xwalk_launch_screen": { + "ready_when": "complete", + "default": { + "background_color": "#2C3E50", + "image": "logo.png" + } }, "icons": { "128": "icon.png" - } + }, + "xwalk_hosts": [ + "https://*" + ] } diff --git a/img/notification.png b/img/notification.png new file mode 100644 index 000000000..70b0843c0 Binary files /dev/null and b/img/notification.png differ diff --git a/index.html b/index.html index 7e1d39cba..13c84811b 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,8 @@ - + + Copay - Multisignature Wallet @@ -138,7 +139,7 @@
Download seed backup + ng-show="!$root.wallet.publicKeyRing.isComplete()">Save seed backup
diff --git a/js/app.js b/js/app.js index 01c36efb6..cf5656438 100644 --- a/js/app.js +++ b/js/app.js @@ -33,6 +33,13 @@ var copayApp = window.copayApp = angular.module('copayApp', [ 'copayApp.directives', ]); +copayApp.config(function($sceDelegateProvider) { + $sceDelegateProvider.resourceUrlWhitelist([ + 'self', + 'mailto:**' + ]); +}); + angular.module('copayApp.filters', []); angular.module('copayApp.services', []); angular.module('copayApp.controllers', []); diff --git a/js/controllers/backup.js b/js/controllers/backup.js index f6fa34ad1..509163b9d 100644 --- a/js/controllers/backup.js +++ b/js/controllers/backup.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('copayApp.controllers').controller('BackupController', - function($scope, $rootScope, $location, $window, $timeout, $modal, backupService, walletFactory, controllerUtils) { + function($scope, $rootScope, backupService, walletFactory, controllerUtils) { $scope.download = function() { backupService.download($rootScope.wallet); }; diff --git a/js/services/backupService.js b/js/services/backupService.js index 0b7375c0e..41fbe559f 100644 --- a/js/services/backupService.js +++ b/js/services/backupService.js @@ -28,6 +28,17 @@ BackupService.prototype.download = function(wallet) { wallet: ew }); } + + // throw an email intent if we are in the mobile version + if (window.xwalk) { + var name = wallet.name ? wallet.name + ' ' : ''; + var partial = partial ? 'Partial ' : ''; + var subject = 'Copay - ' + name + 'Wallet ' + partial + 'Backup'; + var body = 'This is the encrypted backup of the wallet ' + wallet.id + ':\n\n' + ew; + var mailURL = encodeURI('mailto:?subject=' + subject + '&body=' + body); + return window.open(mailURL,'_blank'); + } + // otherwise lean on the browser implementation saveAs(blob, filename); }; diff --git a/js/services/notifications.js b/js/services/notifications.js index 4c3c00e4b..43668edec 100644 --- a/js/services/notifications.js +++ b/js/services/notifications.js @@ -198,7 +198,12 @@ factory('notification', ['$timeout', $timeout(function removeFromQueueTimeout() { queue.splice(queue.indexOf(notification), 1); }, settings[type].duration); + } + // Movile notification + window.navigator.vibrate([200,100,200]); + if (document.hidden && (type == 'info' || type == 'funds')) { + new window.Notification(title, {body: content, icon:'img/notification.png'}); } this.save();