decord/source/stores/native/InAppNotificationStore.tsx
github-actions ecf26fc058 chore: update source for alpha 347.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4823.js (118.4 MB)
2026-09-16 07:03:15 +00:00

789 lines
33 KiB
TypeScript

// Module ID: 10218
// Function ID: 10219
// Name: InAppNotificationStore
// Dependencies: [1957, 4654, 10219, 7225, 7647, 1220, 1958, 1980, 10220, 4653, 2012, 1952, 1372, 1074, 8133, 8131, 4229, 12, 10221, 10223, 7439, 7380, 10224, 9750, 4861, 10232, 10233, 10235, 10228, 10236, 10240, 4792, 1936, 1186, 7969, 10241, 4818, 11, 504, 573, 2]
// Module 10218 (InAppNotificationStore)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import _modDef4229 from "module_4229" /* 4229 */;
import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 4818 */;
import isSystemMessageDefault from "isSystemMessage" /* 7380 */;
import GuildAntiRaidUtils from "GuildAntiRaidUtils" /* 8131 */;
import GuildAntiRaidTypes from "GuildAntiRaidTypes" /* 8133 */;
import ExternalPipDefault from "ExternalPip" /* 9750 */;
import RestrictedScheduleNotificationUtils from "RestrictedScheduleNotificationUtils" /* 10221 */;
import MessageUtils from "MessageUtils" /* 10223 */;
import NotificationTextUtils from "NotificationTextUtils" /* 10224 */;
import InAppNotificationUtils from "InAppNotificationUtils" /* 10233 */;
import InAppNotificationActionCreatorsDefault from "InAppNotificationActionCreators" /* 10235 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 1957 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4654 */;
import GuildIncidentsStore from "GuildIncidentsStore" /* 10219 */;
import FamilyCenterStore from "FamilyCenterStore" /* 7647 */;
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1220 */;
import ChannelStore from "ChannelStore" /* 1958 */;
import GuildStore from "GuildStore" /* 1980 */;
import NotificationSettingsStore from "NotificationSettingsStore" /* 10220 */;
import ReadStateStore from "ReadStateStore" /* 4653 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2012 */;
import UserRequiredActionStore from "UserRequiredActionStore" /* 1952 */;
import UserStore from "UserStore" /* 1372 */;
const playInAppMessageSound = tmp(10241);
require = fn;
function handleAlertMessage() {
if (obj.allowInAppNotifications()) {
const result = tmp(10236).shouldShowRaidInAppNotification();
const guildId = result.guildId;
if (result.show) {
if (null != guildId) {
const guild = GuildStore.getGuild(guildId);
if (null == guild) {
return false;
} else {
channel = ChannelStore.getChannel(channel(10240)(guild));
if (null == channel) {
return false;
} else if (SelectedChannelStore.getChannelId() === channel.id) {
return false;
} else {
obj2 = { guild, channel };
if (merged.wasRecentlyDismissed(obj2)) {
return false;
} else {
const ALERT = constants3.ALERT;
const obj3 = { notification: null };
const obj4 = {
type: ALERT,
key: guildId,
duration: tmp(10233).getNotificationDuration(ALERT),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
merged.dismissNotification({ guild, channel });
},
channel,
guild,
inAppNotificationId: null
};
const tmpResult3 = tmp(10233);
obj4.inAppNotificationId = tmp(10233).generateInAppNotificationId();
obj3.notification = obj4;
handleEnqueueNotification(obj3);
}
}
}
}
}
return false;
} else {
return false;
}
obj = guild(10224);
}
function handleEnqueueNotification(notification) {
notification = notification.notification;
const result = InAppNotificationUtils.extractMetadataFromNotification(notification);
({ guildId, channelId, messageId } = result);
const trackWithMetadata = AppAnalyticsUtilsDefault.trackWithMetadata;
if (isInRestrictedHours) {
obj2 = { type: notification.type, guild_id: guildId, channel_id: channelId, message_id: messageId, dismiss_reason: "restricted_hours", in_app_notification_id: notification.inAppNotificationId };
trackWithMetadata(tmp5.IN_APP_NOTIFICATION_DISMISSED, obj2);
return false;
} else {
const obj4 = { type: notification.type, guild_id: guildId, channel_id: channelId, in_app_notification_id: notification.inAppNotificationId, message_id: messageId };
trackWithMetadata(tmp5.IN_APP_NOTIFICATION_CREATED, obj4);
obj2.enqueue(notification);
const result1 = playInAppMessageSound.playInAppMessageSound(notification);
if (null == c21) {
c21 = obj2.tryDrain();
}
}
}
function trackDismissed(type, arg1) {
const result = InAppNotificationUtils.extractMetadataFromNotification(type);
({ guildId, channelId, messageId } = result);
AppAnalyticsUtilsDefault.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, { type: type.type, guild_id: guildId, channel_id: channelId, message_id: messageId, dismiss_reason: "rejected_from_queue", in_app_notification_id: type.inAppNotificationId });
}
let closure_6 = fn(7225).trackMessageNotificationTimestamps;
const Constants = fn(1074);
({ AnalyticEvents: closure_16, ChannelTypes: closure_17, InAppNotificationTypes: closure_18, MessageTypesSets: closure_19 } = Constants);
class AlertDismissalHandler {
constructor() {
merged = Object.assign({ dissmissedAlertsMap: null, threshold: null });
obj = {};
map = new Map();
obj[closure_0(closure_2[14]).GuildIncidentAlertTypes.JOIN_RAID] = map;
map1 = new Map();
obj[closure_0(closure_2[14]).GuildIncidentAlertTypes.DM_RAID] = map1;
merged[0] = obj;
merged[1] = { amount: 1, unitOfTime: "hour" };
return merged;
}
}
const prototype = AlertDismissalHandler.prototype;
prototype["key"] = function key(guild) {
return guild.guild.id + guild.channel.id;
};
prototype["dismissNotification"] = function dismissNotification(guild) {
guild = guild.guild;
const incidentAlertType = GuildAntiRaidUtils.getIncidentAlertType(GuildIncidentsStore.getGuildIncident(guild.id));
if (null != incidentAlertType) {
const self = this;
obj2 = { guild, channel: guild.channel };
const result = this.dissmissedAlertsMap[incidentAlertType].set(this.key(obj2), _modDef4229());
const keyResult = this.key(obj2);
}
};
prototype["wasRecentlyDismissed"] = function wasRecentlyDismissed(guild) {
guild = guild.guild;
const incidentAlertType = GuildAntiRaidUtils.getIncidentAlertType(GuildIncidentsStore.getGuildIncident(guild.id));
if (null == incidentAlertType) {
return false;
} else {
const self = this;
const obj3 = { guild, channel: guild.channel };
value = this.dissmissedAlertsMap[incidentAlertType].get(this.key(obj3));
let tmp4 = undefined !== value;
if (tmp4) {
tmp4 = _modDef4229().diff(_modDef4229(value), self.threshold.unitOfTime) < self.threshold.amount;
obj2 = _modDef4229();
}
return tmp4;
}
};
let merged = Object.assign({ dissmissedAlertsMap: null, threshold: null });
let obj = {};
obj[fn(8133).GuildIncidentAlertTypes.JOIN_RAID] = new Map();
let map = new Map();
obj[fn(8133).GuildIncidentAlertTypes.DM_RAID] = new Map();
merged[0] = obj;
merged[1] = { amount: 1, unitOfTime: "hour" };
let c21 = null;
class NotificationQueue {
constructor() {
obj = Object.create(new.target.prototype);
obj.queue = [];
return obj;
}
}
const prototype2 = NotificationQueue.prototype;
prototype2["enqueue"] = function enqueue(arg0) {
const self = this;
if (this.isFull()) {
const queue = self.queue;
const arr = queue.shift();
if (null != arr) {
const result = InAppNotificationUtils.extractMetadataFromNotification(arr);
({ guildId, channelId, messageId } = result);
const obj3 = { type: arr.type, guild_id: guildId, channel_id: channelId, message_id: messageId, dismiss_reason: "evicted_from_queue", in_app_notification_id: arr.inAppNotificationId };
AppAnalyticsUtilsDefault.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj3);
}
}
const queue1 = self.queue;
queue1.push(arg0);
};
prototype2["tryDrain"] = function tryDrain() {
const queue = this.queue;
return queue.shift();
};
prototype2["isFull"] = function isFull() {
return this.queue.length >= 2;
};
prototype2["removeAll"] = function removeAll(arg0) {
const removeResult = _modDef12.remove(this.queue, arg0);
while (tmp2 !== undefined) {
let tmp5 = trackDismissed(tmp3, "rejected_from_queue");
continue;
}
};
let obj2 = Object.create(NotificationQueue.prototype);
obj2.queue = [];
let isInRestrictedHours = FamilyCenterStore.isCurrentUserInRestrictedHours();
let c24 = false;
let EMPTY_SCHEDULE_SNAPSHOT = fn(10221).EMPTY_SCHEDULE_SNAPSHOT;
const Store = initializeDefault.Store;
class InAppNotificationStore extends Store {
}
const prototype3 = InAppNotificationStore.prototype;
prototype3["initialize"] = function initialize() {
this.waitFor(ChannelRTCStore, ChannelStore, EmbeddedActivitiesStore, FamilyCenterStore, GuildIncidentsStore, GuildStore, NotificationSettingsStore, ReadStateStore, SelectedChannelStore, UserRequiredActionStore, UserSettingsProtoStore, UserStore);
const items = [GuildIncidentsStore];
this.syncWith(items, handleAlertMessage);
};
prototype3["getCurrentNotification"] = function getCurrentNotification() {
return c21;
};
InAppNotificationStore.displayName = "InAppNotificationStore";
const inAppNotificationStore = new InAppNotificationStore(DispatcherDefault, {
POST_CONNECTION_OPEN: function handlePostConnectionOpen() {
c24 = true;
const currentUser = UserStore.getCurrentUser();
let restrictedSchedule;
if (currentUser != null) {
restrictedSchedule = currentUser.restrictedSchedule;
}
let tmp3 = null;
if (null != restrictedSchedule) {
tmp3 = null;
if (0 !== restrictedSchedule.rules.length) {
tmp3 = restrictedSchedule;
}
}
EMPTY_SCHEDULE_SNAPSHOT = RestrictedScheduleNotificationUtils.toScheduleSnapshot(tmp3);
handleAlertMessage();
},
LOGOUT: function handleLogout() {
c24 = false;
EMPTY_SCHEDULE_SNAPSHOT = RestrictedScheduleNotificationUtils.EMPTY_SCHEDULE_SNAPSHOT;
c21 = null;
obj2.removeAll(() => true);
},
GUILD_UPDATE: handleAlertMessage,
MESSAGE_CREATE: function handleIncomingMessage(message) {
message = message.message;
const channel_id = message.channel_id;
if (obj.canViewPotentiallyNSFWChannel(channel_id)) {
if (tmpResult.shouldShowSpoilerGateForChannelId(channel_id)) {
return false;
} else {
if (isSystemMessageDefault(message)) {
const SELF_MENTIONABLE_SYSTEM = constants4.SELF_MENTIONABLE_SYSTEM;
if (!SELF_MENTIONABLE_SYSTEM.has(message.type)) {
return false;
}
}
if (!message.optimistic) {
if (tmpResult8.allowInAppNotifications()) {
if (!tmp3Result.isEnabled()) {
if (!ChannelRTCStore.getChatOpen(channel_id)) {
const result = tmp(10224).shouldIncludeSelectedChannel();
const tmpResult9 = tmp(10224);
if (tmpResult10.shouldNotify(message, channel_id, result)) {
const channel = ChannelStore.getChannel(channel_id);
if (null == channel) {
return false;
} else {
const messageRecord = tmp(4861).createMessageRecord(message);
const tmpResult11 = tmp(4861);
if (tmpResult12.isMessageContentPreviewable(messageRecord)) {
closure_6(message, channel.guild_id);
const MESSAGE = constants3.MESSAGE;
obj2 = { notification: null };
const obj3 = { type: MESSAGE, guild: null, channel: null, message: null, key: null, duration: null, onDismiss: null, parentChannel: null, inAppNotificationId: null, mentionCount: null };
const notificationDuration = tmp(10233).getNotificationDuration(MESSAGE);
obj3.guild = GuildStore.getGuild(channel.getGuildId());
obj3.channel = channel;
obj3.message = messageRecord;
obj3.key = messageRecord.id;
obj3.duration = notificationDuration;
obj3.onDismiss = function onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
};
obj3.parentChannel = obj7.getChannel(channel.parent_id);
const tmpResult13 = tmp(10233);
obj3.inAppNotificationId = tmp(10233).generateInAppNotificationId();
obj3.mentionCount = ReadStateStore.getMentionCount(channel.id);
obj2.notification = obj3;
handleEnqueueNotification(obj2);
} else {
return false;
}
tmpResult12 = tmp(10232);
}
obj7 = ChannelStore;
} else {
return false;
}
tmpResult10 = tmp(10224);
}
}
tmp3Result = ExternalPipDefault;
}
tmpResult8 = tmp(10224);
}
return false;
}
tmpResult = tmp(7439);
} else {
return false;
}
obj = MessageUtils;
},
MESSAGE_REQUEST_NOTIFICATION_SENT: function handleMessageRequest(triggeringUserId) {
triggeringUserId = triggeringUserId.triggeringUserId;
const user = UserStore.getUser(triggeringUserId);
if (null == user) {
return false;
} else {
const MESSAGE_REQUEST = constants3.MESSAGE_REQUEST;
const obj = { notification: null };
obj2 = { type: MESSAGE_REQUEST, author: user, numMutualGuilds: triggeringUserId.numMutualGuilds, key: null, duration: null, onDismiss: null, inAppNotificationId: null };
const _HermesInternal = HermesInternal;
obj2.key = "message-request-" + triggeringUserId;
obj2.duration = InAppNotificationUtils.getNotificationDuration(MESSAGE_REQUEST);
obj2.onDismiss = function onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
};
obj2.inAppNotificationId = InAppNotificationUtils.generateInAppNotificationId();
obj.notification = obj2;
handleEnqueueNotification(obj);
}
},
MESSAGE_ACK: function handleMessageAck(channelId) {
channelId = channelId.channelId;
const messageId = channelId.messageId;
let tmp = null != _null;
if (tmp) {
let tmp4 = _null.type === constants3.MESSAGE && tmp2.channel.id === channelId;
if (tmp4) {
tmp4 = messageId(11).compare(tmp2.message.id, messageId) <= 0;
let obj = messageId(11);
}
tmp = tmp4;
}
if (tmp) {
obj2 = channelId(10233);
const result = obj2.extractMetadataFromNotification(_null);
({ guildId, channelId: channelId2, messageId: messageId2 } = result);
const obj4 = { type: _null.type, guild_id: guildId, channel_id: channelId2, message_id: messageId2, dismiss_reason: "message_acked", in_app_notification_id: _null.inAppNotificationId };
messageId(4818).trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj4);
const obj3 = messageId(4818);
}
obj2.removeAll(function predicate(type) {
let tmp = type.type === constants3.MESSAGE;
if (tmp) {
tmp = type.channel.id === channelId;
}
if (tmp) {
tmp = SnowflakeUtilsDefault.compare(type.message.id, messageId) <= 0;
}
return tmp;
});
if (null != _null) {
let tmp17 = _null.type === constants3.MESSAGE && tmp15.channel.id === channelId;
if (tmp17) {
tmp17 = messageId(11).compare(tmp15.message.id, messageId) <= 0;
const obj6 = messageId(11);
}
if (tmp17) {
_null = obj5.tryDrain();
let flag = true;
}
return flag;
}
flag = false;
if (null == _null) {
_null = obj5.tryDrain();
flag = true;
}
},
REACTION_NOTIFICATION_SENT: function handleReactionNotification(arg0) {
({ message, emoji } = arg0);
if (null != message) {
if (null != message.reactions) {
if (null != emoji) {
if (obj14.allowInAppNotifications()) {
let tryParseChannelPathResult = tmp19(4792).tryParseChannelPath(tmp);
if (tryParseChannelPathResult == null) {
tryParseChannelPathResult = { channelId: null, guildId: null };
}
({ channelId, guildId } = tryParseChannelPathResult);
if (null != channelId) {
if (null != guildId) {
const ReactionNotifications = tmp19(1936).ReactionNotifications;
const setting = ReactionNotifications.getSetting();
if (setting === tmp19(1186).ReactionNotificationType.NOTIFICATIONS_DISABLED) {
return false;
} else {
const channel = ChannelStore.getChannel(channelId);
let type1;
if (channel != null) {
type1 = channel.type;
}
let result = null != type1;
if (result) {
result = channel.type === constants2.GUILD_ANNOUNCEMENT;
}
if (channel != null) {
const type = channel.type;
}
if (!result) {
result = tmp19Result8.isReactionMilestoneNotification(message.reactions, type);
}
const guild = GuildStore.getGuild(guildId);
const user = UserStore.getUser(tmp2);
if (null != channel) {
if (!obj4.isEnabled()) {
if (!ChannelRTCStore.getChatOpen(channelId)) {
const result1 = tmp19(10224).shouldIncludeSelectedChannel();
const tmp19Result9 = tmp19(10224);
const obj = { message, channel, reactor: user, includeSelectedChannel: result1 };
if (tmp19Result10.shouldNotifyForReaction(obj)) {
const messageRecord = tmp19(4861).createMessageRecord(message);
const tmp19Result11 = tmp19(4861);
if (tmp19Result12.isMessageContentPreviewable(messageRecord)) {
const reactions = message.reactions;
const found = reactions.find((emoji) => {
let tmp2 = emoji.emoji.id === emoji.id;
if (tmp2) {
tmp2 = null != tmp.id;
}
if (!tmp2) {
tmp2 = emoji.emoji.name === tmp.name;
}
return tmp2;
});
if (null == found) {
if (!result) {
return false;
}
}
const REACTION = constants3.REACTION;
obj2 = { notification: null };
const obj3 = {
type: REACTION,
key: channelId,
duration: tmp19(10233).getNotificationDuration(REACTION),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
channel,
guild,
user,
message: messageRecord,
parentChannel: ChannelStore.getChannel(channel.parent_id),
reaction: found,
inAppNotificationId: null
};
const tmp19Result13 = tmp19(10233);
obj3.inAppNotificationId = tmp19(10233).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
} else {
return false;
}
tmp19Result12 = tmp19(10232);
} else {
return false;
}
tmp19Result10 = tmp19(10224);
}
}
return false;
}
return false;
}
}
}
return false;
}
obj14 = emoji(10224);
}
}
}
return false;
},
MESSAGE_REMINDER_DUE: function handleMessageReminderDue(savedMessage) {
savedMessage = savedMessage.savedMessage;
if (obj.isForLaterExperimentOn("inAppNotificationStore")) {
if (null != savedMessage.message) {
const channel = ChannelStore.getChannel(savedMessage.saveData.channelId);
if (null != channel) {
const _HermesInternal = HermesInternal;
const MESSAGE_REMINDER = constants3.MESSAGE_REMINDER;
obj2 = { notification: null };
const obj3 = {
type: MESSAGE_REMINDER,
key: "" + savedMessage.saveData.channelId + "-" + savedMessage.saveData.messageId,
duration: tmp(10233).getNotificationDuration(MESSAGE_REMINDER),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
channel,
author: savedMessage.message.author,
savedMessage,
inAppNotificationId: null
};
const tmpResult = tmp(10233);
obj3.inAppNotificationId = tmp(10233).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
const tmpResult2 = tmp(10233);
}
}
}
},
RESTRICTED_HOURS_WARNING: function handleRestrictedHoursWarning(arg0) {
if (NotificationSettingsStore.screenDowntimeReminder) {
const RESTRICTED_HOURS_WARNING = constants3.RESTRICTED_HOURS_WARNING;
const obj = { notification: null };
obj2 = {
type: RESTRICTED_HOURS_WARNING,
key: "restricted-hours-warning",
duration: InAppNotificationUtils.getNotificationDuration(RESTRICTED_HOURS_WARNING),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
title: tmp,
subtitle: tmp2,
inAppNotificationId: null
};
obj2.inAppNotificationId = InAppNotificationUtils.generateInAppNotificationId();
obj.notification = obj2;
handleEnqueueNotification(obj);
} else {
return false;
}
},
RESTRICTED_HOURS_STATE_CHANGE: function handleRestrictedHoursStateChange(isInRestrictedHours) {
isInRestrictedHours = isInRestrictedHours.isInRestrictedHours;
if (isInRestrictedHours) {
if (null != _null) {
obj2 = InAppNotificationUtils;
const result = obj2.extractMetadataFromNotification(_null);
({ guildId, channelId, messageId } = result);
const obj4 = { type: _null.type, guild_id: guildId, channel_id: channelId, message_id: messageId, dismiss_reason: "restricted_hours", in_app_notification_id: _null.inAppNotificationId };
AppAnalyticsUtilsDefault.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj4);
}
obj2.removeAll(() => true);
if (null != _null) {
_null = obj.tryDrain();
} else if (null == _null) {
_null = obj.tryDrain();
}
} else {
return false;
}
},
THREAD_CREATE: function handleThreadCreate(channel) {
channel = channel.channel;
const channel1 = ChannelStore.getChannel(channel.parent_id);
if (null != channel1) {
if (channel1.isForumLikeChannel()) {
if (channel.isNewlyCreated) {
if (obj2.allowInAppNotifications()) {
const tmpResult = tmp(10224);
if (tmpResult.shouldNotifyForForumThreadCreation(channel, channel1, !tmpResult4.isChannelFocused())) {
const user = UserStore.getUser(channel.ownerId);
if (null == user) {
return false;
} else {
const guild = GuildStore.getGuild(channel1.guild_id);
if (null == guild) {
return false;
} else {
const FORUM_THREAD_CREATED = constants3.FORUM_THREAD_CREATED;
const obj = { notification: null };
const obj3 = {
type: FORUM_THREAD_CREATED,
thread: channel,
threadCreator: user,
parentChannel: channel1,
guild,
key: channel.id,
duration: tmp(10233).getNotificationDuration(FORUM_THREAD_CREATED),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
inAppNotificationId: null
};
const tmpResult5 = tmp(10233);
obj3.inAppNotificationId = tmp(10233).generateInAppNotificationId();
obj.notification = obj3;
handleEnqueueNotification(obj);
}
}
}
tmpResult4 = tmp(10228);
}
return false;
} else {
return false;
}
}
}
return false;
},
CLEAR_IN_APP_NOTIFICATION: function handleClearInAppNotification() {
c21 = obj2.tryDrain();
},
ENQUEUE_IN_APP_NOTIFICATION: handleEnqueueNotification,
CHANNEL_SELECT: function handleChannelSelect(channelId) {
channelId = channelId.channelId;
let tmp = null != _null;
if (tmp) {
let tmp4 = _null.type === constants3.MESSAGE && tmp2.channel.id === channelId;
if (!tmp4) {
tmp4 = tmp2.type === tmp3.MESSAGE_FAILED_TO_SEND && tmp2.channelId === channelId;
const tmp5 = tmp2.type === tmp3.MESSAGE_FAILED_TO_SEND && tmp2.channelId === channelId;
}
if (!tmp4) {
tmp4 = tmp2.type === tmp3.ALERT && tmp2.channel.id === channelId;
let tmp6 = tmp2.type === tmp3.ALERT && tmp2.channel.id === channelId;
}
tmp = tmp4;
}
if (tmp) {
const result = channelId(10233).extractMetadataFromNotification(_null);
({ guildId, channelId: channelId2, messageId } = result);
obj2 = AppAnalyticsUtilsDefault;
const obj3 = { type: _null.type, guild_id: guildId, channel_id: channelId2, message_id: messageId, dismiss_reason: "notification_clicked", in_app_notification_id: _null.inAppNotificationId };
obj2.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj3);
const obj = channelId(10233);
}
obj2.removeAll(function predicate(type) {
let tmp2 = type.type === constants3.MESSAGE;
if (tmp2) {
tmp2 = type.channel.id === channelId;
}
if (!tmp2) {
let tmp4 = type.type === tmp.MESSAGE_FAILED_TO_SEND;
if (tmp4) {
tmp4 = type.channelId === channelId;
}
tmp2 = tmp4;
}
if (!tmp2) {
let tmp6 = type.type === tmp.ALERT;
if (tmp6) {
tmp6 = type.channel.id === channelId;
}
tmp2 = tmp6;
}
return tmp2;
});
if (null != _null) {
let tmp17 = _null.type === constants3.MESSAGE && tmp15.channel.id === channelId;
if (!tmp17) {
tmp17 = tmp15.type === tmp16.MESSAGE_FAILED_TO_SEND && tmp15.channelId === channelId;
const tmp18 = tmp15.type === tmp16.MESSAGE_FAILED_TO_SEND && tmp15.channelId === channelId;
}
if (!tmp17) {
tmp17 = tmp15.type === tmp16.ALERT && tmp15.channel.id === channelId;
const tmp19 = tmp15.type === tmp16.ALERT && tmp15.channel.id === channelId;
}
if (tmp17) {
_null = obj4.tryDrain();
let flag = true;
}
return flag;
}
flag = false;
if (null == _null) {
_null = obj4.tryDrain();
flag = true;
}
},
CHANNEL_RTC_UPDATE_CHAT_OPEN: function handleVoiceChatOpen(channelId) {
channelId = channelId.channelId;
const chatOpen = channelId.chatOpen;
let tmp = null != _null;
if (tmp) {
tmp = _null.type === constants3.MESSAGE && _null.channel.id === channelId && chatOpen;
const tmp3 = _null.type === constants3.MESSAGE && _null.channel.id === channelId && chatOpen;
}
if (tmp) {
const result = channelId(10233).extractMetadataFromNotification(_null);
({ guildId, channelId: channelId2, messageId } = result);
obj2 = chatOpen(4818);
const obj3 = { type: _null.type, guild_id: guildId, channel_id: channelId2, message_id: messageId, dismiss_reason: "notification_clicked", in_app_notification_id: _null.inAppNotificationId };
obj2.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj3);
const obj = channelId(10233);
}
obj2.removeAll(function predicate(type) {
let tmp = type.type === constants3.MESSAGE;
if (tmp) {
tmp = type.channel.id === channelId;
}
if (tmp) {
tmp = chatOpen;
}
return tmp;
});
if (null != _null) {
if (tmp13) {
_null = obj4.tryDrain();
let flag = true;
}
return flag;
}
flag = false;
if (null == _null) {
_null = obj4.tryDrain();
flag = true;
}
},
USER_SETTINGS_PROTO_UPDATE: function handleUserSettingsUpdate() {
const result = NotificationTextUtils.allowInAppNotifications();
let flag = !result;
if (!result) {
if (null != _null) {
const result1 = InAppNotificationUtils.extractMetadataFromNotification(_null);
({ guildId, channelId, messageId } = result1);
const tmpResult = InAppNotificationUtils;
obj2 = { type: _null.type, guild_id: guildId, channel_id: channelId, message_id: messageId, dismiss_reason: "settings_updated", in_app_notification_id: _null.inAppNotificationId };
AppAnalyticsUtilsDefault.trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj2);
_null = null;
}
obj2.removeAll(() => true);
flag = true;
}
return flag;
},
CURRENT_USER_UPDATE: function handleCurrentUserUpdate() {
if (c24) {
const currentUser = UserStore.getCurrentUser();
let restrictedSchedule;
if (currentUser != null) {
restrictedSchedule = currentUser.restrictedSchedule;
}
let tmp8 = null;
if (null != restrictedSchedule) {
tmp8 = null;
if (0 !== restrictedSchedule.rules.length) {
tmp8 = restrictedSchedule;
}
}
const toScheduleSnapshotResult = RestrictedScheduleNotificationUtils.toScheduleSnapshot(tmp8);
EMPTY_SCHEDULE_SNAPSHOT = toScheduleSnapshotResult;
const tmp = EMPTY_SCHEDULE_SNAPSHOT;
const diffSchedulesResult = RestrictedScheduleNotificationUtils.diffSchedules(tmp, toScheduleSnapshotResult);
if (null != diffSchedulesResult) {
const EnableScreenDowntimeScheduleNotifications = tmp2(1936).EnableScreenDowntimeScheduleNotifications;
if (EnableScreenDowntimeScheduleNotifications.getSetting()) {
if (tmp2Result7.allowInAppNotifications()) {
const RESTRICTED_SCHEDULE_UPDATED = constants3.RESTRICTED_SCHEDULE_UPDATED;
obj2 = { notification: null };
const obj3 = { type: RESTRICTED_SCHEDULE_UPDATED, key: null, duration: null, onDismiss: null, title: null, subtitle: null, inAppNotificationId: null };
const notificationDuration = tmp2(10233).getNotificationDuration(RESTRICTED_SCHEDULE_UPDATED);
const tmp2Result8 = tmp2(10233);
obj3.key = tmp2(10221).restrictedScheduleNotificationKey(diffSchedulesResult.kind);
obj3.duration = notificationDuration;
obj3.onDismiss = function onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
};
const tmp2Result9 = tmp2(10221);
obj3.title = tmp2(10221).getRestrictedScheduleNotificationTitle(diffSchedulesResult.kind);
const tmp2Result10 = tmp2(10221);
obj3.subtitle = tmp2(10221).getRestrictedScheduleNotificationSubtitle(diffSchedulesResult.rule);
const tmp2Result11 = tmp2(10221);
obj3.inAppNotificationId = tmp2(10233).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
const tmp2Result12 = tmp2(10233);
}
tmp2Result7 = tmp2(10224);
}
}
} else {
return false;
}
}
});
const size = fn(2);
let result = size.fileFinishedImporting("stores/native/InAppNotificationStore.tsx");
export default inAppNotificationStore;