decord/source/actions/native/PushNotificationActionCreators.tsx

298 lines
10 KiB
TypeScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 11780
// Function ID: 11781
2026-07-20 16:05:17 +00:00
// Name: getOrRefreshPushSyncToken
2026-08-08 06:10:11 +00:00
// Dependencies: [5, 11781, 1218, 676, 5830, 3, 707, 530, 1208, 11785, 595, 5127, 500, 503, 1351, 709, 2]
2026-07-20 16:05:17 +00:00
// Exports: setPushNotificationPermissionEligibleForPrompt, setPushPermissionReactivationSeen, setPushPermissionState, updateNotificationAuthorizationStatus
2026-08-08 06:10:11 +00:00
// Module 11780 (getOrRefreshPushSyncToken)
2026-07-23 10:11:24 +00:00
import timestamp from "timestamp";
2026-07-29 08:29:29 +00:00
import initialize from "initialize";
import fetchFingerprint from "fetchFingerprint";
2026-07-23 10:11:24 +00:00
import ME from "ME";
import str2 from "str2";
2026-07-29 08:29:29 +00:00
let c10;
let c9;
2026-07-23 10:11:24 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let error;
let map1;
let metroImportAll;
let unpackModuleId;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function getOrRefreshPushSyncToken() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _getOrRefreshPushSyncToken.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
function _getOrRefreshPushSyncToken() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
let closure_0 = arg0;
let c5 = 0;
let c6 = 0;
let c4 = 0;
return (function*(arg0, body) {
if (c6 === 2) {
c6 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp7 === 3) {
if (arg0 === 1) {
throw body;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = body;
return obj;
} else {
2026-08-08 06:10:11 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c6 = 2;
if (0 === c5) {
if (arg0 === 1) {
c6 = 3;
throw body;
} else if (arg0 === 2) {
c6 = 3;
obj = { value: null, done: true };
obj[0] = body;
return obj;
} else {
let callback = tmp3;
let token = tmp5;
token = undefined;
if (null == lib.pushSyncToken) {
let obj5 = outer1_2(outer1_3[6]);
token = obj5.getToken(tmp40.id);
if (null == token) {
c6 = 3;
return { value: null, done: true };
} else {
let c4 = 1;
const HTTP = lib(outer1_3[7]).HTTP;
const obj1 = { url: null, headers: null, rejectWithError: false };
obj1[0] = outer1_9.DEVICES_SYNC_TOKEN;
const obj2 = { authorization: null };
obj2[0] = token;
obj1[1] = obj2;
c5 = 2;
c6 = 1;
let obj3 = { value: null, done: false };
obj3[0] = HTTP.get(obj1);
return obj3;
}
} else {
c6 = 3;
const obj4 = { value: null, done: true };
obj4[0] = tmp40.pushSyncToken;
return obj4;
}
}
} else if (1 === tmp8) {
c4 = 0;
callback = dependencyMap;
obj3 = token(1208);
obj3.captureException(callback);
c6 = 3;
return { value: null, done: true };
} else if (arg0 === 1) {
c6 = 3;
throw body;
} else if (arg0 === 2) {
c4 = 0;
c6 = 3;
obj5 = { value: null, done: true };
obj5[0] = body;
return obj5;
} else {
token = body.body.token;
c4 = 0;
2026-08-08 06:10:11 +00:00
obj = callback(11785);
2026-07-29 08:29:29 +00:00
obj.updatePushSyncToken(lib.id, token);
c6 = 3;
const obj6 = { value: null, done: true };
obj6[0] = token;
return obj6;
}
} catch (tmp31) {
dependencyMap = tmp31;
if (tmp4 === c4) {
c6 = tmp2;
throw tmp31;
} else {
c5 = tmp;
}
}
}
})();
});
const _getOrRefreshPushSyncToken = tmp;
const apply = tmp.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
({ DEVICE_TOKEN: error, DEVICE_VOIP_TOKEN: metroImportAll, Endpoints: c9 } = ME);
({ BUNDLE_ID: c10, DEVICE_PUSH_VOIP_PROVIDER: unpackModuleId, getDevicePushProvider: closure_12, IS_QUEST_RELEASE: map1 } = require("str2"));
let closure_14 = new require("ME")("PushNotificationActionCreators");
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
registerDevice(token, flag) {
if (flag === undefined) {
flag = false;
}
const canUseMultiAccountNotifications = obj.canUseMultiAccountNotifications;
2026-07-29 08:29:29 +00:00
tmp4.log("Registering push notification token: " + token + ", is voip:" + flag + ", multi-account:" + canUseMultiAccountNotifications);
const Storage = require(595) /* Storage */.Storage;
2026-07-20 16:05:17 +00:00
const result = Storage.set(flag ? closure_8 : closure_7, token);
if (canUseMultiAccountNotifications) {
2026-07-29 08:29:29 +00:00
const self = this;
let syncDeviceResult = this.syncDevice(token, flag);
2026-07-20 16:05:17 +00:00
} else {
2026-08-08 06:10:11 +00:00
obj = importDefault(5127);
2026-07-29 08:29:29 +00:00
obj = { url: null, body: null, oldFormErrors: true, trackedActionData: null, rejectWithError: false };
obj[0] = constants.DEVICES;
2026-07-20 16:05:17 +00:00
if (flag) {
2026-07-29 08:29:29 +00:00
let tmp8 = closure_11;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp8 = callback2();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { provider: null, token: null, bypass_server_throttling_supported: null, bundle_id: null };
obj[0] = tmp8;
obj[1] = token;
let isAndroidResult = tmp2(500).isAndroid();
2026-07-20 16:05:17 +00:00
if (isAndroidResult) {
isAndroidResult = !closure_13;
}
2026-07-29 08:29:29 +00:00
obj[2] = isAndroidResult;
obj[3] = closure_10;
obj[1] = obj;
const obj1 = { event: null };
obj1[0] = tmp2(503).NetworkActionNames.USER_REGISTER_DEVICE_TOKEN;
obj[3] = obj1;
2026-07-20 16:05:17 +00:00
syncDeviceResult = obj.post(obj);
2026-07-29 08:29:29 +00:00
const tmp2Result = tmp2(500);
2026-07-20 16:05:17 +00:00
}
return syncDeviceResult;
},
syncDevice(token, flag) {
2026-07-23 10:11:24 +00:00
let closure_0 = token;
2026-07-20 16:05:17 +00:00
if (flag === undefined) {
flag = false;
}
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-04 21:03:28 +00:00
let id = tmp2;
id = outer1_6.getId();
const validUsers = outer1_5.getValidUsers();
const sorted = validUsers.sort((id, id2) => {
let num = -1;
if (id.id !== closure_0) {
let num2 = 0;
if (id2.id === tmp) {
num2 = 1;
}
num = num2;
}
return num;
});
yield Promise.all(sorted.map(outer1_15));
if (1 === tmp5) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-04 21:03:28 +00:00
let dependencyMap = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-04 21:03:28 +00:00
dependencyMap = 3;
let obj2 = { value: null, done: true };
obj2[0] = arg1;
return obj2;
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
let closure_1 = arg1;
if (closure_1.length >= 1) {
if (null != closure_1[0]) {
const HTTP = outer1_0(530).HTTP;
const obj3 = { url: null, body: null, rejectWithError: false };
obj3[0] = outer1_9.DEVICES_SYNC;
if (closure_1) {
let tmp9 = outer1_11;
2026-07-29 08:29:29 +00:00
} else {
2026-08-04 21:03:28 +00:00
tmp9 = outer1_12();
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
const obj4 = { provider: null, token: null, push_sync_tokens: null, bypass_server_throttling_supported: null, bundle_id: null };
obj4[0] = tmp9;
obj4[1] = outer1_0;
obj4[2] = closure_1.filter(outer1_0(1351).isNotNullish);
obj2 = outer1_0(500);
let isAndroidResult = obj2.isAndroid();
if (isAndroidResult) {
isAndroidResult = !outer1_13;
2026-07-29 08:29:29 +00:00
}
2026-08-04 21:03:28 +00:00
obj4[3] = isAndroidResult;
obj4[4] = outer1_10;
obj3[1] = obj4;
let v0 = 2;
dependencyMap = 1;
const obj5 = { value: null, done: false };
obj5[0] = HTTP.put(obj3);
return obj5;
2026-07-29 08:29:29 +00:00
}
}
2026-08-04 21:03:28 +00:00
dependencyMap = 3;
}
} else if (arg0 === 1) {
dependencyMap = 3;
throw arg1;
} else if (arg0 !== 2) {
v0 = arg1;
if (v0.body.invalid_push_sync_tokens.length > 0) {
2026-08-08 06:10:11 +00:00
const result = v0(11785).invalidatePushSyncTokens(v0.body.invalid_push_sync_tokens);
const obj9 = v0(11785);
2026-07-29 08:29:29 +00:00
}
}
2026-08-04 21:03:28 +00:00
return arg1;
2026-07-29 08:29:29 +00:00
})();
2026-07-20 16:05:17 +00:00
},
unregisterDevice(token) {
2026-07-29 08:29:29 +00:00
tmp4.log("Unregistering push notification token: " + token);
2026-08-08 06:10:11 +00:00
let obj = importDefault(5127);
2026-07-29 08:29:29 +00:00
obj = { url: constants.DEVICES, body: null, trackedActionData: null, rejectWithError: false };
2026-07-20 16:05:17 +00:00
obj = { provider: callback2(), token };
2026-07-29 08:29:29 +00:00
obj[1] = obj;
obj[2] = { event: require(503) /* encodeProperties */.NetworkActionNames.USER_UNREGISTER_DEVICE_TOKEN };
2026-07-20 16:05:17 +00:00
return obj.delete(obj);
}
};
2026-07-29 08:29:29 +00:00
const tmp4 = new require("ME")("PushNotificationActionCreators");
let result = require("fetchFingerprint").fileFinishedImporting("actions/native/PushNotificationActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default obj;
export const setPushPermissionState = function setPushPermissionState(PROMPT_SEEN) {
2026-07-23 10:11:24 +00:00
let closure_0 = PROMPT_SEEN;
2026-07-29 08:29:29 +00:00
importDefault(709).wait(() => {
2026-07-23 10:11:24 +00:00
let obj = outer1_1(outer1_3[15]);
obj = { type: "PUSH_NOTIFICATION_PERMISSION_SET_STATE", permissionState: closure_0 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
});
};
export const setPushPermissionReactivationSeen = function setPushPermissionReactivationSeen(promptType) {
2026-07-29 08:29:29 +00:00
let obj = importDefault(709);
2026-07-20 16:05:17 +00:00
obj = { type: "PUSH_NOTIFICATION_PERMISSION_REACTIVATION_SEEN", promptType };
obj.dispatch(obj);
};
export const setPushNotificationPermissionEligibleForPrompt = function setPushNotificationPermissionEligibleForPrompt(CHANNEL_BANNER) {
2026-07-29 08:29:29 +00:00
let obj = importDefault(709);
2026-07-20 16:05:17 +00:00
obj = { type: "PUSH_NOTIFICATION_PERMISSION_SET_ELIGIBLE", promptType: CHANNEL_BANNER };
obj.dispatch(obj);
};
2026-07-29 08:29:29 +00:00
export const updateNotificationAuthorizationStatus = function updateNotificationAuthorizationStatus(closure_0) {
let obj = importDefault(709);
obj = { type: "PUSH_NOTIFICATION_AUTHORIZATION_STATUS_UPDATE", authorizationStatus: closure_0 };
2026-07-20 16:05:17 +00:00
obj.dispatch(obj);
};