Merge pull request #909 from yemel/feature/android-package

Android packaging with Crosswalk
This commit is contained in:
Matias Alejo Garcia 2014-07-17 23:08:53 -03:00
commit 9091ee0d73
13 changed files with 81 additions and 38 deletions

1
.gitignore vendored
View File

@ -49,6 +49,7 @@ version.js
android/package
android/*.apk
android/*.keystore
coverage/

View File

@ -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="<path to Crosswalk directory>"
```
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

27
TODO.md
View File

@ -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="<path to Crosswalk directory>"
```
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

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
android/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

@ -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://*"
]
}

BIN
img/notification.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -3,7 +3,8 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="HandheldFriendly" content="true">
<title>Copay - Multisignature Wallet</title>
<link rel="stylesheet" href="css/foundation.min.css">
<link rel="stylesheet" href="css/foundation-icons.css">
@ -138,7 +139,7 @@
<div class="large-12 medium-12 small-12 columns">
<div class="line-dashed">
<a ng-click="dowloadBackup()"
ng-show="!$root.wallet.publicKeyRing.isComplete()">Download seed backup</a>
ng-show="!$root.wallet.publicKeyRing.isComplete()">Save seed backup</a>
<button class="button primary radius right"
ng-click="backup()"
ng-show="!$root.wallet.publicKeyRing.isBackupReady()"
@ -849,7 +850,7 @@
<h4 class="large-12 columns"><i class="fi-download m10r"></i> Backup </h4>
<p class="large-8 columns text-gray"> Its important to back up your wallet so that you can recover your wallet in case of disaster </p>
<div class="large-4 columns">
<a class="button radius secondary expand" ng-click="download()">Download File</a>
<a class="button radius secondary expand" ng-click="download()">Save Backup</a>
</div>
</div>
<div class="large-8 columns large-centered line-dashed-h"> </div>

View File

@ -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', []);

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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();