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

# Conflicts:
#	src/js/services/externalLinkService.js
This commit is contained in:
Jamal Jackson 2016-10-12 13:57:21 -04:00
commit 3d9e40b4c5
10 changed files with 73 additions and 40 deletions

View file

@ -297,7 +297,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var config = configService.getSync();
var spendingPassEnabled = walletService.isEncrypted(wallet);
var touchIdEnabled = config.touchIdFor && !config.touchIdFor[wallet.id];
var touchIdEnabled = config.touchIdFor && config.touchIdFor[wallet.id];
var isCordova = $scope.isCordova;
var bigAmount = parseFloat(txFormatService.formatToUSD(txp.amount)) > 20;
var message = gettextCatalog.getString('Sending {{amountStr}} from your {{name}} wallet', {
@ -308,17 +308,20 @@ angular.module('copayApp.controllers').controller('confirmController', function(
var cancelText = gettextCatalog.getString('Cancel');
if (!spendingPassEnabled && !touchIdEnabled) {
if (isCordova && bigAmount) {
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
if (!ok) {
$scope.sendStatus = '';
$timeout(function() {
$scope.$apply();
});
return;
}
publishAndSign(wallet, txp, onSendStatusChange);
});
if (isCordova) {
if (bigAmount) {
popupService.showConfirm(null, message, okText, cancelText, function(ok) {
if (!ok) {
$scope.sendStatus = '';
$timeout(function() {
$scope.$apply();
});
return;
}
publishAndSign(wallet, txp, onSendStatusChange);
});
}
else publishAndSign(wallet, txp, onSendStatusChange);
}
else {
popupService.showConfirm(null, message, okText, cancelText, function(ok) {

View file

@ -27,16 +27,26 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
};
function updateMemo() {
wallet.getTxNote({
txid: $scope.btx.txid
}, function(err, note) {
if (err || !note) {
$log.debug(gettextCatalog.getString('Could not fetch transaction note'));
walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) {
if (err) {
$log.warn('Could not fetch transaction note ' + err);
return;
}
$scope.note = note;
$timeout(function() {
$scope.$apply();
if (!note) return;
$scope.btx.note = note;
walletService.getTx(wallet, $scope.btx.txid, function(err, tx) {
if (err) {
$log.error(err);
return;
}
tx.note = note;
$timeout(function() {
$scope.$apply();
});
});
});
};
@ -91,19 +101,13 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
body: text
};
wallet.editTxNote(args, function(err) {
walletService.editTxNote(wallet, args, function(err, res) {
if (err) {
$log.debug('Could not save tx comment');
$log.debug('Could not save tx comment ' + err);
return;
}
// This is only to refresh the current screen data
$scope.btx.note = null;
if (args.body) {
$scope.btx.note = {};
$scope.btx.note.body = text;
$scope.btx.note.editedByName = wallet.credentials.copayerName;
$scope.btx.note.editedOn = Math.floor(Date.now() / 1000);
}
updateMemo();
$scope.btx.searcheableString = null;
$timeout(function() {
$scope.$apply();

View file

@ -106,7 +106,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var updateHasFunds = function() {
$scope.hasFunds = null;
$scope.hasFunds = true;
var wallets = profileService.getWallets({
onlyComplete: true,
@ -114,6 +114,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
if (!wallets || !wallets.length) {
$scope.hasFunds = false;
$timeout(function() {
$scope.$apply();
});
}
var index = 0;
@ -124,13 +127,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$log.error(err);
return;
}
if (status.availableBalanceSat) {
if (status.availableBalanceSat && status.availableBalanceSat > 0) {
$scope.hasFunds = true;
}
else $scope.hasFunds = false;
if (index == wallets.length) {
$scope.hasFunds = $scope.hasFunds || false;
}
$timeout(function() {
$scope.$apply();
})
});
});
};

View file

@ -3,6 +3,17 @@
angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog) {
this.open = function(url, optIn, title, desc, okText, cancelText) {
var old = $window.handleOpenURL;
$window.handleOpenURL = function(url) {
// Ignore external URLs
$log.debug('Skip: ' + url);
};
$timeout(function() {
$window.handleOpenURL = old;
}, 500);
if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url);
} else {

View file

@ -118,7 +118,7 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
this.showPrompt = function(title, message, opts, cb) {
$log.warn(title + ": " + message);
if (isCordova)
if (isCordova && !opts.forceHTMLPrompt)
_cordovaPrompt(title, message, opts, cb);
else
_ionicPrompt(title, message, opts, cb);

View file

@ -42,6 +42,8 @@ angular.module('copayApp.services')
root._detect = function(cb) {
return cb('en'); //disable auto detection for release;
var userLang, androidLang;
if (navigator && navigator.globalization) {

View file

@ -512,6 +512,12 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
});
};
root.editTxNote = function(wallet, args, cb) {
wallet.editTxNote(args, function(err, res) {
return cb(err, res);
});
};
root.getTxp = function(wallet, txpid, cb) {
wallet.getTx(txpid, function(err, txp) {
if (err) return cb(err);
@ -821,7 +827,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
// An alert dialog
var askPassword = function(name, title, cb) {
var opts = {
inputType: 'password'
inputType: 'password',
forceHTMLPrompt: true
};
popupService.showPrompt(title, name, opts, function(res) {
if (!res) return cb();
@ -961,7 +968,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
$rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp);
if(!customStatusHandler) {
if (!customStatusHandler) {
root.openStatusModal(type, broadcastedTxp, function() {});
}
@ -972,7 +979,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var type = root.getViewStatus(wallet, signedTxp);
if(!customStatusHandler) {
if (!customStatusHandler) {
root.openStatusModal(type, signedTxp, function() {});
}