decord/source/stores/native/InAppNotificationStore.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

809 lines
34 KiB
TypeScript

// Module ID: 10149
// Function ID: 10150
// Name: InAppNotificationStore
// Dependencies: [1956, 4621, 10150, 7167, 7589, 1221, 1957, 1979, 10151, 4620, 2011, 1951, 1371, 1074, 8069, 8067, 4196, 12, 10152, 10154, 7381, 7322, 10155, 9680, 4828, 10163, 10164, 10166, 10159, 10167, 10168, 10172, 4759, 1935, 1187, 7906, 7645, 10173, 4785, 11, 504, 573, 2]
// Module 10149 (InAppNotificationStore)
import SnowflakeUtilsDefault from "SnowflakeUtils" /* 11 */;
import _modDef12 from "module_12" /* 12 */;
import initializeDefault from "initialize" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 573 */;
import _modDef4196 from "module_4196" /* 4196 */;
import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 4785 */;
import isSystemMessageDefault from "isSystemMessage" /* 7322 */;
import FamilyCenterV3Experiment from "FamilyCenterV3Experiment" /* 7645 */;
import GuildAntiRaidUtils from "GuildAntiRaidUtils" /* 8067 */;
import GuildAntiRaidTypes from "GuildAntiRaidTypes" /* 8069 */;
import ExternalPipDefault from "ExternalPip" /* 9680 */;
import RestrictedScheduleNotificationUtils from "RestrictedScheduleNotificationUtils" /* 10152 */;
import MessageUtils from "MessageUtils" /* 10154 */;
import NotificationTextUtils from "NotificationTextUtils" /* 10155 */;
import InAppNotificationUtils from "InAppNotificationUtils" /* 10164 */;
import InAppNotificationActionCreatorsDefault from "InAppNotificationActionCreators" /* 10166 */;
import MessageRequestPushNotificationExperimentDefault from "MessageRequestPushNotificationExperiment" /* 10167 */;
import EmbeddedActivitiesStore from "EmbeddedActivitiesStore" /* 1956 */;
import ChannelRTCStore from "ChannelRTCStore" /* 4621 */;
import GuildIncidentsStore from "GuildIncidentsStore" /* 10150 */;
import FamilyCenterStore from "FamilyCenterStore" /* 7589 */;
import UserSettingsProtoStore from "UserSettingsProtoStore" /* 1221 */;
import ChannelStore from "ChannelStore" /* 1957 */;
import GuildStore from "GuildStore" /* 1979 */;
import NotificationSettingsStore from "NotificationSettingsStore" /* 10151 */;
import ReadStateStore from "ReadStateStore" /* 4620 */;
import SelectedChannelStore from "SelectedChannelStore" /* 2011 */;
import UserRequiredActionStore from "UserRequiredActionStore" /* 1951 */;
import UserStore from "UserStore" /* 1371 */;
const playInAppMessageSound = tmp(10173);
require = fn;
function handleAlertMessage() {
if (obj.allowInAppNotifications()) {
const result = tmp(10168).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(10172)(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(10164).getNotificationDuration(ALERT),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
merged.dismissNotification({ guild, channel });
},
channel,
guild,
inAppNotificationId: null
};
const tmpResult3 = tmp(10164);
obj4.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj3.notification = obj4;
handleEnqueueNotification(obj3);
}
}
}
}
}
return false;
} else {
return false;
}
obj = guild(10155);
}
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(7167).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), _modDef4196());
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 = _modDef4196().diff(_modDef4196(value), self.threshold.unitOfTime) < self.threshold.amount;
obj2 = _modDef4196();
}
return tmp4;
}
};
let merged = Object.assign({ dissmissedAlertsMap: null, threshold: null });
let obj = {};
obj[fn(8069).GuildIncidentAlertTypes.JOIN_RAID] = new Map();
let map = new Map();
obj[fn(8069).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(10152).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(10155).shouldIncludeSelectedChannel();
const tmpResult9 = tmp(10155);
if (tmpResult10.shouldNotify(message, channel_id, result)) {
const channel = ChannelStore.getChannel(channel_id);
if (null == channel) {
return false;
} else {
const messageRecord = tmp(4828).createMessageRecord(message);
const tmpResult11 = tmp(4828);
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(10164).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(10164);
obj3.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj3.mentionCount = ReadStateStore.getMentionCount(channel.id);
obj2.notification = obj3;
handleEnqueueNotification(obj2);
} else {
return false;
}
tmpResult12 = tmp(10163);
}
obj7 = ChannelStore;
} else {
return false;
}
tmpResult10 = tmp(10155);
}
}
tmp3Result = ExternalPipDefault;
}
tmpResult8 = tmp(10155);
}
return false;
}
tmpResult = tmp(7381);
} else {
return false;
}
obj = MessageUtils;
},
MESSAGE_REQUEST_NOTIFICATION_SENT: function handleMessageRequest(triggeringUserId) {
triggeringUserId = triggeringUserId.triggeringUserId;
if (obj.getConfig({ location: "inAppNotificationStore" }).enabled) {
const user = UserStore.getUser(triggeringUserId);
if (null == user) {
return false;
} else {
const MESSAGE_REQUEST = constants3.MESSAGE_REQUEST;
obj2 = { notification: null };
const obj3 = { type: MESSAGE_REQUEST, author: user, numMutualGuilds: triggeringUserId.numMutualGuilds, key: null, duration: null, onDismiss: null, inAppNotificationId: null };
const _HermesInternal = HermesInternal;
obj3.key = "message-request-" + triggeringUserId;
obj3.duration = InAppNotificationUtils.getNotificationDuration(MESSAGE_REQUEST);
obj3.onDismiss = function onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
};
obj3.inAppNotificationId = InAppNotificationUtils.generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
}
} else {
return false;
}
obj = MessageRequestPushNotificationExperimentDefault;
},
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(10164);
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(4785).trackWithMetadata(constants.IN_APP_NOTIFICATION_DISMISSED, obj4);
const obj3 = messageId(4785);
}
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(4759).tryParseChannelPath(tmp);
if (tryParseChannelPathResult == null) {
tryParseChannelPathResult = { channelId: null, guildId: null };
}
({ channelId, guildId } = tryParseChannelPathResult);
if (null != channelId) {
if (null != guildId) {
const ReactionNotifications = tmp19(1935).ReactionNotifications;
const setting = ReactionNotifications.getSetting();
if (setting === tmp19(1187).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(10155).shouldIncludeSelectedChannel();
const tmp19Result9 = tmp19(10155);
const obj = { message, channel, reactor: user, includeSelectedChannel: result1 };
if (tmp19Result10.shouldNotifyForReaction(obj)) {
const messageRecord = tmp19(4828).createMessageRecord(message);
const tmp19Result11 = tmp19(4828);
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(10164).getNotificationDuration(REACTION),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
channel,
guild,
user,
message: messageRecord,
parentChannel: ChannelStore.getChannel(channel.parent_id),
reaction: found,
inAppNotificationId: null
};
const tmp19Result13 = tmp19(10164);
obj3.inAppNotificationId = tmp19(10164).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
} else {
return false;
}
tmp19Result12 = tmp19(10163);
} else {
return false;
}
tmp19Result10 = tmp19(10155);
}
}
return false;
}
return false;
}
}
}
return false;
}
obj14 = emoji(10155);
}
}
}
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(10164).getNotificationDuration(MESSAGE_REMINDER),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
channel,
author: savedMessage.message.author,
savedMessage,
inAppNotificationId: null
};
const tmpResult = tmp(10164);
obj3.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
const tmpResult2 = tmp(10164);
}
}
}
},
RESTRICTED_HOURS_WARNING: function handleRestrictedHoursWarning(arg0) {
({ title, subtitle } = arg0);
if (obj.getIsFamilyCenterV3Enabled({ location: "InAppNotificationStore" })) {
if (NotificationSettingsStore.screenDowntimeReminder) {
const RESTRICTED_HOURS_WARNING = constants3.RESTRICTED_HOURS_WARNING;
obj2 = { notification: null };
const obj3 = {
type: RESTRICTED_HOURS_WARNING,
key: "restricted-hours-warning",
duration: tmp(10164).getNotificationDuration(RESTRICTED_HOURS_WARNING),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
title,
subtitle,
inAppNotificationId: null
};
const tmpResult = tmp(10164);
obj3.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
} else {
return false;
}
} else {
return false;
}
obj = FamilyCenterV3Experiment;
},
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(10155);
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(10164).getNotificationDuration(FORUM_THREAD_CREATED),
onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
},
inAppNotificationId: null
};
const tmpResult5 = tmp(10164);
obj3.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj.notification = obj3;
handleEnqueueNotification(obj);
}
}
}
tmpResult4 = tmp(10159);
}
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(10164).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(10164);
}
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(10164).extractMetadataFromNotification(_null);
({ guildId, channelId: channelId2, messageId } = result);
obj2 = chatOpen(4785);
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(10164);
}
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) {
if (obj.getIsFamilyCenterV3Enabled({ location: "InAppNotificationStore" })) {
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 = tmp(10152).toScheduleSnapshot(tmp8);
EMPTY_SCHEDULE_SNAPSHOT = toScheduleSnapshotResult;
const tmp3 = EMPTY_SCHEDULE_SNAPSHOT;
const tmpResult = tmp(10152);
const diffSchedulesResult = tmp(10152).diffSchedules(tmp3, toScheduleSnapshotResult);
if (null != diffSchedulesResult) {
const EnableScreenDowntimeScheduleNotifications = tmp(1935).EnableScreenDowntimeScheduleNotifications;
if (EnableScreenDowntimeScheduleNotifications.getSetting()) {
if (tmpResult9.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 = tmp(10164).getNotificationDuration(RESTRICTED_SCHEDULE_UPDATED);
const tmpResult10 = tmp(10164);
obj3.key = tmp(10152).restrictedScheduleNotificationKey(diffSchedulesResult.kind);
obj3.duration = notificationDuration;
obj3.onDismiss = function onDismiss() {
InAppNotificationActionCreatorsDefault.clearNotification();
};
const tmpResult11 = tmp(10152);
obj3.title = tmp(10152).getRestrictedScheduleNotificationTitle(diffSchedulesResult.kind);
const tmpResult12 = tmp(10152);
obj3.subtitle = tmp(10152).getRestrictedScheduleNotificationSubtitle(diffSchedulesResult.rule);
const tmpResult13 = tmp(10152);
obj3.inAppNotificationId = tmp(10164).generateInAppNotificationId();
obj2.notification = obj3;
handleEnqueueNotification(obj2);
const tmpResult14 = tmp(10164);
}
tmpResult9 = tmp(10155);
}
}
} else {
return false;
}
obj = FamilyCenterV3Experiment;
} else {
return false;
}
}
});
const size = fn(2);
let result = size.fileFinishedImporting("stores/native/InAppNotificationStore.tsx");
export default inAppNotificationStore;