fix merge conflicts

This commit is contained in:
Marty Alcala 2016-10-11 19:14:13 -04:00
commit 6bfdec29b3
44 changed files with 28907 additions and 196 deletions

View file

@ -116,7 +116,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
};
popupService.showPrompt(null, message, opts, function(res) {
if (res) $scope.description = res;
if (typeof res != 'undefined') $scope.description = res;
$timeout(function() {
$scope.$apply();
}, 100);

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, popupService, gettextCatalog) {
angular.module('copayApp.controllers').controller('backupRequestController', function($scope, $state, $stateParams, $ionicConfig, popupService, gettextCatalog) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.walletId = $stateParams.walletId;
$scope.openPopup = function() {
@ -18,7 +19,10 @@ angular.module('copayApp.controllers').controller('backupRequestController', fun
var cancelText = gettextCatalog.getString('Go back');
popupService.showConfirm(title, message, okText, cancelText, function(val) {
if (val) {
$state.go('onboarding.disclaimer', {walletId: $scope.walletId, backedUp: false});
$state.go('onboarding.disclaimer', {
walletId: $scope.walletId,
backedUp: false
});
}
});
}

View file

@ -2,6 +2,10 @@
angular.module('copayApp.controllers').controller('backupWarningController', function($scope, $state, $timeout, $stateParams, $ionicModal) {
$scope.walletId = $stateParams.walletId;
$scope.fromState = $stateParams.from == 'onboarding' ? $stateParams.from + '.backupRequest' : $stateParams.from;
$scope.toState = $stateParams.from + '.backup';
$scope.openPopup = function() {
$ionicModal.fromTemplateUrl('views/includes/screenshotWarningModal.html', {
scope: $scope,
@ -15,24 +19,15 @@ angular.module('copayApp.controllers').controller('backupWarningController', fun
$scope.close = function() {
$scope.warningModal.hide();
$scope.warningModal.remove();
$timeout(function() {
if ($stateParams.from == 'onboarding.backupRequest') {
$state.go('onboarding.backup', {
walletId: $stateParams.walletId
});
} else {
$state.go($stateParams.from + '.backup', {
walletId: $stateParams.walletId
});
}
$state.go($scope.toState, {
walletId: $scope.walletId
});
};
}
$scope.goBack = function() {
$state.go($stateParams.from, {
walletId: $stateParams.walletId
$state.go($scope.fromState, {
walletId: $scope.walletId
});
};

View file

@ -1,7 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, profileService, configService, walletService, platformInfo) {
angular.module('copayApp.controllers').controller('collectEmailController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService, walletService, platformInfo) {
$ionicConfig.views.swipeBackEnabled(false);
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
var usePushNotifications = isCordova && !isWP;

View file

@ -6,6 +6,7 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
$scope.terms = {};
$scope.accept1 = $scope.accept2 = $scope.accept3 = false;
$scope.backedUp = $stateParams.backedUp;
$scope.resume = $stateParams.resume;
$timeout(function() {
$scope.$apply();
}, 1);
@ -35,8 +36,10 @@ angular.module('copayApp.controllers').controller('disclaimerController', functi
});
};
$scope.goBack = function(){
$state.go('onboarding.backupRequest', {walletId: $stateParams.walletId});
$scope.goBack = function() {
$state.go('onboarding.backupRequest', {
walletId: $stateParams.walletId
});
}

View file

@ -1,10 +1,9 @@
'use strict';
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, profileService, configService) {
angular.module('copayApp.controllers').controller('notificationsController', function($scope, $state, $timeout, $stateParams, $ionicConfig, profileService, configService) {
$scope.$on("$ionicView.enter", function(event, data) {
$scope.walletId = data.stateParams.walletId;
});
$ionicConfig.views.swipeBackEnabled(false);
$scope.walletId = $stateParams.walletId;
$scope.allowNotif = function() {
$timeout(function() {

View file

@ -1,6 +1,6 @@
'use strict';
angular.module('copayApp.controllers').controller('tourController',
function($scope, $state, $log, $timeout, $filter, ongoingProcess, platformInfo, profileService, rateService) {
function($scope, $state, $log, $timeout, $filter, ongoingProcess, platformInfo, profileService, rateService, popupService, gettextCatalog) {
var isCordova = platformInfo.isCordova;
var isWP = platformInfo.isWP;
@ -37,6 +37,7 @@ angular.module('copayApp.controllers').controller('tourController',
});
});
var retryCount = 0;
$scope.createDefaultWallet = function() {
ongoingProcess.set('creatingWallet', true);
profileService.createDefaultWallet(function(err, walletClient) {
@ -44,9 +45,19 @@ angular.module('copayApp.controllers').controller('tourController',
$log.warn(err);
return $timeout(function() {
$log.warn('Retrying to create default wallet......');
return $scope.createDefaultWallet();
}, 3000);
$log.warn('Retrying to create default wallet.....:' + ++retryCount);
if (retryCount > 3) {
ongoingProcess.set('creatingWallet', false);
popupService.showAlert(
gettextCatalog.getString('Cannot Create Wallet'), err,
function() {
retryCount = 0;
return $scope.createDefaultWallet();
}, gettextCatalog.getString('Retry'));
} else {
return $scope.createDefaultWallet();
}
}, 2000);
};
ongoingProcess.set('creatingWallet', false);
var wallet = walletClient;
@ -55,8 +66,7 @@ angular.module('copayApp.controllers').controller('tourController',
$state.go('onboarding.backupRequest', {
walletId: walletId
});
}
else {
} else {
$state.go('onboarding.notifications', {
walletId: walletId
});

View file

@ -1,6 +1,8 @@
'use strict';
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $log, profileService) {
angular.module('copayApp.controllers').controller('welcomeController', function($scope, $state, $timeout, $ionicConfig, $log, profileService) {
$ionicConfig.views.swipeBackEnabled(false);
$scope.goImport = function(code) {
$state.go('onboarding.import', {

View file

@ -11,12 +11,13 @@ angular.module('copayApp.controllers').controller('tabHomeController',
$scope.version = $window.version;
$scope.name = $window.appConfig.nameCase;
$scope.homeTip = $stateParams.fromOnboarding;
$scope.isCordova = platformInfo.isCordova;
if(!$scope.homeTip){
storageService.getHomeTipAccepted(function(error, value){
$scope.homeTip = (value == 'false') ? false : true;
});
}
if (!$scope.homeTip) {
storageService.getHomeTipAccepted(function(error, value) {
$scope.homeTip = (value == 'false') ? false : true;
});
}
$scope.openNotificationModal = function(n) {
wallet = profileService.getWallet(n.walletId);
@ -170,8 +171,11 @@ angular.module('copayApp.controllers').controller('tabHomeController',
};
$scope.hideHomeTip = function() {
storageService.setHomeTipAccepted(false, function(error, value){
storageService.setHomeTipAccepted(false, function(error, value) {
$scope.homeTip = false;
$timeout(function() {
$scope.$apply();
})
});
};
@ -201,6 +205,11 @@ angular.module('copayApp.controllers').controller('tabHomeController',
});
};
$scope.onRefresh = function() {
$scope.$broadcast('scroll.refreshComplete');
updateAllWallets();
};
$scope.$on("$ionicView.enter", function(event, data) {
$scope.bitpayCard = null;
nextStep();

View file

@ -6,6 +6,7 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
var CONTACTS_SHOW_LIMIT;
var currentContactsPage;
var updateList = function() {
CONTACTS_SHOW_LIMIT = 10;
currentContactsPage = 0;
@ -103,11 +104,56 @@ angular.module('copayApp.controllers').controller('tabSendController', function(
});
};
var updateHasFunds = function() {
$scope.hasFunds = null;
var wallets = profileService.getWallets({
onlyComplete: true,
});
if (!wallets || !wallets.length) {
$scope.hasFunds = false;
}
var index = 0;
lodash.each(wallets, function(w) {
walletService.getStatus(w, {}, function(err, status) {
++index;
if (err || !status) {
$log.error(err);
return;
}
if (status.availableBalanceSat) {
$scope.hasFunds = true;
}
if (index == wallets.length) {
$scope.hasFunds = $scope.hasFunds || false;
}
});
});
};
$scope.$on("$ionicView.beforeEnter", function(event, data) {
$scope.formData = {
search: null
};
updateList();
updateHasFunds();
});
// This could probably be enhanced refactoring the routes abstract states
$scope.createWallet = function() {
$state.go('tabs.home').then(function() {
$state.go('tabs.add.create-personal');
});
};
$scope.buyBitcoin = function() {
$state.go('tabs.home').then(function() {
$state.go('tabs.buyandsell.glidera');
});
};
});

View file

@ -8,6 +8,7 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
$scope.txps = [];
$scope.completeTxHistory = [];
$scope.openTxpModal = txpModalService.open;
$scope.isCordova = platformInfo.isCordova;
$scope.openExternalLink = function(url, target) {
externalLinkService.open(url, target);
@ -159,6 +160,11 @@ angular.module('copayApp.controllers').controller('walletDetailsController', fun
}, 100);
};
$scope.onRefresh = function() {
$scope.$broadcast('scroll.refreshComplete');
$scope.updateAll(true);
};
$scope.updateAll = function(force, cb)  {
updateStatus(force);
updateTxHistory(cb);

View file

@ -689,7 +689,7 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
.state('onboarding.disclaimer', {
url: '/disclaimer/:walletId/:backedUp',
url: '/disclaimer/:walletId/:backedUp/:resume',
views: {
'onboarding': {
templateUrl: 'views/onboarding/disclaimer.html'
@ -840,13 +840,13 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
}
})
/*
*
* BitPay Card
*
*/
/*
*
* BitPay Card
*
*/
.state('tabs.bitpayCard', {
.state('tabs.bitpayCard', {
url: '/bitpay-card',
views: {
'tab-home@tabs': {
@ -912,30 +912,25 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$ionicPlatform.registerBackButtonAction(function(e) {
//from root tabs view
var fromWelcome = $ionicHistory.currentStateName().match(/welcome/) ? true : false;
var matchHome = $ionicHistory.currentStateName().match(/home/) ? true : false;
var matchReceive = $ionicHistory.currentStateName().match(/receive/) ? true : false;
var matchSend = $ionicHistory.currentStateName().match(/send/) ? true : false;
var matchSettings = $ionicHistory.currentStateName().match(/settings/) ? true : false;
var fromTabs = matchHome | matchReceive | matchSend | matchSettings;
var matchHome = $ionicHistory.currentStateName() == 'tabs.home' ? true : false;
var matchReceive = $ionicHistory.currentStateName() == 'tabs.receive' ? true : false;
var matchScan = $ionicHistory.currentStateName() == 'tabs.scan' ? true : false;
var matchSend = $ionicHistory.currentStateName() == 'tabs.send' ? true : false;
var matchSettings = $ionicHistory.currentStateName() == 'tabs.settings' ? true : false;
var fromTabs = matchHome | matchReceive | matchScan | matchSend | matchSettings;
//onboarding with no back views
var matchCollectEmail = $ionicHistory.currentStateName().match(/collectEmail/) ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName().match(/backupRequest/) ? true : false;
var matchDisclaimer = $ionicHistory.currentStateName().match(/disclaimer/) ? true : false;
var matchNotifications = $ionicHistory.currentStateName().match(/notifications/) ? true : false;
var matchWelcome = $ionicHistory.currentStateName() == 'onboarding.welcome' ? true : false;
var matchCollectEmail = $ionicHistory.currentStateName() == 'onboarding.collectEmail' ? true : false;
var matchBackupRequest = $ionicHistory.currentStateName() == 'onboarding.backupRequest' ? true : false;
var matchNotifications = $ionicHistory.currentStateName() == 'onboarding.notifications' ? true : false;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchDisclaimer | matchNotifications;
var fromOnboarding = matchCollectEmail | matchBackupRequest | matchNotifications | matchWelcome;
if (fromOnboarding) {
e.preventDefault();
return;
}
if ($ionicHistory.backView() && !fromTabs) {
if ($ionicHistory.backView() && !fromTabs && !fromOnboarding) {
$ionicHistory.goBack();
} else
if ($rootScope.backButtonPressedOnceToExit || fromWelcome) {
if ($rootScope.backButtonPressedOnceToExit) {
ionic.Platform.exitApp();
} else {
$rootScope.backButtonPressedOnceToExit = true;
@ -973,21 +968,21 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$log.debug('No profile... redirecting');
$state.go('onboarding.welcome');
} else if (err.message && err.message.match('NONAGREEDDISCLAIMER')) {
$log.debug('Display disclaimer... redirecting');
storageService.getLastState(function(err, state) {
if (err && !state) {
$log.error(err);
$state.go('onboarding.disclaimer');
}
else {
var state = JSON.parse(state);
$state.go(state.name, state.toParams);
}
})
if (lodash.isEmpty(profileService.getWallets())) {
$log.debug('No wallets and no disclaimer... redirecting');
$state.go('onboarding.welcome');
}
else {
$log.debug('Display disclaimer... redirecting');
$state.go('onboarding.disclaimer', {
resume: true
});
}
} else {
throw new Error(err); // TODO
}
} else {
}
else {
profileService.storeProfileIfDirty();
$log.debug('Profile loaded ... Starting UX.');
scannerService.gentleInitialize();
@ -1014,11 +1009,5 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
$log.debug('Route change from:', fromState.name || '-', ' to:', toState.name);
$log.debug(' toParams:' + JSON.stringify(toParams || {}));
$log.debug(' fromParams:' + JSON.stringify(fromParams || {}));
if (!toState.name.match(/onboarding/)) return;
var state = {};
state.name = toState.name;
state.toParams = toParams;
if (state.name != 'starting') storageService.setLastState(JSON.stringify(state), function() {});
});
});

View file

@ -6,12 +6,13 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
/*************** Ionic ****************/
var _ionicAlert = function(title, message, cb) {
var _ionicAlert = function(title, message, cb, buttonName) {
if (!cb) cb = function() {};
$ionicPopup.alert({
title: title,
subTitle: message,
okType: 'button-clear button-positive'
okType: 'button-clear button-positive',
okText: buttonName || gettextCatalog.getString('OK'),
}).then(cb);
};
@ -43,9 +44,9 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
/*************** Cordova ****************/
var _cordovaAlert = function(title, message, cb) {
var _cordovaAlert = function(title, message, cb, buttonName) {
if (!cb) cb = function() {};
navigator.notification.alert(message, cb, title);
navigator.notification.alert(message, cb, title, buttonName);
};
var _cordovaConfirm = function(title, message, okText, cancelText, cb) {
@ -74,14 +75,14 @@ angular.module('copayApp.services').service('popupService', function($log, $ioni
* @param {Callback} Function (optional)
*/
this.showAlert = function(title, msg, cb) {
this.showAlert = function(title, msg, cb, buttonName) {
var message = (msg && msg.message) ? msg.message : msg;
$log.warn(title + ": " + message);
if (isCordova)
_cordovaAlert(title, message, cb);
_cordovaAlert(title, message, cb, buttonName);
else
_ionicAlert(title, message, cb);
_ionicAlert(title, message, cb, buttonName);
};
/**

View file

@ -199,9 +199,9 @@ angular.module('copayApp.services')
storage.get('homeTip', cb);
};
root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb);
};
root.setHomeTipAccepted = function(val, cb) {
storage.set('homeTip', val, cb);
};
root.setHideBalanceFlag = function(walletId, val, cb) {
storage.set('hideBalance-' + walletId, val, cb);
@ -284,14 +284,6 @@ angular.module('copayApp.services')
storage.remove('nextStep-' + service, cb);
};
root.setLastState = function(state, toParams, cb) {
storage.set('lastState', state, toParams, cb);
};
root.getLastState = function(cb) {
storage.get('lastState', cb);
};
root.checkQuota = function() {
var block = '';
// 50MB