Skip to content

Commit 4ea8f70

Browse files
committed
fix: モバイル連携画面の下部余白のブラウザ/PWA切り分け最適化対応(v11/v14)
1 parent 6da96fc commit 4ea8f70

5 files changed

Lines changed: 38 additions & 20 deletions

File tree

public/sw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const CACHE_NAME = "launcherg-pwa-shell-mobile-pwa-v13";
1+
const CACHE_NAME = "launcherg-pwa-shell-mobile-pwa-v14";
22
const PRECACHE_ASSETS = Array.isArray(self.__LAUNCHERG_PWA_ASSETS__)
33
? self.__LAUNCHERG_PWA_ASSETS__
44
: [];

src/lib/mobileCompanionInstall.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
describe("createMobileCompanionInstallStartUrl", () => {
99
it("keeps the room in the installed launch URL", () => {
1010
const query = new URLSearchParams({
11-
client: "mobile-pwa-v10",
11+
client: "mobile-pwa-v11",
1212
mode: "library",
1313
roomId: "room-1",
1414
gameId: "42",
@@ -21,7 +21,7 @@ describe("createMobileCompanionInstallStartUrl", () => {
2121
query,
2222
),
2323
).toBe(
24-
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v10&mode=library&roomId=room-1&gameId=42&authToken=short-lived-token",
24+
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v11&mode=library&roomId=room-1&gameId=42&authToken=short-lived-token",
2525
);
2626
});
2727

@@ -84,15 +84,15 @@ describe("configureMobileCompanionInstallManifest", () => {
8484
const link = document.querySelector<HTMLLinkElement>('link[rel="manifest"]');
8585

8686
expect(startUrl).toBe(
87-
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v10&mode=controller&roomId=room-1&authToken=short-lived-token",
87+
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v11&mode=controller&roomId=room-1&authToken=short-lived-token",
8888
);
8989
expect(link?.href).toContain("data:application/manifest+json");
9090
expect(link?.dataset.launchergDynamicCompanionManifest).toBe("true");
9191
const manifest = JSON.parse(
9292
decodeURIComponent(link?.href.split(",")[1] ?? ""),
9393
);
9494
expect(manifest.start_url).toBe(
95-
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v10&mode=controller&roomId=room-1&authToken=short-lived-token",
95+
"https://example.test/Launcherg-Mod/#/companion?client=mobile-pwa-v11&mode=controller&roomId=room-1&authToken=short-lived-token",
9696
);
9797
});
9898
});

src/lib/mobileCompanionUrl.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ describe("createMobileCompanionUrl", () => {
99
});
1010

1111
expect(url).toBe(
12-
"https://example.test/companion.html?client=mobile-pwa-v10&mode=controller&roomId=room-1",
12+
"https://example.test/companion.html?client=mobile-pwa-v11&mode=controller&roomId=room-1",
1313
);
1414
});
1515

@@ -20,7 +20,7 @@ describe("createMobileCompanionUrl", () => {
2020
});
2121

2222
expect(url).toBe(
23-
"https://example.test/Launcherg-Mod/companion.html?client=mobile-pwa-v10&mode=controller&roomId=room-1",
23+
"https://example.test/Launcherg-Mod/companion.html?client=mobile-pwa-v11&mode=controller&roomId=room-1",
2424
);
2525
});
2626

@@ -34,7 +34,7 @@ describe("createMobileCompanionUrl", () => {
3434
});
3535

3636
expect(url).toBe(
37-
"https://example.test/companion.html?client=mobile-pwa-v10&mode=controller&roomId=room-1&gameId=42&seiyaUrl=https%3A%2F%2Fseiya.example%2Fgame%3Fid%3D42&authToken=token-1",
37+
"https://example.test/companion.html?client=mobile-pwa-v11&mode=controller&roomId=room-1&gameId=42&seiyaUrl=https%3A%2F%2Fseiya.example%2Fgame%3Fid%3D42&authToken=token-1",
3838
);
3939
});
4040

