fix merge conflicts
This commit is contained in:
commit
64d81c55ba
47 changed files with 1035 additions and 406 deletions
|
|
@ -145,6 +145,12 @@ angular.module('copayApp.controllers').controller('bitpayCardController', functi
|
|||
updateHistoryFromCache(function() {
|
||||
self.update();
|
||||
});
|
||||
bitpayCardService.getBitpayDebitCards(function(err, cards) {
|
||||
if (err) return;
|
||||
$scope.card = lodash.find(cards, function(card) {
|
||||
return card.eid == $scope.cardId;
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('thanksController', function($scope, $stateParams, $timeout, $log, platformInfo, configService, storageService) {
|
||||
angular.module('copayApp.controllers').controller('completeController', function($scope, $stateParams, $timeout, $log, platformInfo, configService, storageService) {
|
||||
$scope.score = parseInt($stateParams.score);
|
||||
$scope.skipped = $stateParams.skipped == 'false' ? false : true;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
|
|
@ -31,7 +31,12 @@ angular.module('copayApp.controllers').controller('thanksController', function($
|
|||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
storageService.setRateCardFlag('true', function() {});
|
||||
storageService.getFeedbackInfo(function(error, info) {
|
||||
var feedbackInfo = JSON.parse(info);
|
||||
feedbackInfo.sent = true;
|
||||
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {});
|
||||
});
|
||||
|
||||
if (!$scope.isCordova) return;
|
||||
|
||||
window.plugins.socialsharing.available(function(isAvailable) {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('rateAppStoreController', function($scope, $state, $stateParams, externalLinkService, configService, gettextCatalog, platformInfo) {
|
||||
angular.module('copayApp.controllers').controller('rateAppController', function($scope, $state, $stateParams, lodash, externalLinkService, configService, gettextCatalog, platformInfo, feedbackService, ongoingProcess) {
|
||||
$scope.score = parseInt($stateParams.score);
|
||||
var isAndroid = platformInfo.isAndroid;
|
||||
var isIOS = platformInfo.isIOS;
|
||||
|
|
@ -8,14 +8,29 @@ angular.module('copayApp.controllers').controller('rateAppStoreController', func
|
|||
var config = configService.getSync();
|
||||
|
||||
$scope.skip = function() {
|
||||
$state.go('feedback.thanks', {
|
||||
score: $scope.score,
|
||||
skipped: true
|
||||
|
||||
var dataSrc = {
|
||||
"Email": lodash.values(config.emailFor)[0] || ' ',
|
||||
"Feedback": ' ',
|
||||
"Score": $stateParams.score
|
||||
};
|
||||
|
||||
ongoingProcess.set('sendingFeedback', true);
|
||||
feedbackService.send(dataSrc, function(err) {
|
||||
ongoingProcess.set('sendingFeedback', false);
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send feedback'));
|
||||
return;
|
||||
}
|
||||
$state.go('feedback.complete', {
|
||||
score: $stateParams.score,
|
||||
skipped: true
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.sendFeedback = function() {
|
||||
$state.go('feedback.sendFeedback', {
|
||||
$state.go('feedback.send', {
|
||||
score: $scope.score
|
||||
});
|
||||
};
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
angular.module('copayApp.controllers').controller('rateCardController', function($scope, $state, $timeout, gettextCatalog, platformInfo, storageService) {
|
||||
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.score = 0;
|
||||
|
||||
$scope.goFeedbackFlow = function() {
|
||||
if ($scope.isModal) {
|
||||
|
|
@ -10,11 +11,11 @@ angular.module('copayApp.controllers').controller('rateCardController', function
|
|||
$scope.rateModal.remove();
|
||||
}
|
||||
if ($scope.isCordova && $scope.score == 5) {
|
||||
$state.go('feedback.rateAppStore', {
|
||||
$state.go('feedback.rateApp', {
|
||||
score: $scope.score
|
||||
});
|
||||
} else {
|
||||
$state.go('feedback.sendFeedback', {
|
||||
$state.go('feedback.send', {
|
||||
score: $scope.score
|
||||
});
|
||||
}
|
||||
|
|
@ -49,13 +50,17 @@ angular.module('copayApp.controllers').controller('rateCardController', function
|
|||
$scope.rateModal.hide();
|
||||
$scope.rateModal.remove();
|
||||
} else {
|
||||
storageService.setRateCardFlag('true', function() {
|
||||
$scope.hideRateCard.value = true;
|
||||
storageService.getFeedbackInfo(function(error, info) {
|
||||
var feedbackInfo = JSON.parse(info);
|
||||
feedbackInfo.sent = true;
|
||||
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {
|
||||
$scope.showRateCard.value = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
})
|
||||
}, 100);
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('sendFeedbackController', function($scope, $state, $log, $stateParams, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess) {
|
||||
angular.module('copayApp.controllers').controller('sendController', function($scope, $state, $log, $stateParams, gettextCatalog, popupService, configService, lodash, feedbackService, ongoingProcess) {
|
||||
$scope.score = parseInt($stateParams.score);
|
||||
switch ($scope.score) {
|
||||
case 1:
|
||||
|
|
@ -42,7 +42,7 @@ angular.module('copayApp.controllers').controller('sendFeedbackController', func
|
|||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Could not send feedback'));
|
||||
return;
|
||||
}
|
||||
$state.go('feedback.thanks', {
|
||||
$state.go('feedback.complete', {
|
||||
score: $stateParams.score,
|
||||
skipped: skip
|
||||
});
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('headController',
|
||||
function($scope, $window, $log, glideraService) {
|
||||
function($scope, $window, $log) {
|
||||
$scope.appConfig = $window.appConfig;
|
||||
$log.info('Running head controller:' + $window.appConfig.nameCase)
|
||||
});
|
||||
|
|
|
|||
|
|
@ -19,13 +19,7 @@ angular.module('copayApp.controllers').controller('welcomeController', function(
|
|||
$log.debug('Creating profile');
|
||||
profileService.createProfile(function(err) {
|
||||
if (err) $log.warn(err);
|
||||
setProfileCreationTime();
|
||||
});
|
||||
};
|
||||
|
||||
function setProfileCreationTime() {
|
||||
var now = moment().unix() * 1000 + 24 * 60 * 60 * 1000;
|
||||
storageService.setProfileCreationTime(now, function() {});
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
angular.module('copayApp.controllers').controller('preferencesBitpayCardController',
|
||||
function($scope, $state, $timeout, $ionicHistory, bitpayCardService, popupService, gettextCatalog) {
|
||||
|
||||
$scope.remove = function() {
|
||||
$scope.remove = function(card) {
|
||||
var msg = gettextCatalog.getString('Are you sure you would like to remove your BitPay Card account from this device?');
|
||||
popupService.showConfirm(null, msg, null, null, function(res) {
|
||||
if (res) remove();
|
||||
if (res) remove(card);
|
||||
});
|
||||
};
|
||||
|
||||
var remove = function() {
|
||||
bitpayCardService.remove(function() {
|
||||
$ionicHistory.removeBackView();
|
||||
var remove = function(card) {
|
||||
bitpayCardService.remove(card, function() {
|
||||
$ionicHistory.clearHistory();
|
||||
$timeout(function() {
|
||||
$state.go('tabs.home');
|
||||
}, 100);
|
||||
|
|
@ -22,7 +22,7 @@ angular.module('copayApp.controllers').controller('preferencesBitpayCardControll
|
|||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
bitpayCardService.getBitpayDebitCards(function(err, data) {
|
||||
if (err) return;
|
||||
$scope.bitpayCards = data.cards;
|
||||
$scope.bitpayCards = data;
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabHomeController',
|
||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService, addressbookService) {
|
||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, gettextCatalog, lodash, popupService, ongoingProcess, externalLinkService, latestReleaseService, profileService, walletService, configService, $log, platformInfo, storageService, txpModalService, $window, bitpayCardService, startupService, addressbookService, feedbackService) {
|
||||
var wallet;
|
||||
var listeners = [];
|
||||
var notifications = [];
|
||||
|
|
@ -13,7 +13,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isAndroid = platformInfo.isAndroid;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.hideRateCard = {};
|
||||
$scope.showRateCard = {};
|
||||
|
||||
$scope.$on("$ionicView.afterEnter", function() {
|
||||
startupService.ready();
|
||||
|
|
@ -37,13 +37,37 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
});
|
||||
}
|
||||
|
||||
storageService.getProfileCreationTime(function(error, time) {
|
||||
var now = moment().unix() * 1000;
|
||||
storageService.getRateCardFlag(function(error, value) {
|
||||
$scope.hideRateCard.value = (value == 'true' || (time - now) > 0) ? true : false;
|
||||
});
|
||||
storageService.getFeedbackInfo(function(error, info) {
|
||||
if (!info) {
|
||||
initFeedBackInfo();
|
||||
} else {
|
||||
var feedbackInfo = JSON.parse(info);
|
||||
//Check if current version is greater than saved version
|
||||
var currentVersion = window.version;
|
||||
var savedVersion = feedbackInfo.version;
|
||||
var isVersionUpdated = feedbackService.isVersionUpdated(currentVersion, savedVersion);
|
||||
if (!isVersionUpdated) {
|
||||
initFeedBackInfo();
|
||||
return;
|
||||
}
|
||||
var now = moment().unix();
|
||||
var timeExceeded = (now - feedbackInfo.time) >= 24 * 60 * 60;
|
||||
$scope.showRateCard.value = timeExceeded && !feedbackInfo.sent;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function initFeedBackInfo() {
|
||||
var feedbackInfo = {};
|
||||
feedbackInfo.time = moment().unix();
|
||||
feedbackInfo.version = window.version;
|
||||
feedbackInfo.sent = false;
|
||||
storageService.setFeedbackInfo(JSON.stringify(feedbackInfo), function() {
|
||||
$scope.showRateCard.value = false;
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
|
|
@ -102,12 +126,6 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
});
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.leave", function(event, data) {
|
||||
lodash.each(listeners, function(x) {
|
||||
x();
|
||||
});
|
||||
});
|
||||
|
||||
$scope.openExternalLink = function(url, optIn, title, message, okText, cancelText) {
|
||||
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||
};
|
||||
|
|
@ -178,8 +196,11 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
lodash.each($scope.wallets, function(wallet) {
|
||||
walletService.getStatus(wallet, {}, function(err, status) {
|
||||
if (err) {
|
||||
if (err === 'WALLET_NOT_REGISTERED') wallet.error = gettextCatalog.getString('Wallet not registered');
|
||||
else wallet.error = gettextCatalog.getString('Could not update');;
|
||||
$log.error(err);
|
||||
} else {
|
||||
wallet.error = null;
|
||||
wallet.status = status;
|
||||
}
|
||||
if (++j == i) {
|
||||
|
|
@ -231,7 +252,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
var services = ['AmazonGiftCards', 'BitpayCard', 'BuyAndSell'];
|
||||
lodash.each(services, function(service) {
|
||||
storageService.getNextStep(service, function(err, value) {
|
||||
$scope.externalServices[service] = value ? true : false;
|
||||
$scope.externalServices[service] = value == 'true' ? true : false;
|
||||
if (++i == services.length) return cb();
|
||||
});
|
||||
});
|
||||
|
|
@ -252,7 +273,7 @@ angular.module('copayApp.controllers').controller('tabHomeController',
|
|||
$scope.bitpayCards = null;
|
||||
return;
|
||||
}
|
||||
$scope.bitpayCards = data.cards;
|
||||
$scope.bitpayCards = data;
|
||||
});
|
||||
bitpayCardService.getBitpayDebitCardsHistory(null, function(err, data) {
|
||||
if (err) return;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('tabReceiveController', function($scope, $timeout, $log, $ionicModal, $state, $ionicHistory, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService) {
|
||||
angular.module('copayApp.controllers').controller('tabReceiveController', function($rootScope, $scope, $timeout, $log, $ionicModal, $state, $ionicHistory, storageService, platformInfo, walletService, profileService, configService, lodash, gettextCatalog, popupService, bwcError) {
|
||||
|
||||
var listeners = [];
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isNW = platformInfo.isNW;
|
||||
$scope.walletAddrs = {};
|
||||
|
||||
$scope.shareAddress = function(addr) {
|
||||
if ($scope.generatingAddress) return;
|
||||
|
|
@ -18,14 +20,21 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
$scope.generatingAddress = true;
|
||||
walletService.getAddress($scope.wallet, forceNew, function(err, addr) {
|
||||
$scope.generatingAddress = false;
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), err);
|
||||
if (err) popupService.showAlert(gettextCatalog.getString('Error'), bwcError.msg(err));
|
||||
$scope.addr = addr;
|
||||
if ($scope.walletAddrs[$scope.wallet.id]) $scope.walletAddrs[$scope.wallet.id] = addr;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 10);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.loadAddresses = function(wallet, index) {
|
||||
walletService.getAddress(wallet, false, function(err, addr) {
|
||||
$scope.walletAddrs[wallet.id] = addr;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.goCopayers = function() {
|
||||
$ionicHistory.removeBackView();
|
||||
$ionicHistory.nextViewOptions({
|
||||
|
|
@ -67,6 +76,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
});
|
||||
};
|
||||
|
||||
$scope.setWallet = function(index) {
|
||||
$scope.wallet = $scope.wallets[index];
|
||||
$scope.walletIndex = index;
|
||||
if ($scope.walletAddrs[$scope.walletIndex].addr) $scope.addr = $scope.walletAddrs[$scope.walletIndex].addr;
|
||||
else $scope.setAddress(false);
|
||||
}
|
||||
|
||||
$scope.isActive = function(index) {
|
||||
return $scope.wallets[index] == $scope.wallet;
|
||||
}
|
||||
|
||||
$scope.walletPosition = function(index) {
|
||||
if (index == $scope.walletIndex) return 'current';
|
||||
if (index < $scope.walletIndex) return 'prev';
|
||||
if (index > $scope.walletIndex) return 'next';
|
||||
}
|
||||
|
||||
|
||||
$scope.$on('Wallet/Changed', function(event, wallet) {
|
||||
if (!wallet) {
|
||||
$log.debug('No wallet provided');
|
||||
|
|
@ -77,14 +104,57 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
|||
return;
|
||||
}
|
||||
$scope.wallet = wallet;
|
||||
$scope.generatingAddress = false;
|
||||
$log.debug('Wallet changed: ' + wallet.name);
|
||||
|
||||
$scope.walletIndex = lodash.findIndex($scope.wallets, function(wallet) {
|
||||
return wallet.id == $scope.wallet.id;
|
||||
});
|
||||
|
||||
if (!$scope.walletAddrs[wallet.id]) $scope.setAddress(false);
|
||||
else $scope.addr = $scope.walletAddrs[wallet.id];
|
||||
|
||||
$timeout(function() {
|
||||
$scope.setAddress(false);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
|
||||
});
|
||||
|
||||
$scope.updateCurrentWallet = function() {
|
||||
walletService.getStatus($scope.wallet, {}, function(err, status) {
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.wallet = profileService.getWallet($scope.wallet.id);
|
||||
$scope.wallet.status = status;
|
||||
$scope.setAddress();
|
||||
$scope.$apply();
|
||||
}, 200);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
$scope.wallets = profileService.getWallets();
|
||||
|
||||
lodash.each($scope.wallets, function(wallet, index) {
|
||||
$scope.loadAddresses(wallet);
|
||||
});
|
||||
|
||||
|
||||
listeners = [
|
||||
$rootScope.$on('bwsEvent', function(e, walletId, type, n) {
|
||||
// Update current address
|
||||
if ($scope.wallet && walletId == $scope.wallet.id) $scope.updateCurrentWallet();
|
||||
})
|
||||
];
|
||||
|
||||
// Update current wallet
|
||||
if ($scope.wallet) $scope.updateCurrentWallet();
|
||||
});
|
||||
|
||||
$scope.$on("$ionicView.leave", function(event, data) {
|
||||
lodash.each(listeners, function(x) {
|
||||
x();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
|
||||
var updateStatus = function(force) {
|
||||
$scope.updatingStatus = true;
|
||||
$scope.updateStatusError = false;
|
||||
$scope.updateStatusError = null;
|
||||
$scope.walletNotRegistered = false;
|
||||
|
||||
walletService.getStatus($scope.wallet, {
|
||||
|
|
@ -60,18 +60,16 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
if (err === 'WALLET_NOT_REGISTERED') {
|
||||
$scope.walletNotRegistered = true;
|
||||
} else {
|
||||
$scope.updateStatusError = true;
|
||||
$scope.updateStatusError = err;
|
||||
}
|
||||
$scope.status = null;
|
||||
return;
|
||||
} else {
|
||||
setPendingTxps(status.pendingTxps);
|
||||
$scope.status = status;
|
||||
}
|
||||
|
||||
setPendingTxps(status.pendingTxps);
|
||||
|
||||
$scope.status = status;
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
|
@ -114,6 +112,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
|
|||
if (err) return;
|
||||
$timeout(function() {
|
||||
walletService.startScan($scope.wallet, function() {
|
||||
$scope.updateAll();
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue