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

This commit is contained in:
Jamal Jackson 2016-09-30 13:29:40 -04:00
commit 0ebefdce7a
14 changed files with 112 additions and 77 deletions

View file

@ -18,7 +18,7 @@
<h3 translate>Name</h3> <h3 translate>Name</h3>
<strong>{{addressbookEntry.name}}</strong> <strong>{{addressbookEntry.name}}</strong>
</div> </div>
<div class="item item-text-wrap"> <div class="item item-text-wrap" ng-show="addressbookEntry.email">
<h3 translate>Email</h3> <h3 translate>Email</h3>
<strong>{{addressbookEntry.email}}</strong> <strong>{{addressbookEntry.email}}</strong>
</div> </div>

View file

@ -8,7 +8,27 @@
</ion-nav-buttons> </ion-nav-buttons>
</ion-nav-bar> </ion-nav-bar>
<ion-content> <ion-content>
<div id="address"> <div class="list card padding text-center" ng-if="!wallets[0]">
<span translate>No Wallet</span>
</div>
<div id="address" ng-if="wallets[0]">
<article class="text-center" ng-if="!wallet">
<div class="row qr">
<div class="text-center col center-block">
<div style="height:225px; width:220px; margin:auto; background: white; padding-top: 25%;">
...
</div>
</div>
</div>
<div class="row border-top">
<div class="col col-90 center-block bit-address text-center">
<div class="item item-icon-left">
<i class="icon ion-social-bitcoin-outline"></i>
<span class="bit-address-gen-address">...</span>
</div>
</div>
</div>
</article>
<article class="text-center" ng-if="wallet && !wallet.isComplete()"> <article class="text-center" ng-if="wallet && !wallet.isComplete()">
<div class="incomplete"> <div class="incomplete">
<div class="title"> <div class="title">
@ -32,14 +52,14 @@
</article> </article>
<article ng-if="wallet && wallet.isComplete()"> <article ng-if="wallet && wallet.isComplete()">
<div class="row backup" ng-show="!wallet.showBackupNeededModal && wallet.needsBackup" ng-click="goToBackupFlow()"> <div class="row backup" ng-show="!wallet.showBackupNeededModal && wallet.needsBackup" ng-click="goToBackupFlow()">
<div class="m15t text-center col center-block"> <div class="text-center col center-block">
<i class="icon ion-alert"></i><span translate>Wallet not backed up</span><i class="icon ion-ios-arrow-thin-right"></i> <i class="icon ion-alert"></i><span translate>Wallet not backed up</span><i class="icon ion-ios-arrow-thin-right"></i>
</div> </div>
</div> </div>
<div class="row qr"> <div class="row qr">
<div class="m15t text-center col center-block" copy-to-clipboard="addr"> <div class="text-center col center-block" copy-to-clipboard="addr">
<qrcode ng-if="addr" size="220" data="bitcoin:{{addr}}"></qrcode> <qrcode ng-if="addr" size="220" data="bitcoin:{{addr}}"></qrcode>
<div ng-if="!addr" style="height:220px; width:220px; margin:auto; background: white; padding-top: 20%;"> <div ng-if="!addr" style="height:225px; width:220px; margin:auto; background: white; padding-top: 25%;">
... ...
</div> </div>
</div> </div>
@ -62,18 +82,15 @@
<div class="col col-90 center-block bit-address text-center"> <div class="col col-90 center-block bit-address text-center">
<div class="item item-icon-left"> <div class="item item-icon-left">
<i class="icon ion-social-bitcoin-outline"></i> <i class="icon ion-social-bitcoin-outline"></i>
<span ng-if="generatingAddress">...</span> <span class="bit-address-gen-address" ng-if="generatingAddress">...</span>
<span class="bit-address-gen-address" ng-if="!generatingAddress" copy-to-clipboard="addr">{{addr}}</span> <span class="bit-address-gen-address" ng-if="!generatingAddress" copy-to-clipboard="addr">{{addr}}</span>
</div> </div>
</div> </div>
</div> </div>
</article> </article>
</div> </div>
<article id="wallets"> <article id="wallets" ng-if="wallets[0]">
<div class="list card padding text-center" ng-if="!wallets[0]"> <div class="list">
<span translate>No Wallet</span>
</div>
<div class="list" ng-if="wallets[0]">
<wallets wallets="wallets"></wallets> <wallets wallets="wallets"></wallets>
</div> </div>
</article> </article>

View file

@ -111,7 +111,7 @@
No transactions yet No transactions yet
</div> </div>
<div ng-show="updatingTxHistory && updatingTxHistoryProgress>5" class="updatingHistory"> <div ng-show="updatingTxHistory" class="updatingHistory">
<div class="row" > <div class="row" >
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner> <ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
</div> </div>

View file

@ -2,27 +2,32 @@
angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) { angular.module('copayApp.controllers').controller('addressbookViewController', function($scope, $state, $timeout, $stateParams, lodash, addressbookService, popupService, $ionicHistory) {
var address = $stateParams.address; $scope.$on("$ionicView.beforeEnter", function(event, data){
var address = data.stateParams.address;
if (!address) { if (!address) {
$state.go('tabs.addressbook'); $ionicHistory.back();
return;
}
addressbookService.get(address, function(err, obj) {
if (err) {
popupService.showAlert(err);
return; return;
} }
if (!lodash.isObject(obj)) {
var name = obj; addressbookService.get(address, function(err, obj) {
obj = { if (err) {
'name': name, popupService.showAlert(err);
'address': address, return;
'email': '' }
}; if (!lodash.isObject(obj)) {
} var name = obj;
$scope.addressbookEntry = obj; obj = {
'name': name,
'address': address,
'email': ''
};
}
$scope.addressbookEntry = obj;
$timeout(function() {
$scope.$apply();
});
});
}); });
$scope.sendTo = function() { $scope.sendTo = function() {

View file

@ -122,11 +122,13 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$log.error(err); $log.error(err);
return; return;
} }
$scope.$emit('Local/ClearHistory');
$ionicHistory.removeBackView();
$state.go('tabs.home');
$timeout(function() { $timeout(function() {
$ionicHistory.removeBackView(); $state.transitionTo('tabs.wallet', {
$state.go('tabs.home'); walletId: $scope.wallet.id
});
}, 100); }, 100);
}); });
}; };

View file

@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) { function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService) {
var wallet; var wallet;
var listeners = []; var listeners = [];
var notifications = [];
$scope.externalServices = {}; $scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO $scope.bitpayCardEnabled = true; // TODO
$scope.openTxpModal = txpModalService.open; $scope.openTxpModal = txpModalService.open;
@ -102,7 +103,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
var i = $scope.wallets.length; var i = $scope.wallets.length;
var j = 0; var j = 0;
var timeSpan = 60 * 60 * 24 * 7; var timeSpan = 60 * 60 * 24 * 7;
var notifications = [];
lodash.each($scope.wallets, function(wallet) { lodash.each($scope.wallets, function(wallet) {
walletService.getStatus(wallet, {}, function(err, status) { walletService.getStatus(wallet, {}, function(err, status) {

View file

@ -38,6 +38,9 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err); if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
$scope.addr = addr; $scope.addr = addr;
if ($scope.wallet.showBackupNeededModal) $scope.openBackupNeededModal(); if ($scope.wallet.showBackupNeededModal) $scope.openBackupNeededModal();
$timeout(function() {
$scope.$apply();
}, 100);
}); });
}; };

View file

@ -3,10 +3,12 @@
angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) { angular.module('copayApp.controllers').controller('tabSendController', function($scope, $log, $timeout, $ionicScrollDelegate, addressbookService, profileService, lodash, $state, walletService, incomingData, popupService) {
var originalList; var originalList;
var CONTACTS_SHOW_LIMIT = 10; var CONTACTS_SHOW_LIMIT;
var currentContactsPage = 0; var currentContactsPage;
var updateList = function() { var updateList = function() {
CONTACTS_SHOW_LIMIT = 10;
currentContactsPage = 0;
originalList = []; originalList = [];
var wallets = profileService.getWallets({ var wallets = profileService.getWallets({
@ -15,16 +17,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.hasWallets = lodash.isEmpty(wallets) ? false : true; $scope.hasWallets = lodash.isEmpty(wallets) ? false : true;
$scope.oneWallet = wallets.length == 1; $scope.oneWallet = wallets.length == 1;
lodash.each(wallets, function(v) { if (!$scope.oneWallet) {
originalList.push({ lodash.each(wallets, function(v) {
color: v.color, originalList.push({
name: v.name, color: v.color,
isWallet: true, name: v.name,
getAddress: function(cb) { isWallet: true,
walletService.getAddress(v, false, cb); getAddress: function(cb) {
}, walletService.getAddress(v, false, cb);
},
});
}); });
}); }
addressbookService.list(function(err, ab) { addressbookService.list(function(err, ab) {
if (err) $log.error(err); if (err) $log.error(err);
@ -50,7 +54,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() { $timeout(function() {
$ionicScrollDelegate.resize(); $ionicScrollDelegate.resize();
$scope.$apply(); $scope.$apply();
}, 10); }, 100);
}); });
}; };

View file

@ -1,13 +1,12 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) { angular.module('copayApp.controllers').controller('tabSettingsController', function($scope, $window, uxLanguage, platformInfo, profileService, feeService, configService) {
var updateConfig = function() { var updateConfig = function() {
var config = configService.getSync(); var config = configService.getSync();
var isCordova = platformInfo.isCordova; var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP; var isWP = platformInfo.isWP;
var isIOS = platformInfo.isIOS;
$scope.usePushNotifications = isCordova && !isWP; $scope.usePushNotifications = isCordova && !isWP;
@ -22,13 +21,10 @@ angular.module('copayApp.controllers').controller('tabSettingsController', funct
$scope.feeOpts = feeService.feeOpts; $scope.feeOpts = feeService.feeOpts;
$scope.currentFeeLevel = feeService.getCurrentFeeLevel(); $scope.currentFeeLevel = feeService.getCurrentFeeLevel();
$scope.otherWallets = lodash.filter(profileService.getWallets(self.network), function(w) {
return w.id != self.walletId;
});
$scope.wallets = profileService.getWallets(); $scope.wallets = profileService.getWallets();
}; };
$scope.$on("$ionicView.enter", function(event, data) { $scope.$on("$ionicView.beforeEnter", function(event, data) {
updateConfig(); updateConfig();
}); });

View file

@ -122,9 +122,6 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.updatingTxHistoryProgress = txs ? txs.length : 0; $scope.updatingTxHistoryProgress = txs ? txs.length : 0;
$scope.completeTxHistory = txs; $scope.completeTxHistory = txs;
$scope.showHistory(); $scope.showHistory();
$timeout(function() {
$scope.$apply();
});
}; };
$timeout(function() { $timeout(function() {
@ -139,9 +136,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
} }
$scope.completeTxHistory = txHistory; $scope.completeTxHistory = txHistory;
$scope.showHistory(); $scope.showHistory();
$timeout(function() { $scope.$apply();
$scope.$apply();
});
return cb(); return cb();
}); });
}); });

View file

@ -154,6 +154,8 @@ angular.module('copayApp.directives')
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
scope.$on("$ionicSlides.sliderInitialized", function(event, data) { scope.$on("$ionicSlides.sliderInitialized", function(event, data) {
scope.slider = data.slider; scope.slider = data.slider;
if(scope.slider.slides.length == 1)
scope.slider.lockSwipes();
scope.$emit('Wallet/Changed', scope.wallets ? scope.wallets[0] : null); scope.$emit('Wallet/Changed', scope.wallets ? scope.wallets[0] : null);
}); });

View file

@ -129,26 +129,13 @@ angular.module('copayApp.services')
}); });
wallet.on('notification', function(n) { wallet.on('notification', function(n) {
$log.debug('BWC Notification:', n); $log.debug('BWC Notification:', n);
// notification? if (n.type == "NewBlock" && n.data.network == "testnet") {
throttledBwsEvent(n, wallet);
// TODO (put this in wallet ViewModel) }
if (wallet.cachedStatus) else newBwsEvent(n, wallet);
wallet.cachedStatus.isValid = false;
if (wallet.completeHistory)
wallet.completeHistory.isValid = false;
if (wallet.cachedActivity)
wallet.cachedActivity.isValid = false;
if (wallet.cachedTxps)
wallet.cachedTxps.isValid = false;
$rootScope.$emit('bwsEvent', wallet.id, n.type, n);
}); });
wallet.on('walletCompleted', function() { wallet.on('walletCompleted', function() {
@ -183,6 +170,26 @@ angular.module('copayApp.services')
return true; return true;
}; };
var throttledBwsEvent = lodash.throttle(function(n, wallet) {
newBwsEvent(n, wallet);
}, 10000);
var newBwsEvent = function(n, wallet) {
if (wallet.cachedStatus)
wallet.cachedStatus.isValid = false;
if (wallet.completeHistory)
wallet.completeHistory.isValid = false;
if (wallet.cachedActivity)
wallet.cachedActivity.isValid = false;
if (wallet.cachedTxps)
wallet.cachedTxps.isValid = false;
$rootScope.$emit('bwsEvent', wallet.id, n.type, n);
};
var validationLock = false; var validationLock = false;
root.runValidation = function(client, delay, retryDelay) { root.runValidation = function(client, delay, retryDelay) {

View file

@ -8,6 +8,7 @@
height:100%; height:100%;
} }
#add-contact{ #add-contact{
min-width: 300px;
img{ img{
width: 10rem; width: 10rem;
display: inline-block; display: inline-block;

View file

@ -11,6 +11,7 @@
background: #fff; background: #fff;
.incomplete { .incomplete {
padding: 50px; padding: 50px;
height: 350px;
.title { .title {
padding: 20px; padding: 20px;
font-size: 25px; font-size: 25px;
@ -44,11 +45,13 @@
&-gen-address {} &-gen-address {}
} }
.qr { .qr {
padding: 30px; padding: 50px 0 20px 0;
} }
.backup { .backup {
background-color: orange; background-color: orange;
color: #fff; color: #fff;
position: absolute;
top: 5px;
i { i {
padding: 10px; padding: 10px;
} }