Skip to content

Commit

Permalink
chore(web): add all region appIds to apple-app-site-association
Browse files Browse the repository at this point in the history
  • Loading branch information
vince-hz committed Mar 19, 2024
1 parent 05f4904 commit 5b4db7c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions web/flat-web/scripts/vite-plugin-apple-app-site-association.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ export function appleAppSiteAssociation(): Plugin {
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 5b4db7c

Please sign in to comment.