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(){

View file

@ -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 || {}));

View file

@ -107,7 +107,7 @@ angular.module('copayApp.services').factory('configService', function(storageSer
enabled: false,
},
soundsEnabled: false,
soundsEnabled: true,
log: {
filter: 'debug',

View file

@ -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);
}
});

View file

@ -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);
});
};

View file

@ -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',

View file

@ -5,6 +5,7 @@
@import "icons";
@import "buttons";
@import "forms";
@import "qr";
@import "mixins/mixins";
@import "views/views";
@import "directives/directives";

20
src/sass/qr.scss Normal file
View file

@ -0,0 +1,20 @@
qrcode {
&.qr-icon {
&::before {
content: "";
background-size: 100% 100%;
display: block;
margin-left: calc(50% - 22px);
margin-top: 88px;
width: 44px;
height: 44px;
position: absolute;
}
&--bch::before {
background-image: url('../img/qr-overlay-bch.png');
}
&--btc::before {
background-image: url('../img/qr-overlay-btc.png');
}
}
}

View file

@ -86,6 +86,9 @@ slide-to-accept-success {
transition: transform $duration ease, opacity $duration ease;
transition-delay: 250ms;
margin-bottom: constant(safe-area-inset-bottom); /* iOS 11.0 */
margin-bottom: env(safe-area-inset-bottom); /* iOS 11.2 */
&.reveal {
-webkit-transform: translateY(0);
transform: translateY(0);

View file

@ -12,6 +12,11 @@ wallet-selector {
font-weight: bold;
padding-bottom: 10px;
border-bottom: 1px solid #EFEFEF;
.subtitle {
color: $v-mid-gray;
font-size: $font-size-small;
font-weight: 300;
}
.wallet-coin-logo {
vertical-align: middle;
margin-right: 5px;

View file

@ -43,6 +43,11 @@
.icon {
color: $v-mid-gray;
}
.subtitle {
color: $v-mid-gray;
font-size: $font-size-small;
font-weight: 300;
}
}
}
}
}