-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathuniversalLinkAssociation.ts
More file actions
executable file
·72 lines (62 loc) · 2 KB
/
Copy pathuniversalLinkAssociation.ts
File metadata and controls
executable file
·72 lines (62 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import fs from "fs";
import path from "path";
import settings from "./src/common/settings";
const appId = settings.config.appId;
const sha256_cert_fingerprints = settings.config.sha256CertFingerprints;
// IOS universal link setup
const appleAppSiteAssociation: {
applinks: {
details: { appIDs: string[]; paths: string[] }[];
};
appclips: { apps: string[] };
webcredentials: { apps: string[] };
} = {
applinks: {
details: [
{
appIDs: [],
paths: ["/login/*"],
},
],
},
appclips: {
apps: [],
},
webcredentials: {
apps: [],
},
};
const tonomyAppId: string = `6BLD42QR78.foundation.tonomy.projects.${appId}`;
appleAppSiteAssociation.applinks.details[0].appIDs.push(tonomyAppId);
appleAppSiteAssociation.appclips.apps.push(tonomyAppId);
appleAppSiteAssociation.webcredentials.apps.push(tonomyAppId);
const directoryPath = path.join("public", ".well-known");
const filePath = path.join(directoryPath, "apple-app-site-association");
if (!fs.existsSync(directoryPath)) {
fs.mkdirSync(directoryPath, { recursive: true });
console.log(`Directory created: ${directoryPath}`);
}
fs.writeFileSync(filePath, JSON.stringify(appleAppSiteAssociation, null, 2));
console.log(`File written successfully to ${filePath}`);
//Android Universal Link Setup
const androidSiteAssociation = [
{
relation: ["delegate_permission/common.handle_all_urls"],
target: {
namespace: "android_app",
package_name: `foundation.tonomy.projects.${appId}`,
sha256_cert_fingerprints: [sha256_cert_fingerprints],
},
},
];
const androidDirectoryPath = path.join("public", ".well-known");
const androidFilePath = path.join(directoryPath, "assetlinks.json");
if (!fs.existsSync(androidDirectoryPath)) {
fs.mkdirSync(androidDirectoryPath, { recursive: true });
console.log(`Directory created: ${androidDirectoryPath}`);
}
fs.writeFileSync(
androidFilePath,
JSON.stringify(androidSiteAssociation, null, 2),
);
console.log(`File written successfully to ${androidFilePath}`);