184 lines
11 KiB
TypeScript
184 lines
11 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] */
|
|
import ObjectWithoutProperties from '../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */
|
|
import JoinedThreadsStore from './JoinedThreadsStore.tsx'; /* Metro dependency 3786 */
|
|
import ReadStateStore from '../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
|
|
import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as ThreadConstantsModule from './ThreadConstants.tsx'; /* Metro dependency 1243 */
|
|
import * as IndexNativeModule from '../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as AppAnalyticsUtilsModule from '../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
|
|
import * as NotificationSettingsUtilsModule from '../../utils/NotificationSettingsUtils.tsx'; /* Metro dependency 6610 */
|
|
import * as ThreadAnalyticsUtilsModule from '../app_analytics/ThreadAnalyticsUtils.tsx'; /* Metro dependency 7162 */
|
|
|
|
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});
|
|
(FileImportTrackerModule).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 object = {};
|
|
const t = (IndexNativeModule).t;
|
|
object.minutes = t['1Rcf/h'];
|
|
object.hours = t.vgnx51;
|
|
object.days = t.fNvE50;
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const P7Gygz = t.P7Gygz;
|
|
object.month = Reflect.apply(string, intl, [P7Gygz]);
|
|
return object;
|
|
}
|
|
|
|
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 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 getNotificationAnalyticsString2;
|
|
var joinedThreadsStoreBinding;
|
|
var flags;
|
|
var id;
|
|
var notificationAnalyticsString2;
|
|
var isMuted;
|
|
var isMuted2;
|
|
var moduleValue3;
|
|
var muteConfigToTimestamp;
|
|
var getMuteConfig;
|
|
var value8;
|
|
var object;
|
|
var moduleValue4;
|
|
var defaultImport;
|
|
const value2 = (ThreadAnalyticsUtilsModule).collectThreadMetadata(a0);
|
|
if (value2 != null) {
|
|
guildId = a0.getGuildId();
|
|
parent_id = a0.parent_id;
|
|
currentChannelSettings = (require(6610) /* metro dependency 6610: NotificationSettingsUtils */).getCurrentChannelSettings(guildId,
|
|
|
|
parent_id);
|
|
getNotificationAnalyticsString2 = getNotificationAnalyticsString;
|
|
joinedThreadsStoreBinding = JoinedThreadsStore;
|
|
flags = joinedThreadsStoreBinding.flags;
|
|
id = a0.id;
|
|
r12 = Reflect.apply(flags, joinedThreadsStoreBinding, [id]) ?? 0;
|
|
notificationAnalyticsString2 = getNotificationAnalyticsString2(r12);
|
|
joinedThreadsStoreBinding = JoinedThreadsStore;
|
|
isMuted = joinedThreadsStoreBinding.isMuted;
|
|
id = a0.id;
|
|
isMuted2 = Reflect.apply(isMuted, joinedThreadsStoreBinding, [id]);
|
|
moduleValue3 = require(6610) /* metro dependency 6610: NotificationSettingsUtils */;
|
|
muteConfigToTimestamp = moduleValue3.muteConfigToTimestamp;
|
|
getMuteConfig = joinedThreadsStoreBinding.getMuteConfig;
|
|
id = a0.id;
|
|
value8 = Reflect.apply(muteConfigToTimestamp, moduleValue3, [Reflect.apply(getMuteConfig,
|
|
joinedThreadsStoreBinding,
|
|
[id])]);
|
|
value2.can_send_message;
|
|
value2.parent_channel_type;
|
|
object = {};
|
|
copyDataProperties(object, ObjectWithoutProperties(value2, env0_3), joinedThreadsStoreBinding);
|
|
id = a0.id;
|
|
object['channel_id'] = id;
|
|
object['guild_id'] = guildId;
|
|
object['parent_id'] = parent_id;
|
|
object['channel_type'] = a0.type;
|
|
object['has_interacted_with_thread'] = !!(r12 & ThreadMemberFlags.HAS_INTERACTED);
|
|
object['parent_is_muted'] = UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, parent_id);
|
|
object['old_thread_notification_setting'] = notificationAnalyticsString2;
|
|
flags = a1.flags;
|
|
object['new_thread_notification_setting'] = flags == null ? notificationAnalyticsString2 : getNotificationAnalyticsString2(a1.flags);
|
|
object['parent_notification_setting'] = currentChannelSettings.channel_message_notification_settings;
|
|
object['old_thread_is_muted'] = isMuted2;
|
|
object['new_thread_is_muted'] = a1.muted ?? isMuted2;
|
|
object['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);
|
|
}
|
|
object['new_thread_muted_until'] = r3;
|
|
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
|
|
defaultImport.track(AnalyticEvents.THREAD_NOTIFICATION_SETTINGS_UPDATED, object);
|
|
}
|
|
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 = (NotificationSettingsUtilsModule).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;
|
|
}
|
|
|
|
}
|
|
|
|
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 = (FluxModule).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 _fun57580() { // fn#57580, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7347:2438, offset: 0x013e988f, size: 32 bytes, params: 1, frame: 11
|
|
const readStateStoreBinding = ReadStateStore;
|
|
return readStateStoreBinding.lastMessageId(env0_0.id);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun57571, 7169, [29, 4605, 4864, 3786, 1243, 661, 1244, 4911, 4863, 683, 7162, 6610, 1391, 566, 21,
|
|
3738,
|
|
2]) /* metro module 7169, dependencies: [29, 4605, 4864, 3786, 1243, 661, 1244, 4911, 4863, 683, 7162, 6610, 1391, 566, 21, 3738, 2] */;
|