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/moment/min/moment-with-locales.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/ng-lodash/build/ng-lodash.js',
|
||||
'bower_components/angular-qrcode/angular-qrcode.js',
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"angular-mocks": "1.4.10",
|
||||
"angular-foundation": "0.8.0",
|
||||
"angular-gettext": "2.2.1",
|
||||
"angular-moment": "0.10.1",
|
||||
"angular-qrcode": "monospaced/angular-qrcode#~6.2.1",
|
||||
|
@ -24,8 +23,6 @@
|
|||
"ng-csv": "~0.3.6"
|
||||
},
|
||||
"resolutions": {
|
||||
"angular": "1.5.3",
|
||||
"qrcode-generator": "0.1.0",
|
||||
"angular-ui-router": "0.2.13"
|
||||
"angular": "1.5.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
<nav class="tab-bar">
|
||||
<section class="left-small">
|
||||
<a ng-click="cancel()" class="p10">
|
||||
<span class="text-close" translate>Close</span>
|
||||
</a>
|
||||
</section>
|
||||
<section class="middle tab-bar-section">
|
||||
<h1 translate class="title ellipsis">
|
||||
QR-Scanner
|
||||
</h1>
|
||||
</section>
|
||||
</nav>
|
||||
<div class="modal-content text-center fix-modals-touch" ng-init="init()">
|
||||
<canvas id="qr-canvas" width="200" height="150"></canvas>
|
||||
<video id="qrcode-scanner-video" width="300" height="225"></video>
|
||||
</div>
|
||||
<ion-modal-view ng-controller="scannerController">
|
||||
<ion-header-bar align-title="center" class="tab-bar">
|
||||
<div class="left-small">
|
||||
<a ng-click="cancel()" class="p10">
|
||||
<span class="text-close" translate>Close</span>
|
||||
</a>
|
||||
</div>
|
||||
<h1 class="title ellipsis" translate>QR-Scanner</h1>
|
||||
</ion-header-bar>
|
||||
<ion-content class="modal-content text-center fix-modals-touch" 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-modal-view>
|
||||
|
|
|
@ -1,46 +1,47 @@
|
|||
|
||||
<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>
|
||||
<div ng-show="tx.amountStr" class="m20t size-36 text-white">
|
||||
{{tx.amountStr}}
|
||||
<ion-modal-view ng-controller="txStatusController">
|
||||
<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>
|
||||
<div ng-show="tx.amountStr" class="m20t size-36 text-white">
|
||||
{{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 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">
|
||||
<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}">
|
||||
<span translate>Payment Proposal Created</span>
|
||||
<div ng-if="type == 'created'" class="popup-txsigned">
|
||||
<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}">
|
||||
<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 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">
|
||||
<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}">
|
||||
<span translate>Payment Accepted</span>
|
||||
<div ng-if="type == 'accepted'" class="popup-txsigned">
|
||||
<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}">
|
||||
<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 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">
|
||||
<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}">
|
||||
<span translate>Payment Rejected</span>
|
||||
<div ng-if="type=='rejected'" class="popup-txrejected">
|
||||
<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}">
|
||||
<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 class="text-center">
|
||||
<a class="button outline light-gray round tiny small-4" ng-click="cancel()" translate>OKAY</a>
|
||||
</div>
|
||||
</div>
|
||||
</ion-modal-view>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
var modules = [
|
||||
'ui.router',
|
||||
'angularMoment',
|
||||
'mm.foundation',
|
||||
'monospaced.qrcode',
|
||||
'gettext',
|
||||
'ionic',
|
||||
|
@ -25,4 +24,3 @@ angular.module('copayApp.services', []);
|
|||
angular.module('copayApp.controllers', []);
|
||||
angular.module('copayApp.directives', []);
|
||||
angular.module('copayApp.addons', []);
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
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;
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet');
|
||||
|
||||
var client = profileService.focusedClient;
|
||||
if (client) {
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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;
|
||||
this.show2faCodeInput = null;
|
||||
|
@ -12,7 +12,7 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet');
|
||||
|
||||
var client = profileService.focusedClient;
|
||||
if (client) {
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 isCordova = platformInfo.isCordova;
|
||||
var isWP = platformInfo.isWP;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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() {
|
||||
return glideraService.getOauthCodeUrl();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 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.loading = null;
|
||||
if (txp) {
|
||||
txStatus.notify(txp, function() {
|
||||
var type = txStatus.notify(txp);
|
||||
$scope.openStatusModal(type, txp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', txp.status == 'broadcasted');
|
||||
});
|
||||
} else {
|
||||
|
@ -234,6 +235,20 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
|
|||
$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.txpDetailsModal.hide();
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
angular.module('copayApp.controllers').controller('paperWalletController',
|
||||
function($scope, $timeout, $log, configService, profileService, go, addressService, txStatus, bitcore, ongoingProcess) {
|
||||
|
||||
var fc = profileService.focusedClient;
|
||||
var rawTx;
|
||||
|
||||
|
@ -99,15 +100,29 @@ angular.module('copayApp.controllers').controller('paperWalletController',
|
|||
$scope.error = err.message || err.toString();
|
||||
$log.error(err);
|
||||
} else {
|
||||
txStatus.notify({
|
||||
status: 'broadcasted'
|
||||
}, function() {
|
||||
var type = txStatus.notify(txp);
|
||||
$scope.openStatusModal(type, txp, function() {
|
||||
go.walletHome();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.$apply();
|
||||
});
|
||||
}, 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';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesCoinbaseController',
|
||||
function($scope, $modal, $timeout, $ionicModal, applicationService, coinbaseService) {
|
||||
function($scope, $timeout, $ionicModal, applicationService, coinbaseService) {
|
||||
|
||||
this.revokeToken = function(testnet) {
|
||||
$scope.network = testnet ? 'testnet' : 'livenet';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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;
|
||||
$scope.isCordova = isCordova;
|
||||
$scope.error = null;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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) {
|
||||
var self = this;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 client;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 config = configService.getSync();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'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 isWP = platformInfo.isWP;
|
||||
|
@ -464,7 +464,8 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
if (!client.canSign() && !client.isPrivKeyExternal()) {
|
||||
$log.info('No signing proposal: No private key');
|
||||
self.resetForm();
|
||||
txStatus.notify(createdTxp, function() {
|
||||
var type = txStatus.notify(createdTxp);
|
||||
$scope.openStatusModal(type, createdTxp, function() {
|
||||
return $scope.$emit('Local/TxProposalAction');
|
||||
});
|
||||
} else {
|
||||
|
@ -520,14 +521,16 @@ angular.module('copayApp.controllers').controller('walletHomeController', functi
|
|||
}
|
||||
self.resetForm();
|
||||
go.walletHome();
|
||||
txStatus.notify(broadcastedTxp, function() {
|
||||
var type = txStatus.notify(broadcastedTxp);
|
||||
$scope.openStatusModal(type, broadcastedTxp, function() {
|
||||
$scope.$emit('Local/TxProposalAction', broadcastedTxp.status == 'broadcasted');
|
||||
});
|
||||
});
|
||||
} else {
|
||||
self.resetForm();
|
||||
go.walletHome();
|
||||
txStatus.notify(signedTxp, function() {
|
||||
var type = txStatus.notify(signedTxp);
|
||||
$scope.openStatusModal(type, signedTxp, function() {
|
||||
$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() {
|
||||
var fc = profileService.focusedClient;
|
||||
$scope.color = fc.backgroundColor;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
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 isWP = platformInfo.isWP;
|
||||
|
@ -44,114 +44,13 @@ angular.module('copayApp.directives')
|
|||
};
|
||||
|
||||
$scope.modalOpenScanner = function() {
|
||||
var parentScope = $scope;
|
||||
var ModalInstanceCtrl = function($scope, $rootScope, $modalInstance) {
|
||||
// QR code Scanner
|
||||
var video;
|
||||
var canvas;
|
||||
var $video;
|
||||
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
|
||||
$ionicModal.fromTemplateUrl('views/modals/scanner.html', {
|
||||
scope: $scope,
|
||||
animation: 'slide-in-up'
|
||||
}).then(function(modal) {
|
||||
$scope.scannerModal = modal;
|
||||
$scope.scannerModal.show();
|
||||
});
|
||||
modalInstance.result.then(function(data) {
|
||||
parentScope.onScan({
|
||||
data: data
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
$scope.openScanner = function() {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
'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 isCordova = platformInfo.isCordova;
|
||||
|
||||
root.notify = function(txp, cb) {
|
||||
root.notify = function(txp) {
|
||||
var fc = profileService.focusedClient;
|
||||
var status = txp.status;
|
||||
var type;
|
||||
|
@ -19,11 +19,11 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
|
|||
copayerId: fc.credentials.copayerId
|
||||
});
|
||||
|
||||
if (!action) {
|
||||
if (!action) {
|
||||
type = 'created';
|
||||
} else if (action.type == 'accept') {
|
||||
// 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';
|
||||
} else {
|
||||
type = 'accepted';
|
||||
|
@ -34,41 +34,7 @@ angular.module('copayApp.services').factory('txStatus', function($modal, lodash,
|
|||
throw new Error('Unknown type:' + 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 type;
|
||||
};
|
||||
|
||||
return root;
|
||||
|
|
|
@ -20,7 +20,6 @@ module.exports = function(config) {
|
|||
'bower_components/moment/min/moment-with-locales.js',
|
||||
'bower_components/ionic/release/js/ionic.bundle.min.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/ng-lodash/build/ng-lodash.js',
|
||||
'bower_components/angular-qrcode/angular-qrcode.js',
|
||||
|
|
Loading…
Reference in New Issue