ref controllers

This commit is contained in:
Matias Alejo Garcia 2016-05-31 16:52:38 -03:00
commit cc2853e827
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
4 changed files with 166 additions and 159 deletions

View file

@ -1,12 +1,13 @@
'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 SOFT_CONFIRMATION_LIMIT = 12;
var errors = bwcService.getErrors();
var historyUpdateInProgress = {};
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
var isNW = platformInfo.isNW;
var ret = {};
ret.isCordova = isCordova;
@ -48,7 +49,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
ret.tab = 'walletHome';
var vanillaScope = ret;
if (nodeWebkit.isDefined()) {
if (isNW) {
latestReleaseService.checkLatestRelease(function(err, newRelease) {
if (err) {
$log.warn(err);
@ -741,7 +742,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$log.info('CSV generation not available in mobile');
return;
}
var isNode = nodeWebkit.isDefined();
var isNode = isNW;
var fc = profileService.focusedClient;
var c = fc.credentials;
if (!fc.isComplete()) return;

View file

@ -1,9 +1,9 @@
'use strict';
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;
self.isWindowsPhoneApp = isMobile.Windows() && isCordova;
self.isWindowsPhoneApp = platformInfo.isWP && platformInfo.isCordova;
self.walletSelection = false;
// wallet list change

View file

@ -1,8 +1,11 @@
'use strict';
angular.module('copayApp.directives')
.directive('qrScanner', ['$rootScope', '$timeout', '$modal', 'isCordova', 'gettextCatalog', 'isMobile',
function($rootScope, $timeout, $modal, isCordova, gettextCatalog, isMobile) {
.directive('qrScanner', function($rootScope, $timeout, $modal, gettextCatalog, platformInfo) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var isIOS = platformInfo.isIOS;
var controller = function($scope) {
@ -11,11 +14,13 @@ angular.module('copayApp.directives')
window.plugins.spinnerDialog.hide();
window.ignoreMobilePause = false;
}, 100);
if (isMobile.Windows() && result.cancelled) return;
if (isWP && result.cancelled) return;
$timeout(function() {
var data = isMobile.iOS() ? result : result.text;
$scope.onScan({ data: data });
var data = isiOS ? result : result.text;
$scope.onScan({
data: data
});
}, 1000);
};
@ -30,7 +35,7 @@ angular.module('copayApp.directives')
window.ignoreMobilePause = true;
window.plugins.spinnerDialog.show(null, gettextCatalog.getString('Preparing camera...'), true);
$timeout(function() {
if (isMobile.iOS()) {
if (isIOS) {
cloudSky.zBar.scan({}, onSuccess, onError);
} else {
cordova.plugins.barcodeScanner.scan(onSuccess, onError);
@ -73,7 +78,7 @@ angular.module('copayApp.directives')
} else {
try {
localMediaStream.stop();
} catch(e) {
} catch (e) {
// Older Chromium not support the STOP function
};
}
@ -141,11 +146,13 @@ angular.module('copayApp.directives')
templateUrl: 'views/modals/scanner.html',
windowClass: 'full',
controller: ModalInstanceCtrl,
backdrop : 'static',
backdrop: 'static',
keyboard: false
});
modalInstance.result.then(function(data) {
parentScope.onScan({ data: data });
parentScope.onScan({
data: data
});
});
};
@ -153,8 +160,7 @@ angular.module('copayApp.directives')
$scope.openScanner = function() {
if (isCordova) {
$scope.cordovaOpenScanner();
}
else {
} else {
$scope.modalOpenScanner();
}
};
@ -170,5 +176,4 @@ angular.module('copayApp.directives')
replace: true,
template: '<a id="camera-icon" class="p10" ng-click="openScanner()"><i class="icon-scan size-21"></i></a>'
}
}
]);
});

View file

@ -1,7 +1,8 @@
'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 isCordova = platformInfo.isCordova;
root.notify = function(txp, cb) {
var fc = profileService.focusedClient;