97 lines
4 KiB
TypeScript
97 lines
4 KiB
TypeScript
// Module ID: 17470
|
|
// Function ID: 17471
|
|
// Name: isChannelEligible
|
|
// Dependencies: [7659, 1957, 4781, 2011, 8078, 1373, 17471, 1094, 1935, 10749, 8773, 1250, 4447, 9853, 2]
|
|
|
|
// Module 17470 (isChannelEligible)
|
|
import set2 from "set" /* 1094 */;
|
|
import fetchUserAffinitiesV2 from "fetchUserAffinitiesV2" /* 9853 */;
|
|
import onPostConnectionOpenDefault from "onPostConnectionOpen" /* 17471 */;
|
|
import closure_2 from "recomputeAffinities" /* 7659 */;
|
|
import closure_3 from "ensureGuildLoaded" /* 1957 */;
|
|
import closure_4 from "reinjectEphemerals" /* 4781 */;
|
|
import closure_5 from "handleConnectionOpen" /* 2011 */;
|
|
import closure_6 from "getCurrentTime" /* 8078 */;
|
|
import GuildFeatures from "GuildFeatures" /* 1373 */;
|
|
|
|
require = arg1;
|
|
({ GiftIntentSecondaryAction: error, GiftIntentType: closure_8 } = GuildFeatures);
|
|
onPostConnectionOpenDefault;
|
|
class MobileGiftIntentCardManager extends tmp3 {
|
|
}
|
|
const prototype = MobileGiftIntentCardManager.prototype;
|
|
prototype["isChannelEligible"] = function isChannelEligible(channel) {
|
|
return channel.type === set2.ChannelTypes.DM;
|
|
};
|
|
prototype["maybeSendCard"] = function maybeSendCard(id, closure_0) {
|
|
let self = this;
|
|
self = this;
|
|
dependencyMap = id;
|
|
const _require = closure_0;
|
|
const EnableFriendAnniversaryNotifications = _require(1935).EnableFriendAnniversaryNotifications;
|
|
if (EnableFriendAnniversaryNotifications.getSetting()) {
|
|
if (!closure_6.isGiftIntentMessageInCooldown(closure_0)) {
|
|
if (id === store.getChannelId()) {
|
|
if (ready.isReady(id)) {
|
|
if (self.trySendGiftingPromptSystemMessage(id, constants2.FRIEND_ANNIVERSARY, closure_0, constants.SEND_MESSAGE)) {
|
|
let tmpResult = tmp(10749);
|
|
const result = tmpResult.logMessageGiftIntentShown(closure_0);
|
|
const userAffinity = self.getUserAffinity(closure_0);
|
|
tmpResult = tmp(8773);
|
|
let obj = { name: null, type: null, properties: null };
|
|
obj[0] = tmp(1250).ImpressionNames.GIFT_INTENT_UNREAD_NOTIFICATION;
|
|
obj[1] = tmp(1250).ImpressionTypes.VIEW;
|
|
obj = { gift_intent_type: null, dm_affinity: null, channel_id: null };
|
|
obj[0] = tmp6.FRIEND_ANNIVERSARY;
|
|
let dmProbability;
|
|
if (userAffinity != null) {
|
|
dmProbability = userAffinity.dmProbability;
|
|
}
|
|
obj[1] = dmProbability;
|
|
obj[2] = id;
|
|
obj[2] = obj;
|
|
tmpResult.trackImpression(obj);
|
|
}
|
|
tmp6 = constants2;
|
|
} else {
|
|
obj5.whenReady(id, () => {
|
|
if (closure_1_5.getChannelId() === closure_1) {
|
|
self.maybeSendCard(tmp, closure_0);
|
|
}
|
|
});
|
|
}
|
|
obj5 = ready;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
prototype["sendCardInSelectedChannelIfEligible"] = function sendCardInSelectedChannelIfEligible(channelId) {
|
|
let self = this;
|
|
self = this;
|
|
const channel = self.getChannel(channelId);
|
|
if (null != channel) {
|
|
if (self.isChannelEligible(channel)) {
|
|
const _Set = Set;
|
|
const set = new Set(channel.recipients);
|
|
const friendAnniversaries = closure_6.getFriendAnniversaries();
|
|
const found = friendAnniversaries.find((arg0) => set.has(arg0));
|
|
if (null != found) {
|
|
const delayedCall = new found(channel[12]).DelayedCall(1000, () => {
|
|
self.maybeSendCard(channel.id, found);
|
|
});
|
|
delayedCall.delay();
|
|
}
|
|
}
|
|
}
|
|
};
|
|
prototype["onChannelSelect"] = function onChannelSelect(channelId) {
|
|
const result = this.sendCardInSelectedChannelIfEligible(channelId.channelId);
|
|
};
|
|
prototype["sendGiftingPromptSystemMessagesIfEligible"] = function sendGiftingPromptSystemMessagesIfEligible() {
|
|
const userAffinitiesV2 = fetchUserAffinitiesV2.fetchUserAffinitiesV2();
|
|
const result = this.sendCardInSelectedChannelIfEligible(store.getChannelId());
|
|
};
|
|
const mobileGiftIntentCardManager = new MobileGiftIntentCardManager();
|
|
let result = require("set").fileFinishedImporting("modules/premium/gifting/native/MobileGiftIntentCardManager.tsx");
|
|
|
|
export default mobileGiftIntentCardManager;
|