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:
commit
bc641f1cec
51 changed files with 4556 additions and 359 deletions
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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(){
|
||||
|
|
|
|||
|
|
@ -1383,6 +1383,11 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
|
||||
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
|
||||
if (document.body.classList.contains('keyboard-open')) {
|
||||
document.body.classList.remove('keyboard-open');
|
||||
$log.debug('Prevented keyboard open bug..');
|
||||
}
|
||||
|
||||
$log.debug('Route change from:', fromState.name || '-', ' to:', toState.name);
|
||||
$log.debug(' toParams:' + JSON.stringify(toParams || {}));
|
||||
$log.debug(' fromParams:' + JSON.stringify(fromParams || {}));
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
|
|||
enabled: false,
|
||||
},
|
||||
|
||||
soundsEnabled: false,
|
||||
soundsEnabled: true,
|
||||
|
||||
log: {
|
||||
filter: 'debug',
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@ angular.module('copayApp.services').service('scannerService', function($log, $ti
|
|||
_completeInitialization(status, callback);
|
||||
});
|
||||
} else {
|
||||
isAvailable = true; // XX SP: Availability can change after permissions are granted after being denied.
|
||||
_completeInitialization(status, callback);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('storageService', function(appConfigService, logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, secureStorageService, $timeout) {
|
||||
.factory('storageService', function(appConfigService, logHeader, fileStorageService, localStorageService, sjcl, $log, lodash, platformInfo, $timeout) {
|
||||
|
||||
var root = {};
|
||||
var storage;
|
||||
|
|
@ -121,11 +121,7 @@ angular.module('copayApp.services')
|
|||
|
||||
root.storeProfile = function(profile, cb) {
|
||||
var profileString = profile.toObj();
|
||||
if (platformInfo.isNW) {
|
||||
storage.set('profile', profileString, cb);
|
||||
} else {
|
||||
secureStorageService.set('profile', profileString, cb);
|
||||
}
|
||||
storage.set('profile', profileString, cb);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -205,48 +201,19 @@ angular.module('copayApp.services')
|
|||
* @param {getProfileCallback} cb
|
||||
*/
|
||||
root.getProfile = function(cb) {
|
||||
if (platformInfo.isNW) {
|
||||
storage.get('profile', function(getErr, getStr) {
|
||||
_onOldProfileRetrieved(getErr, getStr, cb);
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
secureStorageService.get('profile', function(secureErr, secureStr) {
|
||||
var secureProfile;
|
||||
var oldProfile;
|
||||
|
||||
if (secureErr) {
|
||||
return cb(secureErr, null);
|
||||
storage.get('profile', function(getErr, getStr) {
|
||||
if (getErr) {
|
||||
cb(getErr, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (secureStr) {
|
||||
try {
|
||||
secureProfile = Profile.fromString(secureStr);
|
||||
$log.debug('profile: ' + JSON.stringify(secureProfile));
|
||||
} catch (e) {
|
||||
$log.error(e);
|
||||
return cb(e, null);
|
||||
}
|
||||
if (!getStr) {
|
||||
cb(null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
storage.get('profile', function(getErr, getStr) {
|
||||
_onOldProfileRetrieved(getErr, getStr, function(oldErr, oldProfile){
|
||||
if (oldErr) {
|
||||
return cb(oldErr, null);
|
||||
}
|
||||
|
||||
if (!oldProfile) {
|
||||
if (secureProfile) {
|
||||
return cb(null, secureProfile);
|
||||
} else {
|
||||
// No profiles found. No errors either.
|
||||
return cb(null, null);
|
||||
}
|
||||
}
|
||||
_migrateProfiles(oldProfile, secureProfile, cb);
|
||||
});
|
||||
});
|
||||
|
||||
var profile = Profile.fromString(getStr);
|
||||
cb(null, profile);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ angular.module('copayApp.services')
|
|||
isoCode: 'en',
|
||||
rateCode: 'USD'
|
||||
}, {
|
||||
name: 'català',
|
||||
isoCode: 'ca',
|
||||
rateCode: 'EUR'
|
||||
},{
|
||||
name: 'Čeština',
|
||||
isoCode: 'cs',
|
||||
rateCode: 'EUR'
|
||||
|
|
@ -55,6 +59,10 @@ angular.module('copayApp.services')
|
|||
name: 'Português',
|
||||
isoCode: 'pt',
|
||||
rateCode: 'EUR'
|
||||
}, {
|
||||
name: 'русский язык',
|
||||
isoCode: 'ru',
|
||||
rateCode: 'RUB'
|
||||
}, {
|
||||
name: '한국어',
|
||||
isoCode: 'ko',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue