MOBILE-3833 qr: Set color-scheme to normal when open QR scanner
For some reason leaving this value to 'light dark' displays a black screen in Androidmain
parent
56a3287aff
commit
b3cadf8cd7
|
@ -49,6 +49,7 @@ export class CoreUtilsProvider {
|
||||||
protected iabInstance?: InAppBrowserObject;
|
protected iabInstance?: InAppBrowserObject;
|
||||||
protected uniqueIds: {[name: string]: number} = {};
|
protected uniqueIds: {[name: string]: number} = {};
|
||||||
protected qrScanData?: {deferred: PromiseDefer<string>; observable: Subscription};
|
protected qrScanData?: {deferred: PromiseDefer<string>; observable: Subscription};
|
||||||
|
protected initialColorSchemeContent = 'light dark';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.logger = CoreLogger.getInstance('CoreUtilsProvider');
|
this.logger = CoreLogger.getInstance('CoreUtilsProvider');
|
||||||
|
@ -1646,6 +1647,13 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
document.body.classList.add('core-scanning-qr');
|
document.body.classList.add('core-scanning-qr');
|
||||||
|
|
||||||
|
// Set color-scheme to 'normal', otherwise the camera isn't seen in Android.
|
||||||
|
const colorSchemeMeta = document.querySelector('meta[name="color-scheme"]');
|
||||||
|
if (colorSchemeMeta) {
|
||||||
|
this.initialColorSchemeContent = colorSchemeMeta.getAttribute('content') || this.initialColorSchemeContent;
|
||||||
|
colorSchemeMeta.setAttribute('content', 'normal');
|
||||||
|
}
|
||||||
|
|
||||||
return this.qrScanData.deferred.promise;
|
return this.qrScanData.deferred.promise;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.stopScanQR(e, true);
|
this.stopScanQR(e, true);
|
||||||
|
@ -1674,6 +1682,10 @@ export class CoreUtilsProvider {
|
||||||
|
|
||||||
// Hide camera preview.
|
// Hide camera preview.
|
||||||
document.body.classList.remove('core-scanning-qr');
|
document.body.classList.remove('core-scanning-qr');
|
||||||
|
|
||||||
|
// Set color-scheme to the initial value.
|
||||||
|
document.querySelector('meta[name="color-scheme"]')?.setAttribute('content', this.initialColorSchemeContent);
|
||||||
|
|
||||||
QRScanner.hide();
|
QRScanner.hide();
|
||||||
QRScanner.destroy();
|
QRScanner.destroy();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue