214 lines
12 KiB
TypeScript
214 lines
12 KiB
TypeScript
/* Metro module 11872; source: stores/native/PushNotificationPermissionStore.tsx; dependencies: [6, 7, 15, 17, 18, 10741, 566, 694, 2] */
|
|
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import PushNotification from '../../lib/pushnotification/PushNotification.tsx'; /* Metro dependency 10741 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun91035(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:6, offset: 0x020513e0, size: 702 bytes, params: 8, frame: 25
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
object = {INIT: 0};
|
|
object[0] = 'INIT';
|
|
object.REQUESTED = 1;
|
|
object[1] = 'REQUESTED';
|
|
object.PROMPT_SEEN = 2;
|
|
object[2] = 'PROMPT_SEEN';
|
|
object.PROMPT_SKIPPED = 3;
|
|
object[3] = 'PROMPT_SKIPPED';
|
|
const object2 = {MESSAGE_SENT: 0};
|
|
object2[0] = 'MESSAGE_SENT';
|
|
object2.INVITE_ACCEPTED = 1;
|
|
object2[1] = 'INVITE_ACCEPTED';
|
|
object2.FRIEND_REQUEST_SENT = 2;
|
|
object2[2] = 'FRIEND_REQUEST_SENT';
|
|
object2.DM_SPACE = 3;
|
|
object2[3] = 'DM_SPACE';
|
|
object2.CHANNEL_BANNER = 5;
|
|
object2[5] = 'CHANNEL_BANNER';
|
|
object2.POST_REACTION_BANNER = 6;
|
|
object2[6] = 'POST_REACTION_BANNER';
|
|
object2.GUILD_OPEN_BOTTOM_SHEET = 7;
|
|
object2[7] = 'GUILD_OPEN_BOTTOM_SHEET';
|
|
object2.CALL_DISCONNECT_BOTTOM_SHEET = 8;
|
|
object2[8] = 'CALL_DISCONNECT_BOTTOM_SHEET';
|
|
const object3 = {};
|
|
const INIT = object.INIT;
|
|
object3.permissionState = INIT;
|
|
const MESSAGE_SENT = object2.MESSAGE_SENT;
|
|
const INVITE_ACCEPTED = object2.INVITE_ACCEPTED;
|
|
const FRIEND_REQUEST_SENT = object2.FRIEND_REQUEST_SENT;
|
|
const DM_SPACE = object2.DM_SPACE;
|
|
const CHANNEL_BANNER = object2.CHANNEL_BANNER;
|
|
const POST_REACTION_BANNER = object2.POST_REACTION_BANNER;
|
|
const GUILD_OPEN_BOTTOM_SHEET = object2.GUILD_OPEN_BOTTOM_SHEET;
|
|
const CALL_DISCONNECT_BOTTOM_SHEET = object2.CALL_DISCONNECT_BOTTOM_SHEET;
|
|
object3.promptLastSeen = {[MESSAGE_SENT]: null, [INVITE_ACCEPTED]: null, [FRIEND_REQUEST_SENT]: null,
|
|
[DM_SPACE]: null, [CHANNEL_BANNER]: null, [POST_REACTION_BANNER]: null, [GUILD_OPEN_BOTTOM_SHEET]: null,
|
|
[CALL_DISCONNECT_BOTTOM_SHEET]: null};
|
|
const Set = global.Set;
|
|
let set = new Set([]);
|
|
object3.eligiblePromptTypes = set;
|
|
const DeviceSettingsStore = (Flux).DeviceSettingsStore;
|
|
set = _fun91039(DeviceSettingsStore);
|
|
set.displayName = 'PushNotificationPermissionStore';
|
|
set.persistKey = 'PushNotificationPermissionStoreKey_1';
|
|
set.migrations = [_fun91048];
|
|
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{PUSH_NOTIFICATION_PERMISSION_SET_STATE: PUSH_NOTIFICATION_PERMISSION_SET_STATE,
|
|
PUSH_NOTIFICATION_PERMISSION_REACTIVATION_SEEN: PUSH_NOTIFICATION_PERMISSION_REACTIVATION_SEEN,
|
|
PUSH_NOTIFICATION_PERMISSION_SET_ELIGIBLE: PUSH_NOTIFICATION_PERMISSION_SET_ELIGIBLE,
|
|
PUSH_NOTIFICATION_AUTHORIZATION_STATUS_UPDATE: function(a0) {
|
|
env0_11 = a0.authorizationStatus;
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/native/PushNotificationPermissionStore.tsx');
|
|
exports.default = set;
|
|
exports.PermissionStateType = object;
|
|
exports.PermissionPromptType = object2;
|
|
function _isNativeReflectConstruct_91036() { // fn#91036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:148, offset: 0x0205169e, size: 98 bytes, params: 1, frame: 18
|
|
var Boolean;
|
|
var prototype;
|
|
var valueOf;
|
|
var call;
|
|
var Reflect;
|
|
var construct;
|
|
var closure;
|
|
var value;
|
|
var error;
|
|
try {
|
|
Boolean = global.Boolean;
|
|
prototype = Boolean.prototype;
|
|
valueOf = prototype.valueOf;
|
|
call = valueOf.call;
|
|
Reflect = global.Reflect;
|
|
construct = Reflect.construct;
|
|
Boolean = global.Boolean;
|
|
closure = function() {
|
|
};
|
|
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
|
|
value = Reflect.apply(call, valueOf, [value]);
|
|
var result = !value;
|
|
} catch (error) {
|
|
}
|
|
return (_isNativeReflectConstruct_91036_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _fun91039(a0) { // fn#91039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:1199, offset: 0x02051700, size: 174 bytes, params: 2, frame: 16
|
|
const PushNotificationPermissionStore2 = PushNotificationPermissionStore;
|
|
Inherits(PushNotificationPermissionStore2, a0);
|
|
return CreateClass(PushNotificationPermissionStore2, [{key: 'initialize', value: value_91041},
|
|
{key: 'getUserAgnosticState', value: value_91044}, {key: 'permissionState', get: get_91045}, {key: 'promptSeen',
|
|
get: get_91046}, {key: 'authorizationStatus', get: get_91047}]);
|
|
function PushNotificationPermissionStore() { // fn#91040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:1211, offset: 0x00de700a, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, PushNotificationPermissionStore);
|
|
const value3 = env1_5(PushNotificationPermissionStore);
|
|
return env1_4(this, _isNativeReflectConstruct_91036() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_91041(a0) { // fn#91041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:1584, offset: 0x020517ae, size: 257 bytes, params: 2, frame: 21
|
|
let value = a0;
|
|
const object = {};
|
|
copyDataProperties(object, env1_9, undefined);
|
|
const value3 = null;
|
|
copyDataProperties(object, value3 != value ? value : value3, undefined);
|
|
const object2 = {};
|
|
copyDataProperties(object2, env1_9.promptLastSeen, undefined);
|
|
const value4 = undefined;
|
|
copyDataProperties(object2, value3 == value ? value4 : value.promptLastSeen, undefined);
|
|
object['promptLastSeen'] = object2;
|
|
const Set = global.Set;
|
|
let eligiblePromptTypes = env1_9.eligiblePromptTypes;
|
|
const items2 = [];
|
|
const value5 = arraySpread(items2, eligiblePromptTypes, 0, undefined);
|
|
const value6 = value3 == value;
|
|
eligiblePromptTypes = value6 ? value4 : value.eligiblePromptTypes;
|
|
arraySpread(items2, value3 != eligiblePromptTypes ? eligiblePromptTypes : [], value5, value6);
|
|
value = items2.filter(_fun91042);
|
|
const value7 = Object.create(Set.prototype, {constructor: {value: Set}});
|
|
const set = new Set(value);
|
|
object['eligiblePromptTypes'] = set instanceof Object ? set : value7;
|
|
(PushNotification).checkPermissions(_fun91043);
|
|
return value4;
|
|
function _fun91042(a0) { // fn#91042, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:1818, offset: 0x020518af, size: 22 bytes, params: 2, frame: 2
|
|
const POST_REACTION_BANNER = env2_8.POST_REACTION_BANNER;
|
|
return a0 !== POST_REACTION_BANNER;
|
|
}
|
|
|
|
function _fun91043({alert, sound, badge}) { // fn#91043, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:1878, offset: 0x020518c5, size: 63 bytes, params: 2, frame: 4
|
|
var value;
|
|
let r0 = alert || sound;
|
|
r0 = !r0 ? badge : r0;
|
|
if (r0) {
|
|
value = environment.__proto__.__proto__;
|
|
env2_10.permissionState = env2_7.REQUESTED;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
function value_91044() { // fn#91044, offset: 0x00fbd9ec, size: 9 bytes, params: 1, frame: 1
|
|
return env1_10;
|
|
}
|
|
|
|
function get_91045() { // fn#91045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2039, offset: 0x02051904, size: 15 bytes, params: 1, frame: 1
|
|
return env1_10.permissionState;
|
|
}
|
|
|
|
function get_91046() { // fn#91046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2099, offset: 0x02051913, size: 53 bytes, params: 1, frame: 12
|
|
const binding = env1_7;
|
|
const PROMPT_SEEN = binding.PROMPT_SEEN;
|
|
const items2 = [PROMPT_SEEN];
|
|
const PROMPT_SKIPPED = binding.PROMPT_SKIPPED;
|
|
items2[1] = PROMPT_SKIPPED;
|
|
return items2.includes(env1_10.permissionState);
|
|
}
|
|
|
|
function get_91047() { // fn#91047, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
|
|
return env1_11;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun91048(a0) { // fn#91048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2378, offset: 0x02051948, size: 244 bytes, params: 2, frame: 15
|
|
const object = {};
|
|
const binding = env0_9;
|
|
copyDataProperties(object, binding, undefined);
|
|
copyDataProperties(object, a0, undefined);
|
|
const object2 = {};
|
|
copyDataProperties(object2, binding.promptLastSeen, undefined);
|
|
copyDataProperties(object2, a0.promptLastSeen, undefined);
|
|
object['promptLastSeen'] = object2;
|
|
object['eligiblePromptTypes'] = a0.eligiblePromptTypes == null ? new global.Set([]) : global.Array.isArray(a0.eligiblePromptTypes) ? new global.Set(a0.eligiblePromptTypes) : a0.eligiblePromptTypes instanceof global.Set ? a0.eligiblePromptTypes : new global.Set([]);
|
|
return object;
|
|
}
|
|
|
|
function PUSH_NOTIFICATION_PERMISSION_SET_STATE({permissionState}) { // fn#91049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2712, offset: 0x02051a3c, size: 26 bytes, params: 2, frame: 2
|
|
env0_10.permissionState = permissionState;
|
|
}
|
|
|
|
function PUSH_NOTIFICATION_PERMISSION_REACTIVATION_SEEN({promptType}) { // fn#91050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2845, offset: 0x02051a56, size: 58 bytes, params: 2, frame: 11
|
|
const promptLastSeen = env0_10.promptLastSeen;
|
|
const Date = global.Date;
|
|
promptLastSeen[promptType] = new Date();
|
|
return true;
|
|
}
|
|
|
|
function PUSH_NOTIFICATION_PERMISSION_SET_ELIGIBLE({promptType}) { // fn#91051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12058:2986, offset: 0x02051a90, size: 74 bytes, params: 2, frame: 13
|
|
const binding = env0_10;
|
|
const Set = global.Set;
|
|
binding.eligiblePromptTypes = new Set(env0_10.eligiblePromptTypes).add(promptType);
|
|
return true;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun91035, 11872, [6, 7, 15, 17, 18, 10741, 566, 694,
|
|
2]) /* metro module 11872, dependencies: [6, 7, 15, 17, 18, 10741, 566, 694, 2] */;
|