mirror of https://github.com/BTCPrivate/copay.git
Merge pull request #191 from cmgustavo/ref/design-04
Adds scan tab. Fix grunt ios
This commit is contained in:
commit
2f0daa50aa
|
@ -259,8 +259,9 @@ module.exports = function(grunt) {
|
||||||
grunt.registerTask('chrome', ['exec:chrome']);
|
grunt.registerTask('chrome', ['exec:chrome']);
|
||||||
grunt.registerTask('wp', ['prod', 'exec:wp']);
|
grunt.registerTask('wp', ['prod', 'exec:wp']);
|
||||||
grunt.registerTask('wp-debug', ['default', 'exec:wp']);
|
grunt.registerTask('wp-debug', ['default', 'exec:wp']);
|
||||||
grunt.registerTask('ios', ['prod', 'exec:ios', 'exec:xcode']);
|
grunt.registerTask('ios', ['prod', 'exec:ios']);
|
||||||
grunt.registerTask('ios-debug', ['default', 'exec:ios', 'exec:xcode']);
|
grunt.registerTask('ios-debug', ['default', 'exec:ios']);
|
||||||
|
grunt.registerTask('ios-run', ['exec:xcode']);
|
||||||
grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
|
grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
|
||||||
grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
|
grunt.registerTask('android-debug', ['default', 'exec:android', 'exec:androidrun']);
|
||||||
grunt.registerTask('android', ['prod', 'exec:android']);
|
grunt.registerTask('android', ['prod', 'exec:android']);
|
||||||
|
|
|
@ -11,8 +11,7 @@ clean:
|
||||||
$(WORKDIR)android $(WORKDIR)ios $(WORKDIR)wp: config.xml
|
$(WORKDIR)android $(WORKDIR)ios $(WORKDIR)wp: config.xml
|
||||||
cordova create $@ com.bitpay.*NAMENOSPACE* *NAMECASENOSPACE* || echo "Project Path Existed"
|
cordova create $@ com.bitpay.*NAMENOSPACE* *NAMECASENOSPACE* || echo "Project Path Existed"
|
||||||
cp ProjectMakefile $@/Makefile
|
cp ProjectMakefile $@/Makefile
|
||||||
cp -af ../public/** $@/www
|
rm -r $@/www && ln -sF ../../public $@/www
|
||||||
sed "s/<\!-- PLACEHOLDER: CORDOVA SRIPT -->/<script type='text\/javascript' charset='utf-8' src='cordova.js'><\/script>/g" ../public/index.html > $@/www/index.html
|
|
||||||
cp config.xml $@/config.xml
|
cp config.xml $@/config.xml
|
||||||
make -C $@ $(subst $(WORKDIR),, $@)
|
make -C $@ $(subst $(WORKDIR),, $@)
|
||||||
|
|
||||||
|
|
|
@ -8,19 +8,17 @@
|
||||||
<meta name="format-detection" content="telephone=no">
|
<meta name="format-detection" content="telephone=no">
|
||||||
<link rel="stylesheet" type="text/css" href="css/ionic.min.css">
|
<link rel="stylesheet" type="text/css" href="css/ionic.min.css">
|
||||||
<link rel="stylesheet" type="text/css" href="css/copay.css">
|
<link rel="stylesheet" type="text/css" href="css/copay.css">
|
||||||
<title>{{index.appConfig.name}} - {{index.appConfig.description}}</title>
|
<title>{{index.appConfig.nameCase}} - {{index.appConfig.description}}</title>
|
||||||
<link rel="shortcut icon" href="img/favicon.ico">
|
<link rel="shortcut icon" href="img/favicon.ico">
|
||||||
</head>
|
</head>
|
||||||
<!-- <body ng-cloak class="ng-cloak"> -->
|
<body>
|
||||||
<body >
|
|
||||||
|
|
||||||
<ion-nav-view name="main"></ion-nav-view>
|
<ion-nav-view name="main"></ion-nav-view>
|
||||||
|
|
||||||
<script src="lib/ionic.bundle.min.js"></script>
|
<script src="lib/ionic.bundle.min.js"></script>
|
||||||
<script src="lib/angular.js"></script>
|
<script src="lib/angular.js"></script>
|
||||||
|
|
||||||
<!-- DO NOT DELETE THIS COMMET -->
|
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
|
||||||
<!-- PLACEHOLDER: CORDOVA SRIPT -->
|
|
||||||
|
|
||||||
<script src="js/copay.js"></script>
|
<script src="js/copay.js"></script>
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,21 @@
|
||||||
<div class="splash extra-padding-bottom p20t content text-center"
|
<ion-view>
|
||||||
ng-controller="disclaimerController as disclaimer" ng-init="disclaimer.init()">
|
<ion-content class="padding" ng-controller="disclaimerController" ng-init="init()">
|
||||||
<div class="row">
|
<h1 translate>WELCOME TO COPAY</h1>
|
||||||
<div class="medium-centered small-centered large-centered columns size-14">
|
<h3 translate>A multisignature bitcoin wallet</h3>
|
||||||
<span class="text-bold text-white" translate>WELCOME TO COPAY</span>
|
|
||||||
<p class="text-gray m0 text-light" translate>A multisignature bitcoin wallet</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="scrollArea">
|
|
||||||
<p class="enable_text_select m0">
|
|
||||||
<div class="size-14 text-gray" translate>Terms of Use</div>
|
|
||||||
<div ng-include="'views/includes/terms.html'"></div>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<h4 translate>Terms of Use</h4>
|
||||||
<p ng-show="disclaimer.lang != 'en'">
|
<p ng-include="'views/includes/terms.html'"></p>
|
||||||
<a class="center" ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<p class="text-gray columns size-12" translate>I affirm that I have read, understood, and agree with these terms.</p>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="start-button columns button-box">
|
<div class="padding-vertical" ng-show="lang != 'en'">
|
||||||
<button ng-click="disclaimer.accept()" class="button black expand round size-12 text-spacing m0" translate>
|
<a ng-click="$root.openExternalLink('https://copay.io/disclaimer')" translate>Official English Disclaimer</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p translate>I affirm that I have read, understood, and agree with these terms.</p>
|
||||||
|
|
||||||
|
<button ng-click="accept()" class="button button-block button-positive" translate>
|
||||||
I AGREE. GET STARTED
|
I AGREE. GET STARTED
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</ion-content>
|
||||||
</div>
|
</ion-view>
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<ion-modal-view ng-controller="scannerController">
|
<ion-modal-view>
|
||||||
<ion-header-bar align-title="center" class="tab-bar">
|
<ion-header-bar align-title="center" class="tab-bar">
|
||||||
<div class="left-small">
|
<div class="left-small">
|
||||||
<a ng-click="cancel()" class="p10">
|
<a ng-click="cancel()" class="p10">
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
</div>
|
</div>
|
||||||
<h1 class="title ellipsis" translate>QR-Scanner</h1>
|
<h1 class="title ellipsis" translate>QR-Scanner</h1>
|
||||||
</ion-header-bar>
|
</ion-header-bar>
|
||||||
<ion-content class="modal-content text-center fix-modals-touch" ng-init="init()">
|
<ion-content ng-controller="tabScanController" ng-init="init()">
|
||||||
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
||||||
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
<ion-view view-title="Scan" cache-view="false">
|
||||||
|
<ion-nav-bar class="bar-stable">
|
||||||
|
<ion-nav-title>Scan</ion-nav-title>
|
||||||
|
</ion-nav-bar>
|
||||||
|
<ion-content ng-controller="tabScanController" ng-init="init()">
|
||||||
|
|
||||||
|
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
||||||
|
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
||||||
|
|
||||||
|
</ion-content>
|
||||||
|
</ion-view>
|
|
@ -14,7 +14,7 @@ navigation history that also transitions its views in and out.
|
||||||
</ion-tab>
|
</ion-tab>
|
||||||
|
|
||||||
|
|
||||||
<ion-tab title="Scan" icon-off="ion-ios-chatboxes-outline" icon-on="ion-ios-chatboxes" href="#/scan">
|
<ion-tab title="Scan" icon-off="ion-ios-camera-outline" icon-on="ion-ios-camera" href="#/tabs/scan">
|
||||||
<ion-nav-view name="tab-scan"></ion-nav-view>
|
<ion-nav-view name="tab-scan"></ion-nav-view>
|
||||||
</ion-tab>
|
</ion-tab>
|
||||||
|
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('disclaimerController',
|
angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
function($scope, $rootScope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService, gettext, platformInfo, ongoingProcess) {
|
function($scope, $rootScope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService, gettext, platformInfo, ongoingProcess) {
|
||||||
var self = this;
|
var tries = 0;
|
||||||
self.tries = 0;
|
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
ongoingProcess.set('creatingWallet', true);
|
ongoingProcess.set('creatingWallet', true);
|
||||||
|
@ -20,13 +19,13 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
|
|
||||||
return $timeout(function() {
|
return $timeout(function() {
|
||||||
$log.warn('Retrying to create profile......');
|
$log.warn('Retrying to create profile......');
|
||||||
if (self.tries == 3) {
|
if (tries == 3) {
|
||||||
self.tries == 0;
|
tries == 0;
|
||||||
return create({
|
return create({
|
||||||
noWallet: true
|
noWallet: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.tries += 1;
|
tries += 1;
|
||||||
return create();
|
return create();
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
@ -36,9 +35,9 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.init = function(opts) {
|
$scope.init = function(opts) {
|
||||||
$ionicSideMenuDelegate.canDragContent(false);
|
$ionicSideMenuDelegate.canDragContent(false);
|
||||||
self.lang = uxLanguage.currentLanguage;
|
$scope.lang = uxLanguage.currentLanguage;
|
||||||
|
|
||||||
storageService.getProfile(function(err, profile) {
|
storageService.getProfile(function(err, profile) {
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
|
@ -57,7 +56,7 @@ angular.module('copayApp.controllers').controller('disclaimerController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.accept = function() {
|
$scope.accept = function() {
|
||||||
profileService.setDisclaimerAccepted(function(err) {
|
profileService.setDisclaimerAccepted(function(err) {
|
||||||
if (err) $log.error(err);
|
if (err) $log.error(err);
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,6 +1,63 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('scannerController', function($scope, $timeout) {
|
angular.module('copayApp.controllers').controller('tabScanController', function($scope, $timeout, $ionicModal, gettextCatalog, platformInfo) {
|
||||||
|
|
||||||
|
var isCordova = platformInfo.isCordova;
|
||||||
|
var isWP = platformInfo.isWP;
|
||||||
|
var isIOS = platformInfo.isIOS;
|
||||||
|
|
||||||
|
var onSuccess = function(result) {
|
||||||
|
$timeout(function() {
|
||||||
|
window.plugins.spinnerDialog.hide();
|
||||||
|
}, 100);
|
||||||
|
if (isWP && result.cancelled) return;
|
||||||
|
|
||||||
|
$timeout(function() {
|
||||||
|
var data = isIOS ? result : result.text;
|
||||||
|
$scope.onScan({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
var onError = function(error) {
|
||||||
|
$timeout(function() {
|
||||||
|
window.plugins.spinnerDialog.hide();
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.cordovaOpenScanner = function() {
|
||||||
|
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
||||||
|
$timeout(function() {
|
||||||
|
if (isIOS) {
|
||||||
|
cloudSky.zBar.scan({}, onSuccess, onError);
|
||||||
|
} else {
|
||||||
|
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
|
||||||
|
}
|
||||||
|
if ($scope.beforeScan) {
|
||||||
|
$scope.beforeScan();
|
||||||
|
}
|
||||||
|
}, 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.modalOpenScanner = function() {
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/scanner.html', {
|
||||||
|
scope: $scope,
|
||||||
|
animation: 'slide-in-up'
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.scannerModal = modal;
|
||||||
|
$scope.scannerModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.openScanner = function() {
|
||||||
|
if (isCordova) {
|
||||||
|
$scope.cordovaOpenScanner();
|
||||||
|
} else {
|
||||||
|
$scope.modalOpenScanner();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// QR code Scanner
|
// QR code Scanner
|
||||||
var video;
|
var video;
|
||||||
|
@ -73,6 +130,10 @@ angular.module('copayApp.controllers').controller('scannerController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
|
if (isCordova) {
|
||||||
|
$scope.cordovaOpenScanner();
|
||||||
|
return;
|
||||||
|
}
|
||||||
setScanner();
|
setScanner();
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if ($scope.beforeScan) {
|
if ($scope.beforeScan) {
|
||||||
|
@ -99,4 +160,8 @@ angular.module('copayApp.controllers').controller('scannerController', function(
|
||||||
$scope.scannerModal.remove();
|
$scope.scannerModal.remove();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.$on("$destroy", function(){
|
||||||
|
_scanStop();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
|
@ -1,66 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('qrScanner', function($rootScope, $timeout, $ionicModal, gettextCatalog, platformInfo) {
|
.directive('qrScanner', function() {
|
||||||
|
|
||||||
var isCordova = platformInfo.isCordova;
|
|
||||||
var isWP = platformInfo.isWP;
|
|
||||||
var isIOS = platformInfo.isIOS;
|
|
||||||
|
|
||||||
var controller = function($scope) {
|
|
||||||
|
|
||||||
var onSuccess = function(result) {
|
|
||||||
$timeout(function() {
|
|
||||||
window.plugins.spinnerDialog.hide();
|
|
||||||
}, 100);
|
|
||||||
if (isWP && result.cancelled) return;
|
|
||||||
|
|
||||||
$timeout(function() {
|
|
||||||
var data = isIOS ? result : result.text;
|
|
||||||
$scope.onScan({
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
}, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
var onError = function(error) {
|
|
||||||
$timeout(function() {
|
|
||||||
window.plugins.spinnerDialog.hide();
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cordovaOpenScanner = function() {
|
|
||||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
|
||||||
$timeout(function() {
|
|
||||||
if (isIOS) {
|
|
||||||
cloudSky.zBar.scan({}, onSuccess, onError);
|
|
||||||
} else {
|
|
||||||
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
|
|
||||||
}
|
|
||||||
if ($scope.beforeScan) {
|
|
||||||
$scope.beforeScan();
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.modalOpenScanner = function() {
|
|
||||||
$ionicModal.fromTemplateUrl('views/modals/scanner.html', {
|
|
||||||
scope: $scope,
|
|
||||||
animation: 'slide-in-up'
|
|
||||||
}).then(function(modal) {
|
|
||||||
$scope.scannerModal = modal;
|
|
||||||
$scope.scannerModal.show();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.openScanner = function() {
|
|
||||||
if (isCordova) {
|
|
||||||
$scope.cordovaOpenScanner();
|
|
||||||
} else {
|
|
||||||
$scope.modalOpenScanner();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
|
@ -68,7 +9,7 @@ angular.module('copayApp.directives')
|
||||||
onScan: "&",
|
onScan: "&",
|
||||||
beforeScan: "&"
|
beforeScan: "&"
|
||||||
},
|
},
|
||||||
controller: controller,
|
controller: 'tabScanController',
|
||||||
replace: true,
|
replace: true,
|
||||||
template: '<a ng-click="openScanner()"><i class="icon ion-qr-scanner"></i></a>'
|
template: '<a ng-click="openScanner()"><i class="icon ion-qr-scanner"></i></a>'
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.state('tabs.scan', {
|
||||||
|
url: '/scan',
|
||||||
|
needProfile: true,
|
||||||
|
views: {
|
||||||
|
'tab-scan': {
|
||||||
|
templateUrl: 'views/tab-scan.html',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
.state('tabs.send', {
|
.state('tabs.send', {
|
||||||
url: '/send',
|
url: '/send',
|
||||||
cache: false,
|
cache: false,
|
||||||
|
@ -652,9 +661,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}, 300);
|
}, 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (window.cordova.plugins.Keyboard) {
|
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
|
||||||
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false);
|
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
|
||||||
cordova.plugins.Keyboard.disableScroll(false);
|
cordova.plugins.Keyboard.disableScroll(true);
|
||||||
|
}
|
||||||
|
if (window.StatusBar) {
|
||||||
|
StatusBar.styleLightContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
$ionicPlatform.registerBackButtonAction(function(event) {
|
$ionicPlatform.registerBackButtonAction(function(event) {
|
||||||
|
|
|
@ -35,16 +35,12 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe
|
||||||
$log.debug("Wallet not complete at startup... redirecting")
|
$log.debug("Wallet not complete at startup... redirecting")
|
||||||
root.path('copayers');
|
root.path('copayers');
|
||||||
} else {
|
} else {
|
||||||
root.path('walletHome', function() {
|
root.path('tabs.home');
|
||||||
$rootScope.$emit('Local/SetTab', 'walletHome', true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
root.send = function() {
|
root.send = function() {
|
||||||
root.path('walletHome', function() {
|
root.path('tabs.send');
|
||||||
$rootScope.$emit('Local/SetTab', 'send');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
root.addWallet = function() {
|
root.addWallet = function() {
|
||||||
|
|
Loading…
Reference in New Issue