42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
// Metro module 13515 (f13516).
|
|
import { NOTIF_SETTINGS, NOTIF_SETTING_MAPPING } from "./NotificationSettingsConstants";
|
|
import { knownExperimentConfigs } from "./NotificationSettingsExperiments";
|
|
export function getAssignedNotifSettingsAndMappings() {
|
|
const settings = [];
|
|
const mappings = [];
|
|
const set = new Set();
|
|
for (const item of NOTIF_SETTINGS) {
|
|
if (item.experiment != null) {
|
|
const r45 = knownExperimentConfigs[item.experiment];
|
|
if (r45.definition.name !== item.experiment) {
|
|
throw new Error(`Experiment called ${r45.definition.name} assigned to name ${item.experiment}`);
|
|
}
|
|
if (!item.variations.includes(r45.getConfig({
|
|
location: "getAssignedNotifSettingsAndMappings"
|
|
}).variation)) {
|
|
continue;
|
|
}
|
|
}
|
|
settings.push(item);
|
|
set.add(item.id);
|
|
}
|
|
loop10: for (const r87 of Object.entries(NOTIF_SETTING_MAPPING)) {
|
|
const [r91, r92] = r87;
|
|
const notifType = parseInt(r91);
|
|
for (const item2 of r92) {
|
|
if (!set.has(item2)) {
|
|
continue;
|
|
}
|
|
mappings.push({
|
|
notifType,
|
|
notifSetting: item2
|
|
});
|
|
continue loop10;
|
|
}
|
|
}
|
|
return {
|
|
settings,
|
|
mappings
|
|
};
|
|
}
|