Merge pull request #201 from Bitcoin-com/wallet/task/419

Wallet/task/419 in 363 for testing (fix the issue)
This commit is contained in:
Jean-Baptiste Dominguez 2018-07-02 15:21:33 +09:00 committed by GitHub
commit bc641f1cec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 4556 additions and 359 deletions

View file

@ -13,6 +13,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
var currentAddressSocket = {};
var paymentSubscriptionObj = { op:"addr_sub" }
var config;
var soundLoaded = false;
var nativeAudioAvailable = (window.plugins && window.plugins.NativeAudio);
if (nativeAudioAvailable) {
window.plugins.NativeAudio.preloadSimple('received', 'misc/coin_received.mp3', function (msg) {
$log.debug('Receive sound loaded.');
soundLoaded = true;
}, function (error) {
$log.debug('Error loading receive sound.');
$log.debug(error);
});
} else {
$log.debug('isNW: Using HTML5-Audio instead of native audio');
soundLoaded = true;
}
$scope.displayBalanceAsFiat = true;
$scope.requestSpecificAmount = function() {
@ -135,6 +153,17 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
}
$scope.paymentReceivedCoin = $scope.wallet.coin;
$scope.$apply(function () {
if (config.soundsEnabled && soundLoaded) {
$log.debug('Play sound.');
if (nativeAudioAvailable) {
window.plugins.NativeAudio.play('received');
} else {
new Audio('misc/coin_received.ogg').play(); // NW.js has no mp3 support
}
} else {
$log.debug('Sound is disabled.');
}
$scope.showingPaymentReceived = true;
});
}
@ -221,12 +250,14 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
})
];
configService.whenAvailable(function(config) {
$scope.displayBalanceAsFiat = config.wallet.settings.priceDisplay === 'fiat';
configService.whenAvailable(function(_config) {
$scope.displayBalanceAsFiat = _config.wallet.settings.priceDisplay === 'fiat';
config = _config;
});
});
$scope.$on("$ionicView.enter", function(event, data) {
$scope.showingPaymentReceived = false;
$ionicNavBarDelegate.showBar(true);
});

View file

@ -122,8 +122,11 @@ angular.module('copayApp.controllers').controller('tabScanController', function(
scannerService.openSettings();
};
$scope.reactivationCount = 0;
$scope.attemptToReactivate = function(){
scannerService.reinitialize();
scannerService.reinitialize(function(){
$scope.reactivationCount++;
});
};
$scope.toggleLight = function(){