feed
This commit is contained in:
parent
d7080bb2c9
commit
7229adf08a
8 changed files with 335 additions and 64 deletions
32
public/views/activity.html
Normal file
32
public/views/activity.html
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
|
||||||
|
<ion-view>
|
||||||
|
<ion-nav-bar class="bar-stable">
|
||||||
|
<ion-nav-title>Recent Activity</ion-nav-title>
|
||||||
|
</ion-nav-bar>
|
||||||
|
<ion-content class="padding" ng-controller="activityController" ng-init="init()">
|
||||||
|
|
||||||
|
<div ng-if="fetchingNotifications" class="updatingHistory">
|
||||||
|
<div class="row" >
|
||||||
|
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
||||||
|
</div>
|
||||||
|
<div class="row" >
|
||||||
|
<div class="col" translate>Updating activity. Please stand by.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-if="!fetchingNotifications">
|
||||||
|
<div class="list card" ng-if="!fetchingNotifications">
|
||||||
|
<ul>
|
||||||
|
<li ng-repeat="x in notifications" class="item item-icon-left" ng-click="x.action()">
|
||||||
|
<span ng-include="'views/includes/walletActivity.html'"></span>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li class="item" ng-show="!notifications[0]">
|
||||||
|
No recent activity
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ion-content>
|
||||||
|
</ion-view>
|
||||||
38
public/views/includes/walletActivity.html
Normal file
38
public/views/includes/walletActivity.html
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
|
||||||
|
|
||||||
|
<span ng-if="x.types.indexOf('NewIncomingTx')>=0">
|
||||||
|
<i class="icon ion-arrow-down-c size-21" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
{{x.amountStr}}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span ng-if="x.types.indexOf('TxProposalRemoved')>=0">
|
||||||
|
<i class="icon ion-ios-close-empty size-21" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
Proposal Deleted
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span ng-if="x.types.indexOf('TxProposalRejected')>=0">
|
||||||
|
<i class="icon ion-ios-close-empty size-21" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
Proposal Rejected
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span ng-if="x.types.indexOf('TxProposalRemoved') == -1 && x.types.indexOf('TxProposalRejected') == -1">
|
||||||
|
<span ng-if="x.types.indexOf('NewTxProposal')>=0 ">
|
||||||
|
<i class="icon ion-arrow-up-c size-21" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
{{x.message}}
|
||||||
|
</span>
|
||||||
|
<span ng-if="x.types.indexOf('TxProposalAcceptedBy')>=0 && x.types.indexOf('NewTxProposal') == -1 ">
|
||||||
|
<i class="icon ion-checkmark-round size-21" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
Proposal Accepted
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="item-note">
|
||||||
|
<!-- {{x.types}} -->
|
||||||
|
·
|
||||||
|
<i class="ion-briefcase" ng-style="{'color':x.wallet.color}"></i>
|
||||||
|
{{ x.creatorName}}@{{x.wallet.name}}
|
||||||
|
· <time>{{ x.createdOn * 1000 | amTimeAgo}}</time>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
@ -6,30 +6,36 @@
|
||||||
<ion-content class="padding" ng-controller="tabHomeController">
|
<ion-content class="padding" ng-controller="tabHomeController">
|
||||||
|
|
||||||
|
|
||||||
<div ng-if="events[0]">
|
<h2 translate>Activity</h2>
|
||||||
<h3 class="title m0" translate>Activity</h3>
|
<div ng-if="fetchingNotifications" class="updatingHistory">
|
||||||
<div class="list card">
|
<div class="row" >
|
||||||
|
<ion-spinner class="spinner-dark" icon="lines"></ion-spinner>
|
||||||
|
</div>
|
||||||
|
<div class="row" >
|
||||||
|
<div class="col" translate>Updating activity. Please stand by.</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-if="!fetchingNotifications">
|
||||||
|
<div class="list card" ng-if="!fetchingNotifications">
|
||||||
<ul>
|
<ul>
|
||||||
<li ng-repeat="tx in txps" class="item item-icon-left" ng-click="xxx(tx)">
|
<li ng-repeat="x in notifications" class="item item-icon-left" ng-click="x.action()">
|
||||||
<span >
|
<span ng-include="'views/includes/walletActivity.html'"></span>
|
||||||
bla bla
|
|
||||||
</span>
|
|
||||||
<div class="item-note">
|
|
||||||
blo blo · <time>{{ (tx.ts || tx.createdOn ) * 1000 | amTimeAgo}}</time>
|
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="item " ng-click="xxx(tx)" ng-show="1">
|
<li class="item " ui-sref="activity" ng-show="notificationsMore">
|
||||||
<button class="button button-block button-passive">
|
<button class="button button-block button-passive">
|
||||||
More (5)
|
More ({{notificationsMore}})
|
||||||
</button>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="item" ng-show="!notifications[0]">
|
||||||
|
No recent activity
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-80">
|
<div class="col col-80">
|
||||||
<h2>Wallets </h2>
|
<h2>Wallets </h2>
|
||||||
|
|
|
||||||
47
src/js/controllers/activity.js
Normal file
47
src/js/controllers/activity.js
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
angular.module('copayApp.controllers').controller('activityController',
|
||||||
|
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
var setNotifications = function(notifications) {
|
||||||
|
var n = walletService.processNotifications(notifications);
|
||||||
|
|
||||||
|
$scope.notifications = n;
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
}, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$scope.init = function() {
|
||||||
|
$scope.wallets = profileService.getWallets();
|
||||||
|
|
||||||
|
var i = $scope.wallets.length,
|
||||||
|
j = 0;
|
||||||
|
// var timeSpan = 60 * 60 * 24 * 7; TODO
|
||||||
|
var timeSpan = 60 * 60 * 6;
|
||||||
|
var notifications = [];
|
||||||
|
|
||||||
|
$scope.fetchingNotifications = true;
|
||||||
|
|
||||||
|
lodash.each($scope.wallets, function(wallet) {
|
||||||
|
|
||||||
|
walletService.getNotifications(wallet, {
|
||||||
|
timeSpan: timeSpan
|
||||||
|
}, function(err, n) {
|
||||||
|
if (err) {
|
||||||
|
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notifications.push(n);
|
||||||
|
if (++j == i) {
|
||||||
|
$scope.fetchingNotifications = false;
|
||||||
|
setNotifications(lodash.compact(lodash.flatten(notifications)));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
@ -4,27 +4,58 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
function($rootScope, $timeout, $scope, $state, lodash, profileService, walletService, configService, txFormatService, $ionicModal, $log, platformInfo) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.setWallets = function() {
|
var setNotifications = function(notifications) {
|
||||||
$scope.wallets = profileService.getWallets();
|
|
||||||
|
var n = walletService.processNotifications(notifications, 5);
|
||||||
|
|
||||||
|
$scope.notifications = n;
|
||||||
|
$scope.notificationsMore = notifications.length > 5 ? notifications.length - 5 : null;
|
||||||
|
$timeout(function() {
|
||||||
|
$scope.$apply();
|
||||||
|
}, 1);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.updateAllWallets = function() {
|
self.updateAllWallets = function() {
|
||||||
$scope.wallets = profileService.getWallets();
|
$scope.wallets = profileService.getWallets();
|
||||||
|
|
||||||
var i = $scope.wallets.length;
|
var i = $scope.wallets.length, j =0;
|
||||||
|
// var timeSpan = 60 * 60 * 24 * 7;
|
||||||
|
var timeSpan = 60 * 60 * 24 * 1;
|
||||||
|
var notifications = [];
|
||||||
|
|
||||||
|
$scope.fetchingNotifications = true;
|
||||||
|
|
||||||
lodash.each($scope.wallets, function(wallet) {
|
lodash.each($scope.wallets, function(wallet) {
|
||||||
|
|
||||||
walletService.getStatus(wallet, {}, function(err, status) {
|
walletService.getStatus(wallet, {}, function(err, status) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wallet.status = status;
|
wallet.status = status;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
walletService.getNotifications(wallet, {
|
||||||
|
timeSpan: timeSpan
|
||||||
|
}, function(err, n) {
|
||||||
|
if (err) {
|
||||||
|
console.log('[tab-home.js.35:err:]', $log.error(err)); //TODO
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notifications.push(n);
|
||||||
|
if (++j == i) {
|
||||||
|
$scope.fetchingNotifications = false;
|
||||||
|
setNotifications(lodash.compact(lodash.flatten(notifications)));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.updateWallet = function(wallet) {
|
self.updateWallet = function(wallet) {
|
||||||
|
|
||||||
$log.debug('Updating wallet:' + wallet.name)
|
$log.debug('Updating wallet:' + wallet.name)
|
||||||
walletService.getStatus(wallet, {}, function(err, status) {
|
walletService.getStatus(wallet, {}, function(err, status) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
@ -32,7 +63,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wallet.status = status;
|
wallet.status = status;
|
||||||
$timeout(function(){
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
});
|
});
|
||||||
|
|
@ -55,7 +86,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
||||||
];
|
];
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
$scope.$on('$destroy', function() {
|
||||||
lodash.each(listeners, function(x){
|
lodash.each(listeners, function(x) {
|
||||||
x();
|
x();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'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, storageService) {
|
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, $ionicPopup) {
|
||||||
|
|
||||||
var isCordova = platformInfo.isCordova;
|
var isCordova = platformInfo.isCordova;
|
||||||
var isWP = platformInfo.isWP;
|
var isWP = platformInfo.isWP;
|
||||||
|
|
@ -39,10 +39,10 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
setPendingTxps(status.pendingTxps);
|
setPendingTxps(status.pendingTxps);
|
||||||
|
|
||||||
$scope.status = status;
|
$scope.status = status;
|
||||||
$timeout(function(){
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -80,7 +80,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
];
|
];
|
||||||
|
|
||||||
$scope.$on('$destroy', function() {
|
$scope.$on('$destroy', function() {
|
||||||
lodash.each(listeners, function(x){
|
lodash.each(listeners, function(x) {
|
||||||
x();
|
x();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -117,7 +117,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
walletService.recreate();
|
walletService.recreate();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.updateTxHistory = function() {
|
$scope.updateTxHistory = function(cb) {
|
||||||
|
|
||||||
if ($scope.updatingTxHistory) return;
|
if ($scope.updatingTxHistory) return;
|
||||||
|
|
||||||
|
|
@ -129,10 +129,10 @@ 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(){
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
|
|
@ -148,9 +148,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$scope.completeTxHistory = txHistory;
|
$scope.completeTxHistory = txHistory;
|
||||||
|
|
||||||
$scope.showHistory();
|
$scope.showHistory();
|
||||||
$timeout(function(){
|
|
||||||
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
return cb();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
@ -168,9 +170,9 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
$scope.$broadcast('scroll.infiniteScrollComplete');
|
$scope.$broadcast('scroll.infiniteScrollComplete');
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.updateAll = function() {
|
$scope.updateAll = function(cb) {
|
||||||
$scope.updateStatus(false);
|
$scope.updateStatus(false);
|
||||||
$scope.updateTxHistory();
|
$scope.updateTxHistory(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideBalance = function() {
|
var hideBalance = function() {
|
||||||
|
|
@ -200,7 +202,30 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
||||||
hideBalance();
|
hideBalance();
|
||||||
$ionicNavBarDelegate.title(wallet.name);
|
$ionicNavBarDelegate.title(wallet.name);
|
||||||
|
|
||||||
$scope.updateAll();
|
$scope.updateAll(function() {
|
||||||
};
|
if ($stateParams.txid) {
|
||||||
|
var txp = lodash.find($scope.completeTxHistory, {
|
||||||
|
txid: $stateParams.txid
|
||||||
|
});
|
||||||
|
if (txp) {
|
||||||
|
$scope.openTxModal(tx);
|
||||||
|
} else {
|
||||||
|
$ionicPopup.alert({
|
||||||
|
title: gettext('TX not available'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} else if ($stateParams.txpId) {
|
||||||
|
var txp = lodash.find($scope.txps, {
|
||||||
|
id: $stateParams.txpId
|
||||||
|
});
|
||||||
|
if (txp) {
|
||||||
|
$scope.openTxpModal(txp);
|
||||||
|
} else {
|
||||||
|
$ionicPopup.alert({
|
||||||
|
title: gettext('Proposal not longer available'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,10 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
},
|
},
|
||||||
needProfile: true
|
needProfile: true
|
||||||
})
|
})
|
||||||
|
.state('activity', {
|
||||||
|
url: '/activity',
|
||||||
|
templateUrl: 'views/activity.html'
|
||||||
|
})
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
|
|
@ -140,7 +143,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
'wallet': {
|
'wallet': {
|
||||||
templateUrl: 'views/walletDetails.html'
|
templateUrl: 'views/walletDetails.html'
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
params: {
|
||||||
|
txid: null,
|
||||||
|
txpId: null,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
.state('wallet.preferences', {
|
.state('wallet.preferences', {
|
||||||
url: '/preferences',
|
url: '/preferences',
|
||||||
|
|
@ -274,6 +281,8 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Tabs
|
* Tabs
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal, $state) {
|
angular.module('copayApp.services').factory('walletService', function($log, $timeout, lodash, trezor, ledger, storageService, configService, rateService, uxLanguage, $filter, gettextCatalog, bwcError, $ionicPopup, fingerprintService, ongoingProcess, gettext, $rootScope, txStatus, txFormatService, $ionicModal, $state, bwcService) {
|
||||||
// `wallet` is a decorated version of client.
|
// `wallet` is a decorated version of client.
|
||||||
|
|
||||||
var root = {};
|
var root = {};
|
||||||
|
|
@ -765,10 +765,10 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
includeCopayerBranches: true,
|
includeCopayerBranches: true,
|
||||||
}, function(err) {
|
}, function(err) {
|
||||||
|
|
||||||
if (err && wallet.walletId == walletId) {
|
if (err && wallet.walletId == walletId) {
|
||||||
wallet.updating = false;
|
wallet.updating = false;
|
||||||
handleError(err);
|
handleError(err);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -998,33 +998,61 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
root.getEncodedWalletInfo = function(wallet,cb){
|
|
||||||
|
root.getNotifications = function(wallet, opts, cb) {
|
||||||
|
|
||||||
|
wallet.getNotifications(opts, function(err, notifications) {
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
notifications = lodash.filter(notifications, function(x) {
|
||||||
|
return x.type != 'NewBlock' && x.type != 'BalanceUpdated';
|
||||||
|
});
|
||||||
|
|
||||||
|
var idToName = {};
|
||||||
|
if (wallet.cachedStatus) {
|
||||||
|
lodash.each(wallet.cachedStatus.wallet.copayers, function(c) {
|
||||||
|
idToName[c.id] = c.name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
lodash.each(notifications, function(x) {
|
||||||
|
x.wallet = wallet;
|
||||||
|
if (x.creatorId && wallet.cachedStatus) {
|
||||||
|
x.creatorName = idToName[x.creatorId];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
return cb(null, notifications);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
root.getEncodedWalletInfo = function(wallet, cb) {
|
||||||
|
|
||||||
var getCode = function() {
|
var getCode = function() {
|
||||||
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
|
var derivationPath = wallet.credentials.getBaseAddressDerivationPath();
|
||||||
var encodingType = {
|
var encodingType = {
|
||||||
mnemonic: 1,
|
mnemonic: 1,
|
||||||
xpriv: 2,
|
xpriv: 2,
|
||||||
xpub: 3
|
xpub: 3
|
||||||
};
|
};
|
||||||
var info;
|
var info;
|
||||||
|
|
||||||
// not supported yet
|
// not supported yet
|
||||||
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
|
if (wallet.credentials.derivationStrategy != 'BIP44' || !wallet.canSign())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (wallet.credentials.mnemonic) {
|
if (wallet.credentials.mnemonic) {
|
||||||
info = {
|
info = {
|
||||||
type: encodingType.mnemonic,
|
type: encodingType.mnemonic,
|
||||||
data: wallet.credentials.mnemonic,
|
data: wallet.credentials.mnemonic,
|
||||||
}
|
|
||||||
} else {
|
|
||||||
info = {
|
|
||||||
type: encodingType.xpriv,
|
|
||||||
data: wallet.credentials.xPrivKey
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase);
|
} else {
|
||||||
|
info = {
|
||||||
|
type: encodingType.xpriv,
|
||||||
|
data: wallet.credentials.xPrivKey
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return info.type + '|' + info.data + '|' + wallet.credentials.network.toLowerCase() + '|' + derivationPath + '|' + (wallet.credentials.mnemonicHasPassphrase);
|
||||||
};
|
};
|
||||||
|
|
||||||
fingerprintService.check(wallet, function(err) {
|
fingerprintService.check(wallet, function(err) {
|
||||||
|
|
@ -1034,11 +1062,66 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
var code = getCode();
|
var code = getCode();
|
||||||
console.log('[walletService.js.948:code:]',code); //TODO
|
console.log('[walletService.js.948:code:]', code); //TODO
|
||||||
return cb(null, code);
|
return cb(null, code);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
root.processNotifications = function(notifications, limit) {
|
||||||
|
if (!notifications) return [];
|
||||||
|
|
||||||
|
var shown = lodash.sortBy(notifications, 'createdOn').reverse();
|
||||||
|
|
||||||
|
if (limit)
|
||||||
|
shown = shown.splice(0, limit);
|
||||||
|
|
||||||
|
lodash.each(shown, function(x) {
|
||||||
|
x.txpId = x.data ? x.data.txProposalId : null;
|
||||||
|
x.txid = x.data ? x.data.txid : null;
|
||||||
|
x.types = [x.type];
|
||||||
|
|
||||||
|
if (x.data && x.data.amount)
|
||||||
|
x.amountStr = txFormatService.formatAmountStr(x.data.amount);
|
||||||
|
|
||||||
|
x.action = function() {
|
||||||
|
// TODO?
|
||||||
|
$state.go('wallet.details', {
|
||||||
|
walletId: x.walletId,
|
||||||
|
txpId: x.txpId,
|
||||||
|
txid: x.txid,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
// condense
|
||||||
|
var finale = [],
|
||||||
|
prev;
|
||||||
|
|
||||||
|
|
||||||
|
lodash.each(shown, function(x) {
|
||||||
|
if (prev && prev.walletId === x.walletId && prev.txpId && prev.txpId === x.txpId) {
|
||||||
|
prev.types.push(x.type);
|
||||||
|
prev.data = lodash.assign(prev.data, x.data);
|
||||||
|
prev.txid = prev.txid || x.txid;
|
||||||
|
} else {
|
||||||
|
finale.push(x);
|
||||||
|
prev = x;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// messsages...
|
||||||
|
|
||||||
|
var u = bwcService.getUtils();
|
||||||
|
lodash.each(finale, function(x) {
|
||||||
|
if (x.data && x.data.message && x.wallet && x.wallet.credentials.sharedEncryptingKey) {
|
||||||
|
// TODO TODO TODO => BWC
|
||||||
|
x.message = u.decryptMessage(x.data.message, x.wallet.credentials.sharedEncryptingKey);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return finale;
|
||||||
|
};
|
||||||
|
|
||||||
return root;
|
return root;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue