rm go
This commit is contained in:
parent
aa372ea618
commit
a8cf875def
22 changed files with 53 additions and 1392 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('applicationService', function($rootScope, $timeout, platformInfo, go) {
|
||||
.factory('applicationService', function($rootScope, $timeout, platformInfo, $state) {
|
||||
var root = {};
|
||||
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
|
|
@ -19,7 +19,7 @@ angular.module('copayApp.services')
|
|||
if (isChromeApp) {
|
||||
chrome.runtime.reload();
|
||||
} else if (isNW) {
|
||||
go.walletHome();
|
||||
$state.go('tabs.home');
|
||||
$timeout(function() {
|
||||
var win = require('nw.gui').Window.get();
|
||||
win.reload(3);
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('go', function($window, $ionicSideMenuDelegate, $rootScope, $location, $state, $timeout, $log, profileService, platformInfo, nodeWebkit) {
|
||||
var root = {};
|
||||
|
||||
root.openExternalLink = function(url, target) {
|
||||
if (platformInfo.isNW) {
|
||||
nodeWebkit.openExternalLink(url);
|
||||
} else {
|
||||
target = target || '_blank';
|
||||
var ref = window.open(url, target, 'location=no');
|
||||
}
|
||||
};
|
||||
|
||||
root.is = function(name) {
|
||||
return $state.is(name);
|
||||
};
|
||||
|
||||
root.path = function(path, cb) {
|
||||
$state.transitionTo(path)
|
||||
.then(function() {
|
||||
if (cb) return cb();
|
||||
}, function() {
|
||||
if (cb) return cb('animation in progress');
|
||||
});
|
||||
};
|
||||
|
||||
root.toggleLeftMenu = function() {
|
||||
$ionicSideMenuDelegate.toggleLeft();
|
||||
};
|
||||
|
||||
root.walletHome = function() {
|
||||
var fc = profileService.focusedClient;
|
||||
if (fc && !fc.isComplete()) {
|
||||
$log.debug("Wallet not complete at startup... redirecting");
|
||||
$state.transitionTo('wallet.details', {walletId: fc.credentials.walletId})
|
||||
} else {
|
||||
root.path('tabs.home');
|
||||
}
|
||||
};
|
||||
|
||||
root.confirm = function(params) {
|
||||
$state.transitionTo('confirm', params)
|
||||
};
|
||||
|
||||
root.send = function() {
|
||||
root.path('tabs.send');
|
||||
};
|
||||
|
||||
root.addWallet = function() {
|
||||
$state.transitionTo('add');
|
||||
};
|
||||
|
||||
root.preferences = function() {
|
||||
$state.transitionTo('preferences');
|
||||
};
|
||||
|
||||
root.preferencesGlobal = function() {
|
||||
$state.transitionTo('tabs.settings');
|
||||
};
|
||||
|
||||
root.reload = function() {
|
||||
$state.reload();
|
||||
};
|
||||
|
||||
|
||||
// Global go. This should be in a better place TODO
|
||||
// We don't do a 'go' directive, to use the benefits of ng-touch with ng-click
|
||||
$rootScope.go = function(path) {
|
||||
root.path(path);
|
||||
};
|
||||
|
||||
$rootScope.openExternalLink = function(url, target) {
|
||||
root.openExternalLink(url, target);
|
||||
};
|
||||
|
||||
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
@ -1,10 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
// DO NOT INCLUDE STORAGE HERE \/ \/
|
||||
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal) {
|
||||
// DO NOT INCLUDE STORAGE HERE ^^
|
||||
//
|
||||
//
|
||||
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal, $state) {
|
||||
// `wallet` is a decorated version of client.
|
||||
|
||||
var root = {};
|
||||
|
|
@ -104,7 +100,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
console.log('[walletService.js.93] TODO NOT AUTH'); //TODO
|
||||
// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO
|
||||
wallet.notAuthorized = true;
|
||||
go.walletHome();
|
||||
$state.go('tabs.home');
|
||||
} else if (err instanceof errors.NOT_FOUND) {
|
||||
root.showErrorPopup(gettext('Could not access Wallet Service: Not found'));
|
||||
} else {
|
||||
|
|
@ -665,6 +661,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
alertPopup.then(cb);
|
||||
};
|
||||
|
||||
// walletHome
|
||||
root.recreate = function(wallet, cb) {
|
||||
ongoingProcess.set('recreating', true);
|
||||
wallet.recreateWallet(function(err) {
|
||||
|
|
@ -672,7 +669,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
ongoingProcess.set('recreating', false);
|
||||
|
||||
if (err) {
|
||||
wallet.handleError(err);
|
||||
handleError(err);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -693,12 +690,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
includeCopayerBranches: true,
|
||||
}, function(err) {
|
||||
|
||||
// TODO
|
||||
// if (err && wallet.walletId == walletId) {
|
||||
// wallet.updating = false;
|
||||
// wallet.handleError(err);
|
||||
// $rootScope.$apply();
|
||||
// }
|
||||
if (err && wallet.walletId == walletId) {
|
||||
wallet.updating = false;
|
||||
handleError(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue