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>
<strong>{{addressbookEntry.name}}</strong>
</div>
<div class="item item-text-wrap">
<div class="item item-text-wrap" ng-show="addressbookEntry.email">
<h3 translate>Email</h3>
<strong>{{addressbookEntry.email}}</strong>
</div>

View File

@ -8,7 +8,27 @@
</ion-nav-buttons>
</ion-nav-bar>
<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()">
<div class="incomplete">
<div class="title">
@ -32,14 +52,14 @@
</article>
<article ng-if="wallet && wallet.isComplete()">
<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>
</div>
</div>
<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>
<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>
@ -62,18 +82,15 @@
<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 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>
</div>
</div>
</div>
</article>
</div>
<article id="wallets">
<div class="list card padding text-center" ng-if="!wallets[0]">
<span translate>No Wallet</span>
</div>
<div class="list" ng-if="wallets[0]">
<article id="wallets" ng-if="wallets[0]">
<div class="list">
<wallets wallets="wallets"></wallets>
</div>
</article>

View File

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

View File

@ -2,27 +2,32 @@
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) {
$state.go('tabs.addressbook');
return;
}
addressbookService.get(address, function(err, obj) {
if (err) {
popupService.showAlert(err);
if (!address) {
$ionicHistory.back();
return;
}
if (!lodash.isObject(obj)) {
var name = obj;
obj = {
'name': name,
'address': address,
'email': ''
};
}
$scope.addressbookEntry = obj;
addressbookService.get(address, function(err, obj) {
if (err) {
popupService.showAlert(err);
return;
}
if (!lodash.isObject(obj)) {
var name = obj;
obj = {
'name': name,
'address': address,
'email': ''
};
}
$scope.addressbookEntry = obj;
$timeout(function() {
$scope.$apply();
});
});
});
$scope.sendTo = function() {

View File

@ -122,11 +122,13 @@ angular.module('copayApp.controllers').controller('preferencesHistory',
$log.error(err);
return;
}
$scope.$emit('Local/ClearHistory');
$ionicHistory.removeBackView();
$state.go('tabs.home');
$timeout(function() {
$ionicHistory.removeBackView();
$state.go('tabs.home');
$state.transitionTo('tabs.wallet', {
walletId: $scope.wallet.id
});
}, 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) {
var wallet;
var listeners = [];
var notifications = [];
$scope.externalServices = {};
$scope.bitpayCardEnabled = true; // TODO
$scope.openTxpModal = txpModalService.open;
@ -102,7 +103,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
var i = $scope.wallets.length;
var j = 0;
var timeSpan = 60 * 60 * 24 * 7;
var notifications = [];
lodash.each($scope.wallets, function(wallet) {
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);
$scope.addr = addr;
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) {
var originalList;
var CONTACTS_SHOW_LIMIT = 10;
var currentContactsPage = 0;
var CONTACTS_SHOW_LIMIT;
var currentContactsPage;
var updateList = function() {
CONTACTS_SHOW_LIMIT = 10;
currentContactsPage = 0;
originalList = [];
var wallets = profileService.getWallets({
@ -15,16 +17,18 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$scope.hasWallets = lodash.isEmpty(wallets) ? false : true;
$scope.oneWallet = wallets.length == 1;
lodash.each(wallets, function(v) {
originalList.push({
color: v.color,
name: v.name,
isWallet: true,
getAddress: function(cb) {
walletService.getAddress(v, false, cb);
},
if (!$scope.oneWallet) {
lodash.each(wallets, function(v) {
originalList.push({
color: v.color,
name: v.name,
isWallet: true,
getAddress: function(cb) {
walletService.getAddress(v, false, cb);
},
});
});
});
}
addressbookService.list(function(err, ab) {
if (err) $log.error(err);
@ -50,7 +54,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
$timeout(function() {
$ionicScrollDelegate.resize();
$scope.$apply();
}, 10);
}, 100);
});
};

View File

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

View File

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

View File

@ -154,6 +154,8 @@ angular.module('copayApp.directives')
link: function(scope, element, attrs) {
scope.$on("$ionicSlides.sliderInitialized", function(event, data) {
scope.slider = data.slider;
if(scope.slider.slides.length == 1)
scope.slider.lockSwipes();
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) {
$log.debug('BWC Notification:', n);
// notification?
// TODO (put this in wallet ViewModel)
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);
if (n.type == "NewBlock" && n.data.network == "testnet") {
throttledBwsEvent(n, wallet);
}
else newBwsEvent(n, wallet);
});
wallet.on('walletCompleted', function() {
@ -183,6 +170,26 @@ angular.module('copayApp.services')
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;
root.runValidation = function(client, delay, retryDelay) {

View File

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

View File

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