Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(web): add all region appIds to apple-app-site-association #2134

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading