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

# Conflicts:
#	public/views/onboarding/backupWarning.html
#	src/sass/common.scss
This commit is contained in:
Jamal Jackson 2016-09-02 06:57:50 -04:00
commit ee7bb0f455
96 changed files with 610 additions and 607 deletions

View file

@ -83,7 +83,6 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
this.getBuyPrice = function(token, price) {
var self = this;
this.error = null;
if (!price || (price && !price.qty && !price.fiat)) {
this.buyPrice = null;
return;

View file

@ -1,24 +1,10 @@
'use strict';
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal) {
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $filter, $timeout, $ionicScrollDelegate, $ionicNavBarDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, $ionicPopup, txStatus, gettext, txFormatService, ongoingProcess, $ionicModal, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Confirm'));
var cachedTxp = {};
var isChromeApp = platformInfo.isChromeApp;
// An alert dialog
var showAlert = function(title, msg, cb) {
var message = msg.message ? msg.message : msg;
$log.warn(title + ": " + message);
var alertPopup = $ionicPopup.alert({
title: title,
template: message
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
$scope.showDescriptionPopup = function() {
var commentPopup = $ionicPopup.show({
templateUrl: "views/includes/note.html",
@ -52,7 +38,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (!wallet) return cb();
if (isChromeApp) {
showAlert(gettext('Payment Protocol not supported on Chrome App'));
popupService.showAlert(gettextCatalog.getString('Payment Protocol not supported on Chrome App'));
return cb(true);
}
@ -69,15 +55,15 @@ angular.module('copayApp.controllers').controller('confirmController', function(
$log.warn('Could not fetch payment request:', err);
var msg = err.toString();
if (msg.match('HTTP')) {
msg = gettext('Could not fetch payment information');
msg = gettextCatalog.getString('Could not fetch payment information');
}
showAlert(msg);
popupService.showAlert(msg);
return cb(true);
}
if (!paypro.verified) {
$log.warn('Failed to verify payment protocol signatures');
showAlert(gettext('Payment Protocol Invalid'));
popupService.showAlert(gettextCatalog.getString('Payment Protocol Invalid'));
return cb(true);
}
@ -189,7 +175,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
};
var setSendError = function(msg) {
showAlert(gettext('Error at confirm:'), msg);
popupService.showAlert(gettextCatalog.getString('Error at confirm:'), msg);
};
function apply(txp) {
@ -212,13 +198,13 @@ angular.module('copayApp.controllers').controller('confirmController', function(
if (description && !wallet.credentials.sharedEncryptingKey) {
var msg = 'Could not add message to imported wallet without shared encrypting key';
$log.warn(msg);
return setSendError(gettext(msg));
return setSendError(msg);
}
if (toAmount > Number.MAX_SAFE_INTEGER) {
var msg = 'Amount too big';
$log.warn(msg);
return setSendError(gettext(msg));
return setSendError(msg);
};
outputs.push({
@ -263,13 +249,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var wallet = $scope.wallet;
var txp = $scope.txp;
if (!wallet) {
return setSendError(gettext('No wallet selected'));
return;
return setSendError(gettextCatalog.getString('No wallet selected'));
};
if (!txp) {
return setSendError(gettext('No transaction'));
return;
return setSendError(gettextCatalog.getString('No transaction'));
};
if (!wallet.canSign() && !wallet.isPrivKeyExternal()) {

View file

@ -45,7 +45,7 @@ angular.module('copayApp.controllers').controller('copayersController',
profileService.deleteWalletClient(wallet, function(err) {
ongoingProcess.set('deletingWallet', false);
if (err) {
$scope.error = err.message || err;
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$state.transitionTo('tabs.home');
}

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('createController',
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService) {
function($scope, $rootScope, $timeout, $log, lodash, $state, $ionicScrollDelegate, profileService, configService, gettext, gettextCatalog, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, storageService, popupService) {
var isChromeApp = platformInfo.isChromeApp;
var isCordova = platformInfo.isCordova;
@ -92,7 +92,7 @@ angular.module('copayApp.controllers').controller('createController',
this.create = function(form) {
if (form && form.$invalid) {
this.error = gettext('Please enter the required fields');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
@ -119,7 +119,7 @@ angular.module('copayApp.controllers').controller('createController',
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
this.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
@ -132,14 +132,14 @@ angular.module('copayApp.controllers').controller('createController',
}
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the wallet recovery phrase'));
return;
}
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if (!account || account < 1) {
this.error = gettext('Invalid account number');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
@ -154,8 +154,7 @@ angular.module('copayApp.controllers').controller('createController',
src.getInfoForNewWallet(opts.n > 1, account, function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
opts = lodash.assign(lopts, opts);
@ -174,10 +173,7 @@ angular.module('copayApp.controllers').controller('createController',
ongoingProcess.set('creatingWallet', false);
if (err) {
$log.warn(err);
self.error = err;
$timeout(function() {
$rootScope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}

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) {
function($rootScope, $scope, $timeout, $log, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
var prevState;
var isWP = platformInfo.isWP;
var isAndroid = platformInfo.isAndroid;
@ -10,7 +10,6 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
$scope.isCordova = platformInfo.isCordova;
$scope.isSafari = platformInfo.isSafari;
$scope.error = null;
$scope.init = function() {
$scope.supported = true;
@ -51,7 +50,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.downloadWalletBackup = function() {
$scope.getAddressbook(function(err, localAddressBook) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
}
var opts = {
@ -61,7 +60,7 @@ angular.module('copayApp.controllers').controller('exportController',
backupService.walletDownload($scope.password, opts, function(err) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return;
}
$state.go('tabs.home');
@ -87,7 +86,7 @@ angular.module('copayApp.controllers').controller('exportController',
$scope.getBackup = function(cb) {
$scope.getAddressbook(function(err, localAddressBook) {
if (err) {
$scope.error = true;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
return cb(null);
}
var opts = {
@ -97,9 +96,7 @@ angular.module('copayApp.controllers').controller('exportController',
var ew = backupService.walletExport($scope.password, opts);
if (!ew) {
$scope.error = true;
} else {
$scope.error = false;
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
}
return cb(ew);
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('importController',
function($scope, $rootScope, $timeout, $log, $state, $stateParams, $ionicHistory, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService) {
function($scope, $rootScope, $timeout, $log, $state, $stateParams, $ionicHistory, profileService, configService, sjcl, gettext, ledger, trezor, derivationPathHelper, platformInfo, bwcService, ongoingProcess, walletService, popupService, gettextCatalog) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -36,14 +36,12 @@ angular.module('copayApp.controllers').controller('importController',
$scope.processWalletInfo = function(code) {
if (!code) return;
$scope.importErr = false;
$scope.error = null;
var parsedCode = code.split('|');
if (parsedCode.length != 5) {
/// Trying to import a malformed wallet export QR code
$scope.error = gettext('Incorrect code format');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Incorrect code format'));
return;
}
@ -56,7 +54,7 @@ angular.module('copayApp.controllers').controller('importController',
};
if (info.type == 1 && info.hasPassphrase)
$scope.error = gettext('Password required. Make sure to enter your password in advanced options');
popupService.showAlert(gettextCatalog.getString('Password required. Make sure to enter your password in advanced options'));
$scope.derivationPath = info.derivationPath;
$scope.testnetEnabled = info.network == 'testnet' ? true : false;
@ -69,7 +67,6 @@ angular.module('copayApp.controllers').controller('importController',
$scope.setType = function(type) {
$scope.type = type;
$scope.error = null;
$timeout(function() {
$rootScope.$apply();
}, 1);
@ -80,12 +77,12 @@ angular.module('copayApp.controllers').controller('importController',
try {
str2 = sjcl.decrypt($scope.password, str);
} catch (e) {
err = gettext('Could not decrypt file, check your password');
err = gettextCatalog.getString('Could not decrypt file, check your password');
$log.warn(e);
};
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
$timeout(function() {
$rootScope.$apply();
});
@ -100,22 +97,11 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importWallet(str2, opts, function(err, client) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -129,25 +115,13 @@ angular.module('copayApp.controllers').controller('importController',
if (err instanceof errors.NOT_AUTHORIZED) {
$scope.importErr = true;
} else {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
}
return $timeout(function() {
$scope.$apply();
});
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -168,11 +142,12 @@ angular.module('copayApp.controllers').controller('importController',
}
profileService.setBackupFlag(walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
});
}, 100);
@ -190,24 +165,13 @@ angular.module('copayApp.controllers').controller('importController',
if (err instanceof errors.NOT_AUTHORIZED) {
$scope.importErr = true;
} else {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
}
return $timeout(function() {
$scope.$apply();
});
}
walletService.updateRemotePreferences(client, {}, function() {
$log.debug('Remote preferences saved for:' + client.credentials.walletId)
});
profileService.setBackupFlag(client.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(client);
});
}, 100);
};
@ -232,10 +196,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importBlob = function(form) {
if (form.$invalid) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form'));
return;
}
@ -244,11 +205,7 @@ angular.module('copayApp.controllers').controller('importController',
var password = form.password.$modelValue;
if (!backupFile && !backupText) {
$scope.error = gettext('Please, select your backup file');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please, select your backup file'));
return;
}
@ -263,10 +220,7 @@ angular.module('copayApp.controllers').controller('importController',
$scope.importMnemonic = function(form) {
if (form.$invalid) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('There is an error in the form'));
return;
}
@ -276,7 +230,7 @@ angular.module('copayApp.controllers').controller('importController',
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
$scope.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
opts.account = pathData.account;
@ -284,10 +238,9 @@ angular.module('copayApp.controllers').controller('importController',
opts.derivationStrategy = pathData.derivationStrategy;
var words = form.words.$modelValue || null;
$scope.error = null;
if (!words) {
$scope.error = gettext('Please enter the recovery phrase');
popupService.showAlert(gettextCatalog.getString('Please enter the recovery phrase'));
} else if (words.indexOf('xprv') == 0 || words.indexOf('tprv') == 0) {
return _importExtendedPrivateKey(words, opts);
} else if (words.indexOf('xpub') == 0 || words.indexOf('tpuv') == 0) {
@ -296,17 +249,11 @@ angular.module('copayApp.controllers').controller('importController',
var wordList = words.split(/[\u3000\s]+/);
if ((wordList.length % 3) != 0) {
$scope.error = gettext('Wrong number of recovery words:') + wordList.length;
popupService.showAlert(gettextCatalog.getString('Wrong number of recovery words:') + wordList.length);
return;
}
}
if ($scope.error) {
$timeout(function() {
$scope.$apply();
});
return;
}
var passphrase = form.passphrase.$modelValue;
opts.passphrase = form.passphrase.$modelValue || null;
@ -317,8 +264,7 @@ angular.module('copayApp.controllers').controller('importController',
trezor.getInfoForNewWallet(isMultisig, account, function(err, lopts) {
ongoingProcess.clear();
if (err) {
$scope.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -330,37 +276,19 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importExtendedPublicKey(lopts, function(err, wallet) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
return $timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.walletId)
});
profileService.setBackupFlag(wallet.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(wallet);
});
}, 100);
};
$scope.importHW = function(form) {
if (form.$invalid || $scope.account < 0) {
$scope.error = gettext('There is an error in the form');
$timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('There is an error in the form'));
return;
}
$scope.error = '';
$scope.importErr = false;
var account = +$scope.account;
@ -400,8 +328,7 @@ angular.module('copayApp.controllers').controller('importController',
ledger.getInfoForNewWallet(true, account, function(err, lopts) {
ongoingProcess.clear();
if (err) {
$scope.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
@ -413,28 +340,30 @@ angular.module('copayApp.controllers').controller('importController',
profileService.importExtendedPublicKey(lopts, function(err, wallet) {
ongoingProcess.set('importingWallet', false);
if (err) {
$scope.error = err;
return $timeout(function() {
$scope.$apply();
});
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.walletId)
});
profileService.setBackupFlag(wallet.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
finish(wallet);
});
}, 100);
};
var finish = function(wallet) {
walletService.updateRemotePreferences(wallet, {}, function() {
$log.debug('Remote preferences saved for:' + wallet.credentials.walletId)
});
profileService.setBackupFlag(wallet.credentials.walletId);
if ($stateParams.fromOnboarding) {
profileService.setDisclaimerAccepted(function(err) {
if (err) $log.error(err);
});
}
$state.go('tabs.home');
};
updateSeedSourceSelect();
$scope.setSeedSource('new');
$scope.setSeedSource();
if ($stateParams.code) $scope.processWalletInfo($stateParams.code);
});

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('joinController',
function($scope, $rootScope, $timeout, $state, profileService, configService, storageService, applicationService, gettext, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams) {
function($scope, $rootScope, $timeout, $state, profileService, configService, storageService, applicationService, gettext, gettextCatalog, lodash, ledger, trezor, platformInfo, derivationPathHelper, ongoingProcess, walletService, $log, $stateParams, popupService) {
var isChromeApp = platformInfo.isChromeApp;
var isDevel = platformInfo.isDevel;
@ -14,7 +14,6 @@ angular.module('copayApp.controllers').controller('joinController',
this.onQrCodeScanned = function(data) {
console.log('[join.js.16:data:]',data); //TODO
$scope.secret = data;
if ($scope.joinForm) {
$scope.joinForm.secret.$setViewValue(data);
@ -64,7 +63,7 @@ console.log('[join.js.16:data:]',data); //TODO
this.join = function(form) {
if (form && form.$invalid) {
self.error = gettext('Please enter the required fields');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the required fields'));
return;
}
@ -86,7 +85,7 @@ console.log('[join.js.16:data:]',data); //TODO
var pathData = derivationPathHelper.parse($scope.derivationPath);
if (!pathData) {
this.error = gettext('Invalid derivation path');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid derivation path'));
return;
}
opts.account = pathData.account;
@ -100,15 +99,14 @@ console.log('[join.js.16:data:]',data); //TODO
if (setSeed && !opts.mnemonic && !opts.extendedPrivateKey) {
this.error = gettext('Please enter the wallet recovery phrase');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Please enter the wallet recovery phrase'));
return;
}
if (self.seedSourceId == 'ledger' || self.seedSourceId == 'trezor') {
var account = $scope.account;
if (!account || account < 1) {
this.error = gettext('Invalid account number');
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Invalid account number'));
return;
}
@ -122,8 +120,7 @@ console.log('[join.js.16:data:]',data); //TODO
src.getInfoForNewWallet(true, account, function(err, lopts) {
ongoingProcess.set('connecting' + self.seedSourceId, false);
if (err) {
self.error = err;
$scope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}
opts = lodash.assign(lopts, opts);
@ -141,8 +138,7 @@ console.log('[join.js.16:data:]',data); //TODO
profileService.joinWallet(opts, function(err, client) {
ongoingProcess.set('joiningWallet', false);
if (err) {
self.error = err;
$rootScope.$apply();
popupService.showAlert(gettextCatalog.getString('Error'), err);
return;
}

View file

@ -1,22 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash) {
angular.module('copayApp.controllers').controller('addressbookModalController', function($scope, $log, $state, $timeout, $ionicPopup, addressbookService, lodash, popupService) {
var contacts;
// An alert dialog
var showAlert = function(title, msg, cb) {
$log.warn(title + ": " + msg);
var alertPopup = $ionicPopup.alert({
title: title,
template: msg
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
$scope.initAddressbook = function() {
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
@ -94,7 +81,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
$timeout(function() {
addressbookService.add(addressbook, function(err, ab) {
if (err) {
showAlert(err);
popupService.showAlert(err);
return;
}
$scope.initAddressbook();
@ -108,7 +95,7 @@ angular.module('copayApp.controllers').controller('addressbookModalController',
$timeout(function() {
addressbookService.remove(addr, function(err, ab) {
if (err) {
showAlert(err);
popupService.showAlert(err);
return;
}
$scope.initAddressbook();

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $ionicModal, ongoingProcess, platformInfo, txStatus, $ionicScrollDelegate, txFormatService, fingerprintService, bwcError, gettextCatalog, lodash, walletService) {
angular.module('copayApp.controllers').controller('txpDetailsController', function($scope, $rootScope, $timeout, $interval, $ionicModal, ongoingProcess, platformInfo, txStatus, $ionicScrollDelegate, txFormatService, fingerprintService, bwcError, gettextCatalog, lodash, walletService, popupService) {
var self = $scope.self;
var tx = $scope.tx;
var copayers = $scope.copayers;
@ -25,13 +25,11 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
}
var setSendError = function(msg) {
$scope.error = msg || gettextCatalog.getString('Could not send payment');
var error = msg || gettextCatalog.getString('Could not send payment');
popupService.showAlert(gettextCatalog.getString('Error'), error);
}
$scope.sign = function() {
$scope.error = null;
$scope.loading = true;
walletService.publishAndSign($scope.wallet, $scope.tx, function(err, txp) {
$scope.$emit('UpdateTx');
@ -42,18 +40,14 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
function setError(err, prefix) {
$scope.loading = false;
$scope.error = bwcError.msg(err, prefix);
$timeout(function() {
$scope.$digest();
}, 10);
popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err, prefix));
};
$scope.reject = function(txp) {
$scope.loading = true;
$scope.error = null;
walletService.reject($scope.wallet, $scope.tx, function(err, txpr) {
if (err)
if (err)
return setError(err, gettextCatalog.getString('Could not reject payment'));
$scope.close(txpr);
@ -64,7 +58,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.remove = function() {
$scope.loading = true;
$scope.error = null;
$timeout(function() {
ongoingProcess.set('removeTx', true);
@ -84,7 +77,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
$scope.broadcast = function(txp) {
$scope.loading = true;
$scope.error = null;
$timeout(function() {
ongoingProcess.set('broadcastTx', true);
@ -185,7 +177,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
if (txp) {
var type = txStatus.notify(txp);
$scope.openStatusModal(type, txp, function() {});
}
}
$scope.cancel();
};

View file

@ -2,6 +2,13 @@
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, $ionicPopup, profileService) {
$scope.goImport = function(code) {
$state.go('onboarding.import.phrase', {
fromOnboarding: true,
code: code
});
};
$scope.createProfile = function() {
$log.debug('Creating profile');
profileService.createProfile(function(err) {

View file

@ -69,10 +69,12 @@ angular.module('copayApp.controllers').controller('preferencesController',
$scope.touchIdChange = function() {
var newStatus = $scope.touchIdEnabled;
walletService.setTouchId(wallet, newStatus, function(err) {
walletService.setTouchId(wallet, !!newStatus, function(err) {
if (err) {
$log.warn(err);
$scope.touchIdEnabled = !newStatus;
$timeout(function() {
$scope.$apply();
}, 1);
return;
}
$log.debug('Touch Id status changed: ' + newStatus);

View file

@ -3,7 +3,6 @@
angular.module('copayApp.controllers').controller('preferencesBwsUrlController',
function($scope, $log, $stateParams, $ionicNavBarDelegate, configService, applicationService, profileService, storageService) {
$ionicNavBarDelegate.title('Wallet Service URL');
$scope.error = null;
$scope.success = null;
var wallet = profileService.getWallet($stateParams.walletId);

View file

@ -1,12 +1,11 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesDeleteWalletController',
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess) {
function($scope, $ionicPopup, $stateParams, $ionicNavBarDelegate, gettextCatalog, lodash, profileService, $state, ongoingProcess, popupService) {
$ionicNavBarDelegate.title(gettextCatalog.getString('Delete Wallet'));
var wallet = profileService.getWallet($stateParams.walletId);
$scope.alias = lodash.isEqual(wallet.name, wallet.credentials.walletName) ? null : wallet.name + ' ';
$scope.walletName = '[' + wallet.credentials.walletName + ']';
$scope.error = null;
$scope.showDeletePopup = function() {
var popup = $ionicPopup.show({
@ -36,7 +35,7 @@ angular.module('copayApp.controllers').controller('preferencesDeleteWalletContro
profileService.deleteWalletClient(wallet, function(err) {
ongoingProcess.set('deletingWallet', false);
if (err) {
$scope.error = err.message || err;
popupService.showAlert(gettextCatalog.getString('Error'), err.message || err);
} else {
$state.go('tabs.home');
}

View file

@ -58,7 +58,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
profileService.getNotifications({
limit: 3
}, function(err, n) {
console.log('[tab-home.js.57]', n); //TODO
if (err) {
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
return;

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, platformInfo, walletService, profileService, configService, lodash, gettextCatalog) {
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
$scope.isCordova = platformInfo.isCordova;
@ -33,7 +33,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
if ($scope.generatingAddress) return;
var wallet = wallet || $scope.wallet;
$scope.error = null;
$scope.addr = null;
$scope.generatingAddress = true;
@ -41,7 +40,7 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
walletService.getAddress(wallet, forceNew, function(err, addr) {
$scope.generatingAddress = false;
if (err) {
$scope.error = err;
popupService.showAlert(gettextCatalog.getString('Error'), err);
} else {
if (addr)
$scope.addr = addr;

View file

@ -1,21 +1,27 @@
'use strict';
angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $ionicModal, incomingData) {
angular.module('copayApp.controllers').controller('tabsController', function($log, $scope, $stateParams, $ionicModal, $timeout, incomingData) {
$scope.onScan = function(data) {
console.log('[tabsController.js.6:data:]',data); //TODO
if (!incomingData.redir(data)) {
$ionicPopup.alert({
title: 'Invalid data',
});
}
$scope.onScan = function(data) {
if (!incomingData.redir(data)) {
$ionicPopup.alert({
title: 'Invalid data',
});
}
}
$scope.setScanFn = function(scanFn) {
$scope.scan = function() {
$log.debug('Scanning...');
scanFn();
};
$scope.setScanFn = function(scanFn) {
$scope.scan = function() {
$log.debug('Scanning...');
scanFn();
};
});
};
$scope.importInit = function() {
$scope.fromOnboarding = $stateParams.fromOnboarding;
$timeout(function() {
$scope.$apply();
}, 1);
}
});

View file

@ -194,6 +194,10 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
return $state.go('wallet.copayers');
};
/* Set color for header bar */
$rootScope.walletDetailsColor = wallet.color;
$rootScope.walletDetailsName = wallet.name;
$scope.wallet = wallet;
$scope.requiresMultipleSignatures = wallet.credentials.m > 1;
$scope.newTx = false;

View file

@ -270,12 +270,15 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
})
.state('tabs.import', {
url: '/import/:fromOnboarding',
// abstract: true,
// abstract: true,
views: {
'tab-home': {
templateUrl: 'views/import.html'
},
}
},
params: {
code: null
},
})
.state('tabs.import.phrase', {
url: '/tab-import-phrase',
@ -628,6 +631,42 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
}
})
.state('onboarding.import', {
url: '/import/:fromOnboarding',
abstract: true,
views: {
'onboarding': {
templateUrl: 'views/import.html'
},
},
params: {
code: null
},
})
.state('onboarding.import.phrase', {
url: '/tab-import-phrase',
views: {
'tab-import-phrase': {
templateUrl: 'views/tab-import-phrase.html',
},
}
})
.state('onboarding.import.file', {
url: '/tab-import-file',
views: {
'tab-import-file': {
templateUrl: 'views/tab-import-file.html',
},
}
})
.state('onboarding.import.hardware', {
url: '/tab-import-hardware',
views: {
'tab-import-hardware': {
templateUrl: 'views/tab-import-hardware.html',
},
}
})
/*
*

View file

@ -1,11 +1,17 @@
'use strict';
angular.module('copayApp.services').factory('glideraService', function($http, $log, platformInfo, storageService, configService, $rootScope) {
angular.module('copayApp.services').factory('glideraService', function($http, $log, $window, platformInfo, storageService, configService, $rootScope) {
var root = {};
var credentials = {};
var isCordova = platformInfo.isCordova;
var _setCredentials = function() {
if (!$window.externalServices || !$window.externalServices.glidera) {
return;
}
var glidera = $window.externalServices.glidera;
/*
* Development: 'testnet'
* Production: 'livenet'
@ -13,26 +19,26 @@ angular.module('copayApp.services').factory('glideraService', function($http, $l
credentials.NETWORK = 'livenet';
if (credentials.NETWORK == 'testnet') {
credentials.HOST = 'https://sandbox.glidera.io';
credentials.HOST = glidera.sandbox.host;
if (isCordova) {
credentials.REDIRECT_URI = 'copay://glidera';
credentials.CLIENT_ID = '6163427a2f37d1b2022ececd6d6c9cdd';
credentials.CLIENT_SECRET = '599cc3af26108c6fece8ab17c3f35867';
credentials.REDIRECT_URI = glidera.sandbox.mobile.redirect_uri;
credentials.CLIENT_ID = glidera.sandbox.mobile.client_id;
credentials.CLIENT_SECRET = glidera.sandbox.mobile.client_secret;
} else {
credentials.REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob';
credentials.CLIENT_ID = 'c402f4a753755456e8c384fb65b7be1d';
credentials.CLIENT_SECRET = '3ce826198e3618d0b8ed341ab91fe4e5';
credentials.REDIRECT_URI = glidera.sandbox.desktop.redirect_uri;
credentials.CLIENT_ID = glidera.sandbox.desktop.client_id;
credentials.CLIENT_SECRET = glidera.sandbox.desktop.client_secret;
}
} else {
credentials.HOST = 'https://glidera.io';
credentials.HOST = glidera.production.host;
if (isCordova) {
credentials.REDIRECT_URI = 'copay://glidera';
credentials.CLIENT_ID = '9c8023f0ac0128235b7b27a6f2610c83';
credentials.CLIENT_SECRET = '30431511407b47f25a83bffd72881d55';
credentials.REDIRECT_URI = glidera.production.mobile.redirect_uri;
credentials.CLIENT_ID = glidera.production.mobile.client_id;
credentials.CLIENT_SECRET = glidera.production.mobile.client_secret;
} else {
credentials.REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob';
credentials.CLIENT_ID = '8a9e8a9cf155db430c1ea6c7889afed1';
credentials.CLIENT_SECRET = '24ddec578f38d5488bfe13601933c05f';
credentials.REDIRECT_URI = glidera.production.desktop.redirect_uri;
credentials.CLIENT_ID = glidera.production.desktop.client_id;
credentials.CLIENT_SECRET = glidera.production.desktop.client_secret;
}
};
};

View file

@ -822,25 +822,29 @@ angular.module('copayApp.services')
};
});
// condense
var finale = [],
prev;
var finale = shown; // GROUPING DISABLED!
lodash.each(shown, function(x) {
if (prev && prev.walletId === x.walletId && prev.txpId && prev.txpId === x.txpId && prev.creatorId && prev.creatorId === x.creatorId) {
prev.types.push(x.type);
prev.data = lodash.assign(prev.data, x.data);
prev.txid = prev.txid || x.txid;
prev.amountStr = prev.amountStr || x.amountStr;
prev.creatorName = prev.creatorName || x.creatorName;
} else {
finale.push(x);
prev = x;
}
});
// messages...
// var finale = [],
// prev;
//
//
// // Item grouping... DISABLED.
//
// // REMOVE (if we want 1-to-1 notification) ????
// lodash.each(shown, function(x) {
// if (prev && prev.walletId === x.walletId && prev.txpId && prev.txpId === x.txpId && prev.creatorId && prev.creatorId === x.creatorId) {
// prev.types.push(x.type);
// prev.data = lodash.assign(prev.data, x.data);
// prev.txid = prev.txid || x.txid;
// prev.amountStr = prev.amountStr || x.amountStr;
// prev.creatorName = prev.creatorName || x.creatorName;
// } else {
// finale.push(x);
// prev = x;
// }
// });
//
var u = bwcService.getUtils();
lodash.each(finale, function(x) {

View file

@ -1,6 +1,6 @@
'use strict';
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, bwcService, bitcore) {
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, bwcService, bitcore, popupService) {
// `wallet` is a decorated version of client.
var root = {};
@ -81,12 +81,11 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
wallet.notAuthorized = true;
$state.go('tabs.home');
} else if (err instanceof errors.NOT_FOUND) {
root.showErrorPopup(gettext('Could not access Wallet Service: Not found'));
popupService.showAlert(gettextCatalog.getString('Could not access Wallet Service: Not found'));
} else {
var msg = ""
$rootScope.$emit('Local/ClientError', (err.error ? err.error : err));
var msg = bwcError.msg(err, gettext('Error at Wallet Service'));
root.showErrorPopup(msg);
popupService.showAlert(bwcError.msg(err, gettextCatalog.getString('Error at Wallet Service')));
}
};
root.handleError = lodash.debounce(_handleError, 1000);
@ -664,20 +663,6 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.showErrorPopup = function(msg, cb) {
$log.warn('Showing err popup:' + msg);
// An alert dialog
var alertPopup = $ionicPopup.alert({
title: title,
template: msg
});
if (!cb) cb = function() {};
alertPopup.then(cb);
};
// walletHome
root.recreate = function(wallet, cb) {
ongoingProcess.set('recreating', true);
@ -1010,10 +995,17 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
};
root.setTouchId = function(wallet, enabled, cb) {
var opts = {
touchIdFor: {}
};
opts.touchIdFor[wallet.id] = enabled;
fingerprintService.check(wallet, function(err) {
if (err) return cb(err); {
$log.debug(err);
return;
if (err) {
opts.touchIdFor[wallet.id] = !enabled;
$log.debug('Error with fingerprint:' + err);
return cb(err);
}
configService.set(opts, cb);
});

View file

@ -25,7 +25,6 @@
box-shadow: 0px 6px 12px 0px rgba(0, 0, 0, 0.3);
}
}
.overlay{
position: absolute;
top:0;
@ -34,4 +33,27 @@
height: 100%;
background: rgba(0,0,0,.4);
z-index: 4;
}
}
.back-button {
border: 0;
.icon:before {
color: #fff;
font-size: 30px !important;
font-weight: bold;
margin-left: 5px;
}
}
.search-button {
.icon:before {
color: #fff;
font-size: 30px !important;
margin-left: 5px;
}
}
.button-block {
width: 90% !important;
margin-left: auto;
margin-right: auto;
}

9
src/sass/ionic.scss Normal file
View file

@ -0,0 +1,9 @@
/* Set ionic variables */
$font-family-sans-serif: "Roboto", sans-serif;
$font-family-light-sans-serif: "Roboto-Light", sans-serif-light;
$royal: #1e3186;
$base-background-color: #f5f5f5;
@import "../../bower_components/ionic/scss/ionic";

View file

@ -339,20 +339,6 @@ ul.wallet-selection.wallets {
padding-right: 10%;
}
.amount {
width: 100%;
text-align: center;
padding: 1.5rem 1rem 1.5rem 1rem;
color: #fff;
height: 150px;
margin-bottom: 25px;
}
.alternative-amount {
height: 25px;
text-align: center;
}
.wallet-info {
position: absolute;
top: inherit;
@ -1003,8 +989,11 @@ input[type=number] {
}
}
@import "ionic";
@import "common";
@import 'mixins/mixins';
@import 'views/onboarding/onboarding';
@import "views/common";
@import "views/add";
@import "views/tab-home";
@import "views/includes/walletActivity";
@import "views/walletDetails";
@import 'views/onboarding/onboarding';
@import "views/includes/walletActivity";

13
src/sass/views/add.scss Normal file
View file

@ -0,0 +1,13 @@
#view-add {
.item {
margin-bottom: 10px;
margin-left: 10px;
margin-right: 10px;
&:first-child {
margin-top: 25px;
}
}
}

View file

@ -5,6 +5,7 @@
background-size: contain;
background-repeat-y: no-repeat;
#shopping-24 {
content: url("../img/onboarding-welcome-shopping24.png");
position: absolute;
top: 2%;
right: 5%;

View file

@ -19,4 +19,8 @@
background-repeat: no-repeat;
background-position: -5px -6px;
}
a.item {
color: #444;
}
}

View file

@ -0,0 +1,24 @@
#walletDetails {
.bar-header {
border: 0;
.title, .button {
color: #fff;
}
.button {
background-color: transparent;
}
}
.amount {
width: 100%;
text-align: center;
padding: 2.5rem 1rem 1.5rem 1rem;
color: #fff;
height: 150px;
margin-bottom: 25px;
&-alternative {
line-height: 48px;
}
}
}