Skip to content

Commit

Permalink
new style
Browse files Browse the repository at this point in the history
  • Loading branch information
vince-hz committed Mar 21, 2024
1 parent ce1b858 commit 4707834
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions web/flat-web/scripts/vite-plugin-apple-app-site-association.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ export function appleAppSiteAssociation(): Plugin {
const content = await readFile(file, "utf8");
const json = JSON.parse(content) as { applinks: { details: { appID: string }[] } };

json.applinks.details.forEach(detail => {
detail.appID = AppleAppID[region];
console.log("Updated apple-app-site-association.json:", detail.appID);
});

// Append all appIds to allow universal links for different region apps.
if (json.applinks.details.length > 0) {
const keys = Object.keys(AppleAppID) as (keyof typeof AppleAppID)[];
keys.forEach((key) => {
const appId = AppleAppID[key];
const appIdExist = json.applinks.details.some((detail) => detail.appID == appId);
if (!appIdExist) {
const appendingDetail = { ...json.applinks.details[0] };
appendingDetail.appID = appId;
json.applinks.details.push(appendingDetail);
}
});
}
// json.applinks.details.forEach(detail => {
// detail.appID = AppleAppID[region];
// console.log("Updated apple-app-site-association.json:", detail.appID);
// });

// // Append all appIds to allow universal links for different region apps.
// if (json.applinks.details.length > 0) {
// const keys = Object.keys(AppleAppID) as (keyof typeof AppleAppID)[];
// keys.forEach((key) => {
// const appId = AppleAppID[key];
// const appIdExist = json.applinks.details.some((detail) => detail.appID == appId);
// if (!appIdExist) {
// const appendingDetail = { ...json.applinks.details[0] };
// appendingDetail.appID = appId;
// json.applinks.details.push(appendingDetail);
// }
// });
// }

await writeFile(file, JSON.stringify(json, null, 2), "utf8");
},
Expand Down

0 comments on commit 4707834

Please sign in to comment.