add popover menu to share/scan addresses
This commit is contained in:
parent
439300743d
commit
de65f88b9e
10 changed files with 117 additions and 59 deletions
|
|
@ -1,59 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesInformation',
|
||||
function($scope, $log, $timeout, $ionicHistory, platformInfo, lodash, profileService, configService, $stateParams, walletService, $state) {
|
||||
var base = 'xpub';
|
||||
function($scope, $log, $ionicHistory, platformInfo, lodash, profileService, configService, $stateParams, $state) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = wallet.id;
|
||||
var config = configService.getSync();
|
||||
var b = 1;
|
||||
var colorCounter = 1;
|
||||
var BLACK_WALLET_COLOR = '#202020';
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
config.colorFor = config.colorFor || {};
|
||||
|
||||
$scope.sendAddrs = function() {
|
||||
function formatDate(ts) {
|
||||
var dateObj = new Date(ts * 1000);
|
||||
if (!dateObj) {
|
||||
$log.debug('Error formating a date');
|
||||
return 'DateError';
|
||||
}
|
||||
if (!dateObj.toJSON()) {
|
||||
return '';
|
||||
}
|
||||
return dateObj.toJSON();
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
walletService.getMainAddresses(wallet, {}, function(err, addrs) {
|
||||
if (err) {
|
||||
$log.warn(err);
|
||||
return;
|
||||
};
|
||||
|
||||
var body = 'Copay Wallet "' + $scope.walletName + '" Addresses\n Only Main Addresses are shown.\n\n';
|
||||
body += "\n";
|
||||
body += addrs.map(function(v) {
|
||||
return ('* ' + v.address + ' ' + base + v.path.substring(1) + ' ' + formatDate(v.createdOn));
|
||||
}).join("\n");
|
||||
|
||||
window.plugins.socialsharing.shareViaEmail(
|
||||
body,
|
||||
'Copay Addresses',
|
||||
null, // TO: must be null or an array
|
||||
null, // CC: must be null or an array
|
||||
null, // BCC: must be null or an array
|
||||
null, // FILES: can be null, a string, or an array
|
||||
function() {},
|
||||
function() {}
|
||||
);
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.saveBlack = function() {
|
||||
function save(color) {
|
||||
var opts = {
|
||||
|
|
@ -68,14 +24,8 @@ angular.module('copayApp.controllers').controller('preferencesInformation',
|
|||
});
|
||||
};
|
||||
|
||||
if (b != 5) return b++;
|
||||
save('#202020');
|
||||
};
|
||||
|
||||
$scope.scan = function() {
|
||||
walletService.startScan(wallet);
|
||||
$ionicHistory.removeBackView();
|
||||
$state.go('tabs.home');
|
||||
if (colorCounter != 5) return colorCounter++;
|
||||
save(BLACK_WALLET_COLOR);
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue