diff --git a/public/views/modals/scan-tips.html b/public/views/modals/scan-tips.html
index 07ef9e5c7..512b60327 100644
--- a/public/views/modals/scan-tips.html
+++ b/public/views/modals/scan-tips.html
@@ -1,15 +1,15 @@
-
+
-
diff --git a/src/js/controllers/modals/receiveTips.js b/src/js/controllers/modals/receiveTips.js
index 5412a614b..2297be7a4 100644
--- a/src/js/controllers/modals/receiveTips.js
+++ b/src/js/controllers/modals/receiveTips.js
@@ -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();
});
}
});
diff --git a/src/js/controllers/modals/scanTips.js b/src/js/controllers/modals/scanTips.js
new file mode 100644
index 000000000..a82f70554
--- /dev/null
+++ b/src/js/controllers/modals/scanTips.js
@@ -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();
+ });
+ }
+});
diff --git a/src/js/controllers/modals/scanner.js b/src/js/controllers/modals/scanner.js
index c1bccb708..f92b2d14f 100644
--- a/src/js/controllers/modals/scanner.js
+++ b/src/js/controllers/modals/scanner.js
@@ -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) {
diff --git a/src/js/controllers/tab-receive.js b/src/js/controllers/tab-receive.js
index 25ceb5964..2fa2147f6 100644
--- a/src/js/controllers/tab-receive.js
+++ b/src/js/controllers/tab-receive.js
@@ -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) {
diff --git a/src/js/services/storageService.js b/src/js/services/storageService.js
index b41b63834..5e23c7114 100644
--- a/src/js/services/storageService.js
+++ b/src/js/services/storageService.js
@@ -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);
};