168 lines
9.0 KiB
TypeScript
168 lines
9.0 KiB
TypeScript
/* Metro module 7169; source: modules/threads/ThreadUtils.tsx; dependencies: [29, 4605, 4864, 3786, 1243, 661, 1244, 4911, 4863, 683, 7162, 6610, 1391, 566, 21, 3738, 2] */
|
|
function _fun57571(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#57571, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:6, offset: 0x013e91d8, size: 316 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const env0_3 = ['can_send_message', 'parent_channel_type'];
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_4 = importDefault(29) /* metro dependency 29 */;
|
|
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
|
|
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
|
|
const joinedThreadsStore = importDefault(3786) /* metro dependency 3786: JoinedThreadsStore */;
|
|
const env0_8 = (require(1243) /* metro dependency 1243: ThreadConstants */).ThreadMemberFlags;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_9 = constantsModule.AnalyticEvents;
|
|
const env0_10 = constantsModule.UserNotificationSettings;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/threads/ThreadUtils.tsx');
|
|
exports.getTimestampString = importDefault(4911) /* metro dependency 4911: getTimestampString */;
|
|
exports.getTimestampAccessibilityLabel = function(a0) {
|
|
return importDefault(dependencyMap[7])(a0, getAccessibilityLabelFormatter);
|
|
};
|
|
exports.trackThreadBrowserTab = function() {
|
|
require(dependencyMap[8]).trackWithMetadata(AnalyticEvents.THREAD_BROWSER_TAB_CHANGED);
|
|
};
|
|
exports.trackThreadBrowserOpened = trackThreadBrowserOpened;
|
|
exports.trackActiveThreadsPopoutOpened = function() {
|
|
var defaultImport = importDefault(dependencyMap[9]);
|
|
var OPEN_POPOUT = AnalyticEvents.OPEN_POPOUT;
|
|
defaultImport.track(OPEN_POPOUT, {type: 'Active Threads Popout'});
|
|
};
|
|
exports.trackThreadNotificationSettingsUpdated = trackThreadNotificationSettingsUpdated;
|
|
exports.useLastMessageTimestamp = useLastMessageTimestamp;
|
|
}
|
|
|
|
function getAccessibilityLabelFormatter() { // fn#57572, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:302, offset: 0x013e9314, size: 152 bytes, params: 1, frame: 15
|
|
const object2 = {};
|
|
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
|
|
object2.minutes = t['1Rcf/h'];
|
|
object2.hours = t.vgnx51;
|
|
object2.days = t.fNvE50;
|
|
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
|
|
const string = intl.string;
|
|
const P7Gygz = t.P7Gygz;
|
|
object2.month = Reflect.apply(string, intl, [P7Gygz]);
|
|
return object2;
|
|
}
|
|
|
|
function trackThreadBrowserOpened() { // fn#57575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:741, offset: 0x013e9404, size: 77 bytes, params: 1, frame: 16
|
|
const value = a0;
|
|
const r5 = value !== undefined ? value : 'Modal';
|
|
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
|
|
const trackWithMetadata = appAnalyticsUtilsModule.trackWithMetadata;
|
|
const OPEN_MODAL = AnalyticEvents.OPEN_MODAL;
|
|
Reflect.apply(trackWithMetadata, appAnalyticsUtilsModule, [OPEN_MODAL, {type: 'Thread Browser',
|
|
location_section: r5}]);
|
|
}
|
|
|
|
function trackThreadNotificationSettingsUpdated(a0, a1) { // fn#57577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:1047, offset: 0x013e948d, size: 547 bytes, params: 3, frame: 28
|
|
var r12;
|
|
var r3;
|
|
var guildId;
|
|
var parent_id;
|
|
var currentChannelSettings;
|
|
var closure;
|
|
var flags;
|
|
var id;
|
|
var value7;
|
|
var isMuted;
|
|
var isMuted2;
|
|
var moduleValue3;
|
|
var muteConfigToTimestamp;
|
|
var getMuteConfig;
|
|
var value8;
|
|
var object2;
|
|
var moduleValue4;
|
|
var defaultImport;
|
|
const value2 = (require(7162) /* metro dependency 7162: ThreadAnalyticsUtils */).collectThreadMetadata(a0);
|
|
if (value2 != null) {
|
|
guildId = a0.getGuildId();
|
|
parent_id = a0.parent_id;
|
|
currentChannelSettings = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).getCurrentChannelSettings(guildId,
|
|
|
|
parent_id);
|
|
closure = getNotificationAnalyticsString;
|
|
flags = JoinedThreadsStore.flags;
|
|
id = a0.id;
|
|
r12 = Reflect.apply(flags, JoinedThreadsStore, [id]) ?? 0;
|
|
value7 = closure(r12);
|
|
isMuted = JoinedThreadsStore.isMuted;
|
|
id = a0.id;
|
|
isMuted2 = Reflect.apply(isMuted, JoinedThreadsStore, [id]);
|
|
moduleValue3 = require(6610) /* metro dependency 6610: NotificationSettingsUtils */;
|
|
muteConfigToTimestamp = moduleValue3.muteConfigToTimestamp;
|
|
getMuteConfig = JoinedThreadsStore.getMuteConfig;
|
|
id = a0.id;
|
|
value8 = Reflect.apply(muteConfigToTimestamp, moduleValue3, [Reflect.apply(getMuteConfig, JoinedThreadsStore,
|
|
[id])]);
|
|
value2.can_send_message;
|
|
value2.parent_channel_type;
|
|
object2 = {};
|
|
copyDataProperties(object2, env0_4(value2, env0_3), JoinedThreadsStore);
|
|
id = a0.id;
|
|
object2['channel_id'] = id;
|
|
object2['guild_id'] = guildId;
|
|
object2['parent_id'] = parent_id;
|
|
object2['channel_type'] = a0.type;
|
|
object2['has_interacted_with_thread'] = !!(r12 & ThreadMemberFlags.HAS_INTERACTED);
|
|
object2['parent_is_muted'] = UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, parent_id);
|
|
object2['old_thread_notification_setting'] = value7;
|
|
flags = a1.flags;
|
|
object2['new_thread_notification_setting'] = flags == null ? value7 : closure(a1.flags);
|
|
object2['parent_notification_setting'] = currentChannelSettings.channel_message_notification_settings;
|
|
object2['old_thread_is_muted'] = isMuted2;
|
|
object2['new_thread_is_muted'] = a1.muted ?? isMuted2;
|
|
object2['old_thread_muted_until'] = value8;
|
|
if (a1.mute_config == null) {
|
|
r3 = value8;
|
|
} else {
|
|
moduleValue4 = require(6610) /* metro dependency 6610: NotificationSettingsUtils */;
|
|
r3 = moduleValue4.muteConfigToTimestamp(a1.mute_config);
|
|
}
|
|
object2['new_thread_muted_until'] = r3;
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.THREAD_NOTIFICATION_SETTINGS_UPDATED, object2);
|
|
}
|
|
}
|
|
|
|
function useLastMessageTimestamp(a0) { // fn#57579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:2391, offset: 0x013e97b6, size: 217 bytes, params: 2, frame: 19
|
|
const env0_0 = a0;
|
|
var value;
|
|
const value2 = undefined;
|
|
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([ReadStateStore], _fun57580);
|
|
const value4 = null;
|
|
const r5 = value4 != value3 ? (importDefault(21) /* metro dependency 21: SnowflakeUtils */).extractTimestamp(value3) : value4;
|
|
const threadMetadata = a0.threadMetadata;
|
|
const createTimestamp = value4 == threadMetadata ? value2 : threadMetadata.createTimestamp;
|
|
let r0 = value4 != createTimestamp ? (importDefault(3738) /* metro dependency 3738 */)(createTimestamp).valueOf() : value4;
|
|
r0 = value4 != r5 ? r5 : r0;
|
|
if (value4 == r0) {
|
|
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
|
|
value = value.extractTimestamp(a0.id);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function getNotificationAnalyticsString(a0) { // fn#57578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:1264, owner: trackThreadNotificationSettingsUpdated.getNotificationAnalyticsString, offset: 0x013e96b0, size: 262 bytes, params: 2, frame: 19
|
|
var r0;
|
|
var moduleValue2;
|
|
var moduleValue3;
|
|
const MessageNotificationSettings = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).MessageNotificationSettings;
|
|
const flagUtilsModule = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
const hasFlag = flagUtilsModule.hasFlag;
|
|
const ALL_MESSAGES = ThreadMemberFlags.ALL_MESSAGES;
|
|
if (Reflect.apply(hasFlag, flagUtilsModule, [a0, ALL_MESSAGES])) {
|
|
r0 = MessageNotificationSettings[UserNotificationSettings.ALL_MESSAGES];
|
|
} else {
|
|
moduleValue2 = flagUtilsModule;
|
|
if (moduleValue2.hasFlag(a0, ThreadMemberFlags.ONLY_MENTIONS)) {
|
|
r0 = MessageNotificationSettings[UserNotificationSettings.ONLY_MENTIONS];
|
|
} else {
|
|
moduleValue3 = require(1391) /* metro dependency 1391: FlagUtils */;
|
|
r0 = moduleValue3.hasFlag(a0,
|
|
ThreadMemberFlags.NO_MESSAGES) ? MessageNotificationSettings[UserNotificationSettings.NO_MESSAGES] : MessageNotificationSettings[UserNotificationSettings.NULL];
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|