fix merge conflicts
This commit is contained in:
commit
d5476b6ccf
31 changed files with 275 additions and 171 deletions
|
|
@ -239,10 +239,10 @@ angular.module('copayApp.controllers').controller('amountController', function($
|
|||
});
|
||||
|
||||
} else {
|
||||
var amount = $scope.showAlternativeAmount ? fromFiat(_amount).toFixed(unitDecimals) : _amount.toFixed(unitDecimals);
|
||||
var amount = $scope.showAlternativeAmount ? fromFiat(_amount) : _amount;
|
||||
$state.transitionTo('tabs.send.confirm', {
|
||||
isWallet: $scope.isWallet,
|
||||
toAmount: amount * unitToSatoshi,
|
||||
toAmount: (amount * unitToSatoshi).toFixed(0),
|
||||
toAddress: $scope.toAddress,
|
||||
toName: $scope.toName,
|
||||
toEmail: $scope.toEmail
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
var cachedTxp = {};
|
||||
var isChromeApp = platformInfo.isChromeApp;
|
||||
var countDown = null;
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$ionicConfig.views.swipeBackEnabled(false);
|
||||
|
||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||
|
|
@ -30,9 +31,6 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
|||
$log.error('Bad params at amount');
|
||||
throw ('bad params');
|
||||
}
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.hasClick = platformInfo.hasClick;
|
||||
$scope.data = {};
|
||||
|
||||
var config = configService.getSync().wallet;
|
||||
$scope.feeLevel = config.settings && config.settings.feeLevel ? config.settings.feeLevel : 'normal';
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesEmailController', function($scope, $ionicHistory, $stateParams, gettextCatalog, profileService, walletService, configService) {
|
||||
|
||||
$scope.wallet = profileService.getWallet($stateParams.walletId);
|
||||
var walletId = $scope.wallet.credentials.walletId;
|
||||
|
||||
var config = configService.getSync();
|
||||
config.emailFor = config.emailFor || {};
|
||||
$scope.emailForExist = config.emailFor && config.emailFor[walletId];
|
||||
$scope.email = {
|
||||
value: config.emailFor && config.emailFor[walletId]
|
||||
};
|
||||
|
||||
|
||||
$scope.save = function(val) {
|
||||
var opts = {
|
||||
emailFor: {}
|
||||
};
|
||||
opts.emailFor[walletId] = val;
|
||||
|
||||
walletService.updateRemotePreferences($scope.wallet, {
|
||||
email: val,
|
||||
}, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
$ionicHistory.goBack();
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
@ -1,49 +1,97 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('preferencesNotificationsController',
|
||||
function($scope, $rootScope, $log, $window, lodash, configService, uxLanguage, platformInfo, pushNotificationsService, profileService, feeService) {
|
||||
angular.module('copayApp.controllers').controller('preferencesNotificationsController', function($scope, $log, $timeout, $window, lodash, configService, platformInfo, pushNotificationsService, profileService, emailService) {
|
||||
var updateConfig = function() {
|
||||
var config = configService.getSync();
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.PNEnabledByUser = true;
|
||||
$scope.usePushNotifications = platformInfo.isCordova && !platformInfo.isWP;
|
||||
$scope.isIOSApp = platformInfo.isIOS && platformInfo.isCordova;
|
||||
|
||||
var updateConfig = function() {
|
||||
|
||||
var config = configService.getSync();
|
||||
var isCordova = platformInfo.isCordova;
|
||||
var isIOS = platformInfo.isIOS;
|
||||
|
||||
$scope.appName = $window.appConfig.nameCase;
|
||||
$scope.PNEnabledByUser = true;
|
||||
$scope.isIOSApp = isIOS && isCordova;
|
||||
if ($scope.isIOSApp) {
|
||||
try {
|
||||
PushNotification.hasPermission(function(data) {
|
||||
$scope.PNEnabledByUser = data.isEnabled;
|
||||
});
|
||||
} catch(e) {
|
||||
$log.error(e);
|
||||
};
|
||||
}
|
||||
|
||||
$scope.pushNotifications = {
|
||||
value: config.pushNotifications.enabled
|
||||
};
|
||||
$scope.pushNotifications = {
|
||||
value: config.pushNotifications.enabled
|
||||
};
|
||||
|
||||
$scope.pushNotificationsChange = function() {
|
||||
if (!$scope.pushNotifications) return;
|
||||
var opts = {
|
||||
pushNotifications: {
|
||||
enabled: $scope.pushNotifications.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
if (opts.pushNotifications.enabled)
|
||||
profileService.pushNotificationsInit();
|
||||
else
|
||||
pushNotificationsService.disableNotifications(profileService.getWallets());
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
$scope.latestEmail = {
|
||||
value: getLatestEmailConfig()
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
updateConfig();
|
||||
$scope.newEmail = lodash.clone($scope.latestEmail);
|
||||
var isEmailEnabled = config.emailNotifications ? config.emailNotifications.enabled : false;
|
||||
|
||||
$scope.emailNotifications = {
|
||||
value: isEmailEnabled && $scope.newEmail.value ? true : false
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.pushNotificationsChange = function() {
|
||||
if (!$scope.pushNotifications) return;
|
||||
var opts = {
|
||||
pushNotifications: {
|
||||
enabled: $scope.pushNotifications.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
if (opts.pushNotifications.enabled)
|
||||
profileService.pushNotificationsInit();
|
||||
else
|
||||
pushNotificationsService.disableNotifications(profileService.getWallets());
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.emailNotificationsChange = function() {
|
||||
var opts = {
|
||||
emailNotifications: {
|
||||
enabled: $scope.emailNotifications.value
|
||||
}
|
||||
};
|
||||
configService.set(opts, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
|
||||
$scope.latestEmail = {
|
||||
value: getLatestEmailConfig()
|
||||
};
|
||||
|
||||
$scope.newEmail = lodash.clone($scope.latestEmail);
|
||||
|
||||
if (!$scope.emailNotifications.value) {
|
||||
emailService.enableEmailNotifications({
|
||||
enabled: $scope.emailNotifications.value,
|
||||
email: null
|
||||
});
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
$scope.save = function() {
|
||||
emailService.enableEmailNotifications({
|
||||
enabled: $scope.emailNotifications.value,
|
||||
email: $scope.newEmail.value
|
||||
});
|
||||
|
||||
$scope.latestEmail = {
|
||||
value: $scope.newEmail.value
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
function getLatestEmailConfig() {
|
||||
var config = configService.getSync();
|
||||
return config.emailFor ? lodash.values(config.emailFor)[0] : null;
|
||||
};
|
||||
|
||||
$scope.$on("$ionicView.enter", function(event, data) {
|
||||
updateConfig();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -276,7 +276,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
templateUrl: 'views/confirm.html'
|
||||
}
|
||||
},
|
||||
params: { paypro: null }
|
||||
params: {
|
||||
paypro: null
|
||||
}
|
||||
})
|
||||
.state('tabs.send.addressbook', {
|
||||
url: '/addressbook/add/:fromSendTab/:addressbookEntry',
|
||||
|
|
@ -465,15 +467,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
}
|
||||
})
|
||||
.state('tabs.preferences.preferencesEmail', {
|
||||
url: '/preferencesEmail',
|
||||
views: {
|
||||
'tab-settings@tabs': {
|
||||
controller: 'preferencesEmailController',
|
||||
templateUrl: 'views/preferencesEmail.html'
|
||||
}
|
||||
}
|
||||
})
|
||||
.state('tabs.preferences.backupWarning', {
|
||||
url: '/backupWarning/:from',
|
||||
views: {
|
||||
|
|
@ -892,7 +885,9 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
templateUrl: 'views/confirm.html'
|
||||
}
|
||||
},
|
||||
params: { paypro: null }
|
||||
params: {
|
||||
paypro: null
|
||||
}
|
||||
})
|
||||
.state('tabs.bitpayCard.preferences', {
|
||||
url: '/preferences',
|
||||
|
|
@ -907,7 +902,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
.run(function($rootScope, $state, $location, $log, $timeout, $ionicHistory, $ionicPlatform, $window, lodash, platformInfo, profileService, uxLanguage, gettextCatalog, openURLService, storageService, scannerService) {
|
||||
|
||||
uxLanguage.init();
|
||||
openURLService.init();
|
||||
|
||||
$ionicPlatform.ready(function() {
|
||||
if (platformInfo.isCordova) {
|
||||
|
|
@ -1000,6 +994,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
scannerService.gentleInitialize();
|
||||
$state.go('tabs.home');
|
||||
}
|
||||
|
||||
// After everything have been loaded, initialize handler URL
|
||||
$timeout(function() {
|
||||
openURLService.init();
|
||||
}, 1000);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
|||
windows: {},
|
||||
}
|
||||
},
|
||||
|
||||
emailNotifications: {
|
||||
enabled: false,
|
||||
},
|
||||
};
|
||||
|
||||
var configCache = null;
|
||||
|
|
|
|||
40
src/js/services/emailService.js
Normal file
40
src/js/services/emailService.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.services').factory('emailService', function($log, configService, profileService, lodash, walletService) {
|
||||
var root = {};
|
||||
|
||||
root.enableEmailNotifications = function(opts) {
|
||||
opts = opts || {};
|
||||
|
||||
var wallets = profileService.getWallets();
|
||||
var keys = lodash.map(wallets, function(w) {
|
||||
return w.credentials.walletId;
|
||||
});
|
||||
|
||||
lodash.each(wallets, function(w) {
|
||||
walletService.updateRemotePreferences(w, {
|
||||
email: opts.enabled ? opts.email : null
|
||||
}, function(err) {
|
||||
if (err) $log.warn(err);
|
||||
});
|
||||
});
|
||||
|
||||
var config = configService.getSync();
|
||||
if (!config.emailFor)
|
||||
config.emailFor = {};
|
||||
|
||||
lodash.each(keys, function(k) {
|
||||
config.emailFor[k] = opts.email;
|
||||
});
|
||||
|
||||
if (!opts.enabled) return;
|
||||
|
||||
configService.set({
|
||||
emailFor: config.emailFor
|
||||
}, function(err) {
|
||||
if (err) $log.debug(err);
|
||||
});
|
||||
};
|
||||
|
||||
return root;
|
||||
});
|
||||
|
|
@ -40,7 +40,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
// data extensions for Payment Protocol with non-backwards-compatible request
|
||||
if ((/^bitcoin:\?r=[\w+]/).exec(data)) {
|
||||
data = decodeURIComponent(data.replace('bitcoin:?r=', ''));
|
||||
$state.go('tabs.send').then(function() {
|
||||
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() {
|
||||
$state.transitionTo('tabs.send.confirm', {paypro: data});
|
||||
});
|
||||
return true;
|
||||
|
|
@ -62,7 +62,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
handlePayPro(details);
|
||||
});
|
||||
} else {
|
||||
$state.go('tabs.send');
|
||||
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true});
|
||||
// Timeout is required to enable the "Back" button
|
||||
$timeout(function() {
|
||||
if (amount) {
|
||||
|
|
@ -70,7 +70,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
} else {
|
||||
$state.transitionTo('tabs.send.amount', {toAddress: addr});
|
||||
}
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
return true;
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
var secret = getParameterByName('secret', data);
|
||||
var email = getParameterByName('email', data);
|
||||
var otp = getParameterByName('otp', data);
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
|
||||
$state.transitionTo('tabs.bitpayCardIntro', {
|
||||
secret: secret,
|
||||
email: email,
|
||||
|
|
@ -113,14 +113,14 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
|
||||
// Join
|
||||
} else if (data && data.match(/^copay:[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
|
||||
$state.transitionTo('tabs.add.join', {url: data});
|
||||
});
|
||||
return true;
|
||||
|
||||
// Old join
|
||||
} else if (data && data.match(/^[0-9A-HJ-NP-Za-km-z]{70,80}$/)) {
|
||||
$state.go('tabs.home').then(function() {
|
||||
$state.go('tabs.home', {}, {'reload': true, 'notify': $state.current.name == 'tabs.home' ? false : true}).then(function() {
|
||||
$state.transitionTo('tabs.add.join', {url: data});
|
||||
});
|
||||
return true;
|
||||
|
|
@ -136,7 +136,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
};
|
||||
|
||||
function goToAmountPage(toAddress) {
|
||||
$state.go('tabs.send');
|
||||
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true});
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.amount', {toAddress: toAddress});
|
||||
}, 100);
|
||||
|
|
@ -150,7 +150,7 @@ angular.module('copayApp.services').factory('incomingData', function($log, $stat
|
|||
paypro: payProDetails
|
||||
};
|
||||
scannerService.pausePreview();
|
||||
$state.go('tabs.send').then(function() {
|
||||
$state.go('tabs.send', {}, {'reload': true, 'notify': $state.current.name == 'tabs.send' ? false : true}).then(function() {
|
||||
$timeout(function() {
|
||||
$state.transitionTo('tabs.send.confirm', stateParams);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,9 +8,10 @@ angular.module('copayApp.services').factory('openURLService', function($rootScop
|
|||
// Stop it from caching the first view as one to return when the app opens
|
||||
$ionicHistory.nextViewOptions({
|
||||
historyRoot: true,
|
||||
disableBack: true,
|
||||
disableBack: false,
|
||||
disableAnimation: true
|
||||
});
|
||||
|
||||
var url = args.url;
|
||||
if (!url) {
|
||||
$log.error('No url provided');
|
||||
|
|
|
|||
|
|
@ -220,8 +220,9 @@ angular.module('copayApp.services').factory('walletService', function($log, $tim
|
|||
cache.totalBalanceStr = txFormatService.formatAmount(cache.totalBalanceSat) + ' ' + cache.unitName;
|
||||
cache.lockedBalanceStr = txFormatService.formatAmount(cache.lockedBalanceSat) + ' ' + cache.unitName;
|
||||
cache.availableBalanceStr = txFormatService.formatAmount(cache.availableBalanceSat) + ' ' + cache.unitName;
|
||||
cache.pendingBalanceStr = txFormatService.formatAmount(cache.totalBalanceSat + (cache.pendingAmount === null? 0 : cache.pendingAmount)) + ' ' + cache.unitName;
|
||||
|
||||
if (cache.pendingAmount) {
|
||||
if (cache.pendingAmount !== null && cache.pendingAmount !== 0) {
|
||||
cache.pendingAmountStr = txFormatService.formatAmount(cache.pendingAmount) + ' ' + cache.unitName;
|
||||
} else {
|
||||
cache.pendingAmountStr = null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue