1 line
1.7 KiB
Plaintext
1 line
1.7 KiB
Plaintext
{"version":3,"file":"getInstallationIdAsync.js","sourceRoot":"","sources":["../../src/environment/getInstallationIdAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAChD,OAAO,MAAM,MAAM,SAAS,CAAC;AAE7B,IAAI,cAA6B,CAAC;AAClC,MAAM,cAAc,GAAG,sCAAsC,CAAC,CAAC,oBAAoB;AAEnF,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,sBAAsB;IAClD,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC;KACvB;IAED,MAAM,mBAAmB,GAAG,MAAM,WAAW,CAAC,sBAAsB,EAAE,CAAC;IACvE,MAAM,gBAAgB,GAAG,WAAW,CAAC,aAAc,CAAC;IAEpD,yEAAyE;IACzE,yEAAyE;IACzE,QAAQ;IACR,IAAI,mBAAmB,EAAE;QACvB,cAAc,GAAG,MAAM,CAAC,GAAG,gBAAgB,IAAI,mBAAmB,EAAE,EAAE,cAAc,CAAC,CAAC;KACvF;SAAM;QACL,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,wBAAwB,EAAE,CAAC;QACtE,cAAc,GAAG,MAAM,CAAC,GAAG,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;KAC9F;IAED,OAAO,cAAc,CAAC;AACxB,CAAC","sourcesContent":["import * as Application from 'expo-application';\nimport uuidv5 from 'uuid/v5';\n\nlet installationId: string | null;\nconst UUID_NAMESPACE = '29cc8a0d-747c-5f85-9ff9-f2f16636d963'; // uuidv5(0, \"expo\")\n\nexport default async function getInstallationIdAsync() {\n if (installationId) {\n return installationId;\n }\n\n const identifierForVendor = await Application.getIosIdForVendorAsync();\n const bundleIdentifier = Application.applicationId!;\n\n // It's unlikely identifierForVendor will be null (it returns null if the\n // device has been restarted but not yet unlocked), but let's handle this\n // case.\n if (identifierForVendor) {\n installationId = uuidv5(`${bundleIdentifier}-${identifierForVendor}`, UUID_NAMESPACE);\n } else {\n const installationTime = await Application.getInstallationTimeAsync();\n installationId = uuidv5(`${bundleIdentifier}-${installationTime.getTime()}`, UUID_NAMESPACE);\n }\n\n return installationId;\n}\n"]} |