Fix android orientation lock on back

This commit is contained in:
WardPearce
2024-10-17 16:25:22 +13:00
parent 9f667ccbc9
commit fc762c6676
5 changed files with 19 additions and 8 deletions
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "us.materialio.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 62
versionName "1.6.11"
versionCode 63
versionName "1.6.12"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Materialious",
"version": "1.6.11",
"version": "1.6.12",
"description": "Modern material design for Invidious.",
"author": {
"name": "Ward Pearce",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "materialious",
"version": "1.6.11",
"version": "1.6.12",
"private": true,
"scripts": {
"dev": "vite dev",
+14 -3
View File
@@ -3,7 +3,7 @@
import { page } from '$app/stores';
import { Capacitor } from '@capacitor/core';
import { ScreenOrientation } from '@capacitor/screen-orientation';
import { ScreenOrientation, type ScreenOrientationResult } from '@capacitor/screen-orientation';
import { StatusBar } from '@capacitor/status-bar';
import { AudioPlayer } from '@mediagrid/capacitor-native-audio';
import type { Page } from '@sveltejs/kit';
@@ -60,6 +60,8 @@
let silenceSkipperInterval: NodeJS.Timeout;
let originalOrigination: ScreenOrientationResult | undefined;
let sponsorBlockElements: Element[] = [];
function setSponsorTimeline() {
@@ -402,7 +404,7 @@
format.type.startsWith('video/')
);
const originalOrigination = await ScreenOrientation.orientation();
originalOrigination = await ScreenOrientation.orientation();
player.addEventListener('fullscreen-change', async (event: FullscreenChangeEvent) => {
if (event.detail && videoFormats[0].resolution) {
const widthHeight = videoFormats[0].resolution.split('x');
@@ -417,7 +419,9 @@
}
} else {
await StatusBar.setOverlaysWebView({ overlay: false });
await ScreenOrientation.lock({ orientation: originalOrigination.type });
await ScreenOrientation.lock({
orientation: (originalOrigination as ScreenOrientationResult).type
});
}
});
}
@@ -522,6 +526,13 @@
onDestroy(async () => {
if (Capacitor.getPlatform() === 'android') {
await AudioPlayer.destroy({ audioId: data.video.videoId });
if (originalOrigination) {
await StatusBar.setOverlaysWebView({ overlay: false });
await ScreenOrientation.lock({
orientation: originalOrigination.type
});
}
}
if (typeof silenceSkipperInterval !== 'undefined') {
clearInterval(silenceSkipperInterval);
+1 -1
View File
@@ -5,7 +5,7 @@ import json
import os
import re
LATEST_VERSION = "1.6.11"
LATEST_VERSION = "1.6.12"
WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious")
ROOT_PACKAGE = os.path.join(WORKING_DIR, "package.json")