mirror of https://github.com/BTCPrivate/copay.git
Feat: new setting to notify when a transaction is confirmed
This commit is contained in:
parent
f9125e1193
commit
c9cdd91741
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, bwcError) {
|
angular.module('copayApp.controllers').controller('confirmController', function($rootScope, $scope, $interval, $filter, $timeout, $ionicScrollDelegate, gettextCatalog, walletService, platformInfo, lodash, configService, rateService, $stateParams, $window, $state, $log, profileService, bitcore, txFormatService, ongoingProcess, $ionicModal, popupService, $ionicHistory, $ionicConfig, payproService, feeService, bwcError, txConfirmNotification) {
|
||||||
|
|
||||||
var countDown = null;
|
var countDown = null;
|
||||||
var CONFIRM_LIMIT_USD = 20;
|
var CONFIRM_LIMIT_USD = 20;
|
||||||
|
@ -509,6 +509,11 @@ angular.module('copayApp.controllers').controller('confirmController', function(
|
||||||
|
|
||||||
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
walletService.publishAndSign(wallet, txp, function(err, txp) {
|
||||||
if (err) return setSendError(err);
|
if (err) return setSendError(err);
|
||||||
|
if (config.notifyIfTxConfirmed && config.notifyIfTxConfirmed.enabled) {
|
||||||
|
txConfirmNotification.subscribe(wallet, {
|
||||||
|
txid: txp.id
|
||||||
|
});
|
||||||
|
}
|
||||||
}, onSendStatusChange);
|
}, onSendStatusChange);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,11 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
|
||||||
value: config.pushNotificationsEnabled
|
value: config.pushNotificationsEnabled
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var isNotifyTxEnabled = config.notifyIfTxConfirmed ? config.notifyIfTxConfirmed.enabled : false;
|
||||||
|
$scope.notifyIfTxConfirmed = {
|
||||||
|
value: isNotifyTxEnabled
|
||||||
|
};
|
||||||
|
|
||||||
$scope.latestEmail = {
|
$scope.latestEmail = {
|
||||||
value: emailService.getEmailIfEnabled()
|
value: emailService.getEmailIfEnabled()
|
||||||
};
|
};
|
||||||
|
@ -42,6 +47,18 @@ angular.module('copayApp.controllers').controller('preferencesNotificationsContr
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.notifyIfTxConfirmedChange = function() {
|
||||||
|
if (!$scope.pushNotifications) return;
|
||||||
|
var opts = {
|
||||||
|
notifyIfTxConfirmed: {
|
||||||
|
enabled: $scope.notifyIfTxConfirmed.value
|
||||||
|
}
|
||||||
|
};
|
||||||
|
configService.set(opts, function(err) {
|
||||||
|
if (err) $log.debug(err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
$scope.emailNotificationsChange = function() {
|
$scope.emailNotificationsChange = function() {
|
||||||
var opts = {
|
var opts = {
|
||||||
enabled: $scope.emailNotifications.value,
|
enabled: $scope.emailNotifications.value,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService, ongoingProcess, txFormatService, txConfirmNotification, feeService) {
|
angular.module('copayApp.controllers').controller('txDetailsController', function($rootScope, $log, $ionicHistory, $scope, $timeout, walletService, lodash, gettextCatalog, profileService, externalLinkService, popupService, ongoingProcess, txFormatService, txConfirmNotification, feeService, configService) {
|
||||||
|
|
||||||
var txId;
|
var txId;
|
||||||
var listeners = [];
|
var listeners = [];
|
||||||
|
var config = configService.getSync();
|
||||||
|
|
||||||
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
$scope.$on("$ionicView.beforeEnter", function(event, data) {
|
||||||
txId = data.stateParams.txid;
|
txId = data.stateParams.txid;
|
||||||
|
@ -12,6 +13,7 @@ angular.module('copayApp.controllers').controller('txDetailsController', functio
|
||||||
$scope.color = $scope.wallet.color;
|
$scope.color = $scope.wallet.color;
|
||||||
$scope.copayerId = $scope.wallet.credentials.copayerId;
|
$scope.copayerId = $scope.wallet.credentials.copayerId;
|
||||||
$scope.isShared = $scope.wallet.credentials.n > 1;
|
$scope.isShared = $scope.wallet.credentials.n > 1;
|
||||||
|
$scope.notifyIfTxConfirmed = config.notifyIfTxConfirmed ? config.notifyIfTxConfirmed.enabled : false;
|
||||||
|
|
||||||
txConfirmNotification.checkIfEnabled(txId, function(res) {
|
txConfirmNotification.checkIfEnabled(txId, function(res) {
|
||||||
$scope.txNotification = {
|
$scope.txNotification = {
|
||||||
|
|
|
@ -80,6 +80,10 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
||||||
|
|
||||||
pushNotificationsEnabled: true,
|
pushNotificationsEnabled: true,
|
||||||
|
|
||||||
|
notifyIfTxConfirmed: {
|
||||||
|
enabled: true,
|
||||||
|
},
|
||||||
|
|
||||||
emailNotifications: {
|
emailNotifications: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
},
|
},
|
||||||
|
|
|
@ -43,6 +43,13 @@
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-if="PNEnabledByUser">
|
||||||
|
<ion-toggle ng-model="notifyIfTxConfirmed.value" toggle-class="toggle-balanced" ng-change="notifyIfTxConfirmedChange()" ng-if="usePushNotifications">
|
||||||
|
<span class="toggle-label" translate>Notify me when confirm transactions</span>
|
||||||
|
</ion-toggle>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
@ -108,6 +108,7 @@ This transaction amount is too small compared to current Bitcoin network fees. S
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-if="!notifyIfTxConfirmed">
|
||||||
<ion-toggle ng-show="!btx.confirmations || btx.confirmations == 0"
|
<ion-toggle ng-show="!btx.confirmations || btx.confirmations == 0"
|
||||||
class="toggle-unconfirmed"
|
class="toggle-unconfirmed"
|
||||||
ng-model="txNotification.value"
|
ng-model="txNotification.value"
|
||||||
|
@ -115,6 +116,7 @@ This transaction amount is too small compared to current Bitcoin network fees. S
|
||||||
ng-change="txConfirmNotificationChange()">
|
ng-change="txConfirmNotificationChange()">
|
||||||
<span class="toggle-label" translate>Notify me if confirmed</span>
|
<span class="toggle-label" translate>Notify me if confirmed</span>
|
||||||
</ion-toggle>
|
</ion-toggle>
|
||||||
|
</div>
|
||||||
<div ng-if="actionList[0]">
|
<div ng-if="actionList[0]">
|
||||||
<div class="item item-divider" translate>Timeline</div>
|
<div class="item item-divider" translate>Timeline</div>
|
||||||
<div class="item timeline-item" ng-class="{'action-created' : a.type == 'created' || a.type == 'accept', 'action-rejected' : a.type == 'reject'}" ng-repeat="a in actionList track by $index">
|
<div class="item timeline-item" ng-class="{'action-created' : a.type == 'created' || a.type == 'accept', 'action-rejected' : a.type == 'reject'}" ng-repeat="a in actionList track by $index">
|
||||||
|
|
Loading…
Reference in New Issue