@@ -46,7 +46,7 @@ describe("createMobileCompanionUrl", () => {
4646
});
4747

4848
expect(url).toBe(
49-
"https://example.test/companion.html?client=mobile-pwa-v10&mode=library&roomId=room-1",
49+
"https://example.test/companion.html?client=mobile-pwa-v11&mode=library&roomId=room-1",
5050
);
5151
});
5252
});

src/lib/mobileCompanionUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const configuredMobileCompanionOrigin =
33

44
export const MOBILE_COMPANION_ORIGIN =
55
configuredMobileCompanionOrigin || "https://nnnsmm.github.io/Launcherg-Mod/";
6-
export const MOBILE_COMPANION_CLIENT_VERSION = "mobile-pwa-v10";
6+
export const MOBILE_COMPANION_CLIENT_VERSION = "mobile-pwa-v11";
77
export const SKYWAY_CONNECT_ENDPOINT = "https://launcherg.ryoha.moe/connect";
88

99
export type MobileCompanionUrlParams = {

src/views/MobileCompanion.svelte

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,18 @@
891891
};
892892
893893
onMount(() => {
894+
const htmlEl = document.documentElement;
895+
const bodyEl = document.body;
894896
const appEl = document.querySelector("#app") as HTMLElement | null;
897+
if (htmlEl) {
898+
htmlEl.style.height = "100dvh";
899+
}
900+
if (bodyEl) {
901+
bodyEl.style.height = "100dvh";
902+
}
895903
if (appEl) {
896904
appEl.style.overflow = "hidden";
897-
appEl.style.height = "100%";
905+
appEl.style.height = "100dvh";
898906
}
899907
900908
void getAllCachedImages().then((cached) => {
@@ -920,7 +928,15 @@
920928
});
921929
922930
onDestroy(() => {
931+
const htmlEl = document.documentElement;
932+
const bodyEl = document.body;
923933
const appEl = document.querySelector("#app") as HTMLElement | null;
934+
if (htmlEl) {
935+
htmlEl.style.height = "";
936+
}
937+
if (bodyEl) {
938+
bodyEl.style.height = "";
939+
}
924940
if (appEl) {
925941
appEl.style.overflow = "";
926942
appEl.style.height = "";
@@ -1328,14 +1344,14 @@
13281344
min-height: 0;
13291345
overflow-y: auto;
13301346
overflow-x: hidden;
1331-
padding: 14px 14px calc(92px + env(safe-area-inset-bottom, 0px));
1347+
padding: 14px 14px 24px;
13321348
display: grid;
13331349
align-content: start;
13341350
gap: 14px;
13351351
}
13361352
13371353
.content.controller-mode {
1338-
padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
1354+
padding-bottom: 24px;
13391355
}
13401356
13411357
.section,
@@ -1918,20 +1934,22 @@
19181934
}
19191935
19201936
.bottom-nav {
1921-
position: fixed;
1922-
left: 50%;
1923-
bottom: 0;
1924-
transform: translateX(-50%);
1925-
width: min(620px, 100vw);
1926-
height: calc(72px + env(safe-area-inset-bottom, 0px));
1937+
width: 100%;
1938+
height: 72px;
19271939
display: grid;
19281940
grid-template-columns: repeat(3, minmax(0, 1fr));
1929-
padding-bottom: env(safe-area-inset-bottom, 0px);
19301941
border-top: 1px solid rgb(255 255 255 / 0.1);
19311942
background: rgb(25 25 25 / 0.96);
19321943
backdrop-filter: blur(14px);
19331944
}
19341945
1946+
@media (display-mode: standalone) {
1947+
.bottom-nav {
1948+
height: calc(60px + env(safe-area-inset-bottom, 0px));
1949+
padding-bottom: env(safe-area-inset-bottom, 0px);
1950+
}
1951+
}
1952+
19351953
.bottom-nav button {
19361954
display: flex;
19371955
flex-direction: column;

0 commit comments

Comments
 (0)