mirror of https://github.com/BTCPrivate/copay.git
remove angular foundation and use only ionic modals
This commit is contained in:
parent
61f6909d9a
commit
0cca8f6367
|
@ -94,7 +94,6 @@ module.exports = function(grunt) {
|
||||||
'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
|
'bower_components/qrcode-decoder-js/lib/qrcode-decoder.js',
|
||||||
'bower_components/moment/min/moment-with-locales.js',
|
'bower_components/moment/min/moment-with-locales.js',
|
||||||
'bower_components/angular-ui-router/release/angular-ui-router.js',
|
'bower_components/angular-ui-router/release/angular-ui-router.js',
|
||||||
'bower_components/angular-foundation/mm-foundation-tpls.js',
|
|
||||||
'bower_components/angular-moment/angular-moment.js',
|
'bower_components/angular-moment/angular-moment.js',
|
||||||
'bower_components/ng-lodash/build/ng-lodash.js',
|
'bower_components/ng-lodash/build/ng-lodash.js',
|
||||||
'bower_components/angular-qrcode/angular-qrcode.js',
|
'bower_components/angular-qrcode/angular-qrcode.js',
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"angular-mocks": "1.4.10",
|
"angular-mocks": "1.4.10",
|
||||||
"angular-foundation": "0.8.0",
|
|
||||||
"angular-gettext": "2.2.1",
|
"angular-gettext": "2.2.1",
|
||||||
"angular-moment": "0.10.1",
|
"angular-moment": "0.10.1",
|
||||||
"angular-qrcode": "monospaced/angular-qrcode#~6.2.1",
|
"angular-qrcode": "monospaced/angular-qrcode#~6.2.1",
|
||||||
|
@ -24,8 +23,6 @@
|
||||||
"ng-csv": "~0.3.6"
|
"ng-csv": "~0.3.6"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"angular": "1.5.3",
|
"angular": "1.5.3"
|
||||||
"qrcode-generator": "0.1.0",
|
|
||||||
"angular-ui-router": "0.2.13"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
<nav class="tab-bar">
|
<ion-modal-view ng-controller="scannerController">
|
||||||
<section class="left-small">
|
<ion-header-bar align-title="center" class="tab-bar">
|
||||||
<a ng-click="cancel()" class="p10">
|
<div class="left-small">
|
||||||
<span class="text-close" translate>Close</span>
|
<a ng-click="cancel()" class="p10">
|
||||||
</a>
|
<span class="text-close" translate>Close</span>
|
||||||
</section>
|
</a>
|
||||||
<section class="middle tab-bar-section">
|
</div>
|
||||||
<h1 translate class="title ellipsis">
|
<h1 class="title ellipsis" translate>QR-Scanner</h1>
|
||||||
QR-Scanner
|
</ion-header-bar>
|
||||||
</h1>
|
<ion-content class="modal-content text-center fix-modals-touch" ng-init="init()">
|
||||||
</section>
|
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
||||||
</nav>
|
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
||||||
<div class="modal-content text-center fix-modals-touch" ng-init="init()">
|
</ion-content>
|
||||||
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
</ion-modal-view>
|
||||||
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -1,46 +1,47 @@
|
||||||
|
<ion-modal-view ng-controller="txStatusController">
|
||||||
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center">
|
<div ng-if="type == 'broadcasted'" class="popup-txsent text-center">
|
||||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||||
<div ng-show="tx.amountStr" class="m20t size-36 text-white">
|
<div ng-show="tx.amountStr" class="m20t size-36 text-white">
|
||||||
{{tx.amountStr}}
|
{{tx.amountStr}}
|
||||||
|
</div>
|
||||||
|
<div class="size-16 text-gray">
|
||||||
|
<span translate>Sent</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center m20t">
|
||||||
|
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="size-16 text-gray">
|
|
||||||
<span translate>Sent</span>
|
|
||||||
</div>
|
|
||||||
<div class="text-center m20t">
|
|
||||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div ng-if="type == 'created'" class="popup-txsigned">
|
<div ng-if="type == 'created'" class="popup-txsigned">
|
||||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||||
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
||||||
<span translate>Payment Proposal Created</span>
|
<span translate>Payment Proposal Created</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
|
||||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div ng-if="type == 'accepted'" class="popup-txsigned">
|
<div ng-if="type == 'accepted'" class="popup-txsigned">
|
||||||
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
<i class="small-centered columns fi-check m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||||
<div class="text-center size-18 text-primary tu text-bold p20" ng-style="{'color':color}">
|
<div class="text-center size-18 text-primary tu text-bold p20" ng-style="{'color':color}">
|
||||||
<span translate>Payment Accepted</span>
|
<span translate>Payment Accepted</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
|
||||||
<a class="button outline round light-gray tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if="type=='rejected'" class="popup-txrejected">
|
<div ng-if="type=='rejected'" class="popup-txrejected">
|
||||||
<i class="fi-x small-centered columns m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
<i class="fi-x small-centered columns m30tp" ng-style="{'color':color, 'border-color':color}"></i>
|
||||||
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
<div class="text-center size-18 tu text-bold p20" ng-style="{'color':color}">
|
||||||
<span translate>Payment Rejected</span>
|
<span translate>Payment Rejected</span>
|
||||||
|
</div>
|
||||||
|
<div class="text-center">
|
||||||
|
<a class="button outline light-gray round tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center">
|
</ion-modal-view>
|
||||||
<a class="button outline light-gray round tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
var modules = [
|
var modules = [
|
||||||
'ui.router',
|
'ui.router',
|
||||||
'angularMoment',
|
'angularMoment',
|
||||||
'mm.foundation',
|
|
||||||
'monospaced.qrcode',
|
'monospaced.qrcode',
|
||||||
'gettext',
|
'gettext',
|
||||||
'ionic',
|
'ionic',
|
||||||
|
@ -25,4 +24,3 @@ angular.module('copayApp.services', []);
|
||||||
angular.module('copayApp.controllers', []);
|
angular.module('copayApp.controllers', []);
|
||||||
angular.module('copayApp.directives', []);
|
angular.module('copayApp.directives', []);
|
||||||
angular.module('copayApp.addons', []);
|
angular.module('copayApp.addons', []);
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
||||||
function($scope, $modal, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService, ongoingProcess) {
|
function($scope, $log, $ionicModal, $timeout, lodash, profileService, coinbaseService, bwsError, addressService, ongoingProcess) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
this.init = function(testnet) {
|
this.init = function(testnet) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('buyGlideraController',
|
angular.module('copayApp.controllers').controller('buyGlideraController',
|
||||||
function($scope, $timeout, $modal, $ionicModal, profileService, addressService, glideraService, bwsError, lodash, ongoingProcess) {
|
function($scope, $timeout, $ionicModal, profileService, addressService, glideraService, bwsError, lodash, ongoingProcess) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.show2faCodeInput = null;
|
this.show2faCodeInput = null;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('coinbaseController',
|
angular.module('copayApp.controllers').controller('coinbaseController',
|
||||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo, ongoingProcess) {
|
function($rootScope, $scope, $timeout, $ionicModal, profileService, configService, storageService, coinbaseService, lodash, platformInfo, ongoingProcess) {
|
||||||
|
|
||||||
var isNW = platformInfo.isNW;
|
var isNW = platformInfo.isNW;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('copayersController',
|
angular.module('copayApp.controllers').controller('copayersController',
|
||||||
function($scope, $rootScope, $timeout, $log, $modal, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog) {
|
function($scope, $rootScope, $timeout, $log, $ionicModal, profileService, go, notification, platformInfo, gettext, gettextCatalog) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
var isWP = platformInfo.isWP;
|
var isWP = platformInfo.isWP;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('glideraController',
|
angular.module('copayApp.controllers').controller('glideraController',
|
||||||
function($rootScope, $scope, $timeout, $modal, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess) {
|
function($rootScope, $scope, $timeout, $ionicModal, profileService, configService, storageService, glideraService, lodash, ongoingProcess) {
|
||||||
|
|
||||||
this.getAuthenticateUrl = function() {
|
this.getAuthenticateUrl = function() {
|
||||||
return glideraService.getOauthCodeUrl();
|
return glideraService.getOauthCodeUrl();
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('joinController',
|
angular.module('copayApp.controllers').controller('joinController',
|
||||||
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, $modal, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
|
function($scope, $rootScope, $timeout, go, notification, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess) {
|
||||||
|
|
||||||
var isChromeApp = platformInfo.isChromeApp;
|
var isChromeApp = platformInfo.isChromeApp;
|
||||||
var isDevel = platformInfo.isDevel;
|
var isDevel = platformInfo.isDevel;
|
||||||
|
|
|
@ -0,0 +1,102 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('scannerController', function($scope, $timeout) {
|
||||||
|
|
||||||
|
// QR code Scanner
|
||||||
|
var video;
|
||||||
|
var canvas;
|
||||||
|
var $video;
|
||||||
|
var context;
|
||||||
|
var localMediaStream;
|
||||||
|
var prevResult;
|
||||||
|
var scanTimer;
|
||||||
|
|
||||||
|
var _scan = function(evt) {
|
||||||
|
if (localMediaStream) {
|
||||||
|
context.drawImage(video, 0, 0, 300, 225);
|
||||||
|
try {
|
||||||
|
qrcode.decode();
|
||||||
|
} catch (e) {
|
||||||
|
//qrcodeError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scanTimer = $timeout(_scan, 800);
|
||||||
|
};
|
||||||
|
|
||||||
|
var _scanStop = function() {
|
||||||
|
$timeout.cancel(scanTimer);
|
||||||
|
if (localMediaStream && localMediaStream.active) {
|
||||||
|
var localMediaStreamTrack = localMediaStream.getTracks();
|
||||||
|
for (var i = 0; i < localMediaStreamTrack.length; i++) {
|
||||||
|
localMediaStreamTrack[i].stop();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
localMediaStream.stop();
|
||||||
|
} catch (e) {
|
||||||
|
// Older Chromium not support the STOP function
|
||||||
|
};
|
||||||
|
}
|
||||||
|
localMediaStream = null;
|
||||||
|
video.src = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
qrcode.callback = function(data) {
|
||||||
|
if (prevResult != data) {
|
||||||
|
prevResult = data;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_scanStop();
|
||||||
|
$scope.cancel();
|
||||||
|
$scope.onScan({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
var _successCallback = function(stream) {
|
||||||
|
video.src = (window.URL && window.URL.createObjectURL(stream)) || stream;
|
||||||
|
localMediaStream = stream;
|
||||||
|
video.play();
|
||||||
|
$timeout(_scan, 1000);
|
||||||
|
};
|
||||||
|
|
||||||
|
var _videoError = function(err) {
|
||||||
|
$scope.cancel();
|
||||||
|
};
|
||||||
|
|
||||||
|
var setScanner = function() {
|
||||||
|
navigator.getUserMedia = navigator.getUserMedia ||
|
||||||
|
navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
|
||||||
|
navigator.msGetUserMedia;
|
||||||
|
window.URL = window.URL || window.webkitURL ||
|
||||||
|
window.mozURL || window.msURL;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.init = function() {
|
||||||
|
setScanner();
|
||||||
|
$timeout(function() {
|
||||||
|
if ($scope.beforeScan) {
|
||||||
|
$scope.beforeScan();
|
||||||
|
}
|
||||||
|
canvas = document.getElementById('qr-canvas');
|
||||||
|
context = canvas.getContext('2d');
|
||||||
|
|
||||||
|
video = document.getElementById('qrcode-scanner-video');
|
||||||
|
$video = angular.element(video);
|
||||||
|
canvas.width = 300;
|
||||||
|
canvas.height = 225;
|
||||||
|
context.clearRect(0, 0, 300, 225);
|
||||||
|
|
||||||
|
navigator.getUserMedia({
|
||||||
|
video: true
|
||||||
|
}, _successCallback, _videoError);
|
||||||
|
}, 500);
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.cancel = function() {
|
||||||
|
_scanStop();
|
||||||
|
$scope.scannerModal.hide();
|
||||||
|
$scope.scannerModal.remove();
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
|
@ -0,0 +1,11 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('txStatusController', function($scope, $timeout) {
|
||||||
|
|
||||||
|
if ($scope.cb) $timeout($scope.cb, 100);
|
||||||
|
|
||||||
|
$scope.cancel = function() {
|
||||||
|
$scope.txStatusModal.hide();
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
|
@ -223,7 +223,8 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
$scope.close = function(txp) {
|
$scope.close = function(txp) {
|
||||||
$scope.loading = null;
|
$scope.loading = null;
|
||||||
if (txp) {
|
if (txp) {
|
||||||
txStatus.notify(txp, function() {
|
var type = txStatus.notify(txp);
|
||||||
|
$scope.openStatusModal(type, txp, function() {
|
||||||
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
|
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -234,6 +235,20 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
||||||
$scope.cancel();
|
$scope.cancel();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openStatusModal = function(type, txp, cb) {
|
||||||
|
$scope.type = type;
|
||||||
|
$scope.tx = txFormatService.processTx(txp);
|
||||||
|
$scope.cb = cb;
|
||||||
|
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
||||||
|
scope: $scope,
|
||||||
|
animation: 'slide-in-up'
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.txStatusModal = modal;
|
||||||
|
$scope.txStatusModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.cancel = function() {
|
$scope.cancel = function() {
|
||||||
$scope.txpDetailsModal.hide();
|
$scope.txpDetailsModal.hide();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
angular.module('copayApp.controllers').controller('paperWalletController',
|
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
function($scope, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess) {
|
function($scope, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess) {
|
||||||
|
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var rawTx;
|
var rawTx;
|
||||||
|
|
||||||
|
@ -99,15 +100,29 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
||||||
$scope.error = err.message || err.toString();
|
$scope.error = err.message || err.toString();
|
||||||
$log.error(err);
|
$log.error(err);
|
||||||
} else {
|
} else {
|
||||||
txStatus.notify({
|
var type = txStatus.notify(txp);
|
||||||
status: 'broadcasted'
|
$scope.openStatusModal(type, txp, function() {
|
||||||
}, function() {
|
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openStatusModal = function(type, txp, cb) {
|
||||||
|
$scope.type = type;
|
||||||
|
$scope.tx = txFormatService.processTx(txp);
|
||||||
|
$scope.color = fc.backgroundColor;
|
||||||
|
$scope.cb = cb;
|
||||||
|
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
||||||
|
scope: $scope,
|
||||||
|
animation: 'slide-in-up'
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.txStatusModal = modal;
|
||||||
|
$scope.txStatusModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
|
angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
|
||||||
function($scope, $modal, $timeout, $ionicModal, applicationService, coinbaseService) {
|
function($scope, $timeout, $ionicModal, applicationService, coinbaseService) {
|
||||||
|
|
||||||
this.revokeToken = function(testnet) {
|
this.revokeToken = function(testnet) {
|
||||||
$scope.network = testnet ? 'testnet' : 'livenet';
|
$scope.network = testnet ? 'testnet' : 'livenet';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
|
||||||
function($scope, $rootScope, $filter, $timeout, $modal, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService, ongoingProcess) {
|
function($scope, $rootScope, $filter, $timeout, $log, $ionicModal, storageService, notification, profileService, platformInfo, go, gettext, gettextCatalog, applicationService, ongoingProcess) {
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
$scope.isCordova = isCordova;
|
$scope.isCordova = isCordova;
|
||||||
$scope.error = null;
|
$scope.error = null;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('preferencesGlideraController',
|
angular.module('copayApp.controllers').controller('preferencesGlideraController',
|
||||||
function($scope, $modal, $timeout, $ionicModal, profileService, applicationService, glideraService, storageService) {
|
function($scope, $timeout, $ionicModal, profileService, applicationService, glideraService, storageService) {
|
||||||
|
|
||||||
this.getEmail = function(token) {
|
this.getEmail = function(token) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
angular.module('copayApp.controllers').controller('sellCoinbaseController',
|
||||||
function($rootScope, $scope, $modal, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService, ongoingProcess, go) {
|
function($rootScope, $scope, $log, $timeout, $ionicModal, lodash, profileService, coinbaseService, bwsError, configService, walletService, fingerprintService, ongoingProcess, go) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var client;
|
var client;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('sellGlideraController',
|
angular.module('copayApp.controllers').controller('sellGlideraController',
|
||||||
function($rootScope, $scope, $timeout, $ionicModal, $log, $modal, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService, ongoingProcess, go) {
|
function($rootScope, $scope, $timeout, $ionicModal, $log, configService, profileService, addressService, feeService, glideraService, bwsError, lodash, walletService, fingerprintService, ongoingProcess, go) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
var config = configService.getSync();
|
var config = configService.getSync();
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $modal, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit, ongoingProcess) {
|
angular.module('copayApp.controllers').controller('walletHomeController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, notification, txStatus, profileService, lodash, configService, rateService, storageService, bitcore, gettext, gettextCatalog, platformInfo, addressService, ledger, bwsError, confirmDialog, txFormatService, addressbookService, go, feeService, walletService, fingerprintService, nodeWebkit, ongoingProcess) {
|
||||||
|
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
var isWP = platformInfo.isWP;
|
var isWP = platformInfo.isWP;
|
||||||
|
@ -464,7 +464,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
if (!client.canSign() && !client.isPrivKeyExternal()) {
|
if (!client.canSign() && !client.isPrivKeyExternal()) {
|
||||||
$log.info('No signing proposal: No private key');
|
$log.info('No signing proposal: No private key');
|
||||||
self.resetForm();
|
self.resetForm();
|
||||||
txStatus.notify(createdTxp, function() {
|
var type = txStatus.notify(createdTxp);
|
||||||
|
$scope.openStatusModal(type, createdTxp, function() {
|
||||||
return $scope.$emit('Local/TxProposalAction');
|
return $scope.$emit('Local/TxProposalAction');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -520,14 +521,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
}
|
}
|
||||||
self.resetForm();
|
self.resetForm();
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
txStatus.notify(broadcastedTxp, function() {
|
var type = txStatus.notify(broadcastedTxp);
|
||||||
|
$scope.openStatusModal(type, broadcastedTxp, function() {
|
||||||
$scope.$emit('Local/TxProposalAction', broadcastedTxp.status == 'broadcasted');
|
$scope.$emit('Local/TxProposalAction', broadcastedTxp.status == 'broadcasted');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.resetForm();
|
self.resetForm();
|
||||||
go.walletHome();
|
go.walletHome();
|
||||||
txStatus.notify(signedTxp, function() {
|
var type = txStatus.notify(signedTxp);
|
||||||
|
$scope.openStatusModal(type, signedTxp, function() {
|
||||||
$scope.$emit('Local/TxProposalAction');
|
$scope.$emit('Local/TxProposalAction');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -537,6 +540,22 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openStatusModal = function(type, txp, cb) {
|
||||||
|
var fc = profileService.focusedClient;
|
||||||
|
$scope.type = type;
|
||||||
|
$scope.tx = txFormatService.processTx(txp);
|
||||||
|
$scope.color = fc.backgroundColor;
|
||||||
|
$scope.cb = cb;
|
||||||
|
|
||||||
|
$ionicModal.fromTemplateUrl('views/modals/tx-status.html', {
|
||||||
|
scope: $scope,
|
||||||
|
animation: 'slide-in-up'
|
||||||
|
}).then(function(modal) {
|
||||||
|
$scope.txStatusModal = modal;
|
||||||
|
$scope.txStatusModal.show();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.openSearchModal = function() {
|
$scope.openSearchModal = function() {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
$scope.color = fc.backgroundColor;
|
$scope.color = fc.backgroundColor;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('qrScanner', function($rootScope, $timeout, $modal, gettextCatalog, platformInfo) {
|
.directive('qrScanner', function($rootScope, $timeout, $ionicModal, gettextCatalog, platformInfo) {
|
||||||
|
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
var isWP = platformInfo.isWP;
|
var isWP = platformInfo.isWP;
|
||||||
|
@ -44,114 +44,13 @@ angular.module('copayApp.directives')
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.modalOpenScanner = function() {
|
$scope.modalOpenScanner = function() {
|
||||||
var parentScope = $scope;
|
$ionicModal.fromTemplateUrl('views/modals/scanner.html', {
|
||||||
var ModalInstanceCtrl = function($scope, $rootScope, $modalInstance) {
|
scope: $scope,
|
||||||
// QR code Scanner
|
animation: 'slide-in-up'
|
||||||
var video;
|
}).then(function(modal) {
|
||||||
var canvas;
|
$scope.scannerModal = modal;
|
||||||
var $video;
|
$scope.scannerModal.show();
|
||||||
var context;
|
|
||||||
var localMediaStream;
|
|
||||||
var prevResult;
|
|
||||||
|
|
||||||
var _scan = function(evt) {
|
|
||||||
if (localMediaStream) {
|
|
||||||
context.drawImage(video, 0, 0, 300, 225);
|
|
||||||
try {
|
|
||||||
qrcode.decode();
|
|
||||||
} catch (e) {
|
|
||||||
//qrcodeError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$timeout(_scan, 800);
|
|
||||||
};
|
|
||||||
|
|
||||||
var _scanStop = function() {
|
|
||||||
if (localMediaStream && localMediaStream.active) {
|
|
||||||
var localMediaStreamTrack = localMediaStream.getTracks();
|
|
||||||
for (var i = 0; i < localMediaStreamTrack.length; i++) {
|
|
||||||
localMediaStreamTrack[i].stop();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
localMediaStream.stop();
|
|
||||||
} catch (e) {
|
|
||||||
// Older Chromium not support the STOP function
|
|
||||||
};
|
|
||||||
}
|
|
||||||
localMediaStream = null;
|
|
||||||
video.src = '';
|
|
||||||
};
|
|
||||||
|
|
||||||
qrcode.callback = function(data) {
|
|
||||||
if (prevResult != data) {
|
|
||||||
prevResult = data;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_scanStop();
|
|
||||||
$modalInstance.close(data);
|
|
||||||
};
|
|
||||||
|
|
||||||
var _successCallback = function(stream) {
|
|
||||||
video.src = (window.URL && window.URL.createObjectURL(stream)) || stream;
|
|
||||||
localMediaStream = stream;
|
|
||||||
video.play();
|
|
||||||
$timeout(_scan, 1000);
|
|
||||||
};
|
|
||||||
|
|
||||||
var _videoError = function(err) {
|
|
||||||
$scope.cancel();
|
|
||||||
};
|
|
||||||
|
|
||||||
var setScanner = function() {
|
|
||||||
navigator.getUserMedia = navigator.getUserMedia ||
|
|
||||||
navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
|
|
||||||
navigator.msGetUserMedia;
|
|
||||||
window.URL = window.URL || window.webkitURL ||
|
|
||||||
window.mozURL || window.msURL;
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.init = function() {
|
|
||||||
setScanner();
|
|
||||||
$timeout(function() {
|
|
||||||
if (parentScope.beforeScan) {
|
|
||||||
parentScope.beforeScan();
|
|
||||||
}
|
|
||||||
canvas = document.getElementById('qr-canvas');
|
|
||||||
context = canvas.getContext('2d');
|
|
||||||
|
|
||||||
|
|
||||||
video = document.getElementById('qrcode-scanner-video');
|
|
||||||
$video = angular.element(video);
|
|
||||||
canvas.width = 300;
|
|
||||||
canvas.height = 225;
|
|
||||||
context.clearRect(0, 0, 300, 225);
|
|
||||||
|
|
||||||
navigator.getUserMedia({
|
|
||||||
video: true
|
|
||||||
}, _successCallback, _videoError);
|
|
||||||
}, 500);
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.cancel = function() {
|
|
||||||
_scanStop();
|
|
||||||
$modalInstance.dismiss('cancel');
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
var modalInstance = $modal.open({
|
|
||||||
templateUrl: 'views/modals/scanner.html',
|
|
||||||
windowClass: 'full',
|
|
||||||
controller: ModalInstanceCtrl,
|
|
||||||
backdrop: 'static',
|
|
||||||
keyboard: false
|
|
||||||
});
|
});
|
||||||
modalInstance.result.then(function(data) {
|
|
||||||
parentScope.onScan({
|
|
||||||
data: data
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.openScanner = function() {
|
$scope.openScanner = function() {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout, txFormatService, platformInfo) {
|
angular.module('copayApp.services').factory('txStatus', function(lodash, profileService, $timeout, platformInfo) {
|
||||||
var root = {};
|
var root = {};
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
root.notify = function(txp, cb) {
|
root.notify = function(txp) {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var status = txp.status;
|
var status = txp.status;
|
||||||
var type;
|
var type;
|
||||||
|
@ -19,11 +19,11 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
|
||||||
copayerId: fc.credentials.copayerId
|
copayerId: fc.credentials.copayerId
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!action) {
|
if (!action) {
|
||||||
type = 'created';
|
type = 'created';
|
||||||
} else if (action.type == 'accept') {
|
} else if (action.type == 'accept') {
|
||||||
// created and accepted at the same time?
|
// created and accepted at the same time?
|
||||||
if ( n == 1 && action.createdOn - txp.createdOn < INMEDIATE_SECS ) {
|
if (n == 1 && action.createdOn - txp.createdOn < INMEDIATE_SECS) {
|
||||||
type = 'created';
|
type = 'created';
|
||||||
} else {
|
} else {
|
||||||
type = 'accepted';
|
type = 'accepted';
|
||||||
|
@ -34,41 +34,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
|
||||||
throw new Error('Unknown type:' + type);
|
throw new Error('Unknown type:' + type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return type;
|
||||||
openModal(type, txp, cb);
|
|
||||||
};
|
|
||||||
|
|
||||||
root._templateUrl = function(type, txp) {
|
|
||||||
return 'views/modals/tx-status.html';
|
|
||||||
};
|
|
||||||
|
|
||||||
var openModal = function(type, txp, cb) {
|
|
||||||
var fc = profileService.focusedClient;
|
|
||||||
var ModalInstanceCtrl = function($scope, $modalInstance) {
|
|
||||||
$scope.type = type;
|
|
||||||
$scope.tx = txFormatService.processTx(txp);
|
|
||||||
$scope.color = fc.backgroundColor;
|
|
||||||
if (isCordova && StatusBar.isVisible) {
|
|
||||||
StatusBar.hide();
|
|
||||||
}
|
|
||||||
$scope.cancel = function() {
|
|
||||||
$modalInstance.dismiss('cancel');
|
|
||||||
};
|
|
||||||
if (cb) $timeout(cb, 100);
|
|
||||||
};
|
|
||||||
var modalInstance = $modal.open({
|
|
||||||
templateUrl: root._templateUrl(type, txp),
|
|
||||||
windowClass: 'popup-tx-status full',
|
|
||||||
controller: ModalInstanceCtrl,
|
|
||||||
});
|
|
||||||
|
|
||||||
modalInstance.result.finally(function() {
|
|
||||||
if (isCordova && !StatusBar.isVisible) {
|
|
||||||
StatusBar.show();
|
|
||||||
}
|
|
||||||
var m = angular.element(document.getElementsByClassName('reveal-modal'));
|
|
||||||
m.addClass('hideModal');
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
|
|
|
@ -20,7 +20,6 @@ module.exports = function(config) {
|
||||||
'bower_components/moment/min/moment-with-locales.js',
|
'bower_components/moment/min/moment-with-locales.js',
|
||||||
'bower_components/ionic/release/js/ionic.bundle.min.js',
|
'bower_components/ionic/release/js/ionic.bundle.min.js',
|
||||||
'bower_components/angular-ui-router/release/angular-ui-router.js',
|
'bower_components/angular-ui-router/release/angular-ui-router.js',
|
||||||
'bower_components/angular-foundation/mm-foundation-tpls.js',
|
|
||||||
'bower_components/angular-moment/angular-moment.js',
|
'bower_components/angular-moment/angular-moment.js',
|
||||||
'bower_components/ng-lodash/build/ng-lodash.js',
|
'bower_components/ng-lodash/build/ng-lodash.js',
|
||||||
'bower_components/angular-qrcode/angular-qrcode.js',
|
'bower_components/angular-qrcode/angular-qrcode.js',
|
||||||
|
|
Loading…
Reference in New Issue