show scan tips
This commit is contained in:
parent
3c353fdbcb
commit
091ae73e2d
6 changed files with 53 additions and 8 deletions
|
|
@ -1,15 +1,15 @@
|
|||
<ion-modal-view ng-style="{opacity: '0.9'}">
|
||||
<ion-modal-view ng-style="{opacity: '0.9'}" ng-controller="scanTipsController">
|
||||
<ion-nav-bar class="bar-ligt">
|
||||
<ion-nav-buttons side="secondary">
|
||||
<button class="button" ng-click="scanTipsModal.hide()">
|
||||
<button class="button" ng-click="close()">
|
||||
X
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
<ion-content class="has-header">
|
||||
<div class="text-center">
|
||||
<h2>Receive bitcoin by sharing your address</h2>
|
||||
<h3>Other bitcoin users can scan this code to send you money</h3>
|
||||
<h2>Scan the code to pay with bitcoin</h2>
|
||||
<h3>QR codes could also contain a bitcoin wallet invitation, or an URL</h3>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-modal-view>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ angular.module('copayApp.controllers').controller('receiveTipsController', funct
|
|||
$log.debug('Receive tips accepted');
|
||||
storageService.setReceiveTipsAccepted(true, function(err) {
|
||||
$scope.receiveTipsModal.hide();
|
||||
$scope.receiveTipsModal.remove();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
11
src/js/controllers/modals/scanTips.js
Normal file
11
src/js/controllers/modals/scanTips.js
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('scanTipsController', function($scope, $log, storageService) {
|
||||
$scope.close = function() {
|
||||
$log.debug('Scan tips accepted');
|
||||
storageService.setScanTipsAccepted(true, function(err) {
|
||||
$scope.$emit('TipsModalClosed', function() {});
|
||||
$scope.scanTipsModal.hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('scannerController', function($scope, $timeout) {
|
||||
angular.module('copayApp.controllers').controller('scannerController', function($scope, $timeout, storageService, $ionicModal) {
|
||||
|
||||
// QR code Scanner
|
||||
var video;
|
||||
|
|
@ -73,6 +73,29 @@ angular.module('copayApp.controllers').controller('scannerController', function(
|
|||
};
|
||||
|
||||
$scope.init = function() {
|
||||
storageService.getScanTipsAccepted(function(err, accepted) {
|
||||
if (err) $log.warn(err);
|
||||
if (accepted) {
|
||||
scannerInit();
|
||||
return;
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
$ionicModal.fromTemplateUrl('views/modals/scan-tips.html', {
|
||||
scope: $scope
|
||||
}).then(function(modal) {
|
||||
$scope.scanTipsModal = modal;
|
||||
$scope.scanTipsModal.show();
|
||||
});
|
||||
}, 1000);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on('TipsModalClosed', function(event) {
|
||||
scannerInit();
|
||||
});
|
||||
|
||||
function scannerInit() {
|
||||
setScanner();
|
||||
$timeout(function() {
|
||||
if ($scope.beforeScan) {
|
||||
|
|
|
|||
|
|
@ -10,9 +10,13 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
});
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.checkTips();
|
||||
}
|
||||
|
||||
$scope.checkTips = function() {
|
||||
storageService.getReceiveTipsAccepted(function(err, accepted) {
|
||||
if (err || accepted) return;
|
||||
if (err) $log.warn(err);
|
||||
if (accepted) return;
|
||||
|
||||
$timeout(function() {
|
||||
$ionicModal.fromTemplateUrl('views/modals/receive-tips.html', {
|
||||
|
|
@ -23,7 +27,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
});
|
||||
}, 1000);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
if (!wallet) {
|
||||
|
|
|
|||
|
|
@ -342,6 +342,14 @@ angular.module('copayApp.services')
|
|||
});
|
||||
};
|
||||
|
||||
root.setScanTipsAccepted = function(val, cb) {
|
||||
storage.set('scanTips', val, cb);
|
||||
};
|
||||
|
||||
root.getScanTipsAccepted = function(cb) {
|
||||
storage.get('scanTips', cb);
|
||||
};
|
||||
|
||||
root.setReceiveTipsAccepted = function(val, cb) {
|
||||
storage.set('receiveTips', val, cb);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue