Merge pull request #178 from Bitcoin-com/wallet/task/379
Improvement - 379 - Coin sounds on "Payment received" screen
This commit is contained in:
commit
06adfc5f44
4 changed files with 33 additions and 2 deletions
|
|
@ -72,6 +72,7 @@
|
||||||
<plugin name="cordova-plugin-queries-schemes" spec="~0.1.5" />
|
<plugin name="cordova-plugin-queries-schemes" spec="~0.1.5" />
|
||||||
<plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.git" />
|
<plugin name="cordova-plugin-firebase" spec="https://github.com/arnesson/cordova-plugin-firebase.git" />
|
||||||
<plugin name="cordova-plugin-wkwebview-inputfocusfix" spec="https://github.com/onderceylan/cordova-plugin-wkwebview-inputfocusfix.git" />
|
<plugin name="cordova-plugin-wkwebview-inputfocusfix" spec="https://github.com/onderceylan/cordova-plugin-wkwebview-inputfocusfix.git" />
|
||||||
|
<plugin name="cordova-plugin-nativeaudio" spec="^3.0.9" />
|
||||||
<!-- Changes in error descriptions may break the use of cordova-plugin-secure-storage -->
|
<!-- Changes in error descriptions may break the use of cordova-plugin-secure-storage -->
|
||||||
<plugin name="cordova-plugin-secure-storage" spec="2.6.8" />
|
<plugin name="cordova-plugin-secure-storage" spec="2.6.8" />
|
||||||
<!-- Supported Platforms -->
|
<!-- Supported Platforms -->
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,24 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
var currentAddressSocket = {};
|
var currentAddressSocket = {};
|
||||||
var paymentSubscriptionObj = { op:"addr_sub" }
|
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.displayBalanceAsFiat = true;
|
||||||
|
|
||||||
$scope.requestSpecificAmount = function() {
|
$scope.requestSpecificAmount = function() {
|
||||||
|
|
@ -129,6 +147,17 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
}
|
}
|
||||||
$scope.paymentReceivedCoin = $scope.wallet.coin;
|
$scope.paymentReceivedCoin = $scope.wallet.coin;
|
||||||
$scope.$apply(function () {
|
$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;
|
$scope.showingPaymentReceived = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -215,8 +244,9 @@ angular.module('copayApp.controllers').controller('tabReceiveController', functi
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
configService.whenAvailable(function(config) {
|
configService.whenAvailable(function(_config) {
|
||||||
$scope.displayBalanceAsFiat = config.wallet.settings.priceDisplay === 'fiat';
|
$scope.displayBalanceAsFiat = _config.wallet.settings.priceDisplay === 'fiat';
|
||||||
|
config = _config;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
BIN
www/misc/coin_received.mp3
Normal file
BIN
www/misc/coin_received.mp3
Normal file
Binary file not shown.
BIN
www/misc/coin_received.ogg
Normal file
BIN
www/misc/coin_received.ogg
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue