Merge branch 'ref/design' of github.com:matiu/copay into ref/design

This commit is contained in:
Matias Alejo Garcia 2016-08-23 16:53:33 -03:00
commit c83c2e7550
No known key found for this signature in database
GPG key ID: 02470DB551277AB3
26 changed files with 95 additions and 92 deletions

View file

@ -5,6 +5,8 @@ var modules = [
'monospaced.qrcode',
'gettext',
'ionic',
'ionic-toast',
'angular-clipboard',
'ngLodash',
'ngCsv',
'bwcModule',

View file

@ -85,11 +85,6 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
return n.substring(0, 4);
};
$scope.copyToClipboard = function(addr, $event) {
if (!addr) return;
self.copyToClipboard(addr, $event);
};
$scope.cancel = function() {
$scope.txDetailsModal.hide();
};

View file

@ -8,7 +8,7 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
var now = Math.floor(Date.now() / 1000);
$scope.loading = null;
$scope.copayerId = $scope.wallet.credentials.copayerId;
$scope.isShared = $scope.wallet.credentials.n > 1;
$scope.canSign = $scope.wallet.canSign() || $scope.wallet.isPrivKeyExternal();
@ -182,11 +182,6 @@ angular.module('copayApp.controllers').controller('txpDetailsController', functi
});
};
$scope.copyToClipboard = function(addr, $event) {
if (!addr) return;
self.copyToClipboard(addr, $event);
};
$scope.close = function(txp) {
$scope.loading = null;
if (txp) {

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesAltCurrencyController',
function($scope, $log, $timeout, configService, rateService, lodash, profileService, walletService, $state) {
function($scope, $log, $state, $timeout, configService, rateService, lodash, profileService, walletService) {
var next = 10;
var completeAlternativeList;
@ -42,9 +42,9 @@ angular.module('copayApp.controllers').controller('preferencesAltCurrencyControl
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('preferencesGlobal');
$scope.$emit('Local/UnitSettingUpdated');
walletService.updateRemotePreferences(profileService.getClients(), {}, function() {
$state.go('tabs.settings');
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});
});

View file

@ -113,13 +113,6 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
save('#202020');
};
$scope.copyToClipboard = function(data) {
if ($scope.isCordova) {
window.cordova.plugins.clipboard.copy(data);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
}
};
$scope.scan = function() {
walletService.startScan(wallet);
$state.go('tabs.home');

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('preferencesLanguageController',
function($scope, $log, $state, configService, profileService, uxLanguage, walletService, go) {
function($scope, $log, $state, configService, profileService, uxLanguage, walletService) {
$scope.init = function() {
$scope.availableLanguages = uxLanguage.getLanguages();
@ -19,10 +19,10 @@ angular.module('copayApp.controllers').controller('preferencesLanguageController
configService.set(opts, function(err) {
if (err) $log.warn(err);
go.preferencesGlobal();
$state.go('tabs.settings')
uxLanguage.update(function() {
walletService.updateRemotePreferences(profileService.getClients(), {}, function() {
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});
});

View file

@ -36,10 +36,8 @@ angular.module('copayApp.controllers').controller('preferencesUnitController', f
configService.set(opts, function(err) {
if (err) $log.warn(err);
$state.go('preferencesGlobal');
$scope.$emit('Local/UnitSettingUpdated');
walletService.updateRemotePreferences(profileService.getClients(), {}, function() {
$state.go('tabs.settings');
walletService.updateRemotePreferences(profileService.getWallets(), {}, function() {
$log.debug('Remote preferences saved');
});
});

View file

@ -32,39 +32,6 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
});
}
$scope.copyToClipboard = function(addr, $event) {
var showPopover = function() {
$ionicPopover.fromTemplateUrl('views/includes/copyToClipboard.html', {
scope: $scope
}).then(function(popover) {
$scope.popover = popover;
$scope.popover.show($event);
});
$scope.close = function() {
$scope.popover.hide();
}
$timeout(function() {
$scope.popover.hide(); //close the popover after 0.7 seconds
}, 700);
$scope.$on('$destroy', function() {
$scope.popover.remove();
});
};
if ($scope.isCordova) {
window.cordova.plugins.clipboard.copy(addr);
window.plugins.toast.showShortCenter(gettextCatalog.getString('Copied to clipboard'));
} else if ($scope.isNW) {
nodeWebkit.writeToClipboard(addr);
showPopover($event);
}
};
$scope.shareAddress = function(addr) {
if ($scope.isCordova) {
window.plugins.socialsharing.share('bitcoin:' + addr, null, null, null);

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) {
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, storageService) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -11,9 +11,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
var HISTORY_SHOW_LIMIT = 10;
$scope.openSearchModal = function() {
var wallet = profileService.getWallet($stateParams.walletId);
$scope.color = wallet.color;
$ionicModal.fromTemplateUrl('views/modals/search.html', {
@ -113,9 +111,17 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updateTxHistory();
}
var hideBalance = function() {
storageService.getHideBalanceFlag(wallet.credentials.walletId, function(err, shouldHideBalance) {
if (err) $scope.shouldHideBalance = false;
else $scope.shouldHideBalance = (shouldHideBalance == 'true') ? true : false;
});
}
$scope.hideToggle = function() {
console.log('[walletDetails.js.70:hideToogle:] TODO'); //TODO
};
$scope.shouldHideBalance = !$scope.shouldHideBalance;
storageService.setHideBalanceFlag(wallet.credentials.walletId, $scope.shouldHideBalance.toString(), function() {});
}
var currentTxHistoryPage;
var wallet;
@ -129,6 +135,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.requiresMultipleSignatures = wallet.credentials.m > 1;
$scope.newTx = false;
hideBalance();
$ionicNavBarDelegate.title(wallet.name);
$scope.updateAll();

View file

@ -0,0 +1,39 @@
'use strict';
angular.module('copayApp.directives')
.directive('copyToClipboard', function(platformInfo, gettextCatalog, ionicToast, clipboard) {
return {
restrict: 'A',
scope: {
copyToClipboard: '=copyToClipboard'
},
link: function(scope, elem, attrs, ctrl) {
var isCordova = platformInfo.isCordova;
var isChromeApp = platformInfo.isChromeApp;
var isNW = platformInfo.isNW;
elem.bind('mouseover', function() {
elem.css('cursor', 'pointer');
});
var msg = gettextCatalog.getString('Copied to clipboard');
elem.bind('click', function() {
var data = scope.copyToClipboard;
if (isCordova) {
window.cordova.plugins.clipboard.copy(data);
window.plugins.toast.showShortCenter(msg);
} else if (isNW) {
nodeWebkit.writeToClipboard(data);
scope.$apply(function() {
ionicToast.show(msg, 'bottom', false, 1000);
});
} else if (clipboard.supported) {
clipboard.copyText(data);
scope.$apply(function() {
ionicToast.show(msg, 'bottom', false, 1000);
});
}
});
}
}
});

View file

@ -3,8 +3,8 @@ angular.module('copayApp.services')
.factory('applicationService', function($rootScope, $timeout, platformInfo, $state) {
var root = {};
var isChromeApp = platformInfo.isChromeApp;
var isNW = platformInfo.isNW;
var isChromeApp = platformInfo.isChromeApp;
var isNW = platformInfo.isNW;
root.restart = function() {
var hashIndex = window.location.href.indexOf('#/');