ref controllers
This commit is contained in:
parent
dd1981a26c
commit
cc2853e827
4 changed files with 166 additions and 159 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, nodeWebkit, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) {
|
angular.module('copayApp.controllers').controller('indexController', function($rootScope, $scope, $log, $filter, $timeout, latestReleaseService, bwcService, pushNotificationsService, lodash, go, profileService, configService, rateService, storageService, addressService, gettext, gettextCatalog, amMoment, addonManager, bwsError, txFormatService, uxLanguage, glideraService, coinbaseService, platformInfo, addressbookService, walletService) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var SOFT_CONFIRMATION_LIMIT = 12;
|
var SOFT_CONFIRMATION_LIMIT = 12;
|
||||||
var errors = bwcService.getErrors();
|
var errors = bwcService.getErrors();
|
||||||
var historyUpdateInProgress = {};
|
var historyUpdateInProgress = {};
|
||||||
var isChromeApp = platformInfo.isChromeApp;
|
var isChromeApp = platformInfo.isChromeApp;
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
|
var isNW = platformInfo.isNW;
|
||||||
|
|
||||||
var ret = {};
|
var ret = {};
|
||||||
ret.isCordova = isCordova;
|
ret.isCordova = isCordova;
|
||||||
|
|
@ -48,7 +49,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
ret.tab = 'walletHome';
|
ret.tab = 'walletHome';
|
||||||
var vanillaScope = ret;
|
var vanillaScope = ret;
|
||||||
|
|
||||||
if (nodeWebkit.isDefined()) {
|
if (isNW) {
|
||||||
latestReleaseService.checkLatestRelease(function(err, newRelease) {
|
latestReleaseService.checkLatestRelease(function(err, newRelease) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$log.warn(err);
|
$log.warn(err);
|
||||||
|
|
@ -741,7 +742,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
|
||||||
$log.info('CSV generation not available in mobile');
|
$log.info('CSV generation not available in mobile');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var isNode = nodeWebkit.isDefined();
|
var isNode = isNW;
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
var c = fc.credentials;
|
var c = fc.credentials;
|
||||||
if (!fc.isComplete()) return;
|
if (!fc.isComplete()) return;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('sidebarController',
|
angular.module('copayApp.controllers').controller('sidebarController',
|
||||||
function($rootScope, $timeout, lodash, profileService, configService, go, isMobile, isCordova) {
|
function($rootScope, $timeout, lodash, profileService, configService, go, platformInfo) {
|
||||||
var self = this;
|
var self = this;
|
||||||
self.isWindowsPhoneApp = isMobile.Windows() && isCordova;
|
self.isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
|
||||||
self.walletSelection = false;
|
self.walletSelection = false;
|
||||||
|
|
||||||
// wallet list change
|
// wallet list change
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.directives')
|
angular.module('copayApp.directives')
|
||||||
.directive('qrScanner', ['$rootScope', '$timeout', '$modal', 'isCordova', 'gettextCatalog', 'isMobile',
|
.directive('qrScanner', function($rootScope, $timeout, $modal, gettextCatalog, platformInfo) {
|
||||||
function($rootScope, $timeout, $modal, isCordova, gettextCatalog, isMobile) {
|
|
||||||
|
var isCordova = platformInfo.isCordova;
|
||||||
|
var isWP = platformInfo.isWP;
|
||||||
|
var isIOS = platformInfo.isIOS;
|
||||||
|
|
||||||
var controller = function($scope) {
|
var controller = function($scope) {
|
||||||
|
|
||||||
|
|
@ -11,11 +14,13 @@ angular.module('copayApp.directives')
|
||||||
window.plugins.spinnerDialog.hide();
|
window.plugins.spinnerDialog.hide();
|
||||||
window.ignoreMobilePause = false;
|
window.ignoreMobilePause = false;
|
||||||
}, 100);
|
}, 100);
|
||||||
if (isMobile.Windows() && result.cancelled) return;
|
if (isWP && result.cancelled) return;
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
var data = isMobile.iOS() ? result : result.text;
|
var data = isiOS ? result : result.text;
|
||||||
$scope.onScan({ data: data });
|
$scope.onScan({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -30,7 +35,7 @@ angular.module('copayApp.directives')
|
||||||
window.ignoreMobilePause = true;
|
window.ignoreMobilePause = true;
|
||||||
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if (isMobile.iOS()) {
|
if (isIOS) {
|
||||||
cloudSky.zBar.scan({}, onSuccess, onError);
|
cloudSky.zBar.scan({}, onSuccess, onError);
|
||||||
} else {
|
} else {
|
||||||
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
|
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
|
||||||
|
|
@ -145,7 +150,9 @@ angular.module('copayApp.directives')
|
||||||
keyboard: false
|
keyboard: false
|
||||||
});
|
});
|
||||||
modalInstance.result.then(function(data) {
|
modalInstance.result.then(function(data) {
|
||||||
parentScope.onScan({ data: data });
|
parentScope.onScan({
|
||||||
|
data: data
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
@ -153,8 +160,7 @@ angular.module('copayApp.directives')
|
||||||
$scope.openScanner = function() {
|
$scope.openScanner = function() {
|
||||||
if (isCordova) {
|
if (isCordova) {
|
||||||
$scope.cordovaOpenScanner();
|
$scope.cordovaOpenScanner();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$scope.modalOpenScanner();
|
$scope.modalOpenScanner();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -170,5 +176,4 @@ angular.module('copayApp.directives')
|
||||||
replace: true,
|
replace: true,
|
||||||
template: '<a id="camera-icon" class="p10" ng-click="openScanner()"><i class="icon-scan size-21"></i></a>'
|
template: '<a id="camera-icon" class="p10" ng-click="openScanner()"><i class="icon-scan size-21"></i></a>'
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
]);
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout, txFormatService, isCordova) {
|
angular.module('copayApp.services').factory('txStatus', function($modal, lodash, profileService, $timeout, txFormatService, platformInfo) {
|
||||||
var root = {};
|
var root = {};
|
||||||
|
var isCordova = platformInfo.isCordova;
|
||||||
|
|
||||||
root.notify = function(txp, cb) {
|
root.notify = function(txp, cb) {
|
||||||
var fc = profileService.focusedClient;
|
var fc = profileService.focusedClient;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue