From 5b4db7cab516d12e6672199564d5308828069f2f Mon Sep 17 00:00:00 2001 From: xuyunshi <405029644@qq.com> Date: Tue, 19 Mar 2024 16:12:41 +0800 Subject: [PATCH] chore(web): add all region appIds to apple-app-site-association --- .../vite-plugin-apple-app-site-association.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts b/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts index 2018e7a9602..1cbde39ecc5 100644 --- a/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts +++ b/web/flat-web/scripts/vite-plugin-apple-app-site-association.ts @@ -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"); }, };