diff --git a/Gruntfile.js b/Gruntfile.js index 2e25ce5a3..b56a24bce 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -259,8 +259,9 @@ module.exports = function(grunt) { grunt.registerTask('chrome', ['exec:chrome']); grunt.registerTask('wp', ['prod', 'exec:wp']); grunt.registerTask('wp-debug', ['default', 'exec:wp']); - grunt.registerTask('ios', ['prod', 'exec:ios', 'exec:xcode']); - grunt.registerTask('ios-debug', ['default', 'exec:ios', 'exec:xcode']); + grunt.registerTask('ios', ['prod', 'exec:ios']); + grunt.registerTask('ios-debug', ['default', 'exec:ios']); + 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']); diff --git a/app-template/Makefile b/app-template/Makefile index bb6c3c868..26ec7a8b7 100644 --- a/app-template/Makefile +++ b/app-template/Makefile @@ -1,32 +1,31 @@ -.PHONY: ios android wp +.PHONY: ios android wp WORKDIR=project- all: -clean: - rm -Rf $(WORKDIR)* +clean: + rm -Rf $(WORKDIR)* $(WORKDIR)android $(WORKDIR)ios $(WORKDIR)wp: config.xml cordova create $@ com.bitpay.*NAMENOSPACE* *NAMECASENOSPACE* || echo "Project Path Existed" cp ProjectMakefile $@/Makefile - cp -af ../public/** $@/www - sed "s/<\!-- PLACEHOLDER: CORDOVA SRIPT -->/ - - + diff --git a/public/views/disclaimer.html b/public/views/disclaimer.html index d70ca6323..c86d3aa85 100644 --- a/public/views/disclaimer.html +++ b/public/views/disclaimer.html @@ -1,34 +1,21 @@ -
-
-
- WELCOME TO COPAY -

A multisignature bitcoin wallet

-
-
-
-
-

-

Terms of Use
-
-

-
-
+ + +

WELCOME TO COPAY

+

A multisignature bitcoin wallet

- -
-

I affirm that I have read, understood, and agree with these terms.

-
-
+

Terms of Use

+

-
- -
-
-
+ + + + diff --git a/public/views/modals/scanner.html b/public/views/modals/scanner.html index 03752e79d..f025a5431 100644 --- a/public/views/modals/scanner.html +++ b/public/views/modals/scanner.html @@ -1,4 +1,4 @@ - +

QR-Scanner

- + diff --git a/public/views/tab-scan.html b/public/views/tab-scan.html new file mode 100644 index 000000000..906244030 --- /dev/null +++ b/public/views/tab-scan.html @@ -0,0 +1,11 @@ + + + Scan + + + + + + + + diff --git a/public/views/tabs.html b/public/views/tabs.html index 410caac17..bde3d6e96 100644 --- a/public/views/tabs.html +++ b/public/views/tabs.html @@ -14,7 +14,7 @@ navigation history that also transitions its views in and out. - + @@ -26,4 +26,4 @@ navigation history that also transitions its views in and out. - + diff --git a/src/js/controllers/disclaimer.js b/src/js/controllers/disclaimer.js index 177c82a41..a5ecd37f1 100644 --- a/src/js/controllers/disclaimer.js +++ b/src/js/controllers/disclaimer.js @@ -2,8 +2,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', function($scope, $rootScope, $timeout, $log, $ionicSideMenuDelegate, profileService, applicationService, gettextCatalog, uxLanguage, go, storageService, gettext, platformInfo, ongoingProcess) { - var self = this; - self.tries = 0; + var tries = 0; var isCordova = platformInfo.isCordova; ongoingProcess.set('creatingWallet', true); @@ -20,13 +19,13 @@ angular.module('copayApp.controllers').controller('disclaimerController', return $timeout(function() { $log.warn('Retrying to create profile......'); - if (self.tries == 3) { - self.tries == 0; + if (tries == 3) { + tries == 0; return create({ noWallet: true }); } else { - self.tries += 1; + tries += 1; return create(); } }, 3000); @@ -36,9 +35,9 @@ angular.module('copayApp.controllers').controller('disclaimerController', }); }; - this.init = function(opts) { + $scope.init = function(opts) { $ionicSideMenuDelegate.canDragContent(false); - self.lang = uxLanguage.currentLanguage; + $scope.lang = uxLanguage.currentLanguage; storageService.getProfile(function(err, profile) { if (!profile) { @@ -57,7 +56,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', }); }; - this.accept = function() { + $scope.accept = function() { profileService.setDisclaimerAccepted(function(err) { if (err) $log.error(err); else { diff --git a/src/js/controllers/tab-home.js b/src/js/controllers/tab-home.js index 2a7044a41..edb523880 100644 --- a/src/js/controllers/tab-home.js +++ b/src/js/controllers/tab-home.js @@ -19,7 +19,7 @@ angular.module('copayApp.controllers').controller('tabHomeController', self.setWallets(); }); - self.setWallets = function() { + self.setWallets = function() { $scope.wallets = profileService.getWallets(); }; @@ -36,5 +36,5 @@ angular.module('copayApp.controllers').controller('tabHomeController', $scope.bitpayCardEnabled = true; // TODO - $state.transitionTo('confirm', {toAmount:555500, toAddress: 'mvfAwUJohJWibGzBZgAUGsDarsr4Z4NovU', toName: 'bla bla'}); +// $state.transitionTo('confirm', {toAmount:555500, toAddress: 'mvfAwUJohJWibGzBZgAUGsDarsr4Z4NovU', toName: 'bla bla'}); }); diff --git a/src/js/controllers/modals/scanner.js b/src/js/controllers/tab-scan.js similarity index 58% rename from src/js/controllers/modals/scanner.js rename to src/js/controllers/tab-scan.js index c1bccb708..afb6a5c55 100644 --- a/src/js/controllers/modals/scanner.js +++ b/src/js/controllers/tab-scan.js @@ -1,6 +1,63 @@ '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 var video; @@ -73,6 +130,10 @@ angular.module('copayApp.controllers').controller('scannerController', function( }; $scope.init = function() { + if (isCordova) { + $scope.cordovaOpenScanner(); + return; + } setScanner(); $timeout(function() { if ($scope.beforeScan) { @@ -99,4 +160,8 @@ angular.module('copayApp.controllers').controller('scannerController', function( $scope.scannerModal.remove(); }; + $scope.$on("$destroy", function(){ + _scanStop(); + }); + }); diff --git a/src/js/directives/qrScanner.js b/src/js/directives/qrScanner.js index 09f3b5c61..0c00a8dfa 100644 --- a/src/js/directives/qrScanner.js +++ b/src/js/directives/qrScanner.js @@ -1,66 +1,7 @@ 'use strict'; angular.module('copayApp.directives') - .directive('qrScanner', function($rootScope, $timeout, $ionicModal, gettextCatalog, platformInfo) { - - 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(); - } - }; - }; + .directive('qrScanner', function() { return { restrict: 'E', @@ -68,7 +9,7 @@ angular.module('copayApp.directives') onScan: "&", beforeScan: "&" }, - controller: controller, + controller: 'tabScanController', replace: true, template: '' } diff --git a/src/js/routes.js b/src/js/routes.js index 7571876a0..c7935ea41 100644 --- a/src/js/routes.js +++ b/src/js/routes.js @@ -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', { url: '/send', cache: false, @@ -200,7 +209,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, }, }) - + .state('unsupported', { url: '/unsupported', needProfile: false, @@ -652,9 +661,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr }, 300); }); - if (window.cordova.plugins.Keyboard) { - cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false); - cordova.plugins.Keyboard.disableScroll(false); + if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) { + cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true); + cordova.plugins.Keyboard.disableScroll(true); + } + if (window.StatusBar) { + StatusBar.styleLightContent(); } $ionicPlatform.registerBackButtonAction(function(event) { diff --git a/src/js/services/go.js b/src/js/services/go.js index af3bc8d13..398f20c33 100644 --- a/src/js/services/go.js +++ b/src/js/services/go.js @@ -35,16 +35,12 @@ angular.module('copayApp.services').factory('go', function($window, $ionicSideMe $log.debug("Wallet not complete at startup... redirecting") root.path('copayers'); } else { - root.path('walletHome', function() { - $rootScope.$emit('Local/SetTab', 'walletHome', true); - }); + root.path('tabs.home'); } }; root.send = function() { - root.path('walletHome', function() { - $rootScope.$emit('Local/SetTab', 'send'); - }); + root.path('tabs.send'); }; root.addWallet = function() {