Skip to content

Commit 3159ad6

Browse files
committed
Add manifest file for 2048Clone theme to enable Android to recognize the theme's icon when installing the web app
1 parent f27f777 commit 3159ad6

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

public/manifest_classic.json

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"short_name": "2048 Clone",
3+
"name": "2048 Clone",
4+
"icons": [
5+
{
6+
"src": "icon128_classic.png",
7+
"sizes": "128x128",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "icon152_classic.png",
12+
"sizes": "152x152",
13+
"type": "image/png"
14+
}
15+
],
16+
"start_url": ".",
17+
"display": "fullscreen",
18+
"orientation": "portrait"
19+
}

src/manager/app-icon.ts

+13
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ export class AppIconManager {
33

44
public setAppIcon(type: string) {
55
this.setAppleTouchIcon(type);
6+
this.loadManifest(type);
67
this.setFavicon(type);
78
}
89

@@ -21,6 +22,18 @@ export class AppIconManager {
2122
}
2223
}
2324

25+
private loadManifest(type: string) {
26+
const manifest = document.querySelector("link[rel='manifest']") as HTMLLinkElement;
27+
switch (type) {
28+
case "classic":
29+
manifest.href = "manifest_classic.json";
30+
break;
31+
default:
32+
manifest.href = "manifest.json";
33+
break;
34+
}
35+
}
36+
2437
private setFavicon(type: string) {
2538
const favicon = document.querySelector("link[rel='icon']") as HTMLLinkElement;
2639
switch (type) {

0 commit comments

Comments
 (0)