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

@ -24,7 +24,7 @@
"angular-mocks": "1.4.10", "angular-mocks": "1.4.10",
"bezier-easing": "^2.0.3", "bezier-easing": "^2.0.3",
"bhttp": "^1.2.1", "bhttp": "^1.2.1",
"bitcore-wallet-client": "4.2.1", "bitcore-wallet-client": "4.3.1",
"bower": "^1.7.9", "bower": "^1.7.9",
"chai": "^3.5.0", "chai": "^3.5.0",
"cordova": "5.4.1", "cordova": "5.4.1",

View file

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

View file

@ -27,16 +27,26 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
}; };
function updateMemo() { function updateMemo() {
wallet.getTxNote({ walletService.getTxNote(wallet, $scope.btx.txid, function(err, note) {
txid: $scope.btx.txid if (err) {
}, function(err, note) { $log.warn('Could not fetch transaction note ' + err);
if (err || !note) {
$log.debug(gettextCatalog.getString('Could not fetch transaction note'));
return; return;
} }
$scope.note = note;
$timeout(function() { if (!note) return;
$scope.$apply();
$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 body: text
}; };
wallet.editTxNote(args, function(err) { walletService.editTxNote(wallet, args, function(err, res) {
if (err) { if (err) {
$log.debug('Could not save tx comment'); $log.debug('Could not save tx comment ' + err);
return; return;
} }
// This is only to refresh the current screen data // This is only to refresh the current screen data
$scope.btx.note = null; updateMemo();
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);
}
$scope.btx.searcheableString = null; $scope.btx.searcheableString = null;
$timeout(function() { $timeout(function() {
$scope.$apply(); $scope.$apply();

View file

@ -106,7 +106,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var updateHasFunds = function() { var updateHasFunds = function() {
$scope.hasFunds = null; $scope.hasFunds = true;
var wallets = profileService.getWallets({ var wallets = profileService.getWallets({
onlyComplete: true, onlyComplete: true,
@ -114,6 +114,9 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
if (!wallets || !wallets.length) { if (!wallets || !wallets.length) {
$scope.hasFunds = false; $scope.hasFunds = false;
$timeout(function() {
$scope.$apply();
});
} }
var index = 0; var index = 0;
@ -124,13 +127,16 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$log.error(err); $log.error(err);
return; return;
} }
if (status.availableBalanceSat && status.availableBalanceSat > 0) {
if (status.availableBalanceSat) {
$scope.hasFunds = true; $scope.hasFunds = true;
} }
else $scope.hasFunds = false;
if (index == wallets.length) { if (index == wallets.length) {
$scope.hasFunds = $scope.hasFunds || false; $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) { angular.module('copayApp.services').service('externalLinkService', function(platformInfo, nodeWebkitService, popupService, gettextCatalog) {
this.open = function(url, optIn, title, desc, okText, cancelText) { 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) { if (platformInfo.isNW) {
nodeWebkitService.openExternalLink(url); nodeWebkitService.openExternalLink(url);
} else { } else {

View file

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

View file

@ -42,6 +42,8 @@ angular.module('copayApp.services')
root._detect = function(cb) { root._detect = function(cb) {
return cb('en'); //disable auto detection for release;
var userLang, androidLang; var userLang, androidLang;
if (navigator && navigator.globalization) { 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) { root.getTxp = function(wallet, txpid, cb) {
wallet.getTx(txpid, function(err, txp) { wallet.getTx(txpid, function(err, txp) {
if (err) return cb(err); if (err) return cb(err);
@ -821,7 +827,8 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
// An alert dialog // An alert dialog
var askPassword = function(name, title, cb) { var askPassword = function(name, title, cb) {
var opts = { var opts = {
inputType: 'password' inputType: 'password',
forceHTMLPrompt: true
}; };
popupService.showPrompt(title, name, opts, function(res) { popupService.showPrompt(title, name, opts, function(res) {
if (!res) return cb(); if (!res) return cb();
@ -961,7 +968,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
$rootScope.$emit('Local/TxAction', wallet.id); $rootScope.$emit('Local/TxAction', wallet.id);
var type = root.getViewStatus(wallet, broadcastedTxp); var type = root.getViewStatus(wallet, broadcastedTxp);
if(!customStatusHandler) { if (!customStatusHandler) {
root.openStatusModal(type, broadcastedTxp, function() {}); root.openStatusModal(type, broadcastedTxp, function() {});
} }
@ -972,7 +979,7 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
var type = root.getViewStatus(wallet, signedTxp); var type = root.getViewStatus(wallet, signedTxp);
if(!customStatusHandler) { if (!customStatusHandler) {
root.openStatusModal(type, signedTxp, function() {}); root.openStatusModal(type, signedTxp, function() {});
} }

View file

@ -30,11 +30,11 @@
<span translate>Terms of Use</span> <span translate>Terms of Use</span>
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>
</a> </a>
<a class="item item-icon-left item-icon-right" ui-sref="tabs.about.translators"> <!-- <a class="item item-icon-left item-icon-right" ui-sref="tabs.about.translators">
<i class="icon ion-ios-people-outline"></i> <i class="icon ion-ios-people-outline"></i>
<span translate>Translators</span> <span translate>Translators</span>
<i class="icon bp-arrow-right"></i> <i class="icon bp-arrow-right"></i>
</a> </a> Disabled for release-->
<a class="item item-icon-left item-icon-right" ui-sref="tabs.about.logs"> <a class="item item-icon-left item-icon-right" ui-sref="tabs.about.logs">
<i class="icon ion-ios-copy-outline"></i> <i class="icon ion-ios-copy-outline"></i>
<span translate>Session log</span> <span translate>Session log</span>

View file

@ -130,7 +130,7 @@
</div> </div>
<div class="card list" ng-show="txHistory[0]"> <div class="card list" ng-show="txHistory[0]">
<div class="item" ng-repeat="btx in txHistory track by btx.txid" ng-click="openTxModal(btx)"> <div class="item" ng-repeat="btx in txHistory track by $index" ng-click="openTxModal(btx)">
<span class="item-note text-right"> <span class="item-note text-right">
<span class="size-16" ng-class="{'text-bold': btx.recent}"> <span class="size-16" ng-class="{'text-bold': btx.recent}">
<span ng-if="btx.action == 'received'">+</span> <span ng-if="btx.action == 'received'">+</span>