Merge branch 'ref/design' of https://github.com/bitpay/bitpay-wallet into feature/onboarding_last_steps

# Conflicts:
#	public/views/onboarding/terms.html
#	src/sass/views/onboarding/terms-of-use.scss
This commit is contained in:
Jamal Jackson 2016-09-06 10:46:47 -04:00
commit 229e2fd8ec
83 changed files with 860 additions and 999 deletions

View file

@ -1,15 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('amazonController',
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, nodeWebkit, popupService) {
function($scope, $timeout, $ionicModal, $log, lodash, bwcError, amazonService, platformInfo, externalLinkService, popupService) {
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
nodeWebkit.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
externalLinkService.open(url, target);
};
this.init = function() {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('buyAmazonController',
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, nodeWebkit, popupService) {
function($scope, $log, $timeout, $state, lodash, profileService, bwcError, gettextCatalog, configService, walletService, amazonService, ongoingProcess, platformInfo, externalLinkService, popupService) {
var self = this;
var wallet;
@ -16,12 +16,7 @@ angular.module('copayApp.controllers').controller('buyAmazonController',
});
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
nodeWebkit.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
externalLinkService.open(url, target);
};
this.init = function() {

View file

@ -5,6 +5,17 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
$scope.$on('Wallet/Changed', function(event, wallet) {
if (lodash.isEmpty(wallet)) {
$log.debug('No wallet provided');
return;
}
$log.debug('Wallet changed: ' + wallet.name);
setWallet(wallet, true);
});
$scope.showDescriptionPopup = function() {
var commentPopup = $ionicPopup.show({
templateUrl: "views/includes/note.html",
@ -17,13 +28,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.commentPopupSave = function(description) {
$log.debug('Saving description: ' + description);
$scope.description = description;
$scope.txp = null;
createTx($scope.wallet, function(err, txp) {
if (err) return;
cachedTxp[$scope.wallet.id] = txp;
apply(txp);
});
commentPopup.close();
};
};
@ -137,15 +141,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
};
$scope.$on('Wallet/Changed', function(event, wallet) {
if (lodash.isEmpty(wallet)) {
$log.debug('No wallet provided');
return;
}
$log.debug('Wallet changed: ' + wallet.name);
setWallet(wallet, true);
});
function setWallet(wallet, delayed) {
var stop;
$scope.wallet = wallet;
@ -165,7 +160,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
apply(cachedTxp[wallet.id]);
} else {
stop = $timeout(function() {
createTx(wallet, function(err, txp) {
createTx(wallet, true, function(err, txp) {
if (err) return;
cachedTxp[wallet.id] = txp;
apply(txp);
@ -184,7 +179,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.$apply();
};
var createTx = function(wallet, cb) {
var createTx = function(wallet, dryRun, cb) {
var config = configService.getSync().wallet;
var currentSpendUnconfirmed = config.spendUnconfirmed;
var outputs = [];
@ -227,6 +222,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
txp.payProUrl = paypro;
txp.excludeUnconfirmedUtxos = config.spendUnconfirmed ? false : true;
txp.feeLevel = config.settings.feeLevel || 'normal';
txp.dryRun = dryRun;
walletService.createTx(wallet, txp, function(err, ctxp) {
if (err) {
@ -247,14 +243,10 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$scope.approve = function() {
var wallet = $scope.wallet;
var txp = $scope.txp;
if (!wallet) {
return setSendError(gettextCatalog.getString('No wallet selected'));
};
if (!txp) {
return setSendError(gettextCatalog.getString('No transaction'));
};
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {
$log.info('No signing proposal: No private key');
@ -265,9 +257,14 @@ angular.module('copayApp.controllers').controller('confirmController', function(
});
}
walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
$state.transitionTo('tabs.home');
ongoingProcess.set('creatingTx', true);
createTx(wallet, false, function(err, txp) {
ongoingProcess.set('creatingTx', false);
if (err) return;
walletService.publishAndSign(wallet, txp, function(err, txp) {
if (err) return setSendError(err);
$state.transitionTo('tabs.home');
});
});
};

View file

@ -7,11 +7,6 @@ angular.module('copayApp.controllers').controller('createController',
var isCordova = platformInfo.isCordova;
var isDevel = platformInfo.isDevel;
var self = this;
var defaults = configService.getDefaults();
this.isWindowsPhoneApp = platformInfo.isWP && isCordova;
$scope.account = 1;
/* For compressed keys, m*73 + n*34 <= 496 */
var COPAYER_PAIR_LIMITS = {
1: 1,
@ -28,96 +23,91 @@ angular.module('copayApp.controllers').controller('createController',
12: 1,
};
var defaults = configService.getDefaults();
$scope.bwsurl = defaults.bws.url;
$scope.derivationPath = derivationPathHelper.default;
// ng-repeat defined number of times instead of repeating over array?
this.getNumber = function(num) {
return new Array(num);
}
$scope.init = function() {
$scope.formData = {};
var defaults = configService.getDefaults();
$scope.formData.account = 1;
$scope.formData.bwsurl = defaults.bws.url;
$scope.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.formData.totalCopayers = defaults.wallet.totalCopayers;
$scope.formData.derivationPath = derivationPathHelper.default;
$scope.setTotalCopayers(1);
updateRCSelect(1);
updateSeedSourceSelect(1);
};
$scope.showAdvChange = function() {
$ionicScrollDelegate.resize();
};
var updateRCSelect = function(n) {
$scope.totalCopayers = n;
function updateRCSelect(n) {
$scope.formData.totalCopayers = n;
var maxReq = COPAYER_PAIR_LIMITS[n];
self.RCValues = lodash.range(1, maxReq + 1);
$scope.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
$scope.RCValues = lodash.range(1, maxReq + 1);
$scope.formData.requiredCopayers = Math.min(parseInt(n / 2 + 1), maxReq);
};
var updateSeedSourceSelect = function(n) {
self.seedOptions = [{
function updateSeedSourceSelect(n) {
var seedOptions = [{
id: 'new',
label: gettext('Random'),
}, {
id: 'set',
label: gettext('Specify Recovery Phrase...'),
}];
$scope.seedSource = self.seedOptions[0];
$scope.seedSource = seedOptions[0];
if (n > 1 && isChromeApp)
self.seedOptions.push({
seedOptions.push({
id: 'ledger',
label: 'Ledger Hardware Wallet',
});
if (isChromeApp || isDevel) {
self.seedOptions.push({
seedOptions.push({
id: 'trezor',
label: 'Trezor Hardware Wallet',
});
}
$scope.seedOptions = seedOptions;
};
this.TCValues = lodash.range(2, defaults.limits.totalCopayers + 1);
$scope.totalCopayers = defaults.wallet.totalCopayers;
this.setTotalCopayers = function(tc) {
$scope.setTotalCopayers = function(tc) {
$scope.formData.totalCopayers = tc;
updateRCSelect(tc);
updateSeedSourceSelect(tc);
self.seedSourceId = $scope.seedSource.id;
};
this.setSeedSource = function(src) {
self.seedSourceId = $scope.seedSource.id;
$timeout(function() {
$rootScope.$apply();
});
};
this.create = function(form) {
$scope.create = function(form) {
if (form && form.$invalid) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
var opts = {
m: $scope.requiredCopayers,
n: $scope.totalCopayers,
name: $scope.walletName,
myName: $scope.totalCopayers > 1 ? $scope.myName : null,
networkName: $scope.testnetEnabled ? 'testnet' : 'livenet',
bwsurl: $scope.bwsurl,
singleAddress: $scope.singleAddressEnabled,
walletPrivKey: $scope._walletPrivKey, // Only for testing
name: $scope.formData.walletName,
m: $scope.formData.requiredCopayers,
n: $scope.formData.totalCopayers,
myName: $scope.formData.totalCopayers > 1 ? $scope.formData.myName : null,
networkName: $scope.formData.testnetEnabled ? 'testnet' : 'livenet',
bwsurl: $scope.formData.bwsurl,
singleAddress: $scope.formData.singleAddressEnabled,
walletPrivKey: $scope.formData._walletPrivKey, // Only for testing
};
var setSeed = self.seedSourceId == 'set';
var setSeed = $scope.seedSource.id == 'set';
if (setSeed) {
var words = $scope.privateKey || '';
var words = $scope.formData.privateKey || '';
if (words.indexOf(' ') == -1 && words.indexOf('prv') == 1 && words.length > 108) {
opts.extendedPrivateKey = words;
} else {
opts.mnemonic = words;
}
opts.passphrase = $scope.passphrase;
opts.passphrase = $scope.formData.passphrase;
var pathData = derivationPathHelper.parse($scope.derivationPath);
var pathData = derivationPathHelper.parse($scope.formData.derivationPath);
if (!pathData) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
@ -128,7 +118,7 @@ angular.module('copayApp.controllers').controller('createController',
opts.derivationStrategy = pathData.derivationStrategy;
} else {
opts.passphrase = $scope.createPassphrase;
opts.passphrase = $scope.formData.createPassphrase;
}
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
@ -136,36 +126,36 @@ angular.module('copayApp.controllers').controller('createController',
return;
}
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if ($scope.seedSource.id == 'ledger' || $scope.seedSource.id == 'trezor') {
var account = $scope.formData.account;
if (!account || account < 1) {
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
if (self.seedSourceId == 'trezor')
if ($scope.seedSource.id == 'trezor')
account = account - 1;
opts.account = account;
ongoingProcess.set('connecting' + self.seedSourceId, true);
ongoingProcess.set('connecting' + $scope.seedSource.id, true);
var src = self.seedSourceId == 'ledger' ? ledger : trezor;
var src = $scope.seedSource.id == 'ledger' ? ledger : trezor;
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false);
ongoingProcess.set('connecting' + $scope.seedSource.id, false);
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
opts = lodash.assign(lopts, opts);
self._create(opts);
_create(opts);
});
} else {
self._create(opts);
_create(opts);
}
};
this._create = function(opts) {
function _create(opts) {
ongoingProcess.set('creatingWallet', true);
$timeout(function() {
@ -182,35 +172,11 @@ angular.module('copayApp.controllers').controller('createController',
});
if (self.seedSourceId == 'set') {
if ($scope.seedSource.id == 'set') {
profileService.setBackupFlag(client.credentials.walletId);
}
$state.go('tabs.home')
});
}, 100);
}
this.formFocus = function(what) {
if (!this.isWindowsPhoneApp) return
if (what && what == 'my-name') {
this.hideWalletName = true;
this.hideTabs = true;
} else if (what && what == 'wallet-name') {
this.hideTabs = true;
} else {
this.hideWalletName = false;
this.hideTabs = false;
}
$timeout(function() {
$rootScope.$digest();
}, 1);
};
$scope.$on("$destroy", function() {
$rootScope.hideWalletNavigation = false;
});
updateSeedSourceSelect(1);
self.setSeedSource();
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('exportController',
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
function($rootScope, $scope, $timeout, $log, $ionicHistory, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
var prevState;
var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
@ -63,6 +63,7 @@ angular.module('copayApp.controllers').controller('exportController',
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
}
$ionicHistory.clearHistory();
$state.go('tabs.home');
});
});

View file

@ -1,15 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('glideraController',
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, nodeWebkit, popupService, gettextCatalog) {
function($scope, $timeout, $ionicModal, $log, storageService, glideraService, ongoingProcess, platformInfo, externalLinkService, popupService, gettextCatalog) {
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
nodeWebkit.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
externalLinkService.open(url, target);
};
$scope.init = function(accessToken) {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo) {
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $scope, $filter, $stateParams, $ionicPopup, gettextCatalog, profileService, configService, lodash, txFormatService, platformInfo, externalLinkService) {
var self = $scope.self;
var wallet = profileService.getWallet($stateParams.walletId);
@ -81,12 +81,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
};
$scope.openExternalLink = function(url, target) {
if (platformInfo.isNW) {
nodeWebkit.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
externalLinkService.open(url, target);
};
$scope.getShortNetworkName = function() {

View file

@ -32,12 +32,9 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.sign = function() {
$scope.loading = true;
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
console.log('[txpDetails.js.35] AFTER publush'); //TODO
$scope.$emit('UpdateTx');
if (err) return setSendError(err);
$scope.close(txp);
$scope.close();
});
};
@ -53,7 +50,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
if (err)
return setError(err, gettextCatalog.getString('Could not reject payment'));
$scope.close(txpr);
$scope.close();
});
@ -90,7 +87,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
return setError(err, gettextCatalog.getString('Could not broadcast payment'));
}
$scope.close(txpb);
$scope.close();
});
}, 10);
};
@ -175,7 +172,7 @@ console.log('[txpDetails.js.35] AFTER publush'); //TODO
});
};
$scope.close = function(txp) {
$scope.close = function() {
$scope.loading = null;
$scope.txpDetailsModal.hide();
};

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $ionicPopup) {
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicPopup) {
$scope.walletId = $stateParams.walletId;
$scope.openPopup = function() {
var backupLaterPopup = $ionicPopup.show({
templateUrl: "views/includes/backupLaterPopup.html",

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $ionicPopup, $stateParams, profileService) {
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $stateParams, $ionicPopup, profileService) {
$scope.walletId = $stateParams.walletId;
$scope.openPopup = function() {
var backupWarningPopup = $ionicPopup.show({
templateUrl: "views/includes/backupWarningPopup.html",
@ -10,7 +11,7 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.close = function() {
backupWarningPopup.close();
$state.go('onboarding.backup');
$state.go('onboarding.backup', {walletId: $stateParams.walletId, fromOnboarding: true});
};
}
});

View file

@ -25,9 +25,13 @@ angular.module('copayApp.controllers').controller('collectEmailController', func
if (err) $log.warn(err);
configService.set(opts, function(err) {
if (err) $log.warn(err);
if (!usePushNotifications) $state.go('onboarding.backupRequest');
else $state.go('onboarding.notifications');
if (!usePushNotifications) $state.go('onboarding.backupRequest', {walletId: walletId});
else $state.go('onboarding.notifications', {walletId: walletId});
});
});
};
$scope.onboardingMailSkip = function() {
$state.go('onboarding.backupRequest', {walletId: walletId});
};
});

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, profileService) {
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $stateParams, profileService) {
$scope.walletId = $stateParams.walletId;
$scope.allowNotif = function() {
profileService.pushNotificationsInit();
$state.go('onboarding.backupRequest');

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService) {
angular.module('copayApp.controllers').controller('termsController', function($scope, $log, $state, uxLanguage, profileService, externalLinkService) {
$scope.lang = uxLanguage.currentLanguage;
$scope.confirm = function() {
@ -12,4 +12,8 @@ angular.module('copayApp.controllers').controller('termsController', function($s
});
};
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
});

View file

@ -1,5 +1,5 @@
angular.module('copayApp.controllers').controller('paperWalletController',
function($scope, $timeout, $log, $ionicModal, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
function($scope, $timeout, $log, $ionicModal, $ionicHistory, configService, profileService, $state, addressService, bitcore, ongoingProcess, txFormatService, $stateParams, walletService) {
var wallet = profileService.getWallet($stateParams.walletId);
var rawTx;
@ -102,6 +102,7 @@ angular.module('copayApp.controllers').controller('paperWalletController',
} else {
var type = walletService.getViewStatus(wallet, txp);
$scope.openStatusModal(type, txp, function() {
$ionicHistory.clearHistory();
$state.go('tabs.home');
});
}

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('paymentUriController',
function($rootScope, $scope, $stateParams, $location, $timeout, profileService, configService, lodash, bitcore, $state) {
function($rootScope, $scope, $stateParams, $location, $timeout, $ionicHistory, profileService, configService, lodash, bitcore, $state) {
function strip(number) {
return (parseFloat(number.toPrecision(12)));
};
@ -47,6 +47,7 @@ angular.module('copayApp.controllers').controller('paymentUriController',
this.selectWallet = function(wid) {
var self = this;
profileService.setAndStoreFocus(wid, function() {});
$ionicHistory.clearHistory();
$state.go('tabs.home');
$timeout(function() {
$rootScope.$emit('paymentUri', self.bitcoinURI);

View file

@ -2,7 +2,7 @@
angular.module('copayApp.controllers').controller('preferencesController',
function($scope, $rootScope, $timeout, $log, $stateParams, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, profileService, fingerprintService, walletService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Preferences'));
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Preferences'));
var wallet = profileService.getWallet($stateParams.walletId);
var walletId = wallet.credentials.walletId;
$scope.wallet = wallet;
@ -14,9 +14,6 @@ angular.module('copayApp.controllers').controller('preferencesController',
return $ionicHistory.goBack();
var config = configService.getSync();
config.aliasFor = config.aliasFor || {};
$scope.alias = config.aliasFor[walletId] || wallet.credentials.walletName;
$scope.color = config.colorFor[walletId] || '#4A90E2';
$scope.encryptEnabled = walletService.isEncrypted(wallet);
if (wallet.isPrivKeyExternal)

View file

@ -1,6 +1,14 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesAbout',
function($ionicNavBarDelegate, gettextCatalog) {
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
function($scope, $window, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('About') + ' ' + $window.appConfig.nameCase);
$scope.version = $window.version;
$scope.commitHash = $window.commitHash;
$scope.name = $window.appConfig.gitHubRepoName;
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
});

View file

@ -8,9 +8,8 @@ angular.module('copayApp.controllers').controller('preferencesAliasController',
var walletId = wallet.credentials.walletId;
var config = configService.getSync();
config.aliasFor = config.aliasFor || {};
$scope.walletName = wallet.credentials.walletName;
$scope.alias = config.aliasFor[walletId] || wallet.walletName;
$scope.alias = (config.aliasFor && config.aliasFor[walletId]) || wallet.walletName;
$scope.save = function() {
var opts = {

View file

@ -1,32 +1,17 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet'));
function($scope, $stateParams, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete'));
var wallet = profileService.getWallet($stateParams.walletId);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = '[' + wallet.credentials.walletName + ']';
$scope.showDeletePopup = function() {
var popup = $ionicPopup.show({
template: '<span>' + gettextCatalog.getString('Are you sure you want to delete this wallet?') + '</span>',
title: gettextCatalog.getString('Confirm'),
buttons: [
{
text: gettextCatalog.getString('Cancel'),
onTap: function(e) {
popup.close();
}
},
{
text: gettextCatalog.getString('Accept'),
type: 'button-positive',
onTap: function(e) {
deleteWallet();
popup.close();
}
}
]
var title = gettextCatalog.getString('Warning!');
var message = gettextCatalog.getString('Are you sure you want to delete this wallet?');
popupService.showConfirm(title, message, function(res) {
if (res) deleteWallet();
});
};
@ -37,6 +22,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
if (err) {
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$ionicHistory.clearHistory();
$state.go('tabs.home');
}
});

View file

@ -1,12 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Preferences fee'));
angular.module('copayApp.controllers').controller('preferencesFeeController', function($scope, $timeout, $ionicHistory, $ionicNavBarDelegate, gettextCatalog, configService, feeService, ongoingProcess) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Bitcoin Network Fee Policy'));
$scope.init = function() {
$scope.loading = true;
ongoingProcess.set('gettingFeeLevels', true);
feeService.getFeeLevels(function(levels) {
$scope.loading = false;
ongoingProcess.set('gettingFeeLevels', false);
$scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.feeLevels = levels;
@ -29,7 +29,7 @@ angular.module('copayApp.controllers').controller('preferencesFeeController', fu
$ionicHistory.goBack();
$timeout(function() {
$scope.$apply();
}, 10);
}, 100);
});
};
});

View file

@ -1,17 +1,16 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesHistory',
function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, profileService, lodash) {
function($scope, $log, $stateParams, $timeout, $ionicNavBarDelegate, gettextCatalog, storageService, $state, $ionicHistory, profileService, lodash) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Transaction History'));
var wallet = profileService.getWallet($stateParams.walletId);
var c = wallet.credentials;
$scope.wallet = profileService.getWallet($stateParams.walletId);
$scope.csvReady = false;
$scope.csvHistory = function(cb) {
var allTxs = [];
function getHistory(cb) {
storageService.getTxHistory(c.walletId, function(err, txs) {
storageService.getTxHistory($scope.wallet.id, function(err, txs) {
if (err) return cb(err);
var txsFromLocal = [];
@ -22,7 +21,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
}
allTxs.push(txsFromLocal);
return cb(null, lodash.flatten(allTxs));
return cb(null, lodash.compact(lodash.flatten(allTxs)));
});
};
@ -40,7 +39,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
var data = txs;
var satToBtc = 1 / 100000000;
$scope.csvContent = [];
$scope.csvFilename = 'Copay-' + ($scope.alias || $scope.walletName) + '.csv';
$scope.csvFilename = 'Copay-' + $scope.wallet.name + '.csv';
$scope.csvHeader = ['Date', 'Destination', 'Description', 'Amount', 'Currency', 'Txid', 'Creator', 'Copayers', 'Comment'];
var _amount, _note, _copayers, _creator, _comment;
@ -118,7 +117,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
};
$scope.clearTransactionHistory = function() {
storageService.removeTxHistory(c.walletId, function(err) {
storageService.removeTxHistory($scope.wallet.id, function(err) {
if (err) {
$log.error(err);
return;
@ -126,6 +125,7 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$scope.$emit('Local/ClearHistory');
$timeout(function() {
$ionicHistory.clearHistory();
$state.go('tabs.home');
}, 100);
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesInformation',
function($scope, $log, $timeout, $ionicNavBarDelegate, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
function($scope, $log, $timeout, $ionicNavBarDelegate, $ionicHistory, platformInfo, gettextCatalog, lodash, profileService, configService, $stateParams, walletService, $state) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Wallet Information'));
var base = 'xpub';
var wallet = profileService.getWallet($stateParams.walletId);
@ -105,6 +105,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
opts.colorFor[walletId] = color;
configService.set(opts, function(err) {
$ionicHistory.clearHistory();
$state.go('tabs.home');
if (err) $log.warn(err);
});
@ -116,6 +117,7 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
$scope.scan = function() {
walletService.startScan(wallet);
$ionicHistory.clearHistory();
$state.go('tabs.home');
};

View file

@ -1,9 +1,13 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService) {
function($scope, $log, $ionicNavBarDelegate, $ionicHistory, gettextCatalog, configService, profileService, uxLanguage, walletService, externalLinkService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Language'));
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
$scope.init = function() {
$scope.availableLanguages = uxLanguage.getLanguages();
$scope.currentLanguage = uxLanguage.getCurrentLanguage();
@ -22,7 +26,7 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
if (err) $log.warn(err);
$ionicHistory.goBack();
uxLanguage.update(function() {
uxLanguage.init(function() {
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});

View file

@ -8,13 +8,19 @@ angular.module('copayApp.controllers').controller('preferencesLogs',
$scope.logs = historicLog.get();
}
$scope.sendLogs = function() {
var body = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
body += '\n\n';
body += $scope.logs.map(function(v) {
$scope.prepare = function() {
var log = 'Copay Session Logs\n Be careful, this could contain sensitive private data\n\n';
log += '\n\n';
log += $scope.logs.map(function(v) {
return v.msg;
}).join('\n');
return log;
};
$scope.sendLogs = function() {
var body = $scope.prepare();
window.plugins.socialsharing.shareViaEmail(
body,
'Copay Logs',

View file

@ -1,23 +1,30 @@
'use strict';
angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService) {
function($rootScope, $timeout, $scope, $state, $ionicScrollDelegate, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo, storageService, txpModalService, $window) {
$scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO
function updateTxps() {
profileService.getTxps({
limit: 3
}, function(err, txps, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
}
$scope.txps = txps;
$scope.txpsN = n;
$ionicScrollDelegate.resize();
var setPendingTxps = function(txps) {
if (!txps) {
$scope.txps = [];
return;
}
$scope.txps = lodash.sortBy(txps, 'createdOn').reverse();
$timeout(function() {
$scope.$apply();
}, 1);
})
};
$scope.updateAllWallets = function() {
$scope.wallets = profileService.getWallets();
if (lodash.isEmpty($scope.wallets)) return;
@ -35,20 +42,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
wallet.status = status;
}
if (++j==i) {
profileService.getTxps({
limit: 3
}, function(err, txps, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
}
$scope.txps = txps;
$scope.txpsN = n;
$ionicScrollDelegate.resize();
$timeout(function() {
$scope.$apply();
}, 1);
});
updateTxps();
}
});
});
@ -81,29 +75,18 @@ angular.module('copayApp.controllers').controller('tabHomeController',
}
wallet.status = status;
$scope.fetchingNotifications = true;
profileService.getNotifications({
limit: 3
}, function(err, notifications) {
$scope.fetchingNotifications = false;
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;
}
$scope.notifications = notifications;
profileService.getTxps({
limit: 3
}, function(err, txps, n) {
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
}
$scope.txps = txps;
$scope.txpsN = n;
$ionicScrollDelegate.resize();
$timeout(function() {
$scope.$apply();
}, 1);
})
updateTxps();
})
});
};
@ -123,6 +106,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.updateWallet(wallet);
}),
$rootScope.$on('Local/TxAction', function(e, walletId) {
$log.debug('Got action for wallet '+ walletId);
var wallet = profileService.getWallet(walletId);
$scope.updateWallet(wallet);
}),
@ -143,5 +127,9 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.openTxpModal = txpModalService.open;
$scope.version = $window.version;
$scope.name = $window.appConfig.nameCase;
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $ionicModal, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
$scope.init = function() {
@ -9,6 +9,8 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
var isWP = platformInfo.isWP;
var isIOS = platformInfo.isIOS;
$scope.appName = $window.appConfig.nameCase;
$scope.unitName = config.wallet.settings.unitName;
$scope.currentLanguageName = uxLanguage.getCurrentLanguageName();
$scope.selectedAlternative = {
@ -30,9 +32,6 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.glideraEnabled = config.glidera.enabled;
$scope.coinbaseEnabled = config.coinbase.enabled;
$scope.pushNotifications = config.pushNotifications.enabled;
if (isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
return w.id != self.walletId;
});

View file

@ -1,7 +1,12 @@
'use strict';
angular.module('copayApp.controllers').controller('termOfUseController',
function($scope, uxLanguage, $ionicNavBarDelegate, gettextCatalog) {
$ionicNavBarDelegate.title(gettextCatalog.getString('About Copay'));
function($scope, $window, uxLanguage, $ionicNavBarDelegate, gettextCatalog, externalLinkService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Terms Of Use'));
$scope.lang = uxLanguage.currentLanguage;
$scope.disclaimerUrl = $window.appConfig.disclaimerUrl;
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
});

View file

@ -0,0 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('translatorsController',
function($scope, externalLinkService) {
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService) {
angular.module('copayApp.controllers').controller('walletDetailsController', function($scope, $rootScope, $interval, $timeout, $filter, $log, $ionicModal, $ionicPopover, $ionicNavBarDelegate, $state, $stateParams, bwcError, profileService, lodash, configService, gettext, gettextCatalog, platformInfo, walletService, $ionicPopup, txpModalService, externalLinkService) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -12,6 +12,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
var HISTORY_SHOW_LIMIT = 10;
$scope.txps = [];
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
};
var setPendingTxps = function(txps) {
if (!txps) {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.directives')
.directive('copyToClipboard', function(platformInfo, nodeWebkit, gettextCatalog, ionicToast, clipboard) {
.directive('copyToClipboard', function(platformInfo, nodeWebkitService, gettextCatalog, ionicToast, clipboard) {
return {
restrict: 'A',
scope: {
@ -22,7 +22,7 @@ angular.module('copayApp.directives')
window.cordova.plugins.clipboard.copy(data);
window.plugins.toast.showShortCenter(msg);
} else if (isNW) {
nodeWebkit.writeToClipboard(data);
nodeWebkitService.writeToClipboard(data);
scope.$apply(function() {
ionicToast.show(msg, 'bottom', false, 1000);
});

View file

@ -143,14 +143,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/uri-coinbase/:url',
templateUrl: 'views/coinbaseUri.html'
})
.state('activity', {
url: '/activity',
templateUrl: 'views/activity.html'
})
.state('proposals', {
url: '/proposals',
templateUrl: 'views/proposals.html'
})
/*
*
@ -159,17 +151,33 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
*/
.state('tabs.details', {
url: '/details/{walletId}/{fromOnboarding}',
views: {
'tab-home': {
templateUrl: 'views/walletDetails.html'
url: '/details/{walletId}/{fromOnboarding}',
views: {
'tab-home': {
templateUrl: 'views/walletDetails.html'
}
},
params: {
txid: null,
txpId: null,
},
})
.state('tabs.activity', {
url: '/activity',
views: {
'tab-home': {
templateUrl: 'views/activity.html',
}
}
},
params: {
txid: null,
txpId: null,
},
})
})
.state('tabs.proposals', {
url: '/proposals',
views: {
'tab-home': {
templateUrl: 'views/proposals.html',
}
}
})
/*
*
@ -254,12 +262,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
url: '/add',
views: {
'tab-home': {
templateUrl: 'views/add.html',
controller: function(platformInfo) {
if (platformInfo.isCordova && StatusBar.isVisible) {
StatusBar.backgroundColorByHexString("#4B6178");
}
}
templateUrl: 'views/add.html'
}
}
})
@ -306,30 +309,12 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
})
.state('tabs.create', {
url: '/create',
abstract: true,
templateUrl: 'views/create.html',
views: {
'tab-home': {
templateUrl: 'views/create.html'
},
}
})
.state('tabs.create.personal', {
url: '/tab-create-personal',
views: {
'tab-create-personal': {
templateUrl: 'views/tab-create-personal.html',
},
}
})
.state('tabs.create.shared', {
url: '/tab-create-shared',
views: {
'tab-create-shared': {
templateUrl: 'views/tab-create-shared.html',
},
}
})
/*
*
@ -565,11 +550,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
.state('onboarding', {
url: '/onboarding',
abstract: true,
template: '<ion-nav-view name="onboarding"></ion-nav-view>',
params: {
walletId: null,
fromOnboarding: null,
},
template: '<ion-nav-view name="onboarding"></ion-nav-view>'
})
.state('onboarding.welcome', {
url: '/welcome',
@ -588,7 +569,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.collectEmail', {
url: '/collectEmail',
url: '/collectEmail/:walletId',
views: {
'onboarding': {
templateUrl: 'views/onboarding/collectEmail.html'
@ -596,7 +577,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.notifications', {
url: '/notifications',
url: '/notifications/:walletId',
views: {
'onboarding': {
templateUrl: 'views/onboarding/notifications.html'
@ -604,7 +585,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.backupRequest', {
url: '/backupRequest',
url: '/backupRequest/:walletId',
views: {
'onboarding': {
templateUrl: 'views/onboarding/backupRequest.html'
@ -612,7 +593,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.backupWarning', {
url: '/backupWarning',
url: '/backupWarning/:walletId',
views: {
'onboarding': {
templateUrl: 'views/onboarding/backupWarning.html'
@ -620,7 +601,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.backup', {
url: '/backup',
url: '/backup/:walletId/:fromOnboarding',
views: {
'onboarding': {
templateUrl: 'views/backup.html'
@ -652,7 +633,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
},
},
params: {
code: null
code: null,
fromOnboarding: null
},
})
.state('onboarding.import.phrase', {
@ -807,74 +789,35 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
})
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService) {
if (platformInfo.isCordova) {
if (screen.width < 768) {
screen.lockOrientation('portrait');
} else {
window.addEventListener("orientationchange", function() {
var leftMenuWidth = document.querySelector("ion-side-menu[side='left']").clientWidth;
if (screen.orientation.includes('portrait')) {
// Portrait
document.querySelector("ion-side-menu-content").style.width = (screen.width - leftMenuWidth) + "px";
} else {
// Landscape
document.querySelector("ion-side-menu-content").style.width = (screen.height - leftMenuWidth) + "px";
}
});
}
} else {
if (screen.width >= 768) {
window.addEventListener('resize', lodash.throttle(function() {
$rootScope.$emit('Local/WindowResize');
}, 100));
}
}
uxLanguage.init();
openURLService.init();
$ionicPlatform.ready(function() {
if (platformInfo.isCordova) {
window.addEventListener('native.keyboardhide', function() {
$timeout(function() {
$rootScope.shouldHideMenuBar = false; //show menu bar when keyboard is hidden with back button action on send screen
}, 100);
});
window.addEventListener('native.keyboardshow', function() {
$timeout(function() {
$rootScope.shouldHideMenuBar = true; //hide menu bar when keyboard opens with back button action on send screen
}, 300);
});
if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
cordova.plugins.Keyboard.disableScroll(true);
}
if (window.StatusBar) {
StatusBar.styleLightContent();
}
$ionicPlatform.registerBackButtonAction(function(e) {
var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : '';
var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : '';
var fromDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? 'true' : '';
var fromTabs = $ionicHistory.currentStateName().match(/tabs/) ? 'true' : '';
if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) {
ionic.Platform.exitApp();
} else if ($ionicHistory.backView() && !fromTabs) {
$ionicHistory.goBack();
} else {
$rootScope.backButtonPressedOnceToExit = true;
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
setInterval(function() {
$rootScope.backButtonPressedOnceToExit = false;
}, 5000);
}
e.preventDefault();
},
101);
if ($rootScope.backButtonPressedOnceToExit || fromDisclaimer) {
ionic.Platform.exitApp();
} else if ($ionicHistory.backView() && !fromTabs) {
$ionicHistory.goBack();
} else {
$rootScope.backButtonPressedOnceToExit = true;
window.plugins.toast.showShortBottom(gettextCatalog.getString('Press again to exit'));
setInterval(function() {
$rootScope.backButtonPressedOnceToExit = false;
}, 5000);
}
e.preventDefault();
}, 101);
$ionicPlatform.on('pause', function() {
// Nothing to do
@ -890,7 +833,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
setTimeout(function() {
navigator.splashscreen.hide();
}, 1000);
}, 500);
}

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services')
.factory('applicationService', function($rootScope, $timeout, platformInfo, $state) {
.factory('applicationService', function($rootScope, $timeout, $ionicHistory, platformInfo, $state) {
var root = {};
var isChromeApp = platformInfo.isChromeApp;
@ -19,6 +19,7 @@ angular.module('copayApp.services')
if (isChromeApp) {
chrome.runtime.reload();
} else if (isNW) {
$ionicHistory.clearHistory();
$state.go('tabs.home');
$timeout(function() {
var win = require('nw.gui').Window.get();

View file

@ -0,0 +1,14 @@
'use strict';
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService) {
this.open = function(url, target) {
if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url);
} else {
target = target || '_blank';
var ref = window.open(url, target, 'location=no');
}
};
});

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, bitcore) {
angular.module('copayApp.services').factory('incomingData', function($log, $ionicModal, $state, $window, bitcore) {
var root = {};
@ -63,10 +63,10 @@ angular.module('copayApp.services').factory('incomingData', function($log, $ioni
return $state.go('send.amount', {toAddress: data})
// copay: protocol
} else if (data.indexOf('copay://glidera')==0) {
// Protocol
} else if (data.indexOf($window.appConfig.name + '://glidera')==0) {
return $state.go('uriglidera', {url: data})
} else if (data.indexOf('copay://coinbase')==0) {
} else if (data.indexOf($window.appConfig.name + '://coinbase')==0) {
return $state.go('uricoinbase', {url: data})
// Join

View file

@ -1,38 +0,0 @@
'use strict';
angular.module('copayApp.services').factory('nodeWebkit', function nodeWebkitFactory() {
var root = {};
var isNodeWebkit = function() {
var isNode = (typeof process !== "undefined" && typeof require !== "undefined");
if(isNode) {
try {
return (typeof require('nw.gui') !== "undefined");
} catch(e) {
return false;
}
}
};
root.readFromClipboard = function() {
if (!isNodeWebkit()) return;
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
return clipboard.get();
};
root.writeToClipboard = function(text) {
if (!isNodeWebkit()) return;
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
return clipboard.set(text);
};
root.openExternalLink = function(url) {
if (!isNodeWebkit()) return;
var gui = require('nw.gui');
return gui.Shell.openExternal(url);
};
return root;
});

View file

@ -0,0 +1,22 @@
'use strict';
angular.module('copayApp.services').service('nodeWebkitService', function() {
this.readFromClipboard = function() {
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
return clipboard.get();
};
this.writeToClipboard = function(text) {
var gui = require('nw.gui');
var clipboard = gui.Clipboard.get();
return clipboard.set(text);
};
this.openExternalLink = function(url) {
var gui = require('nw.gui');
return gui.Shell.openExternal(url);
};
});

View file

@ -31,6 +31,7 @@ angular.module('copayApp.services').factory('ongoingProcess', function($log, $ti
'sweepingWallet': gettext('Sweeping Wallet...'),
'deletingWallet': gettext('Deleting Wallet...'),
'extractingWalletInfo': gettext('Extracting Wallet Information...'),
'gettingFeeLevels': gettext('Getting fee levels...'),
};
root.clear = function() {

View file

@ -30,13 +30,12 @@ angular.module('copayApp.services')
root.updateWalletSettings = function(wallet) {
var defaults = configService.getDefaults();
var config = configService.getSync();
wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
wallet.name = config.aliasFor && (config.aliasFor[wallet.id] || wallet.credentials.walletName);
wallet.color = config.colorFor && (config.colorFor[wallet.id] || '#4A90E2');
wallet.email = config.emailFor && config.emailFor[wallet.id];
configService.whenAvailable(function(config){
wallet.usingCustomBWS = config.bwsFor && config.bwsFor[wallet.id] && (config.bwsFor[wallet.id] != defaults.bws.url);
wallet.name = (config.aliasFor && config.aliasFor[wallet.id]) || wallet.credentials.walletName;
wallet.color = (config.colorFor && config.colorFor[wallet.id]) || '#4A90E2';
wallet.email = config.emailFor && config.emailFor[wallet.id];
});
}
root.setBackupFlag = function(walletId) {
@ -78,7 +77,7 @@ angular.module('copayApp.services')
var opts = opts || {};
var walletId = wallet.credentials.walletId;
if ((root.wallet[walletId] && root.wallet[walletId].started) || opts.force) {
if ((root.wallet[walletId] && root.wallet[walletId].started) && !opts.force) {
return false;
}
@ -123,7 +122,6 @@ angular.module('copayApp.services')
if (wallet.cachedActivity)
wallet.cachedActivity.isValid = false;
if (wallet.cachedTxps)
wallet.cachedTxps.isValid = false;
@ -908,22 +906,14 @@ angular.module('copayApp.services')
var txps = [];
function process(notifications) {
if (!notifications) return [];
var shown = lodash.sortBy(notifications, 'createdOn').reverse();
shown = shown.splice(0, opts.limit || MAX);
return shown;
};
lodash.each(w, function(x) {
if (x.pendingTxps)
txps = txps.concat(x.pendingTxps);
});
txps = lodash.sortBy(txps, 'createdOn');
txps = lodash.sortBy(txps, 'pendingForUs', 'createdOn');
txps = lodash.compact(lodash.flatten(txps)).slice(0,MAX);
var n = txps.length;
return cb(null, process(txps), n);
return cb(null, txps, n);
};
return root;

View file

@ -72,7 +72,8 @@ angular.module('copayApp.services')
root._set = function(lang) {
$log.debug('Setting default language: ' + lang);
gettextCatalog.setCurrentLanguage(lang);
root.currentLanguage = lang;
root.currentLanguage = lang;
if (lang == 'zh') lang = lang + '-CN'; // Fix for Chinese Simplified
amMoment.changeLocale(lang);
};
@ -95,31 +96,19 @@ angular.module('copayApp.services')
return root.availableLanguages;
};
root.init = function() {
root._detect(function(lang) {
root._set(lang);
});
};
root.init = function(cb) {
configService.whenAvailable(function(config) {
var userLang = config.wallet.settings.defaultLanguage;
root.update = function(cb) {
var userLang = configService.getSync().wallet.settings.defaultLanguage;
if (!userLang) {
root._detect(function(lang) {
userLang = lang;
if (userLang != root.currentLanguage) {
root._set(lang);
}
if (cb) return cb(userLang);
});
} else {
if (userLang != root.currentLanguage) {
if (userLang && userLang != root.currentLanguage) {
root._set(userLang);
} else {
root._detect(function(lang) {
root._set(lang);
});
}
if (cb) return cb(userLang);
}
if (cb) return cb();
});
};
root.getName = function(lang) {

View file

@ -92,13 +92,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
root.invalidateCache = function(wallet) {
if (wallet.cachedStatus) {
if (wallet.cachedStatus)
wallet.cachedStatus.isValid = false;
}
if (wallet.completeHistory) {
if (wallet.completeHistory)
wallet.completeHistory.isValid = false;
}
if (wallet.cachedActivity)
wallet.cachedActivity.isValid = false;
if (wallet.cachedTxps)
wallet.cachedTxps.isValid = false;
};
root.getStatus = function(wallet, opts, cb) {
@ -623,6 +627,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.removeTxProposal(txp, function(err) {
$log.debug('Transaction removed');
root.invalidateCache(wallet);
$rootScope.$emit('Local/TxAction', wallet.id);
return cb(err);
});
};
@ -852,6 +860,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
askPassword(wallet.name, gettext('Enter Spending Password'), function(password) {
if (!password) return cb('no password');
if (!wallet.checkPassword(password)) return cb('wrong password');
return cb(null, password);
});
@ -862,8 +872,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
ongoingProcess.set('rejectTx', true);
root.rejectTx(wallet, txp, function(err, txpr) {
root.invalidateCache(wallet);
ongoingProcess.set('rejectTx', false);
if (err) return cb(err);
$rootScope.$emit('Local/TxAction', wallet.id);
@ -933,6 +943,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var msg = err.message ?
err.message :
gettext('The payment was created but could not be completed. Please try again from home screen');
$rootScope.$emit('Local/TxAction', wallet.id);
return cb(msg);
}
@ -943,18 +954,18 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
ongoingProcess.set('broadcastingTx', false);
if (err) return cb('sign error' + err);
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp);
root.openStatusModal(type, broadcastedTxp, function() {
$rootScope.$emit('Local/TxAction', wallet.id);
});
return cb(null, broadcastedTxp)
});
} else {
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, signedTxp);
root.openStatusModal(type, signedTxp, function() {
root.invalidateCache(wallet);
$rootScope.$emit('Local/TxAction', wallet.id);
});
return cb(null, signedTxp);
}

View file

@ -1,5 +1,9 @@
.wallet-activity {
&-not-pending {
background-color:#eee;
}
&-amount {
float: right;
font-size: 18px;

View file

@ -1,5 +1,8 @@
#onboarding-collect-email {
background: rgb(17, 209, 166);
.scroll {
height: 100%;
}
#success-image {
margin-top: 4rem;
}
@ -11,17 +14,18 @@
opacity: 1;
background: #fff;
color: rgb(108, 108, 108);
height: 11rem;
height: 13rem;
animation-name: topBottom;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 1s;
animation-delay: 2s;
position: absolute;
bottom: -100%;
bottom: -13rem;
animation-fill-mode: forwards;
z-index: 5;
margin-top: 0;
width: 100%;
label {
background: rgba(200, 200, 200, 0.20);
height: 3rem;

View file

@ -7,7 +7,7 @@
#shopping-24 {
content: url("../img/onboarding-welcome-shopping24.png");
position: absolute;
top: 2%;
top: 5%;
right: 5%;
width: 35px;
height: auto;
@ -17,7 +17,7 @@
@include center-block();
}
.logo {
margin-top: 15rem;
margin-top: 13rem;
}
button {
@include center-block(1rem);

View file

@ -34,7 +34,7 @@
background-size: contain;
width: 100%;
clear: both;
height: 20rem;
height: 23rem;
margin-bottom: -3rem;
background-position: center;
background-repeat: no-repeat;

View file

@ -3,8 +3,8 @@
background: #fff;
box-shadow: 0px 3px 3px 0px rgba(50, 50, 50, 0.2);
}
ion-content {
margin-top: 1.5rem;
ion-content{
padding-top: 1.5rem;
color: rgba(86, 86, 86, 0.77);
p {
padding: 0 2.5%;