This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+127
View File
@@ -0,0 +1,127 @@
// Metro module 10483 (f10484).
import ChannelStore from "../stores/ChannelStore";
import { ActivityTypes, AnalyticEvents, Endpoints, LoggingInviteTypes } from "../Constants";
import { MessageSendLocation } from "../modules/messages/MessageConstants";
import Dispatcher from "../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import MessageParser from "../modules/messages/MessageParser";
import MessageActionCreators from "./MessageActionCreators";
import AppAnalyticsUtils from "../modules/app_analytics/AppAnalyticsUtils";
import ChannelActionCreators from "./ChannelActionCreators";
const r26 = {
updateActivity: (a0) => {
const { applicationId, distributor, shareActivity, token = null, duration: duration2 = 0 } = a0;
const duration = duration2;
const { closed = false, exePath = null, voiceChannelId = null, sessionId = null, mediaSessionId = null } = a0;
Dispatcher.wait(() => Dispatcher.dispatch({
type: "ACTIVITY_UPDATE_START",
applicationId,
duration,
distributor
}));
HTTP.post({
url: Endpoints.ACTIVITIES,
body: {
application_id: applicationId,
token,
duration,
share_activity: shareActivity,
distributor,
closed,
exePath,
voice_channel_id: voiceChannelId,
session_id: sessionId,
media_session_id: mediaSessionId
},
retries: 1,
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "ACTIVITY_UPDATE_SUCCESS",
applicationId,
token: result.body.token,
duration,
distributor
});
}).catch(() => {
Dispatcher.dispatch({
type: "ACTIVITY_UPDATE_FAIL",
applicationId
});
});
},
sendActivityInvite: (a0) => {
const { channelId, type: type2, activity } = a0;
let content2 = a0.content;
const { targetUserId, location: location2 } = a0;
const channel = ChannelStore.getChannel(channelId);
if (channel == null) {
return Promise.resolve(null);
}
if (content2 == null) {
content2 = "";
}
return MessageActionCreators.sendMessage(channel.id, MessageParser.parse(channel, content2), false, {
activityAction: {
type: type2,
activity,
targetUserId
},
location: MessageSendLocation.ACTIVITY_SHARE
}).then((result) => {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.INVITE_SENT, {
location: location2,
invite_type: activity.type === ActivityTypes.LISTENING ? LoggingInviteTypes.SPOTIFY : LoggingInviteTypes.APPLICATION,
application_id: activity.application_id,
guild_id: channel.getGuildId(),
channel_id: channel.id,
message_id: result != null ? result.body.id : null
});
return Promise.resolve(channel);
}, (a0) => Promise.reject(a0));
},
sendActivityInviteUser: function sendActivityInviteUser({ userId, type, activity: activity2, content, location: location3 }) {
return ChannelActionCreators.ensurePrivateChannel(userId).then((result) => this.sendActivityInvite({
channelId: result,
type,
activity: activity2,
content,
location: location3
}));
},
getJoinSecret: async (c17999_0, c17999_1, c17999_2, channel_id, message_id) => {
const query = {};
if (channel_id != null) {
query.channel_id = channel_id;
}
if (message_id != null) {
query.message_id = message_id;
}
let c30228_0 = await HTTP.get({
url: Endpoints.USER_ACTIVITY_JOIN(c17999_0, c17999_1, c17999_2),
retries: 3,
query,
rejectWithError: rejectWithMigratedError()
});
return {
secret: c30228_0.body.secret,
joinUrl: c30228_0.body.join_url
};
},
subscribeActivities: async (c18000_0) => (await HTTP.post({
url: Endpoints.USER_ACTIVITY_SUBSCRIBE,
body: {
subscriptions: c18000_0.map((item) => ({
user_id: item.userId,
application_id: item.applicationId,
party_id: item.partyId,
message_id: item.messageId,
channel_id: item.channelId
}))
},
retries: 1,
rejectWithError: rejectWithMigratedError()
})).body
};
export default r26;
+3
View File
@@ -0,0 +1,3 @@
// Metro module 4528 (f4529).
import * as _AlertActionCreators from "./native/AlertActionCreators";
export default _AlertActionCreators.default;
@@ -0,0 +1,9 @@
// Metro module 14326 (f14327).
import Dispatcher from "../Dispatcher";
export function track(a0, a1) {
Dispatcher.dispatch({
type: "TRACK",
event: a0,
properties: a1
});
}
+529
View File
@@ -0,0 +1,529 @@
// Metro module 8838 (f8839).
import CertifiedDeviceStore from "../stores/CertifiedDeviceStore";
import ChannelStore from "../stores/ChannelStore";
import MediaEngineStore from "../stores/MediaEngineStore";
import RTCConnectionStore from "../stores/RTCConnectionStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import UserStore from "../stores/UserStore";
import { AnalyticEvents, InputModes } from "../Constants";
import { SoundOutputChannel } from "../modules/sound_playback/Constants";
import { MediaEngineContextTypes } from "../_bundle/Module4250";
import Logger from "../modules/debug/Logger";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import debounce from "../_bundle/debounce";
import Dispatcher from "../Dispatcher";
import { snapVolumeToDefault } from "../modules/user_settings/voice/AudioSettingsUtils";
import trackVoiceAndVideoSettingsUpdate from "../modules/user_settings/voice/trackVoiceAndVideoSettingsUpdate";
import { applyInitialVideoBackgroundOption } from "../modules/video_backgrounds/applyBackgroundOption";
import { trackStreamSettingsUpdate } from "../utils/StreamQualityUtils";
let c5763_13, c5763_15, isNotSupported, trackToggleSelfMute, trackToggleSelfDeaf;
const trackDeviceChanged = function trackDeviceChanged(a0, a1, a2, a3, r3) {
const { location: location2, analyticsLocations } = r3;
if (a1 !== a2) {
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
const r10 = voiceChannelId != null ? ChannelStore.getChannel(voiceChannelId) : null;
const r23 = a0[a1];
const r12 = a0[a2];
const audioSubsystem = MediaEngineStore.getMediaEngine().getAudioSubsystem();
const audioLayer = MediaEngineStore.getMediaEngine().getAudioLayer();
const MEDIA_DEVICE_CHANGED = AnalyticEvents.MEDIA_DEVICE_CHANGED;
const r2 = r23 != null;
let r16 = "";
const r40 = {
device_from_name: CertifiedDeviceStore.getCertifiedDeviceName(a1, r2 ? r23.name : ""),
device_to_name: null,
device_type: null,
device_is_certified: null,
location: null,
location_stack: null,
voice_channel_type: null,
audio_subsystem: null,
audio_layer: null
};
if (r12 != null) {
r16 = r12.name;
}
r40.device_to_name = CertifiedDeviceStore.getCertifiedDeviceName(a2, r16);
r40.device_type = a3;
r40.device_is_certified = CertifiedDeviceStore.isCertified(a2);
r40.location = location2;
r40.location_stack = analyticsLocations;
r40.voice_channel_type = r10?.type;
r40.audio_subsystem = audioSubsystem;
r40.audio_layer = audioLayer;
AnalyticsUtils.track(MEDIA_DEVICE_CHANGED, r40);
}
};
SoundOutputChannel;
c5763_13 = new Logger("AudioActionCreators");
c5763_13.enableNativeLogger(true);
c5763_15 = debounce((a0, a1, a2) => {
AnalyticsUtils.track(AnalyticEvents.USER_VOLUME_SETTING_UPDATED, {
target_user_id: a0,
context: a1,
volume: a2,
media_session_id: RTCConnectionStore.getMediaSessionId(),
rtc_connection_id: RTCConnectionStore.getRTCConnectionId()
});
}, 300);
isNotSupported = () => false;
trackToggleSelfMute = () => {};
trackToggleSelfDeaf = () => {};
const r58 = {
enable: () => Promise.resolve(true),
toggleSelfMute: function toggleSelfMute(r2 = {}) {
const { context = MediaEngineContextTypes.DEFAULT, syncRemote = true } = r2;
if (r2.usedKeybind !== void 0) {
let playSoundEffect = r2.playSoundEffect;
if (playSoundEffect === void 0) {
playSoundEffect = true;
}
r2.location;
if (playSoundEffect) {
playSoundEffect = !MediaEngineStore.hasActiveCallKitCall();
}
const currentUser = UserStore.getCurrentUser();
if (currentUser == null ? void 0 : currentUser.isStaff()) {
c5763_13.info("Toggling self mute");
}
return MediaEngineStore.isEnabled() ? Dispatcher.dispatch({
type: "AUDIO_TOGGLE_SELF_MUTE",
context,
syncRemote,
playSoundEffect
}) : this.enable(true);
}
},
setSelfMute: function setSelfMute(a0, a1, playSoundEffect = true) {
if (playSoundEffect) {
playSoundEffect = !MediaEngineStore.hasActiveCallKitCall();
}
const currentUser = UserStore.getCurrentUser();
if (currentUser == null ? void 0 : currentUser.isStaff()) {
c5763_13.info("Setting self mute", a1);
}
Dispatcher.dispatch({
type: "AUDIO_SET_SELF_MUTE",
context: a0,
mute: a1,
playSoundEffect
});
},
setTemporarySelfMute: (a0) => {
const currentUser = UserStore.getCurrentUser();
if (currentUser == null ? void 0 : currentUser.isStaff()) {
c5763_13.info("Setting temporary self mute", a0);
}
Dispatcher.dispatch({
type: "AUDIO_SET_TEMPORARY_SELF_MUTE",
mute: a0
});
},
toggleSelfDeaf: function toggleSelfDeaf(r3 = {}) {
const { context = MediaEngineContextTypes.DEFAULT, syncRemote = true } = r3;
if (r3.usedKeybind !== void 0) {
r3.location;
Dispatcher.dispatch({
type: "AUDIO_TOGGLE_SELF_DEAF",
context,
syncRemote
});
return void 0;
}
},
toggleLocalMute: function toggleLocalMute(a0, context = MediaEngineContextTypes.DEFAULT) {
Dispatcher.dispatch({
type: "AUDIO_TOGGLE_LOCAL_MUTE",
context,
userId: a0
});
},
toggleLocalSoundboardMute: function toggleLocalSoundboardMute(a0, context = MediaEngineContextTypes.DEFAULT) {
Dispatcher.dispatch({
type: "AUDIO_TOGGLE_LOCAL_SOUNDBOARD_MUTE",
context,
userId: a0
});
},
setDisableLocalVideo: function setDisableLocalVideo(a0, a1, context = MediaEngineContextTypes.DEFAULT, persist = true, isAutomatic = false) {
Dispatcher.dispatch({
type: "AUDIO_SET_LOCAL_VIDEO_DISABLED",
context,
userId: a0,
videoToggleState: a1,
persist,
isAutomatic
});
},
setLocalVolume: function setLocalVolume(a0, a1, context = MediaEngineContextTypes.DEFAULT) {
const volume = snapVolumeToDefault(a1, context);
Dispatcher.dispatch({
type: "AUDIO_SET_LOCAL_VOLUME",
context,
userId: a0,
volume
});
c5763_15(a0, context, volume);
},
setAudioMixerSettings: function setAudioMixerSettings(a0, context = MediaEngineContextTypes.DEFAULT) {
Dispatcher.dispatch({
type: "AUDIO_SET_AUDIO_MIXER_SETTINGS",
context,
settings: a0
});
},
setSpatialAudio: (a0, a1) => {
const audioMixerSettings = MediaEngineStore.getAudioMixerSettings();
trackVoiceAndVideoSettingsUpdate("spatial_audio_enabled", a0, audioMixerSettings.enabled, a1);
Dispatcher.dispatch({
type: "AUDIO_SET_AUDIO_MIXER_SETTINGS",
context: MediaEngineContextTypes.DEFAULT,
settings: {
...audioMixerSettings,
enabled: a0
}
});
},
setLocalPan: function setLocalPan(a0, a1, a2, context = MediaEngineContextTypes.DEFAULT) {
Dispatcher.dispatch({
type: "AUDIO_SET_LOCAL_PAN",
context,
userId: a0,
left: a1,
right: a2
});
},
setMode: function setMode(a0, r11 = {}, context = MediaEngineContextTypes.DEFAULT, r22 = {}) {
const analyticsLocations = r22.analyticsLocations;
const mode = MediaEngineStore.getMode();
const modeOptions = MediaEngineStore.getModeOptions(context);
Dispatcher.dispatch({
type: "AUDIO_SET_MODE",
context,
mode: a0,
options: {
...modeOptions,
...r11
}
});
if (a0 !== mode) {
const audioSubsystem2 = MediaEngineStore.getMediaEngine().getAudioSubsystem();
const audioLayer2 = MediaEngineStore.getMediaEngine().getAudioLayer();
const voiceChannelId2 = SelectedChannelStore.getVoiceChannelId();
const r81 = voiceChannelId2 != null ? ChannelStore.getChannel(voiceChannelId2) : null;
const r88 = MediaEngineStore.getInputDevices()[MediaEngineStore.getInputDeviceId()];
AnalyticsUtils.track(AnalyticEvents.VOICE_ACTIVATION_MODE_CHANGED, {
mode: a0,
location_stack: analyticsLocations,
voice_channel_type: r81?.type,
input_device_name: r88 != null ? r88.name : "",
audio_subsystem: audioSubsystem2,
audio_layer: audioLayer2
});
} else if (a0 === InputModes.VOICE_ACTIVITY && modeOptions !== r11) {
const audioSubsystem = MediaEngineStore.getMediaEngine().getAudioSubsystem();
const audioLayer = MediaEngineStore.getMediaEngine().getAudioLayer();
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
const r19 = voiceChannelId != null ? ChannelStore.getChannel(voiceChannelId) : null;
const r54 = MediaEngineStore.getInputDevices()[MediaEngineStore.getInputDeviceId()];
AnalyticsUtils.track(AnalyticEvents.VOICE_ACTIVITY_THRESHOLD_CHANGED, {
location_stack: analyticsLocations,
voice_channel_type: r19?.type,
input_device_name: r54 != null ? r54.name : "",
audio_subsystem: audioSubsystem,
audio_layer: audioLayer,
old_threshold: modeOptions.threshold,
new_threshold: r11.threshold,
old_auto_threshold: modeOptions.autoThreshold,
new_auto_threshold: r11.autoThreshold
});
}
},
setBypassSystemInputProcessing: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_BYPASS_SYSTEM_INPUT_PROCESSING",
bypassEnabled: a0,
location: a1
});
},
setInputVolume: function setInputVolume(a0, r4 = {}) {
const analyticsLocations = r4.analyticsLocations;
Dispatcher.dispatch({
type: "AUDIO_SET_INPUT_VOLUME",
volume: a0
});
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
AnalyticsUtils.track(AnalyticEvents.MEDIA_INPUT_VOLUME_CHANGED, {
volume: a0,
location_stack: analyticsLocations,
voice_channel_type: (voiceChannelId != null ? ChannelStore.getChannel(voiceChannelId) : null)?.type
});
},
setOutputVolume: function setOutputVolume(a0, r4 = {}) {
const analyticsLocations = r4.analyticsLocations;
Dispatcher.dispatch({
type: "AUDIO_SET_OUTPUT_VOLUME",
volume: a0
});
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
AnalyticsUtils.track(AnalyticEvents.MEDIA_OUTPUT_VOLUME_CHANGED, {
volume: a0,
location_stack: analyticsLocations,
voice_channel_type: (voiceChannelId != null ? ChannelStore.getChannel(voiceChannelId) : null)?.type
});
},
setInputDevice: function setInputDevice(a0, r4 = {}) {
const { location: location2, analyticsLocations } = r4;
const inputDeviceId = MediaEngineStore.getInputDeviceId();
if (!(location2 == null && analyticsLocations == null)) {
trackDeviceChanged(MediaEngineStore.getInputDevices(), inputDeviceId, a0, "Audio Input", {
location: location2,
analyticsLocations
});
}
Dispatcher.dispatch({
type: "AUDIO_SET_INPUT_DEVICE",
id: a0,
oldId: inputDeviceId
});
},
setOutputDevice: function setOutputDevice(a0, r4 = {}) {
const { location: location2, analyticsLocations } = r4;
const outputDeviceId = MediaEngineStore.getOutputDeviceId();
if (!(location2 == null && analyticsLocations == null)) {
trackDeviceChanged(MediaEngineStore.getOutputDevices(), outputDeviceId, a0, "Audio Output", {
location: location2,
analyticsLocations
});
}
Dispatcher.dispatch({
type: "AUDIO_SET_OUTPUT_DEVICE",
id: a0,
oldId: outputDeviceId
});
},
setVideoDevice: function setVideoDevice(a0, r4 = {}) {
const { location: location2, analyticsLocations } = r4;
const videoDeviceId = MediaEngineStore.getVideoDeviceId();
if (!(location2 == null && analyticsLocations == null)) {
trackDeviceChanged(MediaEngineStore.getVideoDevices(), videoDeviceId, a0, "Video", {
location: location2,
analyticsLocations
});
}
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_VIDEO_DEVICE",
id: a0,
oldId: videoDeviceId
});
},
setActiveInputProfile: function setActiveInputProfile(a0, r2 = {}) {
const analyticsLocations = r2.analyticsLocations;
let r6 = MediaEngineStore.getActiveInputProfile();
if (r6 == null) {
r6 = void 0;
}
trackVoiceAndVideoSettingsUpdate("active_input_profile", a0, r6, analyticsLocations);
Dispatcher.dispatch({
type: "AUDIO_SET_ACTIVE_INPUT_PROFILE",
inputProfile: a0
});
},
setEchoCancellation: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_ECHO_CANCELLATION",
enabled: a0,
location: a1
});
},
setSidechainCompression: function setSidechainCompression(a0, r1 = {}) {
const analyticsLocations = r1.analyticsLocations;
trackVoiceAndVideoSettingsUpdate("stream_attenuation_enabled", a0, MediaEngineStore.getSidechainCompression(), analyticsLocations);
Dispatcher.dispatch({
type: "AUDIO_SET_SIDECHAIN_COMPRESSION",
enabled: a0
});
},
setSidechainCompressionStrength: function setSidechainCompressionStrength(a0, r1 = {}) {
const analyticsLocations = r1.analyticsLocations;
trackVoiceAndVideoSettingsUpdate("stream_attenuation_strength", a0, MediaEngineStore.getSidechainCompressionStrength(), analyticsLocations);
Dispatcher.dispatch({
type: "AUDIO_SET_SIDECHAIN_COMPRESSION_STRENGTH",
strength: a0
});
},
setLoopback: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_LOOPBACK",
loopbackReason: a0,
enabled: a1
});
},
setNoiseSuppression: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_NOISE_SUPPRESSION",
enabled: a0,
location: a1
});
},
setNoiseCancellation: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_NOISE_CANCELLATION",
enabled: a0,
location: a1
});
Dispatcher.dispatch({
type: "AUDIO_SET_NOISE_SUPPRESSION",
enabled: !a0,
location: a1
});
},
setAutomaticGainControl: (a0, a1) => {
Dispatcher.dispatch({
type: "AUDIO_SET_AUTOMATIC_GAIN_CONTROL",
enabled: a0,
location: a1
});
},
setAttenuation: (a0, a1, a2) => {
const attenuation = MediaEngineStore.getAttenuation();
const attenuateWhileSpeakingSelf = MediaEngineStore.getAttenuateWhileSpeakingSelf();
const attenuateWhileSpeakingOthers = MediaEngineStore.getAttenuateWhileSpeakingOthers();
if (attenuation !== a0) {
trackVoiceAndVideoSettingsUpdate("global_attenuation_strength", a0, attenuation);
} else if (attenuateWhileSpeakingSelf !== a1) {
trackVoiceAndVideoSettingsUpdate("global_attenuation_for_self_speak_enabled", a1, attenuateWhileSpeakingSelf);
} else if (attenuateWhileSpeakingOthers !== a2) {
trackVoiceAndVideoSettingsUpdate("global_attenuation_for_other_speak_enabled", a2, attenuateWhileSpeakingOthers);
}
Dispatcher.dispatch({
type: "AUDIO_SET_ATTENUATION",
attenuation: a0,
attenuateWhileSpeakingSelf: a1,
attenuateWhileSpeakingOthers: a2
});
},
setQoS: (a0) => {
trackVoiceAndVideoSettingsUpdate("quality_of_service_packets_enabled", a0, MediaEngineStore.getQoS());
Dispatcher.dispatch({
type: "AUDIO_SET_QOS",
enabled: a0
});
},
reset: () => {
Dispatcher.dispatch({
type: "AUDIO_RESET"
});
},
setSilenceWarning: (a0) => {
trackVoiceAndVideoSettingsUpdate("silence_warning_enabled", a0, MediaEngineStore.getEnableSilenceWarning());
Dispatcher.dispatch({
type: "AUDIO_SET_DISPLAY_SILENCE_WARNING",
enabled: a0
});
},
setDebugLogging: async (c16822_0) => {
let c26290_0;
c26290_0 = void 0;
isNotSupported();
await trackVoiceAndVideoSettingsUpdate("debug_logging_enabled", c16822_0, MediaEngineStore.getDebugLogging());
Dispatcher.dispatch({
type: "AUDIO_SET_DEBUG_LOGGING",
enabled: c16822_0
});
},
setVideoHook: (a0) => {
trackVoiceAndVideoSettingsUpdate("video_hook_enabled", a0, MediaEngineStore.getVideoHook());
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_VIDEO_HOOK",
enabled: a0
});
},
setExperimentalSoundshare: (a0) => {
trackVoiceAndVideoSettingsUpdate("experimental_soundshare_enabled", a0, MediaEngineStore.getExperimentalSoundshare());
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_EXPERIMENTAL_SOUNDSHARE",
enabled: a0
});
},
setUseSystemScreensharePicker: (a0) => {
trackVoiceAndVideoSettingsUpdate("system_screenshare_picker_enabled", a0, MediaEngineStore.getUseSystemScreensharePicker());
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_USE_SYSTEM_SCREENSHARE_PICKER",
enabled: a0
});
},
setAudioSubsystem: async (c16823_0) => {
let c26291_0;
c26291_0 = void 0;
isNotSupported();
await trackVoiceAndVideoSettingsUpdate("audio_subsystem", c16823_0, MediaEngineStore.getAudioSubsystem());
Dispatcher.dispatch({
type: "AUDIO_SET_SUBSYSTEM",
subsystem: c16823_0
});
},
setVideoEnabled: (a0) => {
applyInitialVideoBackgroundOption();
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_VIDEO_ENABLED",
enabled: a0
});
},
setGoLiveSource: (a0) => {
if (a0?.qualityOptions != null) {
trackStreamSettingsUpdate(a0.qualityOptions.preset, a0.qualityOptions.resolution, a0.qualityOptions.frameRate, a0.desktopSettings?.sound);
}
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_GO_LIVE_SOURCE",
settings: a0
});
},
setAecDump: (a0) => {
trackVoiceAndVideoSettingsUpdate("diagnostic_audio_recording_enabled", a0, MediaEngineStore.getAecDump());
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_AEC_DUMP",
enabled: a0
});
},
interact: () => {
Dispatcher.dispatch({
type: "MEDIA_ENGINE_INTERACTION_REQUIRED",
required: false
});
},
setEnableHardwareMuteNotice: (a0) => {
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_ENABLE_HARDWARE_MUTE_NOTICE",
enabled: a0
});
},
setKrispSuppressionLevel: (a0) => {
Dispatcher.dispatch({
type: "AUDIO_SET_KRISP_SUPPRESSION_LEVEL",
level: a0
});
},
setKrispModelOverride: function setKrispModelOverride(a0) {
Dispatcher.dispatch({
type: "AUDIO_SET_KRISP_MODEL_OVERRIDE",
model: a0
});
if (MediaEngineStore.getNoiseCancellation()) {
this.setNoiseCancellation(false);
this.setNoiseCancellation(true);
}
},
setNoiseCancellationEnableStats: (a0) => {},
setOpenH264Enabled: (a0) => {
Dispatcher.dispatch({
type: "MEDIA_ENGINE_SET_OPENH264_ENABLED",
enabled: a0
});
},
resetMediaEngineSettings: (a0) => Dispatcher.dispatch({
type: "MEDIA_ENGINE_RESET_SETTINGS",
overrides: a0
})
};
export default r58;
+185
View File
@@ -0,0 +1,185 @@
// Metro module 16380 (f16381).
import GuildSettingsAuditLogStore from "../modules/guild_settings/audit_log/GuildSettingsAuditLogStore";
import { AUDIT_LOG_PAGE_LIMIT, Endpoints } from "../Constants";
import { HTTP } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
let $mk99459 = function() {
return ({ body }) => {
const { audit_log_entries, integrations, users, webhooks } = body;
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_SUCCESS",
logs: audit_log_entries,
integrations,
users,
webhooks,
guildScheduledEvents: body.guild_scheduled_events,
automodRules: body.auto_moderation_rules,
threads: body.threads,
applicationCommands: body.application_commands
});
};
}, $mk99460 = function() {
return () => Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_FAIL"
});
};
const makeRequest = function makeRequest(a0, a1) {
const before = a1.before;
let userId = a1.userId;
let targetId = a1.targetId;
let action = a1.action;
if (userId == null) {
userId = GuildSettingsAuditLogStore.userIdFilter;
}
if (action == null) {
action = GuildSettingsAuditLogStore.actionFilter;
}
if (targetId == null) {
targetId = GuildSettingsAuditLogStore.targetIdFilter;
}
const query = {
limit: AUDIT_LOG_PAGE_LIMIT
};
if (before != null) {
query.before = before;
}
if (userId != null) {
query.user_id = userId;
}
if (action != null) {
query.action_type = action;
}
if (targetId != null) {
query.target_id = targetId;
}
return HTTP.get({
url: Endpoints.GUILD_AUDIT_LOG(a0),
query,
oldFormErrors: true,
rejectWithError: true
});
};
export function fetchLogs(a0, a1, a2, a3) {
if (!(GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage) && a0 != null) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_START"
});
const r19 = makeRequest(a0, {
userId: a1,
action: a3,
targetId: a2
});
const r21 = $mk99460();
return r19.then($mk99459(), r21);
}
}
export function fetchNextLogPage(a0, isGroupedFetch = false) {
if (GuildSettingsAuditLogStore.hasOlderLogs && !(GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage) && a0 != null) {
const r14 = GuildSettingsAuditLogStore.logs[GuildSettingsAuditLogStore.logs.length - 1];
const before = r14 != null ? r14.id : null;
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_NEXT_PAGE_START",
before,
isGroupedFetch
});
return makeRequest(a0, {
before
}).then(({ body }) => {
const { audit_log_entries, integrations, users, webhooks } = body;
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_NEXT_PAGE_SUCCESS",
logs: audit_log_entries,
integrations,
users,
webhooks,
guildScheduledEvents: body.guild_scheduled_events,
automodRules: body.auto_moderation_rules,
threads: body.threads,
applicationCommands: body.application_commands
});
}, () => Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_NEXT_PAGE_FAIL"
}));
}
}
export function filterByAction(a0, a1) {
if (!(GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage) && a1 != null) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FILTER_BY_ACTION",
action: a0
});
const r15 = GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage;
let r16 = void 0;
if (!r15) {
const r17 = a1 != null;
r16 = void 0;
if (r17) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_START"
});
const r25 = makeRequest(a1, {
userId: null,
action: a0,
targetId: null
});
const r27 = $mk99460();
r16 = r25.then($mk99459(), r27);
}
}
return r16;
}
}
export function filterByUserId(a0, a1) {
if (!(GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage) && a1 != null) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FILTER_BY_USER",
userId: a0
});
const r15 = GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage;
let r16 = void 0;
if (!r15) {
const r17 = a1 != null;
r16 = void 0;
if (r17) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_START"
});
const r25 = makeRequest(a1, {
userId: a0,
action: void 0,
targetId: void 0
});
const r27 = $mk99460();
r16 = r25.then($mk99459(), r27);
}
}
return r16;
}
}
export function filterByTargetId(a0, a1) {
if (!(GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage) && a1 != null) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FILTER_BY_TARGET",
targetId: a0
});
const r15 = GuildSettingsAuditLogStore.isLoading || GuildSettingsAuditLogStore.isLoadingNextPage;
let r16 = void 0;
if (!r15) {
const r17 = a1 != null;
r16 = void 0;
if (r17) {
Dispatcher.dispatch({
type: "AUDIT_LOG_FETCH_START"
});
const r25 = makeRequest(a1, {
userId: null,
action: void 0,
targetId: a0
});
const r27 = $mk99460();
r16 = r25.then($mk99459(), r27);
}
}
return r16;
}
}
+819
View File
@@ -0,0 +1,819 @@
// Metro module 5641 (f5642).
import { setPromoEmailConsentState } from "../modules/auth/PromoEmailConsentStore";
import AuthenticationStore from "../stores/AuthenticationStore";
import ConsentStore from "../stores/ConsentStore";
import { AbortCodes, DEVICE_TOKEN, DEVICE_VOIP_TOKEN, Endpoints, Routes } from "../Constants";
import { DEVICE_PUSH_VOIP_PROVIDER, getDevicePushProvider } from "../modules/push_notifications/PushNotificationConstants";
import Logger from "../modules/debug/Logger";
import CrossPlatformNativeUtils_native from "../utils/CrossPlatformNativeUtils.native";
import Dispatcher from "../Dispatcher";
import { getRootNavigationRef } from "../modules/main_tabs_v2/RootNavigationRef.native";
import { transitionTo } from "../modules/routing/router_utils";
import ModalActionCreators from "./ModalActionCreators";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import { rejectWithMigratedError, HTTPResponseError, HTTP } from "../_bundle/sendRequest";
import { V6OrEarlierAPIError, APIError } from "../errors/index";
import { fetchWebAuthnPasswordlessChallenge } from "../modules/webauthn/WebAuthnActionCreators";
import SignalHelpers_native from "../modules/webauthn/SignalHelpers.native";
import { Storage } from "../_bundle/Module595";
import { getToken } from "../_bundle/setSecondaryToken";
import { HermesBuiltin } from "../_hermes/prelude";
let c3481_4, c3481_16, c3481_17, c3481_18, $mk76574 = function() {
return (a0) => {
c3481_16.error("Error while dispatching LOGOUT", a0);
const DiscordErrors = window.DiscordErrors;
if (DiscordErrors != null) {
DiscordErrors.softCrash(a0);
}
throw a0;
};
};
const handleLogout = function handleLogout(a0, r8 = Routes.DEFAULT_LOGGED_OUT) {
CrossPlatformNativeUtils_native.clearNavigationHistory();
Dispatcher.dispatch({
type: "LOGOUT",
...void 0
}).catch($mk76574());
if (r8 != null) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null) {
ModalActionCreators.popAll();
rootNavigationRef.reset({
index: 0,
routes: [{
name: "auth"
}]
});
} else {
transitionTo(r8, {
source: a0
});
}
}
};
c3481_16 = new Logger("AuthenticationActionCreators");
c3481_17 = null;
c3481_18 = {
MFA: "MFA",
SUCCESS: "SUCCESS"
};
const r48 = {
startSession: (token) => {
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "START_SESSION",
token
});
});
},
login: function login({ login: login2, password, undelete, source: source4, giftCodeSKUId: giftCodeSKUId2, invite, isMultiAccount }) {
Dispatcher.dispatch({
type: "LOGIN",
isPasswordAttempt: true
});
return TrackedHTTPUtils.post({
url: Endpoints.LOGIN,
body: {
login: login2,
password,
undelete,
login_source: source4,
gift_code_sku_id: giftCodeSKUId2
},
retries: 2,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_LOGIN,
properties: {
invite_code: invite?.code,
is_multi_account: isMultiAccount
}
},
...isMultiAccount ? {
headers: {
authorization: ""
}
} : {},
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
const { mfa, sms, webauthn, ticket: ticket3, token: token6, backup, user_id, required_actions, totp, login_instance_id } = body;
Dispatcher.dispatch({
type: "LOGIN_ATTEMPTED",
user_id,
required_actions
});
if (mfa) {
Dispatcher.dispatch({
type: "LOGIN_MFA_STEP",
ticket: ticket3,
sms,
webauthn,
totp,
backup,
loginInstanceId: login_instance_id
});
} else if (isMultiAccount) {
this.switchAccountToken(token6);
} else {
Dispatcher.dispatch({
type: "LOGIN_SUCCESS",
token: token6
});
}
}, (a0) => {
const v6OrEarlierAPIError = new V6OrEarlierAPIError(a0);
if (a0.body != null) {
if (a0.body?.suspended_user_token != null) {
Dispatcher.dispatch({
type: "LOGIN_SUSPENDED_USER",
suspendedUserToken: a0.body?.suspended_user_token
});
throw v6OrEarlierAPIError;
}
}
const code2 = a0.body?.code;
if (code2 === AbortCodes.ACCOUNT_SCHEDULED_FOR_DELETION && (password != null && password !== "")) {
Dispatcher.dispatch({
type: "LOGIN_ACCOUNT_SCHEDULED_FOR_DELETION",
credentials: {
login: login2,
password
}
});
} else if (code2 === AbortCodes.ACCOUNT_DISABLED && (password != null && password !== "")) {
Dispatcher.dispatch({
type: "LOGIN_ACCOUNT_DISABLED",
credentials: {
login: login2,
password
}
});
} else if (code2 === AbortCodes.PHONE_VERIFICATION_REQUIRED) {
Dispatcher.dispatch({
type: "LOGIN_PHONE_IP_AUTHORIZATION_REQUIRED",
credentials: {
login: login2,
password
}
});
} else {
Dispatcher.dispatch({
type: "LOGIN_FAILURE",
error: v6OrEarlierAPIError
});
}
throw v6OrEarlierAPIError;
});
},
loginMFAv2: function loginMFAv2(a0) {
const { code: code2, ticket: ticket3, source: source4, giftCodeSKUId: giftCodeSKUId2, isMultiAccount: isMultiAccount2, mfaType } = a0;
let loginInstanceId = a0.loginInstanceId;
const r21 = {
url: Endpoints.LOGIN_MFA(mfaType),
body: null,
retries: 2,
oldFormErrors: true,
trackedActionData: null,
rejectWithError: true
};
if (loginInstanceId == null) {
loginInstanceId = AuthenticationStore.getLoginInstanceId();
}
r21.body = {
code: code2,
ticket: ticket3,
login_source: source4,
gift_code_sku_id: giftCodeSKUId2,
login_instance_id: loginInstanceId
};
r21.trackedActionData = {
event: NetworkActionNames.USER_LOGIN_MFA
};
return TrackedHTTPUtils.post(r21).then((result) => {
if (isMultiAccount2) {
this.switchAccountToken(result.body.token);
} else {
Dispatcher.dispatch({
type: "LOGIN_SUCCESS",
token: result.body.token
});
}
}).catch((error) => {
if (error.body != null && error.body.suspended_user_token != null) {
Dispatcher.dispatch({
type: "LOGIN_SUSPENDED_USER",
suspendedUserToken: error.body.suspended_user_token
});
return void 0;
}
if (error.body?.code === AbortCodes.MFA_INVALID_CODE) {
throw new Error(error.body.message);
}
throw error;
});
},
authenticatePasswordless: async function authenticatePasswordless({ authenticateFunc, conditionalMediationAbortController, source, giftCodeSKUId, isMultiAccount: isMultiAccount3 }) {
const _this = this;
let c25514_2;
let c25514_3 = 0;
let c29535_0, c29535_1, c29535_2, c29535_3, c29535_5, c29535_4;
try {
c29535_0 = void 0;
c29535_1 = void 0;
c29535_2 = void 0;
c29535_3 = void 0;
if (conditionalMediationAbortController != null) {
conditionalMediationAbortController.abort("Starting non-conditional mediation");
}
Dispatcher.dispatch({
type: "PASSWORDLESS_START"
});
c25514_3 = 1;
c29535_0 = await fetchWebAuthnPasswordlessChallenge();
c29535_1 = c29535_0.challenge;
c29535_2 = c29535_0.ticket;
c29535_3 = await (0, authenticateFunc)(c29535_1);
c25514_3 = 2;
await _this.loginWebAuthn({
ticket: c29535_2,
credential: c29535_3,
source,
giftCodeSKUId,
isMultiAccount: isMultiAccount3
});
c25514_3 = 0;
} catch ($e) {
const r38 = $e;
let r8 = r38;
c25514_2 = r38;
let r39 = c25514_3;
if (r39 !== 0) {
while (true) {
if (r39 === 1) {
try {
const r204 = c25514_2;
c25514_3 = 0;
c29535_5 = r204;
Dispatcher.dispatch({
type: "PASSWORDLESS_FAILURE",
error: c29535_5
});
throw c29535_5;
} catch (r201) {
r8 = r201;
c25514_2 = r201;
r39 = c25514_3;
if (r39 === 0) {
break;
}
}
} else {
try {
const r146 = c25514_2;
c25514_3 = 1;
c29535_4 = r146;
if (c29535_4 instanceof APIError && c29535_4.status != null && c29535_4.status >= 400 && c29535_4.status < 500) {
await SignalHelpers_native.signalUnknownCredential(c29535_3);
}
throw c29535_4;
} catch (r143) {
r8 = r143;
c25514_2 = r143;
r39 = c25514_3;
if (r39 === 0) {
break;
}
}
}
}
}
throw r8;
}
},
loginWebAuthn: function loginWebAuthn({ ticket: ticket3, credential, source: source4, giftCodeSKUId: giftCodeSKUId2, isMultiAccount: isMultiAccount4 }) {
return TrackedHTTPUtils.post({
url: Endpoints.WEBAUTHN_CONDITIONAL_UI_LOGIN,
body: {
credential,
ticket: ticket3,
source: source4,
giftCodeSKUId: giftCodeSKUId2
},
retries: 1,
trackedActionData: {
event: NetworkActionNames.USER_LOGIN_PASSWORDLESS
},
rejectWithError: true
}).then(({ body }) => {
const token6 = body.token;
Dispatcher.dispatch({
type: "LOGIN_ATTEMPTED",
user_id: body.user_id,
required_actions: body.required_actions
});
if (isMultiAccount4) {
this.switchAccountToken(token6);
} else {
Dispatcher.dispatch({
type: "LOGIN_SUCCESS",
token: token6
});
}
}).catch((error) => {
const r1 = error instanceof HTTPResponseError;
let r12 = error;
if (r1) {
if (error.body.suspended_user_token != null) {
Dispatcher.dispatch({
type: "LOGIN_SUSPENDED_USER",
suspendedUserToken: error.body.suspended_user_token
});
return void 0;
}
r12 = new APIError(error);
}
throw r12;
});
},
loginToken: function loginToken(token2, r4 = true) {
let c14964_0 = r4;
Dispatcher.dispatch({
type: "LOGIN"
});
return new Promise((c25515_0) => {
setImmediate(() => {
Dispatcher.dispatch({
type: "LOGIN_SUCCESS",
token: token2
});
if (c14964_0) {
this.startSession(token2);
}
c25515_0();
});
});
},
oneTimeLogin: async function oneTimeLogin(ticket) {
let r110;
const _this2 = this;
let c25516_2;
let c25516_3 = 0;
let c29536_0, c29536_1;
try {
c29536_0 = void 0;
Dispatcher.dispatch({
type: "LOGIN"
});
c25516_3 = 1;
c29536_0 = (await TrackedHTTPUtils.post({
url: Endpoints.ONE_TIME_LOGIN,
body: {
ticket
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_ONE_TIME_LOGIN
},
rejectWithError: true
})).body.token;
if (!c29536_0) {
throw new Error("No token in response");
}
await _this2.loginToken(c29536_0, false);
r110 = c29536_0;
c25516_3 = 0;
} catch ($e) {
const r34 = $e;
let r8 = r34;
c25516_2 = r34;
if (c25516_3 !== 0) {
while (true) {
try {
const r119 = c25516_2;
c25516_3 = 0;
c29536_1 = r119;
Dispatcher.dispatch({
type: "LOGIN_FAILURE",
error: new V6OrEarlierAPIError(c29536_1)
});
throw c29536_1;
} catch (r115) {
r8 = r115;
c25516_2 = r115;
if (c25516_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r110;
},
loginReset: (a0) => {
Dispatcher.dispatch({
type: "LOGIN_RESET",
isMultiAccount: a0
});
},
loginStatusReset: () => {
Dispatcher.dispatch({
type: "LOGIN_STATUS_RESET"
});
},
logoutInternal: (a0) => {
CrossPlatformNativeUtils_native.clearNavigationHistory();
Dispatcher.dispatch({
type: "LOGOUT",
...a0
}).catch($mk76574());
},
logout: function logout(a0) {
let r3 = arguments[1];
if (r3 === void 0) {
r3 = Routes.DEFAULT_LOGGED_OUT;
}
const DEFAULT_LOGGED_OUT = r3;
const r11 = arguments[2];
let c14966_2 = r11;
const r21 = {
url: Endpoints.LOGOUT,
body: {
provider: getDevicePushProvider(),
token: Storage.get(DEVICE_TOKEN),
voip_provider: DEVICE_PUSH_VOIP_PROVIDER,
voip_token: Storage.get(DEVICE_VOIP_TOKEN)
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_LOGOUT,
properties: {
logout_source: a0
}
}
};
let r41 = r11 != null;
if (r41) {
let authorization = getToken(r11);
if (authorization == null) {
authorization = "";
}
r41 = {
headers: {
authorization
}
};
}
HermesBuiltin.copyDataProperties(r21, r41);
r21.rejectWithError = rejectWithMigratedError();
return TrackedHTTPUtils.post(r21).finally(() => {
if (!(c14966_2 != null && c14966_2 !== AuthenticationStore.getId())) {
handleLogout(a0, DEFAULT_LOGGED_OUT);
}
});
},
switchAccountToken: function switchAccountToken(a0) {
let goHomeAfterSwitching = arguments[1];
if (goHomeAfterSwitching === void 0) {
goHomeAfterSwitching = true;
}
const token6 = AuthenticationStore.getToken();
c3481_16.log("Switching accounts", {
wasLoggedIn: token6 != null,
tokenHasChanged: a0 !== token6
});
const r19 = {
isSwitchingAccount: true,
goHomeAfterSwitching
};
CrossPlatformNativeUtils_native.clearNavigationHistory();
Dispatcher.dispatch({
type: "LOGOUT",
...r19
}).catch($mk76574());
return this.loginToken(a0, true).then(() => {
const isCorrectToken = a0 === AuthenticationStore.getToken();
c3481_16.log("Switched accounts finished", {
isCorrectToken
});
return isCorrectToken;
});
},
verifySSOToken: function verifySSOToken(c14968_0, r6 = Routes.DEFAULT_LOGGED_OUT) {
const DEFAULT_LOGGED_OUT2 = r6;
return HTTP.get({
url: Endpoints.ME,
oldFormErrors: true,
rejectWithError: true
}).catch(() => {
handleLogout(c14968_0, DEFAULT_LOGGED_OUT2);
});
},
verify: async (token3) => {
let c25517_1;
c25517_1 = void 0;
let c29537_0 = await TrackedHTTPUtils.post({
url: Endpoints.VERIFY,
body: {
token: token3
},
trackedActionData: {
event: NetworkActionNames.USER_VERIFY
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "LOGIN_SUCCESS",
token: c29537_0.body.token
});
return c29537_0.body.user_id;
},
authorizePayment: (a0) => TrackedHTTPUtils.post({
url: Endpoints.AUTHORIZE_PAYMENT,
body: {
token: a0
},
trackedActionData: {
event: NetworkActionNames.AUTHORIZE_PAYMENT
},
rejectWithError: true
}),
authorizeIPAddress: (a0) => TrackedHTTPUtils.post({
url: Endpoints.AUTHORIZE_IP,
body: {
token: a0
},
trackedActionData: {
event: NetworkActionNames.AUTHORIZE_IP
},
rejectWithError: true
}),
verifyResend: () => TrackedHTTPUtils.post({
url: Endpoints.VERIFY_RESEND,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_VERIFY_RESEND
},
rejectWithError: rejectWithMigratedError()
}),
resetPassword: async (token4, password2, source2) => {
let r119;
let c25518_2;
let c25518_3 = 0;
let c29538_0, c29538_1, c29538_2, c29538_3, c29538_4, c29538_5, c29538_6, c29538_7, c29538_8, c29538_9;
try {
c29538_0 = void 0;
c29538_1 = void 0;
c29538_2 = void 0;
c29538_3 = void 0;
c29538_4 = void 0;
c29538_5 = void 0;
c29538_6 = void 0;
c29538_7 = void 0;
c29538_8 = void 0;
Dispatcher.dispatch({
type: "LOGIN"
});
const body = {
token: token4,
password: password2,
source: source2
};
const push_token = Storage.get(DEVICE_TOKEN);
const devicePushProvider = getDevicePushProvider();
if (devicePushProvider != null && push_token != null) {
body.push_provider = devicePushProvider;
body.push_token = push_token;
}
const push_voip_token = Storage.get(DEVICE_VOIP_TOKEN);
if (DEVICE_PUSH_VOIP_PROVIDER != null && push_voip_token != null) {
body.push_voip_provider = DEVICE_PUSH_VOIP_PROVIDER;
body.push_voip_token = push_voip_token;
}
c25518_3 = 1;
c29538_0 = (await TrackedHTTPUtils.post({
url: Endpoints.RESET_PASSWORD,
body,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_RESET_PASSWORD
},
rejectWithError: rejectWithMigratedError()
})).body;
c29538_1 = c29538_0.mfa;
c29538_2 = c29538_0.sms;
c29538_3 = c29538_0.webauthn;
c29538_4 = c29538_0.ticket;
c29538_5 = c29538_0.token;
c29538_6 = c29538_0.backup;
c29538_7 = c29538_0.totp;
const r113 = c29538_1;
r119 = {
result: r113 ? c3481_18.MFA : c3481_18.SUCCESS,
sms: c29538_2,
webauthn: c29538_3,
ticket: c29538_4,
token: c29538_5,
backup: c29538_6,
totp: c29538_7
};
c25518_3 = 0;
} catch ($e) {
const r28 = $e;
let r8 = r28;
c25518_2 = r28;
if (c25518_3 !== 0) {
while (true) {
try {
const r134 = c25518_2;
c25518_3 = 0;
c29538_9 = r134;
c29538_8 = new V6OrEarlierAPIError(c29538_9);
Dispatcher.dispatch({
type: "LOGIN_FAILURE",
error: c29538_8
});
throw c29538_8;
} catch (r130) {
r8 = r130;
c25518_2 = r130;
if (c25518_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r119;
},
resetPasswordMFAv2: async ({ method, code, ticket: ticket2, password: password3, token: token5, source: source3 }) => {
Dispatcher.dispatch({
type: "LOGIN_MFA"
});
return (await TrackedHTTPUtils.post({
url: Endpoints.RESET_PASSWORD,
body: {
code,
ticket: ticket2,
password: password3,
token: token5,
source: source3,
method
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_RESET_PASSWORD,
properties: {
mfa: true
}
},
rejectWithError: true
})).body.token;
},
forgotPassword: async (login3) => {
let method2;
let c25520_2;
let c25520_3 = 0;
let c29539_0, c29539_1, c29539_2;
try {
c29539_0 = void 0;
c29539_1 = void 0;
Dispatcher.dispatch({
type: "FORGOT_PASSWORD_REQUEST"
});
c25520_3 = 1;
c29539_0 = await TrackedHTTPUtils.post({
url: Endpoints.FORGOT_PASSWORD,
body: {
login: login3
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.FORGOT_PASSWORD
},
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "FORGOT_PASSWORD_SENT"
});
method2 = c29539_0.body.method;
c25520_3 = 0;
} catch ($e) {
const r27 = $e;
let r8 = r27;
c25520_2 = r27;
if (c25520_3 !== 0) {
while (true) {
try {
const r93 = c25520_2;
c25520_3 = 0;
c29539_2 = r93;
c29539_1 = new V6OrEarlierAPIError(c29539_2);
if (c29539_1.code !== AbortCodes.PHONE_VERIFICATION_REQUIRED) {
Dispatcher.dispatch({
type: "LOGIN_FAILURE",
error: c29539_1
});
throw c29539_1;
}
Dispatcher.dispatch({
type: "LOGIN_PASSWORD_RECOVERY_PHONE_VERIFICATION",
credentials: {
login: login3
}
});
} catch (r89) {
r8 = r89;
c25520_2 = r89;
if (c25520_3 === 0) {
break;
}
continue;
}
return false;
}
}
throw r8;
}
return method2;
},
setFingerprint: (a0) => {
Dispatcher.dispatch({
type: "FINGERPRINT",
fingerprint: a0
});
},
getExperiments: (a0) => {
Dispatcher.dispatch({
type: "EXPERIMENTS_FETCH",
withGuildExperiments: a0
});
},
getLocationMetadata: () => {
let r25;
if (c3481_17 != null) {
r25 = c3481_17;
} else {
clearTimeout(c3481_4);
c3481_4 = setTimeout(() => {
Dispatcher.dispatch({
type: "SET_CONSENT_REQUIRED",
consentRequired: true
});
}, 5000);
r25 = HTTP.get({
url: Endpoints.AUTH_LOCATION_METADATA,
retries: 2,
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
clearTimeout(c3481_4);
if (ConsentStore.getAuthenticationConsentRequired() == null) {
let consentRequired = result == null ? void 0 : result.body?.consent_required;
if (consentRequired == null) {
consentRequired = true;
}
Dispatcher.dispatch({
type: "SET_CONSENT_REQUIRED",
consentRequired
});
}
let countryCode = result == null ? void 0 : result.body?.country_code;
if (countryCode == null) {
countryCode = void 0;
}
Dispatcher.dispatch({
type: "SET_LOCATION_METADATA",
countryCode
});
c3481_17 = null;
if ((result == null ? void 0 : result.body?.promotional_email_opt_in) != null) {
const promotional_email_opt_in = result.body.promotional_email_opt_in;
setPromoEmailConsentState({
required: promotional_email_opt_in.required,
checked: promotional_email_opt_in.pre_checked,
preChecked: promotional_email_opt_in.pre_checked
});
}
}, () => {
clearTimeout(c3481_4);
Dispatcher.dispatch({
type: "SET_CONSENT_REQUIRED",
consentRequired: true
});
c3481_17 = null;
});
c3481_17 = r25;
}
return r25;
},
closeSuspendedUser: () => {
Dispatcher.dispatch({
type: "CLOSE_SUSPENDED_USER"
});
}
};
export default r48;
export { c3481_18 as PasswordResetResult };
+314
View File
@@ -0,0 +1,314 @@
// Metro module 4085 (f4086).
import AppliedGuildBoostRecord from "../records/AppliedGuildBoostRecord";
import GuildBoostSlotRecord from "../records/GuildBoostSlotRecord";
import SubscriptionStore from "../stores/billing/SubscriptionStore";
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import { AppliedGuildBoostError } from "../errors/index";
function $mk114457($env) {
return (a0) => AppliedGuildBoostRecord.createFromServer(a0);
}
function $mk114458($env) {
return (a0) => AppliedGuildBoostRecord.createFromServer(a0);
}
function $mk114459($env) {
return (a0) => GuildBoostSlotRecord.createFromServer(a0, SubscriptionStore.getSubscriptionById(a0.subscription_id));
}
let env2349 = {};
export async function fetchGuildBoostSlots() {
let env29270;
const r12 = env2349;
let c24933_1 = r12;
const r25 = env29270 = {
$parent: r12
};
let c24933_0 = r25;
env29270[0] = void 0;
Dispatcher.dispatch({
type: "GUILD_BOOST_SLOTS_FETCH"
});
env29270[0] = (await HTTP.get({
url: Endpoints.USER_GUILD_BOOST_SLOTS,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body.map($mk114459(env2349));
Dispatcher.dispatch({
type: "GUILD_BOOST_SLOTS_FETCH_SUCCESS",
guildBoostSlots: env29270[0]
});
return env29270[0];
}
export async function fetchAppliedGuildBoostsForGuild(c24931_0, c24931_1) {
let env29268;
const r28 = env2349;
let c24931_3 = r28;
const r10 = env29268 = {
$parent: r28
};
let c24931_2 = r10;
env29268[1] = void 0;
env29268[0] = c24931_0;
let r30 = c24931_1;
if (r30 === void 0) {
r30 = {};
}
const includeEnded = r30.includeEnded;
if (includeEnded !== void 0) {
env29268[1] = includeEnded;
env29268[2] = void 0;
} else {
env29268[1] = false;
env29268[2] = void 0;
}
await void 0;
let query = void 0;
const r55 = {
url: Endpoints.APPLIED_GUILD_BOOSTS_FOR_GUILD(env29268[0]),
oldFormErrors: true,
query: null,
rejectWithError: true
};
if (env29268[1]) {
query = {
include_ended: true
};
}
r55.query = query;
env29268[2] = (await HTTP.get(r55)).body.map($mk114457(env2349));
Dispatcher.dispatch({
type: "GUILD_APPLIED_BOOSTS_FETCH_SUCCESS",
guildId: env29268[0],
appliedBoosts: env29268[2]
});
return env29268[2];
}
export async function fetchAppliedGuildBoostsForUser(c24932_0) {
let env29269;
const r25 = env2349;
let c24932_2 = r25;
const r10 = env29269 = {
$parent: r25
};
let c24932_1 = r10;
env29269[0] = void 0;
if (c24932_0 !== void 0) {
env29269[0] = c24932_0;
env29269[1] = void 0;
} else {
env29269[0] = false;
env29269[1] = void 0;
}
await void 0;
env29269[1] = (await HTTP.get({
url: Endpoints.USER_APPLIED_GUILD_BOOSTS,
oldFormErrors: true,
query: {
paused: env29269[0]
},
rejectWithError: true
})).body.map($mk114458(env2349));
Dispatcher.dispatch({
type: "USER_APPLIED_BOOSTS_FETCH_SUCCESS",
appliedGuildBoosts: env29269[1]
});
return env29269[1];
}
export async function fetchAppliedBoostsCooldown() {
let r69;
let c24934_2;
let c24934_3 = 0;
let c29271_0, c29271_1;
try {
c29271_0 = void 0;
c24934_3 = 1;
c29271_0 = (await HTTP.get({
url: Endpoints.APPLIED_GUILD_BOOST_COOLDOWN,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body.ends_at;
Dispatcher.dispatch({
type: "APPLIED_BOOSTS_COOLDOWN_FETCH_SUCCESS",
endsAt: c29271_0
});
r69 = c29271_0;
c24934_3 = 0;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c24934_2 = r26;
if (c24934_3 !== 0) {
while (true) {
try {
const r77 = c24934_2;
c24934_3 = 0;
c29271_1 = r77;
if (c29271_1.status !== 404) {
throw new AppliedGuildBoostError(c29271_1);
}
Dispatcher.dispatch({
type: "APPLIED_BOOSTS_COOLDOWN_FETCH_SUCCESS",
endsAt: null
});
} catch (r74) {
r8 = r74;
c24934_2 = r74;
if (c24934_3 === 0) {
break;
}
continue;
}
return null;
}
}
throw r8;
}
return r69;
}
export async function applyToGuild(c24935_0, c24935_1, c24935_2) {
let r127;
let c24935_5;
let c24935_6 = 0;
let c29272_2, c29272_0, c29272_1, c29272_3, c29272_4, c29272_5, c29272_6;
try {
c29272_2 = void 0;
c29272_0 = c24935_0;
c29272_1 = c24935_1;
if (c24935_2 !== void 0) {
c29272_2 = c24935_2;
c29272_3 = void 0;
c29272_4 = void 0;
c29272_5 = void 0;
} else {
c29272_2 = false;
c29272_3 = void 0;
c29272_4 = void 0;
c29272_5 = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "GUILD_APPLY_BOOST_START"
});
c24935_6 = 1;
c29272_3 = await HTTP.put({
url: Endpoints.APPLIED_GUILD_BOOSTS_FOR_GUILD(c29272_0),
body: {
user_premium_guild_subscription_slot_ids: c29272_1,
disable_powerup_auto_apply: c29272_2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
c29272_4 = Array.isArray(c29272_3.body) ? c29272_3.body.map(AppliedGuildBoostRecord.createFromServer) : [AppliedGuildBoostRecord.createFromServer(c29272_3.body)];
Dispatcher.dispatch({
type: "GUILD_APPLY_BOOST_SUCCESS",
appliedGuildBoost: c29272_4
});
(0, fetchGuildBoostSlots)();
r127 = c29272_4;
c24935_6 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c24935_5 = r32;
if (c24935_6 !== 0) {
while (true) {
try {
const r136 = c24935_5;
c24935_6 = 0;
c29272_6 = r136;
c29272_5 = new AppliedGuildBoostError(c29272_6);
Dispatcher.dispatch({
type: "GUILD_APPLY_BOOST_FAIL",
error: c29272_5
});
throw c29272_5;
} catch (r132) {
r8 = r132;
c24935_5 = r132;
if (c24935_6 === 0) {
break;
}
}
}
}
throw r8;
}
return r127;
}
export async function unapplyFromGuild(c24936_0, c24936_1) {
let c24936_4;
let c24936_5 = 0;
let c29273_0, c29273_1, c29273_2;
try {
c29273_0 = c24936_1;
c29273_1 = void 0;
Dispatcher.dispatch({
type: "GUILD_UNAPPLY_BOOST_START"
});
c24936_5 = 1;
await HTTP.del({
url: Endpoints.APPLIED_GUILD_BOOST(c24936_0, c24936_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
(0, fetchGuildBoostSlots)();
c24936_5 = 0;
Dispatcher.dispatch({
type: "GUILD_UNAPPLY_BOOST_SUCCESS",
boostId: c29273_0
});
} catch ($e) {
const r28 = $e;
let r8 = r28;
c24936_4 = r28;
if (c24936_5 !== 0) {
while (true) {
try {
const r87 = c24936_4;
c24936_5 = 0;
c29273_2 = r87;
c29273_1 = new AppliedGuildBoostError(c29273_2);
Dispatcher.dispatch({
type: "GUILD_UNAPPLY_BOOST_FAIL",
error: c29273_1
});
throw c29273_1;
} catch (r83) {
r8 = r83;
c24936_4 = r83;
if (c24936_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
export async function cancelGuildBoostSlot(c24937_0) {
let c29274_0 = await HTTP.post({
url: Endpoints.USER_GUILD_BOOST_SLOT_CANCEL(c24937_0),
oldFormErrors: true,
rejectWithError: true
});
let c29274_1 = GuildBoostSlotRecord.createFromServer(c29274_0.body, SubscriptionStore.getSubscriptionById(c29274_0.body.subscription_id));
Dispatcher.dispatch({
type: "GUILD_BOOST_SLOT_UPDATE_SUCCESS",
guildBoostSlot: c29274_1
});
return c29274_1;
}
export async function uncancelGuildBoostSlot(c24938_0) {
let c29275_0 = await HTTP.post({
url: Endpoints.USER_GUILD_BOOST_SLOT_UNCANCEL(c24938_0),
oldFormErrors: true,
rejectWithError: true
});
let c29275_1 = GuildBoostSlotRecord.createFromServer(c29275_0.body, SubscriptionStore.getSubscriptionById(c29275_0.body.subscription_id));
Dispatcher.dispatch({
type: "GUILD_BOOST_SLOT_UPDATE_SUCCESS",
guildBoostSlot: c29275_1
});
return c29275_1;
}
+110
View File
@@ -0,0 +1,110 @@
// Metro module 8917 (f8918).
import ChannelStore from "../stores/ChannelStore";
import RelationshipStore from "../stores/RelationshipStore";
import UserStore from "../stores/UserStore";
import { AnalyticEvents, ChannelTypes, ChannelTypesSets, Endpoints } from "../Constants";
import SelectedChannelActionCreators from "./SelectedChannelActionCreators";
import { HTTP } from "../_bundle/sendRequest";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import AlertActionCreators from "./AlertActionCreators";
import { intl, t } from "../intl/index.native";
import RelationshipActionCreators from "./RelationshipActionCreators";
import * as _useCanRing from "../modules/calls/useCanRing";
import Dispatcher from "../Dispatcher";
const r25 = {
call: function call(a0, a1, a2, a3, a4) {
let user;
const userId = a3;
if (a3 != null) {
if (RelationshipStore.isBlocked(a3)) {
return void 0;
}
user = UserStore.getUser(a3);
HTTP.get({
url: Endpoints.CALL(a0),
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
const r4 = a2 && result.body.ringable;
SelectedChannelActionCreators.selectVoiceChannel(a0, a1);
if (r4) {
this.ring(a0);
}
if (a4 != null) {
a4(a0);
}
}, () => {
AnalyticsUtils.track(AnalyticEvents.OPEN_POPOUT, {
type: "Not Friend",
source: "Call"
});
AlertActionCreators.show({
title: intl.string(t.My50nf),
body: intl.format(t.IdKo2z, {
username: user != null ? user.username : ""
}),
confirmText: intl.string(t["PMsq/b"]),
cancelText: intl.string(t.BddRzS),
onConfirm: () => {
RelationshipActionCreators.addRelationship({
userId,
context: {
location: "Call"
}
});
}
});
});
} else {
SelectedChannelActionCreators.selectVoiceChannel(a0, a1);
if (a2) {
this.ring(a0);
}
if (a4 != null) {
a4(a0);
}
}
},
ring: (a0, a1, a2) => {
const channel = ChannelStore.getChannel(a0);
if (channel != null) {
const canRingUsersInChannel = _useCanRing.canRingUsersInChannel(channel);
const r20 = ChannelTypesSets.CALLABLE.has(channel.type);
if (canRingUsersInChannel) {
HTTP.post({
url: Endpoints.CALL_RING(a0),
body: {
recipients: a1,
analytics_location: a2
},
oldFormErrors: true,
rejectWithError: true
});
if (channel.type === ChannelTypes.GUILD_VOICE && a1 != null) {
Dispatcher.dispatch({
type: "GUILD_LOCAL_RING_START",
ringing: a1,
guildId: channel.guild_id
});
}
return void 0;
}
if (r20) {
Dispatcher.dispatch({
type: "CALL_ENQUEUE_RING",
channelId: a0,
recipients: a1
});
}
}
},
stopRinging: (a0, a1) => HTTP.post({
url: Endpoints.CALL_STOP_RINGING(a0),
body: {
recipients: a1
},
oldFormErrors: true,
rejectWithError: true
})
};
export default r25;
@@ -0,0 +1,26 @@
// Metro module 10002 (f10003).
import Dispatcher from "../Dispatcher";
export function categoryCollapse(a0) {
Dispatcher.dispatch({
type: "CATEGORY_COLLAPSE",
id: a0
});
}
export function categoryExpand(a0) {
Dispatcher.dispatch({
type: "CATEGORY_EXPAND",
id: a0
});
}
export function categoryCollapseAll(a0) {
Dispatcher.dispatch({
type: "CATEGORY_COLLAPSE_ALL",
guildId: a0
});
}
export function categoryExpandAll(a0) {
Dispatcher.dispatch({
type: "CATEGORY_EXPAND_ALL",
guildId: a0
});
}
@@ -0,0 +1,9 @@
// Metro module 13529 (f13530).
import Dispatcher from "../Dispatcher";
export function setCertifiedDevices(a0, a1) {
Dispatcher.dispatch({
type: "CERTIFIED_DEVICES_SET",
applicationId: a0,
devices: a1
});
}
+121
View File
@@ -0,0 +1,121 @@
// Metro module 7867 (f7868).
import ChangelogStore from "../modules/changelog/ChangelogStore";
import { Endpoints } from "../Constants";
import { ChangelogPlatforms } from "../modules/changelog/ChangelogConstants";
import Dispatcher from "../Dispatcher";
import { LastReceivedChangelogId } from "../modules/user_settings/UserSettings";
import { HTTP } from "../_bundle/sendRequest";
const cacheBustParam = function cacheBustParam() {
return `x=${Math.floor(new Date().getMinutes() / 5)}`;
};
const r24 = {
lockChangeLog: (a0) => {
Dispatcher.dispatch({
type: "CHANGE_LOG_LOCK",
key: a0
});
},
unlockChangeLog: (a0) => {
Dispatcher.dispatch({
type: "CHANGE_LOG_UNLOCK",
key: a0
});
},
markChangelogAsSeen: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANGE_LOG_MARK_SEEN",
changelogId: a0,
changelogDate: a1
});
LastReceivedChangelogId.updateSetting(a0);
},
setChangelogOverride: function setChangelogOverride(a0) {
Dispatcher.dispatch({
type: "CHANGE_LOG_SET_OVERRIDE",
id: a0
});
if (a0 != null) {
this.sendChangelogMessage(a0);
}
},
sendChangelogMessage: (a0) => {
HTTP.post({
url: Endpoints.CHANGELOG_MESSAGES,
body: {
changelog_id: a0
},
rejectWithError: true
});
},
fetchChangelogConfig: () => HTTP.get({
url: `https://cdn.discordapp.com/changelogs/config_${ChangelogPlatforms.MOBILE}.json?${`x=${Math.floor(new Date().getMinutes() / 5)}`}`,
rejectWithError: true
}),
fetchChangelog: async function fetchChangelog(c16055_0, c16055_1, r7 = false) {
let r129, body, changelog;
let c16055_2 = r7;
let r5 = arguments[3];
if (r5 === void 0) {
r5 = false;
}
let c16055_3 = r5;
const _this = this;
let c26045_2 = 0;
let c29858_0;
L17: {
try {
c29858_0 = void 0;
if (ChangelogStore.getChangelog(c16055_0, c16055_1) != null) {
break L17;
}
const r35 = c16055_2 ? ChangelogPlatforms.DESKTOP : ChangelogPlatforms.MOBILE;
const r34 = c16055_3 ? "" : `?${cacheBustParam()}`;
c26045_2 = 1;
c29858_0 = await HTTP.get({
url: `https://cdn.discordapp.com/changelogs/${r35}/${c16055_0}/${c16055_1}.json${r34}`,
rejectWithError: true
});
Dispatcher.dispatch({
type: "CHANGE_LOG_FETCH_SUCCESS",
id: c16055_0,
changelog: c29858_0.body
});
body = c29858_0.body;
c26045_2 = 0;
} catch ($e) {
let r51 = $e;
if (c26045_2 !== 0) {
while (true) {
L28: {
try {
c26045_2 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_FETCH_FAILED",
id: c16055_0,
locale: c16055_1
});
r129 = null;
if (c16055_1 !== "en-US") {
changelog = await _this.fetchChangelog(c16055_0, "en-US");
break L28;
}
} catch ($e) {
r51 = $e;
if (c26045_2 === 0) {
break;
}
continue;
}
return r129;
}
return changelog;
}
}
throw r51;
}
return body;
}
return null;
}
};
export default r24;
+27
View File
@@ -0,0 +1,27 @@
// Metro module 6181 (f6182).
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import MessageActionCreators from "./MessageActionCreators";
import { intl, t } from "../intl/index.native";
const r16 = {
changeNickname: (a0, c15560_0, a2, nick) => HTTP.patch({
url: Endpoints.GUILD_MEMBER_NICK(a0, a2),
body: {
nick
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
nick = result.body.nick;
MessageActionCreators.sendBotMessage(c15560_0, nick != null && nick !== "" ? intl.formatToMarkdownString(t["gz+HRq"], {
nick
}) : intl.string(t.Vhpd9A));
}, (a0) => {
if (a0.status === 403) {
MessageActionCreators.sendBotMessage(c15560_0, intl.formatToMarkdownString(t.Izf9jO, {}));
} else {
MessageActionCreators.sendBotMessage(c15560_0, intl.string(t["5LO/Ss"]));
}
})
};
export default r16;
+81
View File
@@ -0,0 +1,81 @@
// Metro module 16484 (f16485).
import { Endpoints } from "../Constants";
import Dispatcher from "../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
const r16 = {
openModal: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANGE_VANITY_URL_MODAL_OPEN",
guildId: a0,
code: a1
});
},
closeModal: () => {
Dispatcher.dispatch({
type: "CHANGE_VANITY_URL_MODAL_CLOSE"
});
},
removeVanityURL: (a0) => HTTP.patch({
url: Endpoints.GUILD_VANITY_URL(a0),
body: {
code: null
},
oldFormErrors: true,
rejectWithError: true
}).then(() => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_SET_VANITY_URL",
code: null,
uses: 0
});
}),
changeVanityURL: function changeVanityURL(a0, a1) {
Dispatcher.dispatch({
type: "CHANGE_VANITY_URL_MODAL_SUBMIT"
});
return HTTP.patch({
url: Endpoints.GUILD_VANITY_URL(a0),
body: {
code: a1
},
oldFormErrors: true,
rejectWithError: true
}).then(({ body }) => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_SET_VANITY_URL",
code: body.code,
uses: body.uses
});
this.closeModal();
}, (a0) => {
Dispatcher.dispatch({
type: "CHANGE_VANITY_URL_MODAL_SUBMIT_FAILURE",
error: a0.body,
hasError: true
});
return a0;
});
},
setVanityURL: (a0, a1) => HTTP.patch({
url: Endpoints.GUILD_VANITY_URL(a0),
body: {
code: a1
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_SET_VANITY_URL",
code: body.code,
uses: body.uses
});
}, (a0) => {
Dispatcher.dispatch({
type: "CHANGE_VANITY_URL_MODAL_SUBMIT_FAILURE",
error: a0.body,
hasError: true
});
return a0;
})
};
export default r16;
+658
View File
@@ -0,0 +1,658 @@
// Metro module 4199 (f4200).
import _slicedToArray from "../_bundle/_slicedToArray";
import ChangelogStore from "../modules/changelog/ChangelogStore";
import { createChannelRecordFromServer } from "../records/ChannelRecord";
import ChannelStore from "../stores/ChannelStore";
import ReadStateStore from "../stores/ReadStateStore";
import { Endpoints, AbortCodes, AnalyticEvents, Routes, ME, CURRENT_APP_CONTEXT, ChannelTypes } from "../Constants";
import CallActionCreators from "./CallActionCreators";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import openQuarantineModeInfoModal_native from "../modules/quarantine/openQuarantineModeInfoModal.native";
import { getRootNavigationRef } from "../modules/main_tabs_v2/RootNavigationRef.native";
import { transitionToChannel } from "../modules/routing/transitionToChannel";
import SelectedChannelActionCreators from "./SelectedChannelActionCreators";
import Dispatcher from "../Dispatcher";
import isChangelogChannel from "../modules/changelog/utils/isChangelogChannel";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import { transitionTo } from "../modules/routing/router_utils";
import { AccessibilityAnnouncer } from "../design/shared";
import { intl, t } from "../intl/index.native";
import GuildTemplateTooltipActionCreators from "../modules/guild_templates/GuildTemplateTooltipActionCreators";
import { httpGetWithCountryCodeQuery } from "../utils/StoreUtils";
let env2419 = {};
const r35 = {
openPrivateChannel: async function openPrivateChannel(a0) {
let r73, id;
let env13902 = {
$parent: env2419
};
env13902[0] = a0.recipientIds;
let joinCall = a0.joinCall;
if (joinCall === void 0) {
joinCall = false;
}
env13902[1] = joinCall;
let joinCallVideo = a0.joinCallVideo;
if (joinCallVideo === void 0) {
joinCallVideo = false;
}
env13902[2] = joinCallVideo;
env13902[3] = a0.location;
env13902[4] = a0.onBeforeTransition;
let navigateToChannel = a0.navigateToChannel;
if (navigateToChannel === void 0) {
navigateToChannel = true;
}
env13902[5] = navigateToChannel;
env13902[6] = this;
let c24954_0, c24954_1, c24954_2;
let c24954_3 = 0;
const r17 = env13902;
L17: {
L10: {
try {
let env29280;
c24954_1 = r17;
const r41 = env29280 = {
$parent: r17
};
c24954_0 = r41;
env29280[1] = void 0;
const joinCallIfRequested = function joinCallIfRequested(a0) {
if (env13902[1]) {
CallActionCreators.call(a0.id, env13902[2], true, a0.isDM() ? a0.getRecipientId() : null);
}
};
env29280[0] = joinCallIfRequested;
const recipients = env13902[6]._getRecipients(env13902[0]);
if (recipients.length === 1) {
const r68 = env13902[6]._openCachedDMChannel(_slicedToArray(recipients, 1)[0], env13902[4], env13902[5]);
if (r68 != null) {
joinCallIfRequested(r68);
r73 = Promise.resolve(r68.id);
break L10;
}
}
c24954_3 = 1;
env29280[1] = await HTTP.post({
url: Endpoints.USER_CHANNELS,
body: {
recipients
},
context: {
location: env13902[3]
},
oldFormErrors: true,
retries: 3,
rejectWithError: rejectWithMigratedError()
});
if (env13902[5]) {
const r99 = env13902[4];
if (r99 != null) {
r99();
}
(0, env29280[0])(env13902[6]._openPrivateChannel(env29280[1].body));
}
id = env29280[1].body.id;
c24954_3 = 0;
break L17;
} catch ($e) {
const r39 = $e;
let r15 = r39;
c24954_2 = r39;
if (c24954_3 !== 0) {
while (true) {
try {
const r116 = c24954_2;
c24954_3 = 0;
env29280[2] = r116;
const r118 = env29280[2];
if ((r118 == null ? void 0 : r118.body?.code) === AbortCodes.QUARANTINED) {
openQuarantineModeInfoModal_native();
}
throw env29280[2];
} catch (r113) {
r15 = r113;
c24954_2 = r113;
if (c24954_3 === 0) {
break;
}
}
}
}
throw r15;
}
}
return r73;
}
return id;
},
createGroupDmShell: async function createGroupDmShell({ recipientId, location: location2, onBeforeTransition, navigateToChannel = true }) {
let id;
let c13903_3 = navigateToChannel;
const _this = this;
let c24955_2;
let c24955_3 = 0;
let c29281_0, c29281_1;
try {
c29281_0 = void 0;
c24955_3 = 1;
c29281_0 = await HTTP.post({
url: Endpoints.USER_GROUP_DM_SHELL,
body: {
recipient_id: recipientId
},
context: {
location: location2
},
oldFormErrors: true,
retries: 3,
rejectWithError: rejectWithMigratedError()
});
if (c13903_3) {
if (onBeforeTransition != null) {
onBeforeTransition();
}
_this._openPrivateChannel(c29281_0.body);
}
id = c29281_0.body.id;
c24955_3 = 0;
} catch ($e) {
const r32 = $e;
let r13 = r32;
c24955_2 = r32;
if (c24955_3 !== 0) {
while (true) {
try {
const r89 = c24955_2;
c24955_3 = 0;
c29281_1 = r89;
const r91 = c29281_1;
if ((r91 == null ? void 0 : r91.body?.code) === AbortCodes.QUARANTINED) {
openQuarantineModeInfoModal_native();
}
throw c29281_1;
} catch (r86) {
r13 = r86;
c24955_2 = r86;
if (c24955_3 === 0) {
break;
}
}
}
}
throw r13;
}
return id;
},
_openCachedDMChannel: function _openCachedDMChannel(a0, a1, r5 = true) {
const dMFromUserId = ChannelStore.getDMFromUserId(a0);
const r10 = dMFromUserId != null ? ChannelStore.getChannel(dMFromUserId) : null;
const r12 = r10 == null;
let r13 = null;
if (!r12) {
r13 = r10;
if (r5) {
if (a1 != null) {
a1();
}
if (getRootNavigationRef() != null) {
transitionToChannel(r10.id, {
navigationReplace: true
});
r13 = r10;
} else {
SelectedChannelActionCreators.selectPrivateChannel(r10.id);
r13 = r10;
}
}
}
return r13;
},
ensurePrivateChannel: async function ensurePrivateChannel(c13904_0) {
const _this2 = this;
let c24956_1;
c24956_1 = void 0;
let c29282_0 = await HTTP.post({
url: Endpoints.USER_CHANNELS,
body: {
recipients: _this2._getRecipients(c13904_0)
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
let c29282_1 = (0, createChannelRecordFromServer)(c29282_0.body);
Dispatcher.dispatch({
type: "CHANNEL_CREATE",
channel: c29282_1
});
return c29282_1.id;
},
getOrEnsurePrivateChannel: async function getOrEnsurePrivateChannel(c13905_0) {
let dMFromUserId;
const _this3 = this;
L11: {
dMFromUserId = ChannelStore.getDMFromUserId(c13905_0);
if (dMFromUserId != null) {
break L11;
}
return await _this3.ensurePrivateChannel(c13905_0);
}
return dMFromUserId;
},
getDMChannel: async (c13906_0) => {
let c24958_1;
c24958_1 = void 0;
let c29283_0 = await HTTP.get({
url: Endpoints.DM_CHANNEL(c13906_0),
rejectWithError: true
});
let c29283_1 = (0, createChannelRecordFromServer)(c29283_0.body);
Dispatcher.dispatch({
type: "CHANNEL_CREATE",
channel: c29283_1
});
return c29283_1.id;
},
_getRecipients: (a0) => a0 != null ? Array.isArray(a0) ? a0 : [a0] : [],
_openPrivateChannel: (a0) => {
const channel = (0, createChannelRecordFromServer)(a0);
Dispatcher.dispatch({
type: "CHANNEL_CREATE",
channel
});
if (getRootNavigationRef() != null) {
transitionToChannel(channel.id, {
navigationReplace: true
});
} else {
SelectedChannelActionCreators.selectPrivateChannel(channel.id);
}
return channel;
},
closePrivateChannel: function closePrivateChannel(a0, r3 = false, silent = false) {
if (isChangelogChannel(a0)) {
AnalyticsUtils.track(AnalyticEvents.CHANGE_LOG_DM_REMOVED, {
last_changelog_id: ChangelogStore.latestChangelogId(),
unread_count: ReadStateStore.getUnreadCount(a0)
});
}
Dispatcher.dispatch({
type: "CHANNEL_DELETE",
channel: {
id: a0,
guild_id: void 0,
parent_id: void 0
},
silent
});
if (r3) {
transitionTo(Routes.FRIENDS);
}
return HTTP.del({
url: Endpoints.CHANNEL(a0),
query: {
silent
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
AccessibilityAnnouncer.announce(intl.string(t.nRbucl));
}).catch(() => {
AccessibilityAnnouncer.announce(intl.string(t.ndXVI5));
});
},
updatePermissionOverwrite: async (c13907_0, body) => {
let c24959_1;
c24959_1 = void 0;
let c29284_0 = await HTTP.put({
url: Endpoints.CHANNEL_PERMISSIONS_OVERWRITE(c13907_0, body.id),
body,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "CHANNEL_PERMISSIONS_PUT_OVERWRITE_SUCCESS",
channelId: c13907_0,
overwrite: body
});
return c29284_0;
},
clearPermissionOverwrite: async (c13908_0, c13908_1) => {
let c24960_1;
c24960_1 = void 0;
let c29285_0 = await HTTP.del({
url: Endpoints.CHANNEL_PERMISSIONS_OVERWRITE(c13908_0, c13908_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "CHANNEL_PERMISSIONS_DELETE_OVERWRITE_SUCCESS",
channelId: c13908_0,
overwriteId: c13908_1
});
return c29285_0;
},
addRecipient: function addRecipient(a0, a1, a2, c13909_0) {
return HTTP.put({
url: Endpoints.CHANNEL_RECIPIENT(a0, a1),
context: {
location: a2
},
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
AccessibilityAnnouncer.announce(intl.string(t.cU0t1F));
if (c13909_0 != null) {
c13909_0();
}
return result.status === 201 ? this._openPrivateChannel(result.body).id : a0;
}).catch(() => {
AccessibilityAnnouncer.announce(intl.string(t["8GEdej"]));
return a0;
});
},
addRecipients: function addRecipients(a0, a1, a2, a3) {
return this.addRecipient(a0, a1[0], a2, a3).then((c24961_0) => Promise.all(a1.slice(1).map((item) => this.addRecipient(c24961_0, item, a2))).then(() => c24961_0));
},
removeRecipient: (a0, a1) => HTTP.del({
url: Endpoints.CHANNEL_RECIPIENT(a0, a1),
oldFormErrors: true,
rejectWithError: true
}),
setDMOwner: (a0, a1) => HTTP.patch({
url: Endpoints.CHANNEL(a0),
body: {
owner: a1
},
oldFormErrors: true,
rejectWithError: true
}),
setName: async (c13911_0, name) => {
let c24962_1;
c24962_1 = void 0;
let c29286_0 = ChannelStore.getChannel(c13911_0);
let c29286_1 = await HTTP.patch({
url: Endpoints.CHANNEL(c13911_0),
body: {
name
},
oldFormErrors: true,
rejectWithError: true
});
let c29286_2 = c29286_0 == null ? void 0 : c29286_0.getGuildId();
let r61 = c29286_2 == null;
if (!r61) {
r61 = c29286_0 == null ? void 0 : c29286_0.isThread();
}
if (!r61) {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c29286_2);
}
return c29286_1;
},
setIcon: async (channel_id, icon, location3) => {
let r112;
let c24963_2;
let c24963_3 = 0;
let c29287_0, c29287_1, c29287_2, c29287_3, c29287_4;
try {
c29287_0 = void 0;
c29287_1 = void 0;
c29287_2 = void 0;
c29287_3 = void 0;
const channel = ChannelStore.getChannel(channel_id);
c29287_0 = channel;
const r23 = {
channel_id,
channel_type: channel?.type,
old_icon_set: channel?.icon != null,
new_icon_set: icon != null,
location: location3
};
c29287_1 = r23;
AnalyticsUtils.track(AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED, {
...r23,
status: "initiated"
});
c24963_3 = 1;
c29287_2 = await HTTP.patch({
url: Endpoints.CHANNEL(channel_id),
body: {
icon
},
oldFormErrors: true,
rejectWithError: true,
failImmediatelyWhenRateLimited: true
});
AnalyticsUtils.track(AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED, {
...c29287_1,
status: "success"
});
const r99 = c29287_0;
c29287_3 = r99 == null ? void 0 : r99.getGuildId();
let r104 = c29287_3 == null;
if (!r104) {
const r107 = c29287_0;
r104 = r107 == null ? void 0 : r107.isThread();
}
if (!r104) {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c29287_3);
}
r112 = c29287_2;
c24963_3 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c24963_2 = r32;
if (c24963_3 !== 0) {
while (true) {
try {
const r131 = c24963_2;
c24963_3 = 0;
c29287_4 = r131;
const CHANNEL_ICON_EDIT_PROGRESSED = AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED;
const r145 = c29287_4;
const r147 = r145 == null ? void 0 : r145.body?.retry_after;
const r150 = c29287_4;
AnalyticsUtils.track(CHANNEL_ICON_EDIT_PROGRESSED, {
...c29287_1,
status: "failed",
is_rate_limited: r147 != null,
error_message: r150 == null ? void 0 : r150.body?.message
});
throw c29287_4;
} catch (r127) {
r8 = r127;
c24963_2 = r127;
if (c24963_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r112;
},
updateChannel: async (channel_id2, body2, location4) => {
let r114;
let c24964_2;
let c24964_3 = 0;
let c29288_0, c29288_1, c29288_2, c29288_3, c29288_4, c29288_5;
try {
c29288_0 = void 0;
c29288_1 = void 0;
c29288_2 = void 0;
c29288_3 = void 0;
c29288_4 = void 0;
const r37 = "icon" in body2;
c29288_0 = r37;
const channel = ChannelStore.getChannel(channel_id2);
c29288_1 = channel;
const r26 = {
channel_id: channel_id2,
channel_type: channel?.type,
old_icon_set: channel?.icon != null,
new_icon_set: body2.icon != null,
location: location4
};
c29288_2 = r26;
if (r37) {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED, {
...r26,
status: "initiated"
});
}
c24964_3 = 1;
c29288_3 = await HTTP.patch({
context: {
location: location4
},
url: Endpoints.CHANNEL(channel_id2),
body: body2,
oldFormErrors: true,
rejectWithError: true
});
const r89 = c29288_1;
c29288_4 = r89 == null ? void 0 : r89.getGuildId();
let r94 = c29288_4 == null;
if (!r94) {
const r97 = c29288_1;
r94 = r97 == null ? void 0 : r97.isThread();
}
if (!r94) {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c29288_4);
}
if (c29288_0) {
AnalyticsUtils.track(AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED, {
...c29288_2,
status: "success"
});
}
r114 = c29288_3;
c24964_3 = 0;
} catch ($e) {
const r35 = $e;
let r8 = r35;
c24964_2 = r35;
if (c24964_3 !== 0) {
while (true) {
try {
const r136 = c24964_2;
c24964_3 = 0;
c29288_5 = r136;
if (c29288_0) {
const CHANNEL_ICON_EDIT_PROGRESSED = AnalyticEvents.CHANNEL_ICON_EDIT_PROGRESSED;
const r154 = c29288_5;
const r156 = r154 == null ? void 0 : r154.body?.retry_after;
const r159 = c29288_5;
AnalyticsUtils.track(CHANNEL_ICON_EDIT_PROGRESSED, {
...c29288_2,
status: "failed",
is_rate_limited: r156 != null,
error_message: r159 == null ? void 0 : r159.body?.message
});
}
throw c29288_5;
} catch (r133) {
r8 = r133;
c24964_2 = r133;
if (c24964_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r114;
},
convertToGuild: (a0) => HTTP.post({
url: Endpoints.CHANNEL_CONVERT(a0),
oldFormErrors: true,
rejectWithError: true
}),
preload: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_PRELOAD",
guildId: a0 !== ME ? a0 : null,
channelId: a1,
context: CURRENT_APP_CONTEXT
});
},
fetchChannelStoreListing: (a0, a1) => {
const channelId = a0;
return httpGetWithCountryCodeQuery(a1 != null ? Endpoints.CHANNEL_STORE_LISTING_SKU(a0, a1) : Endpoints.CHANNEL_STORE_LISTING(a0)).then((result) => {
Dispatcher.dispatch({
type: "STORE_LISTING_FETCH_SUCCESS",
channelId,
storeListing: result.body
});
});
},
createTextChannel: async (c13915_0, name2, parent_id, topic) => {
let c24965_1;
c24965_1 = void 0;
const body3 = {
type: ChannelTypes.GUILD_TEXT,
name: name2,
permission_overwrites: []
};
if (parent_id != null) {
body3.parent_id = parent_id;
}
if (topic != null) {
body3.topic = topic;
}
let c29289_0 = await HTTP.post({
url: Endpoints.GUILD_CHANNELS(c13915_0),
body: body3,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c13915_0);
return c29289_0;
},
fetchChannel: async (c13916_0) => (await HTTP.get({
url: Endpoints.CHANNEL(c13916_0),
rejectWithError: true
})).body,
openChannel: async function openChannel(c13917_0) {
let r55;
const _this4 = this;
let c24967_2 = 0;
let c29290_0, c29290_1;
try {
c29290_0 = void 0;
c29290_1 = void 0;
c24967_2 = 1;
c29290_0 = await _this4.fetchChannel(c13917_0);
c29290_1 = (0, createChannelRecordFromServer)(c29290_0);
Dispatcher.dispatch({
type: "CHANNEL_CREATE",
channel: c29290_1
});
r55 = c29290_1;
c24967_2 = 0;
} catch ($e) {
let r23 = $e;
if (c24967_2 !== 0) {
while (true) {
try {
c24967_2 = 0;
} catch ($e) {
r23 = $e;
if (c24967_2 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r23;
}
return r55;
}
};
export default r35;
+22
View File
@@ -0,0 +1,22 @@
// Metro module 10232 (f10233).
import UserGuildSettingsStore from "../stores/UserGuildSettingsStore";
import Dispatcher from "../Dispatcher";
import UserGuildSettingsManager from "../modules/user_settings/UserGuildSettingsManager";
const r15 = {
update: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_COLLAPSE",
channelId: a0
});
},
toggleCollapseGuild: (a0) => {
UserGuildSettingsManager.saveUserGuildSettings(a0, {
hide_muted_channels: !UserGuildSettingsStore.isGuildCollapsed(a0)
});
Dispatcher.dispatch({
type: "GUILD_TOGGLE_COLLAPSE_MUTED",
guildId: a0
});
}
};
export default r15;
+74
View File
@@ -0,0 +1,74 @@
// Metro module 9880 (f9881).
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
const r18 = {
createChannelFollower: (a0, a1) => HTTP.post({
url: Endpoints.CHANNEL_FOLLOWERS(a1),
body: {
webhook_channel_id: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
fetchChannelFollowerStats: async (channel_id) => {
let c26555_3 = 0;
let c30152_0;
L10: {
try {
c30152_0 = void 0;
Dispatcher.dispatch({
type: "CHANNEL_FOLLOWER_STATS_FETCH_START"
});
c26555_3 = 1;
c30152_0 = await HTTP.get({
url: Endpoints.CHANNEL_FOLLOWER_STATS(channel_id),
body: {
channel_id
},
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "CHANNEL_FOLLOWER_STATS_FETCH_SUCCESS",
stats: c30152_0.body,
channelId: channel_id
});
c26555_3 = 0;
} catch ($e) {
let r8 = $e;
if (c26555_3 !== 0) {
while (true) {
try {
c26555_3 = 0;
Dispatcher.dispatch({
type: "CHANNEL_FOLLOWER_STATS_FETCH_FAILURE",
channelId: channel_id
});
break L10;
} catch ($e) {
r8 = $e;
if (c26555_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
},
dismissPublishBump: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_FOLLOWING_PUBLISH_BUMP_DISMISSED",
messageId: a0
});
},
permanentlyHidePublishBump: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_FOLLOWING_PUBLISH_BUMP_HIDE_PERMANENTLY",
channelId: a0
});
}
};
export default r18;
+168
View File
@@ -0,0 +1,168 @@
// Metro module 9882 (f9883).
import ChannelPinsStore, { FetchState } from "../stores/ChannelPinsStore";
import { AbortCodes, MAX_PINS_PER_CHANNEL, Endpoints } from "../Constants";
import ThreadActionCreators from "../modules/threads/ThreadActionCreators";
import { HTTP } from "../_bundle/sendRequest";
import { APIError } from "../errors/index";
import { intl, t } from "../intl/index.native";
import AlertActionCreators from "./AlertActionCreators";
import Dispatcher from "../Dispatcher";
function $mk115563($env) {
return (a0) => {
const aPIError = new APIError(a0);
const code = aPIError.code;
const r28 = intl.string(t.j2d6Km);
let body = intl.string(t.fEptJP);
let title = r28;
if (code != null) {
if (AbortCodes.TOO_MANY_PINS_IN_CHANNEL === code) {
const r151 = intl.string(t.HI88Q3);
body = $env.$parent[0].isPrivate() ? intl.formatToPlainString(t.Q89oQU, {
maxPins: MAX_PINS_PER_CHANNEL
}) : intl.formatToPlainString(t.NnO1S5, {
maxPins: MAX_PINS_PER_CHANNEL,
channelName: $env[1]
});
title = r151;
} else if (AbortCodes.INVALID_ACCESS === code) {
title = intl.string(t["25gfQX"]);
body = intl.string(t.QNnTwN);
} else if (AbortCodes.INVALID_PIN_MESSAGE_CHANNEL === code) {
title = intl.string(t["Q5G6+m"]);
body = intl.string(t["5hgPfC"]);
} else if (AbortCodes.INVALID_THREAD_ARCHIVE_STATE === code) {
title = intl.string(t.fu6Lbl);
body = intl.string(t.FmrcZM);
} else if (AbortCodes.INVALID_ACTION_SYSTEM_MESSAGE === code) {
title = intl.string(t["zV0/FC"]);
body = intl.string(t.C4a7xI);
} else if (AbortCodes.UNKNOWN_MESSAGE === code) {
title = intl.string(t.fkqPro);
body = intl.string(t.H6fRIg);
} else {
const r53 = intl.string(t.HI88Q3);
let r55 = aPIError.getAnyErrorMessage();
if (r55 == null) {
r55 = intl.string(t.fEptJP);
}
body = r55;
title = r53;
}
}
AlertActionCreators.show({
title,
body,
confirmText: intl.string(t.BddRzS)
});
};
}
function $mk115564($env) {
return () => {
const r18 = {
title: intl.string(t.xFjByk),
body: intl.string(t["0R/Toc"]),
confirmText: intl.string(t["7NqTJn"]),
cancelText: intl.string(t["ETE/oC"]),
onConfirm: null
};
r18.onConfirm = c6553_9.unpinMessage.bind(c6553_9, c17531_0, c17531_1);
return AlertActionCreators.show(r18);
};
}
let env6553 = {};
const c6553_9 = {
pinMessage: async (a0, a1) => {
let env17530 = {
$parent: env6553
};
env17530[0] = a0;
env17530[1] = a1;
let env30153;
const r10 = env17530;
let c26556_1 = r10;
const r13 = env30153 = {
$parent: r10
};
let c26556_0 = r13;
env30153[0] = void 0;
env30153[1] = void 0;
const r26 = env17530[0];
env30153[0] = r26.id;
env30153[1] = r26.name;
await ThreadActionCreators.unarchiveThreadIfNecessary(r26.id);
HTTP.put({
url: Endpoints.PIN(env30153[0], env17530[1]),
rejectWithError: true
}).catch($mk115563(c26556_0));
},
unpinMessage: async (c17531_0, c17531_1) => {
const r26 = void 0;
let c26557_1 = r26;
let c26557_0 = r26;
await ThreadActionCreators.unarchiveThreadIfNecessary(c17531_0.id);
HTTP.del({
url: Endpoints.PIN(c17531_0.id, c17531_1),
oldFormErrors: true,
rejectWithError: true
}).catch($mk115564(c26557_0));
},
ackPins: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_PINS_ACK",
channelId: a0
});
},
fetchPins: (a0, a1) => {
const channelId = a0;
let reset = a1?.reset;
if (reset == null) {
reset = false;
}
let limit = a1?.limit;
if (limit == null) {
limit = 25;
}
const before = a1?.before;
let r19 = reset;
if (!r19) {
const pins = ChannelPinsStore.getPins(a0);
const r5 = pins == null;
let r21 = true;
if (!r5) {
const state = pins.state;
r21 = FetchState.FAILED !== state ? FetchState.LOADING !== state ? FetchState.LOADED_FINISHED !== state ? FetchState.LOADED_HAS_MORE === state ? before == null ? pins.items.length === 0 : pins.items.at(-1).pinnedAt === before : void 0 : false : false : true;
}
r19 = r21;
}
if (r19) {
Dispatcher.dispatch({
type: "LOAD_PINNED_MESSAGES",
channelId: a0,
reset
});
HTTP.get({
url: Endpoints.PINS(a0),
query: {
limit,
before: before == null ? void 0 : before.toISOString()
},
retries: 2,
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "LOAD_PINNED_MESSAGES_SUCCESS",
pins: result.body.items,
channelId,
hasMore: result.body.has_more
});
}, () => {
Dispatcher.dispatch({
type: "LOAD_PINNED_MESSAGES_FAILURE",
channelId
});
});
}
}
};
export default c6553_9;
+101
View File
@@ -0,0 +1,101 @@
// Metro module 4383 (f4384).
import { AnalyticEvents, AppContext, ComponentActions } from "../Constants";
import Dispatcher from "../Dispatcher";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import { collectVoiceAnalyticsMetadata } from "../modules/app_analytics/AppAnalyticsUtils";
import { ComponentDispatch } from "../utils/ComponentDispatchUtils";
const r18 = {
rebuildRTCActiveChannels: () => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_ACTIVE_CHANNELS"
});
},
selectParticipant: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_SELECT_PARTICIPANT",
channelId: a0,
id: a1
});
},
popoutParticipant: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_POPOUT_PARTICIPANT",
channelId: a0,
participantId: a1
});
},
returnParticipant: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_RETURN_PARTICIPANT",
channelId: a0,
participantId: a1
});
},
updateLayout: function updateLayout(a0, a1, appContext = AppContext.APP) {
AnalyticsUtils.track(AnalyticEvents.VIDEO_LAYOUT_TOGGLED, {
video_layout: a1,
...collectVoiceAnalyticsMetadata(a0)
});
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_LAYOUT",
channelId: a0,
layout: a1,
appContext
});
},
toggleParticipants: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_PARTICIPANTS_OPEN",
channelId: a0,
participantsOpen: a1
});
},
toggleVoiceParticipantsHidden: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_VOICE_PARTICIPANTS_HIDDEN",
channelId: a0,
voiceParticipantsHidden: a1
});
},
updateStageStreamSize: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_STAGE_STREAM_SIZE",
channelId: a0,
large: a1
});
},
updateStageVideoLimitBoostUpsellDismissed: (a0, a1) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_STAGE_VIDEO_LIMIT_BOOST_UPSELL_DISMISSED",
channelId: a0,
dismissed: a1
});
},
updateChatOpen: (a0, a1) => {
const channelId = a0;
Dispatcher.dispatch({
type: "CHANNEL_RTC_UPDATE_CHAT_OPEN",
channelId: a0,
chatOpen: a1
});
if (a1) {
setTimeout(() => {
ComponentDispatch.dispatch(ComponentActions.FOCUS_CHANNEL_TEXT_AREA, {
channelId
});
}, 0);
} else {
ComponentDispatch.dispatch(ComponentActions.FOCUS_CHAT_BUTTON);
}
},
jumpToVoiceChannelMessage: (a0, a1, a2, a3) => {
Dispatcher.dispatch({
type: "CHANNEL_RTC_JUMP_TO_VOICE_CHANNEL_MESSAGE",
guildId: a0,
channelId: a1,
messageId: a2,
jumpType: a3
});
}
};
export default r18;
+283
View File
@@ -0,0 +1,283 @@
// Metro module 7686 (f7687).
import ChannelSettingsStore from "../stores/ChannelSettingsStore";
import ChannelStore from "../stores/ChannelStore";
import { ChannelSettingsSections, Endpoints, Layers } from "../Constants";
import Dispatcher from "../Dispatcher";
import { getRootNavigationRef } from "../modules/main_tabs_v2/RootNavigationRef.native";
import ThreadActionCreators from "../modules/threads/ThreadActionCreators";
import { rejectWithMigratedError, HTTP } from "../_bundle/sendRequest";
import GuildTemplateTooltipActionCreators from "../modules/guild_templates/GuildTemplateTooltipActionCreators";
function $mk115059($env) {
return (a0) => {
const r7 = $env;
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_SUBMIT_SUCCESS",
channelId: r7[0]
});
const r13 = r7[26];
const r14 = r13 == null ? void 0 : r13.getGuildId();
let r16 = r14 == null;
if (!r16) {
const r17 = r7[26];
r16 = r17 == null ? void 0 : r17.isThread();
}
if (!r16) {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(r14);
}
return a0;
};
}
function $mk115060($env) {
return (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_SUBMIT_FAILURE",
errors: a0.body
});
return a0;
};
}
let close;
let env4829 = {};
export function init(a0, a1, a2) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_INIT",
channelId: a0,
location: a1,
subsection: a2
});
}
const open2 = function(a0, a1, a2) {
const rootNavigationRef = getRootNavigationRef();
if (rootNavigationRef != null && rootNavigationRef.isReady()) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_INIT",
channelId: a0,
location: a1,
subsection: a2
});
let initialRouteName = ChannelSettingsStore.getSection();
if (initialRouteName == null) {
initialRouteName = ChannelSettingsSections.OVERVIEW;
}
rootNavigationRef.navigate("sidebar", {
channelId: a0,
initialRouteName,
source: "channel-settings-action-creators-open"
});
}
};
const close2 = function close() {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_CLOSE"
});
};
close = close2;
export function setSection(a0) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_SET_SECTION",
section: a0
});
}
export function selectPermissionOverwrite(a0) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_OVERWRITE_SELECT",
overwriteId: a0
});
}
export function updateChannel(a0) {
const { name, type, topic, bitrate, userLimit, nsfw, flags, rateLimitPerUser, defaultThreadRateLimitPerUser, defaultAutoArchiveDuration, template, defaultReactionEmoji, rtcRegion, videoQualityMode, autoArchiveDuration, locked, invitable, availableTags, defaultSortOrder } = a0;
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_UPDATE",
name,
channelType: type,
topic,
bitrate,
userLimit,
nsfw,
flags,
rateLimitPerUser,
defaultThreadRateLimitPerUser,
defaultAutoArchiveDuration,
template,
defaultReactionEmoji,
rtcRegion,
videoQualityMode,
autoArchiveDuration,
locked,
invitable,
availableTags,
defaultSortOrder,
defaultForumLayout: a0.defaultForumLayout,
defaultTagSetting: a0.defaultTagSetting,
iconEmoji: a0.iconEmoji,
themeColor: a0.themeColor
});
}
export async function saveChannel(c26014_0, c26014_1) {
let env29845;
const r32 = env4829;
let c26014_3 = r32;
const r10 = env29845 = {
$parent: r32
};
let c26014_2 = r10;
env29845[1] = void 0;
env29845[2] = void 0;
env29845[3] = void 0;
env29845[4] = void 0;
env29845[5] = void 0;
env29845[6] = void 0;
env29845[7] = void 0;
env29845[8] = void 0;
env29845[9] = void 0;
env29845[10] = void 0;
env29845[11] = void 0;
env29845[12] = void 0;
env29845[13] = void 0;
env29845[14] = void 0;
env29845[15] = void 0;
env29845[16] = void 0;
env29845[17] = void 0;
env29845[18] = void 0;
env29845[19] = void 0;
env29845[20] = void 0;
env29845[21] = void 0;
env29845[22] = void 0;
env29845[23] = void 0;
env29845[24] = void 0;
env29845[25] = void 0;
env29845[0] = c26014_0;
env29845[1] = c26014_1.name;
env29845[2] = c26014_1.type;
env29845[3] = c26014_1.position;
env29845[4] = c26014_1.topic;
env29845[5] = c26014_1.bitrate;
env29845[6] = c26014_1.userLimit;
env29845[7] = c26014_1.nsfw;
env29845[8] = c26014_1.flags;
env29845[9] = c26014_1.permissionOverwrites;
env29845[10] = c26014_1.rateLimitPerUser;
env29845[11] = c26014_1.defaultThreadRateLimitPerUser;
env29845[12] = c26014_1.defaultAutoArchiveDuration;
env29845[13] = c26014_1.template;
env29845[14] = c26014_1.defaultReactionEmoji;
env29845[15] = c26014_1.rtcRegion;
env29845[16] = c26014_1.videoQualityMode;
env29845[17] = c26014_1.autoArchiveDuration;
env29845[18] = c26014_1.locked;
env29845[19] = c26014_1.invitable;
env29845[20] = c26014_1.availableTags;
env29845[21] = c26014_1.defaultSortOrder;
env29845[22] = c26014_1.defaultForumLayout;
env29845[23] = c26014_1.defaultTagSetting;
env29845[24] = c26014_1.iconEmoji;
env29845[25] = c26014_1.themeColor;
env29845[26] = void 0;
await void 0;
env29845[26] = ChannelStore.getChannel(env29845[0]);
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_SUBMIT"
});
await ThreadActionCreators.unarchiveThreadIfNecessary(env29845[0]);
const r114 = {
url: Endpoints.CHANNEL(env29845[0]),
body: null,
oldFormErrors: true,
rejectWithError: null
};
const default_reaction_emoji = env29845[14] != null ? {
emoji_id: env29845[14]?.emojiId,
emoji_name: env29845[14]?.emojiName
} : env29845[14] === null ? null : void 0;
const r142 = env29845[20];
const available_tags = r142 == null ? void 0 : r142.map((item) => ({
id: item.id,
name: item.name,
emoji_id: item.emojiId,
emoji_name: item.emojiName,
moderated: item.moderated
}));
const icon_emoji = env29845[24] != null ? {
id: env29845[24].id,
name: env29845[24].name
} : env29845[24] === null ? null : void 0;
r114.body = {
name: env29845[1],
type: env29845[2],
position: env29845[3],
topic: env29845[4],
bitrate: env29845[5],
user_limit: env29845[6],
nsfw: env29845[7],
flags: env29845[8],
permission_overwrites: env29845[9],
rate_limit_per_user: env29845[10],
default_thread_rate_limit_per_user: env29845[11],
default_auto_archive_duration: env29845[12],
template: env29845[13],
rtc_region: env29845[15],
video_quality_mode: env29845[16],
auto_archive_duration: env29845[17],
locked: env29845[18],
invitable: env29845[19],
default_reaction_emoji,
available_tags,
default_sort_order: env29845[21],
default_forum_layout: env29845[22],
default_tag_setting: env29845[23],
icon_emoji,
theme_color: env29845[25]
};
r114.rejectWithError = rejectWithMigratedError();
const r170 = HTTP.patch(r114);
const r173 = $mk115060(env4829);
return r170.then($mk115059(c26014_2), r173);
}
export async function deleteChannel(c26015_0) {
let c29846_0 = ChannelStore.getChannel(c26015_0);
await HTTP.del({
url: Endpoints.CHANNEL(c26015_0),
oldFormErrors: true,
rejectWithError: true
});
let c29846_1 = c29846_0 == null ? void 0 : c29846_0.getGuildId();
let r58 = c29846_1 == null;
if (!r58) {
r58 = c29846_0 == null ? void 0 : c29846_0.isThread();
}
if (!r58) {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c29846_1);
}
(0, close)();
}
export function updateVoiceChannelStatus(a0, a1) {
return HTTP.put({
url: Endpoints.UPDATE_VOICE_CHANNEL_STATUS(a0),
body: {
status: a1
},
rejectWithError: rejectWithMigratedError()
});
}
export function removeLinkedLobby(a0) {
return HTTP.del({
url: Endpoints.CHANNEL_LINKED_LOBBY(a0),
rejectWithError: true
});
}
Layers;
const r35 = {
init,
open: open2,
close: close2,
setSection,
selectPermissionOverwrite,
updateChannel,
saveChannel,
deleteChannel,
updateVoiceChannelStatus,
removeLinkedLobby
};
export default r35;
export { open2 as open };
export { close2 as close };
@@ -0,0 +1,128 @@
// Metro module 8278 (f8279).
import { checkChattableChannelThresholdMetAfterChannelPermissionDeny } from "../modules/guild_onboarding/DefaultChannelThresholdUtils";
import Dispatcher from "../Dispatcher";
function $mk80306($env) {
return (a0) => {
let env26166 = {
$parent: $env
};
env26166[0] = a0;
const chain = function chain() {
const r3 = env26166.$parent;
const r5 = r3[1];
if (r5.length === 0 && r3[2].length === 0) {
return (0, env26166[0])();
}
if (r5.length > 0) {
const r28 = r5.pop();
if (r28 == null) {
return (0, env26166[1])();
}
const r30 = env26166.$parent.$parent;
const r38 = (0, r30[1])(r30[2][3]).updatePermissionOverwrite(r3[0], r28);
const r40 = env26166[1];
r38.then(r40, r40);
} else {
const r8 = r3[2].pop();
if (r8 == null) {
return (0, env26166[1])();
}
const r13 = env26166.$parent.$parent;
const r20 = (0, r13[1])(r13[2][3]).clearPermissionOverwrite(r3[0], r8);
const r22 = env26166[1];
r20.then(r22, r22);
}
};
env26166[1] = chain;
chain();
};
}
function $mk80307($env) {
return () => {
const r1 = $env.$parent;
(0, r1[1])(r1[2][2]).dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_SAVE_SUCCESS",
silent: $env[3]
});
};
}
let env5273 = {};
export async function updatePermission(c26165_0, c26165_1, c26165_2, c26165_3) {
let c29932_0, c29932_1, c29932_2;
L16: {
L15: {
L14: {
c29932_0 = c26165_1;
c29932_1 = c26165_2;
c29932_2 = c26165_3;
const guildId = c26165_0.getGuildId();
if (guildId != null && c26165_1 === guildId) {
if (await checkChattableChannelThresholdMetAfterChannelPermissionDeny(c26165_0, c26165_3, c26165_2)) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION",
id: c29932_0,
allow: c29932_1,
deny: c29932_2
});
break L15;
}
break L14;
}
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_UPDATE_PERMISSION",
id: c29932_0,
allow: c29932_1,
deny: c29932_2
});
break L16;
}
return false;
}
return void 0;
}
}
export function selectPermission(a0) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_SELECT_PERMISSION",
id: a0
});
}
export function setAdvancedMode(a0) {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_SET_ADVANCED_MODE",
advancedMode: a0
});
}
export function init() {
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_INIT"
});
}
export function savePermissionUpdates(a0, a1, a2) {
let env16454;
const r1 = env16454 = {
$parent: env5273
};
env16454[0] = a0;
env16454[1] = a1;
env16454[2] = [];
env16454[3] = a2;
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_SUBMITTING"
});
return new Promise($mk80306(r1)).then($mk80307(r1));
}
export function saveAndClearPermissionUpdates(a0, a1, a2, a3) {
let env16453;
const r1 = env16453 = {
$parent: env5273
};
env16453[0] = a0;
env16453[1] = a1;
env16453[2] = a2;
env16453[3] = a3;
Dispatcher.dispatch({
type: "CHANNEL_SETTINGS_PERMISSIONS_SUBMITTING"
});
return new Promise($mk80306(r1)).then($mk80307(r1));
}
@@ -0,0 +1,17 @@
// Metro module 11033 (f11034).
import Module3771 from "../_bundle/Module3771";
import GuildActionCreators from "./GuildActionCreators";
const r14 = {
setCommunicationDisabledDuration: async (guildId, userId, duration, reason, location2, moderatorReportId) => {
await GuildActionCreators.setCommunicationDisabledUntil({
guildId,
userId,
communicationDisabledUntilTimestamp: duration != null ? Module3771().add(duration, "s").toISOString() : null,
duration,
reason,
location: location2,
moderatorReportId
});
}
};
export default r14;
+294
View File
@@ -0,0 +1,294 @@
// Metro module 4995 (f4996).
import ConnectedAccountsStore from "../stores/ConnectedAccountsStore";
import { AbortCodes, AnalyticEvents, Endpoints, FRIEND_SYNC_PLATFORM_TYPES } from "../Constants";
import Logger from "../modules/debug/Logger";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import { getCallbackParamsFromURL } from "../modules/connections/ConnectionsUtils";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
let c3004_9;
const callback = function callback(a0, a1, insecure = false) {
return HTTP.post({
url: Endpoints.CONNECTIONS_CALLBACK(a0),
body: {
...a1,
insecure,
friend_sync: FRIEND_SYNC_PLATFORM_TYPES.has(a0)
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
};
c3004_9 = new Logger("ConnectedAccounts");
const r33 = {
fetch: () => HTTP.get({
url: Endpoints.CONNECTIONS,
oldFormErrors: true,
rejectWithError: true
}).then((result) => Dispatcher.dispatch({
type: "USER_CONNECTIONS_UPDATE",
local: true,
accounts: result.body
}), () => Dispatcher.dispatch({
type: "USER_CONNECTIONS_UPDATE",
local: true,
accounts: []
})),
authorize: async function authorize(platform_type, r3 = {}) {
const { location: location2, twoWayLinkType, userCode, twoWayLink, successRedirect, handle } = r3;
let c25307_2;
c25307_2 = void 0;
AnalyticsUtils.track(AnalyticEvents.CONNECTED_ACCOUNT_INITIATED, {
platform_type,
location: location2
});
const r42 = Endpoints.CONNECTIONS_AUTHORIZE(platform_type);
const uRLSearchParams = new URLSearchParams();
if (userCode != null) {
uRLSearchParams.append("two_way_user_code", userCode);
}
if (successRedirect != null) {
uRLSearchParams.append("success_redirect", successRedirect);
}
if (twoWayLinkType != null) {
uRLSearchParams.append("two_way_link_type", twoWayLinkType);
uRLSearchParams.append("two_way_link", "true");
} else if (twoWayLink != null) {
uRLSearchParams.append("two_way_link", String(twoWayLink));
}
if (handle != null) {
uRLSearchParams.append("handle", handle);
}
let c29445_0 = await HTTP.get({
url: r42 + "?" + uRLSearchParams.toString(),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
const url2 = c29445_0.body.url;
let url = url2;
if (url2 == null) {
url = "";
}
let c29445_1 = getCallbackParamsFromURL(url).state;
if (c29445_1 != null) {
ConnectedAccountsStore.addPendingAuthorizedState(c29445_1);
}
return c29445_0;
},
callback,
connect: (a0, a1, a2, a3, a4) => {
const r16 = {
url: Endpoints.CONNECTION(a0, a1),
body: null,
context: null,
oldFormErrors: true,
trackedActionData: null,
rejectWithError: null
};
let friend_sync = a4?.friend_sync;
if (friend_sync == null) {
friend_sync = FRIEND_SYNC_PLATFORM_TYPES.has(a0);
}
r16.body = {
name: a2,
friend_sync
};
r16.context = {
location: a3
};
r16.trackedActionData = {
event: NetworkActionNames.USER_CONNECTIONS_UPDATE,
properties: {
name: a2,
friend_sync: FRIEND_SYNC_PLATFORM_TYPES.has(a0)
}
};
r16.rejectWithError = rejectWithMigratedError();
return TrackedHTTPUtils.put(r16);
},
disconnect: (a0, a1) => HTTP.del({
url: Endpoints.CONNECTION(a0, a1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
refresh: (a0, a1) => HTTP.post({
url: Endpoints.CONNECTION_REFRESH(a0, a1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
setVisibility: function setVisibility(a0, a1, a2) {
return this.update(a0, a1, {
visibility: a2 === 1
});
},
setMetadataVisibility: function setMetadataVisibility(a0, a1, a2) {
return this.update(a0, a1, {
metadata_visibility: a2 === 1
});
},
setFriendSync: function setFriendSync(a0, a1, a2) {
return this.update(a0, a1, {
friend_sync: a2
});
},
setShowActivity: function setShowActivity(a0, a1, a2) {
return this.update(a0, a1, {
show_activity: a2
});
},
update: (a0, a1, a2) => TrackedHTTPUtils.patch({
url: Endpoints.CONNECTION(a0, a1),
body: a2,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_CONNECTIONS_UPDATE,
properties: {
...a2
}
},
rejectWithError: rejectWithMigratedError()
}),
joinServer: (a0, c14493_1) => {
const integrationId = a0;
Dispatcher.dispatch({
type: "USER_CONNECTIONS_INTEGRATION_JOINING",
integrationId: a0,
joining: true
});
HTTP.post({
url: Endpoints.INTEGRATION_JOIN(a0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}, (a0) => {
Dispatcher.dispatch({
type: "USER_CONNECTIONS_INTEGRATION_JOINING",
integrationId,
joining: false
});
if (!a0.ok) {
Dispatcher.dispatch({
type: "USER_CONNECTIONS_INTEGRATION_JOINING_ERROR",
integrationId,
error: a0.hasErr ? void 0 : a0.body.message
});
if (c14493_1 != null) {
c14493_1();
}
}
});
},
refreshAccessToken: async (c14494_0, c14494_1) => {
let r74;
let c25308_2;
let c25308_3 = 0;
let c29446_0, c29446_1;
try {
c29446_0 = void 0;
c25308_3 = 1;
c29446_0 = (await HTTP.get({
url: Endpoints.CONNECTION_ACCESS_TOKEN(c14494_0, c14494_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body.access_token;
Dispatcher.dispatch({
type: "USER_CONNECTION_UPDATE",
platformType: c14494_0,
id: c14494_1,
accessToken: c29446_0
});
r74 = c29446_0;
c25308_3 = 0;
} catch ($e) {
const r29 = $e;
let r8 = r29;
c25308_2 = r29;
if (c25308_3 !== 0) {
while (true) {
try {
const r83 = c25308_2;
c25308_3 = 0;
c29446_1 = r83;
if (c29446_1.body.code === AbortCodes.CONNECTION_REVOKED) {
Dispatcher.dispatch({
type: "USER_CONNECTION_UPDATE",
platformType: c14494_0,
id: c14494_1,
revoked: true
});
}
throw c29446_1;
} catch (r79) {
r8 = r79;
c25308_2 = r79;
if (c25308_3 === 0) {
break;
}
}
}
}
throw r8;
}
return r74;
},
linkDispatchAuthCallback: (a0, a1) => HTTP.post({
url: Endpoints.CONNECTIONS_LINK_DISPATCH_AUTH_CALLBACK(a0),
body: {
...a1
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
completeTwoWayLink: async (c14495_0, c14495_1, code, state, token_redirect_uri) => {
let r57;
L14: {
if (c14495_1 != null) {
const callbackParamsFromURL = getCallbackParamsFromURL(c14495_1);
const { code: code2, error, errorDescription } = callbackParamsFromURL;
if (error == null) {
r57 = await callback(c14495_0, {
code,
state,
two_way_link_code: code2,
token_redirect_uri
});
break L14;
}
c3004_9.error("Two-way link: missing authorize code", {
error,
errorDescription
});
} else {
c3004_9.error("Two-way link: missing authorize location");
}
return void 0;
}
return r57;
},
sessionHandoff: function sessionHandoff(a0, a1, a2, a3, a4) {
return HTTP.post({
url: Endpoints.CONNECTIONS_SESSION_HANDOFF(a0),
body: {
state: a1,
code: a2,
openid_params: a3,
iss: a4
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
},
getHandoffStatus: function getHandoffStatus(a0, a1) {
const uRLSearchParams = new URLSearchParams();
uRLSearchParams.append("state", a1);
return HTTP.get({
url: `${Endpoints.CONNECTIONS_SESSION_HANDOFF(a0)}?${uRLSearchParams.toString()}`,
body: {
state: a1
},
rejectWithError: true
});
}
};
export default r33;
+38
View File
@@ -0,0 +1,38 @@
// Metro module 13886 (f13887).
import { Endpoints } from "../Constants";
import Dispatcher from "../Dispatcher";
import { intl, t } from "../intl/index.native";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
let handleRequestFailure;
const handleRequestSuccess = function handleRequestSuccess(a0) {
if (a0 != null && a0.body != null) {
Dispatcher.dispatch({
type: "UPDATE_CONSENTS",
consents: {
...a0.body
}
});
}
return a0.body;
};
handleRequestFailure = function handleRequestFailure(a0) {
throw new Error(a0.status >= 500 && a0.status <= 599 ? intl.string(t.cvJdtg) : a0 != null && (a0.body != null && a0.body.message != null) ? a0.body.message : intl.string(t.cvJdtg));
};
export function fetchConsents() {
return HTTP.get({
url: Endpoints.SETTINGS_CONSENT,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(handleRequestSuccess, (a0) => Promise.reject(new Error(a0.body.message)));
}
export function setConsents(a0, a1) {
return HTTP.post({
url: Endpoints.SETTINGS_CONSENT,
body: {
grant: a0,
revoke: a1
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(handleRequestSuccess, handleRequestFailure);
}
+118
View File
@@ -0,0 +1,118 @@
// Metro module 5188 (f5189).
import { AppContext } from "../Constants";
import Dispatcher from "../Dispatcher";
import { getCurrentlyInteractingAppContext } from "../modules/main_app_window/web/AppWindowContext";
import { isDesktop } from "../utils/PlatformUtils";
import { addResultListener } from "../utils/SpellcheckUtils";
const openContextMenu = function openContextMenu(a0, a1, a2, a3) {
a0.stopPropagation();
if (!(a0.currentTarget.contains != null && !a0.currentTarget.contains(a0.target))) {
const r3 = "pageX" in a0;
let r15 = 0;
let r14 = 0;
if (r3) {
r14 = a0.pageX;
r15 = a0.pageY;
}
let r10 = r15;
let r28 = r14;
if (r28 === 0) {
r10 = r15;
r28 = r14;
if (r15 === 0) {
const target = a0.target;
const r5 = target == null;
let r13 = void 0;
if (!r5) {
const defaultView = target.ownerDocument.defaultView;
r13 = defaultView == null ? void 0 : defaultView.getSelection();
}
let r34 = r15;
let r35 = r14;
if (r13 != null) {
const rangeCount = r13.rangeCount;
r34 = r15;
r35 = r14;
if (rangeCount > 0) {
r34 = r15;
r35 = r14;
if (target != null) {
const rangeAt = r13.getRangeAt(0);
const r39 = target.contains(rangeAt.commonAncestorContainer);
r34 = r15;
r35 = r14;
if (r39) {
const boundingClientRect = rangeAt.getBoundingClientRect();
const height = boundingClientRect.height;
r34 = r15;
r35 = r14;
if (height !== 0) {
r35 = boundingClientRect.left;
r34 = boundingClientRect.bottom;
}
}
}
}
}
r10 = r34;
r28 = r35;
if (r28 === 0) {
r10 = r34;
r28 = r35;
if (r34 === 0) {
let r44 = target == null ? void 0 : target.getBoundingClientRect();
if (r44 == null) {
r44 = {};
}
const { left = 0, top = 0, width = 0, height: height2 } = r44;
const r53 = left + width / 2;
r10 = top + (height2 !== void 0 ? height2 : 0) / 2;
r28 = r53;
}
}
}
}
let target2 = a0.target;
if (target2 == null) {
target2 = a0.currentTarget;
}
const r58 = {
render: a1,
renderLazy: a3,
target: target2,
rect: new DOMRect(r28, r10, 0, 0),
config: null
};
let context = getCurrentlyInteractingAppContext();
if (context == null) {
context = AppContext.APP;
}
let c14719_1;
r58.config = {
context,
...a2
};
const contextMenu = r58;
const r82 = "nativeEvent" in a0 ? a0.nativeEvent : a0;
if (a2?.enableSpellCheck && (isDesktop() && r82.isTrusted)) {
c14719_1 = addResultListener(function() {
c14719_1();
Dispatcher.dispatch({
type: "CONTEXT_MENU_OPEN",
contextMenu
});
});
} else {
a0.preventDefault();
Dispatcher.dispatch({
type: "CONTEXT_MENU_OPEN",
contextMenu
});
}
}
};
export function closeContextMenu() {}
export { openContextMenu };
export function openContextMenuLazy(a0, a1, a2) {
openContextMenu(a0, void 0, a2, a1);
}
+103
View File
@@ -0,0 +1,103 @@
// Metro module 8275 (f8276).
import UserGuildSettingsStore from "../stores/UserGuildSettingsStore";
import { BITRATE_DEFAULT, ChannelTypes, Endpoints } from "../Constants";
import { ChannelNotificationSettingsFlags } from "../modules/user_settings/UserSettingsConstants";
import Dispatcher from "../Dispatcher";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import { exact } from "../_bundle/Module1385";
import { rejectWithMigratedError } from "../_bundle/sendRequest";
import NotificationSettingsModalActionCreators from "./NotificationSettingsModalActionCreators";
import { NotificationLabels } from "../utils/NotificationSettingsUtils";
import GuildTemplateTooltipActionCreators from "../modules/guild_templates/GuildTemplateTooltipActionCreators";
const r24 = {
createChannel: (a0) => {
const { guildId, type, name, permissionOverwrites = [] } = a0;
let c16439_1 = permissionOverwrites;
const { bitrate, userLimit, parentId, skuId, branchId, flags, availableTags } = a0;
Dispatcher.dispatch({
type: "CREATE_CHANNEL_MODAL_SUBMIT",
guildId,
channelType: type
});
const body = {
type,
name,
permission_overwrites: permissionOverwrites
};
if (bitrate != null && bitrate !== BITRATE_DEFAULT) {
body.bitrate = bitrate;
}
if (userLimit != null && userLimit > 0) {
body.user_limit = userLimit;
}
if (parentId != null) {
body.parent_id = parentId;
}
if (flags != null) {
body.flags = flags;
}
if (availableTags != null && availableTags.length > 0) {
body.available_tags = availableTags.map((availableTag) => ({
name: availableTag.name,
emoji_id: availableTag.emojiId,
emoji_name: availableTag.emojiName,
moderated: availableTag.moderated
}));
}
if (type === ChannelTypes.GUILD_STORE) {
if (skuId == null) {
throw new Error("Unexpected missing SKU");
}
body.sku_id = skuId;
body.branch_id = branchId;
}
return TrackedHTTPUtils.post({
url: Endpoints.GUILD_CHANNELS(guildId),
body,
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.CHANNEL_CREATE,
properties: (a0) => exact({
is_private: c16439_1.length > 0,
channel_id: a0 == null ? void 0 : a0.body?.id,
channel_type: a0 == null ? void 0 : a0.body?.type
})
},
rejectWithError: rejectWithMigratedError()
}).then((result) => {
if (UserGuildSettingsStore.isOptInEnabled(guildId)) {
NotificationSettingsModalActionCreators.updateChannelOverrideSettings(guildId, result.body.id, {
flags: ChannelNotificationSettingsFlags.OPT_IN_ENABLED
}, NotificationLabels.OptedIn);
}
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(guildId);
return result;
}, (a0) => {
Dispatcher.dispatch({
type: "CREATE_CHANNEL_MODAL_SUBMIT_FAILURE",
errors: a0.body
});
throw a0;
});
},
createRoleSubscriptionTemplateChannel: (a0, a1, a2, a3) => TrackedHTTPUtils.post({
url: Endpoints.GUILD_CHANNELS(a0),
body: {
name: a1,
type: a2,
topic: a3
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.CHANNEL_CREATE,
properties: (a0) => exact({
is_private: true,
channel_id: a0 == null ? void 0 : a0.body?.id,
channel_type: a0 == null ? void 0 : a0.body?.type
})
},
rejectWithError: rejectWithMigratedError()
})
};
export default r24;
@@ -0,0 +1,90 @@
// Metro module 8355 (f8356).
import CreateInviteModalStore from "../stores/CreateInviteModalStore";
import { AnalyticEvents } from "../Constants";
import Dispatcher from "../Dispatcher";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import InstantInviteActionCreators from "./InstantInviteActionCreators";
import { intl, t } from "../intl/index.native";
const r18 = {
init: function init(a0, a1, { location: location2 = "", targetType, targetUserId, targetApplicationId, skipCreateInvite }) {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_INIT",
guildId: a0,
channelId: a1,
targetType,
targetUserId,
targetApplicationId
});
if (!skipCreateInvite) {
this.createInvite(location2, true);
}
},
openSettings: (a0, a1, a2, a3) => {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_OPEN",
...CreateInviteModalStore.getInviteSettings(),
guildId: a0,
channelId: a1,
onClose: a3
});
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "Instant Invite",
source: a2
});
},
updateSettings: (a0) => {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_UPDATE_SETTINGS",
settings: a0
});
},
resetSettings: () => {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_RESET_SETTINGS"
});
},
createInvite: (a0, a1) => {
const pendingSettings = CreateInviteModalStore.getPendingSettings();
if (pendingSettings != null) {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_GENERATE_INVITE"
});
const { channelId, maxAge, maxUses, temporary, targetType, targetUserId, targetApplicationId, flags, roleIds } = pendingSettings;
const invite = CreateInviteModalStore.getInvite();
InstantInviteActionCreators.createInvite(channelId, {
temporary,
validate: a1 ? invite != null ? invite.code : null : null,
max_age: parseInt(maxAge, 10),
max_uses: parseInt(maxUses, 10),
target_type: targetType,
target_user_id: targetUserId,
target_application_id: targetApplicationId,
flags,
role_ids: roleIds
}, a0).then(() => {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_GENERATE_INVITE_SUCCESS",
channelId
});
}, (a0) => {
let message = intl.string(t.WB1ip6);
if (a0?.message != null) {
message = a0.message;
}
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_GENERATE_INVITE_FAILURE",
message
});
});
}
},
close: () => {
Dispatcher.dispatch({
type: "CREATE_INVITE_MODAL_CLOSE"
});
if (CreateInviteModalStore.onClose != null) {
CreateInviteModalStore.onClose();
}
}
};
export default r18;
+30
View File
@@ -0,0 +1,30 @@
// Metro module 10874 (f10875).
import LurkingStore from "../modules/lurker_mode/LurkingStore";
import { Routes } from "../Constants";
import { matchPath } from "../modules/routing/matchPathCompat";
import { RouteParam } from "../modules/routing/RouteUtils";
import Dispatcher from "../Dispatcher";
export function saveLastRoute(a0) {
const r19 = matchPath(a0, {
path: Routes.CHANNEL(RouteParam.guildId())
});
const r20 = r19 == null ? void 0 : r19.params?.guildId;
if (r20 == null || !LurkingStore.isLurking(r20)) {
Dispatcher.dispatch({
type: "SAVE_LAST_ROUTE",
path: a0
});
}
}
export function saveLastNonVoiceRoute(a0) {
const r19 = matchPath(a0, {
path: Routes.CHANNEL(RouteParam.guildId())
});
const r20 = r19 == null ? void 0 : r19.params?.guildId;
if (r20 == null || !LurkingStore.isLurking(r20)) {
Dispatcher.dispatch({
type: "SAVE_LAST_NON_VOICE_ROUTE",
path: a0
});
}
}
@@ -0,0 +1,14 @@
// Metro module 708 (f709).
import Dispatcher from "../Dispatcher";
export function setDeveloperOptionSettings(a0) {
return Dispatcher.dispatch({
type: "DEVELOPER_OPTIONS_UPDATE_SETTINGS",
settings: a0
});
}
export function setRoutingKeyTags(a0) {
return Dispatcher.dispatch({
type: "DEVELOPER_OPTIONS_SET_ROUTING_KEY",
tags: a0
});
}
+51
View File
@@ -0,0 +1,51 @@
// Metro module 9908 (f9909).
import Dispatcher from "../Dispatcher";
const r12 = {
updateChannelDimensions: (a0, a1, a2, a3, a4, a5) => {
Dispatcher.dispatch({
type: "UPDATE_CHANNEL_DIMENSIONS",
channelId: a0,
timestamp: a1,
scrollTop: a2,
scrollHeight: a3,
offsetHeight: a4
});
if (a5 != null) {
a5();
}
},
updateChannelListScroll: function updateChannelListScroll(a0, a1, channelIds = []) {
Dispatcher.dispatch({
type: "UPDATE_CHANNEL_LIST_DIMENSIONS",
guildId: a0,
scrollTop: a1,
channelIds
});
},
channelListScrollTo: (a0, a1) => {
Dispatcher.dispatch({
type: "UPDATE_CHANNEL_LIST_DIMENSIONS",
guildId: a0,
scrollTo: a1,
channelIds: []
});
},
clearChannelListScrollTo: (a0) => {
Dispatcher.dispatch({
type: "UPDATE_CHANNEL_LIST_DIMENSIONS",
guildId: a0,
scrollTo: null,
channelIds: []
});
},
clearChannelDimensions: function clearChannelDimensions(a0, a1) {
this.updateChannelDimensions(a0, Date.now(), null, null, null, a1);
},
updateGuildListScrollTo: (a0) => {
Dispatcher.dispatch({
type: "UPDATE_GUILD_LIST_DIMENSIONS",
scrollTop: a0
});
}
};
export default r12;
+35
View File
@@ -0,0 +1,35 @@
// Metro module 6088 (f6089).
import Dispatcher from "../Dispatcher";
const r12 = {
clearDraft: (a0, a1) => {
Dispatcher.dispatch({
type: "DRAFT_CLEAR",
channelId: a0,
draftType: a1
});
},
saveDraft: (a0, a1, a2) => {
Dispatcher.dispatch({
type: "DRAFT_SAVE",
channelId: a0,
draft: a1,
draftType: a2
});
},
changeDraft: (a0, a1, a2) => {
Dispatcher.dispatch({
type: "DRAFT_CHANGE",
channelId: a0,
draft: a1,
draftType: a2
});
},
changeThreadSettings: (a0, a1) => {
Dispatcher.dispatch({
type: "THREAD_SETTINGS_DRAFT_CHANGE",
channelId: a0,
draft: a1
});
}
};
export default r12;
+217
View File
@@ -0,0 +1,217 @@
// Metro module 9415 (f9416).
import EmojiStore from "../modules/emojis/EmojiStore";
import GatewayConnectionStore from "../modules/gateway/GatewayConnectionStore";
import GuildAvailabilityStore from "../stores/GuildAvailabilityStore";
import { Endpoints } from "../Constants";
import { MAX_FAVORITES, UserSettingsDelay } from "../modules/user_settings/UserSettingsConstants";
import { PreloadedUserSettingsActionCreators, FrecencyUserSettingsActionCreators } from "../modules/user_settings/UserSettingsProtoActionCreators";
import { StringValue } from "../_bundle/Module1337";
import Dispatcher from "../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import InlineUploader from "../lib/uploader_inline/InlineUploader";
import { AccessibilityAnnouncer } from "../design/shared";
import { intl, t } from "../intl/index.native";
import APIError from "../errors/APIError";
import UnicodeEmojis from "../modules/emojis/UnicodeEmojis";
import { isNotNullish } from "../utils/GlobalUtils";
import dedupeEmojisByNameOrId from "../modules/emojis/utils/dedupeEmojisByNameOrId";
import Module12 from "../_bundle/Module12";
import AlertActionCreators from "./AlertActionCreators";
let $mk82452 = function() {
return (a0) => {
let r5 = EmojiStore.getCustomEmojiById(a0);
if (r5 == null) {
r5 = UnicodeEmojis.getByName(a0);
}
return r5;
};
};
export function setDiversityColor(value) {
PreloadedUserSettingsActionCreators.updateAsync("textAndImages", (a0) => {
a0.diversitySurrogate = StringValue.create();
a0.diversitySurrogate.value = value;
}, UserSettingsDelay.FREQUENT_USER_ACTION);
}
export function fetchEmoji(a0) {
const guildId = a0;
Dispatcher.dispatch({
type: "EMOJI_FETCH",
guildId: a0
});
HTTP.get({
url: Endpoints.GUILD_EMOJIS(a0),
oldFormErrors: true,
rejectWithError: true
}).then((result) => Dispatcher.dispatch({
type: "EMOJI_FETCH_SUCCESS",
guildId,
emojis: result.body
}), () => Dispatcher.dispatch({
type: "EMOJI_FETCH_FAILURE",
guildId
}));
}
export function uploadEmoji({ guildId: guildId2, image, name: name3, roles, analyticsLocation, originalMd5 }) {
Dispatcher.dispatch({
type: "EMOJI_UPLOAD_START",
guildId: guildId2
});
return HTTP.post({
url: Endpoints.GUILD_EMOJIS(guildId2),
body: {
image,
name: name3,
roles
},
headers: InlineUploader.buildHeadersForMd5(originalMd5),
context: {
client_event_source: analyticsLocation?.page
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "EMOJI_UPLOAD_STOP",
guildId: guildId2
});
return result.body;
}, (a0) => {
Dispatcher.dispatch({
type: "EMOJI_UPLOAD_STOP",
guildId: guildId2
});
return Promise.reject(a0);
});
}
export function deleteEmoji(a0, a1, a2) {
Dispatcher.dispatch({
type: "EMOJI_DELETE",
guildId: a0,
emojiId: a1
});
return HTTP.del({
url: Endpoints.GUILD_EMOJI(a0, a1),
body: a2 != null ? {
replaced_by: a2
} : void 0,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
AccessibilityAnnouncer.announce(intl.string(t.L3UUha));
});
}
export async function updateEmoji(c26435_0) {
let r70;
let c26435_3;
let c26435_4 = 0;
let c30087_0, c30087_1, c30087_2, c30087_3, c30087_4;
try {
c30087_0 = void 0;
c30087_1 = void 0;
c30087_2 = void 0;
c30087_3 = void 0;
c30087_0 = c26435_0.guildId;
c30087_1 = c26435_0.emojiId;
c30087_2 = c26435_0.name;
c30087_3 = c26435_0.roles;
await void 0;
c26435_4 = 1;
r70 = await HTTP.patch({
url: Endpoints.GUILD_EMOJI(c30087_0, c30087_1),
body: {
name: c30087_2,
roles: c30087_3
},
oldFormErrors: true,
rejectWithError: true
});
c26435_4 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c26435_3 = r31;
if (c26435_4 !== 0) {
while (true) {
try {
const r88 = c26435_3;
c26435_4 = 0;
c30087_4 = r88;
throw new APIError(c30087_4);
} catch (r84) {
r8 = r84;
c26435_3 = r84;
if (c26435_4 === 0) {
break;
}
}
}
}
throw r8;
}
return r70;
}
export function favoriteEmoji(a0) {
const r2 = a0 == null;
let r5 = null;
if (!r2) {
let id = a0.id;
if (id == null) {
id = UnicodeEmojis.convertSurrogateToBase(a0.surrogates)?.name;
}
if (id == null) {
id = a0.name;
}
r5 = id;
}
const name = r5;
if (name != null) {
FrecencyUserSettingsActionCreators.updateAsync("favoriteEmojis", (a0) => {
let r47;
const emojis = a0.emojis;
a0.emojis = GuildAvailabilityStore.totalUnavailableGuilds > 0 ? emojis : GatewayConnectionStore.isConnected() ? [...dedupeEmojisByNameOrId(emojis.map($mk82452()).filter(isNotNullish)).keys()] : emojis;
if (Module12.size(a0.emojis) >= MAX_FAVORITES) {
AlertActionCreators.show({
title: intl.string(t["+XYXtZ"]),
body: intl.formatToPlainString(t.JaIyFi, {
count: MAX_FAVORITES
})
});
r47 = false;
} else {
const r46 = a0.emojis.includes(name);
r47 = !r46;
if (!r46) {
a0.emojis.push(name);
r47 = void 0;
}
}
return r47;
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
}
export function unfavoriteEmoji(a0) {
const r2 = a0 == null;
let r5 = null;
if (!r2) {
let id = a0.id;
if (id == null) {
id = UnicodeEmojis.convertSurrogateToBase(a0.surrogates)?.name;
}
if (id == null) {
id = a0.name;
}
r5 = id;
}
const name2 = r5;
if (name2 != null) {
FrecencyUserSettingsActionCreators.updateAsync("favoriteEmojis", (a0) => {
const emojis = a0.emojis;
a0.emojis = GuildAvailabilityStore.totalUnavailableGuilds > 0 ? emojis : GatewayConnectionStore.isConnected() ? [...dedupeEmojisByNameOrId(emojis.map($mk82452()).filter(isNotNullish)).keys()] : emojis;
if (a0.emojis.includes(name2)) {
a0.emojis = a0.emojis.filter((emoji) => name2 !== emoji);
return void 0;
}
return false;
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
}
+173
View File
@@ -0,0 +1,173 @@
// Metro module 5850 (f5851).
import { Endpoints } from "../Constants";
import Dispatcher from "../Dispatcher";
import { HTTP } from "../_bundle/sendRequest";
import { httpGetWithCountryCodeQuery } from "../utils/StoreUtils";
export function fetchUserEntitlementsForApplication(a0) {
const applicationId = a0;
let exclude_consumed = arguments[1];
if (exclude_consumed === void 0) {
exclude_consumed = true;
}
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "ENTITLEMENT_FETCH_APPLICATION_START",
applicationId
});
});
return HTTP.get({
url: Endpoints.ENTITLEMENTS_FOR_APPLICATION(a0),
oldFormErrors: true,
query: {
exclude_consumed
},
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "ENTITLEMENT_FETCH_APPLICATION_SUCCESS",
applicationId,
entitlements: result.body
});
return result.body;
}).catch(() => {
Dispatcher.dispatch({
type: "ENTITLEMENT_FETCH_APPLICATION_FAIL",
applicationId
});
});
}
export async function fetchUserEntitlements(c25631_0) {
let r16, excludeEnded, withApplication;
let c25631_4 = 0;
let c29629_0, c29629_1, c29629_2, c29629_3, c29629_4;
L21: {
try {
L16: {
L13: {
L14: {
L10: {
c29629_0 = void 0;
c29629_1 = void 0;
c29629_2 = void 0;
c29629_3 = void 0;
r16 = c25631_0;
const withSku = r16.withSku;
if (withSku !== void 0) {
c29629_0 = withSku;
withApplication = r16.withApplication;
if (withApplication !== void 0) {
break L10;
}
} else {
c29629_0 = false;
withApplication = r16.withApplication;
if (withApplication !== void 0) {
break L10;
}
}
c29629_1 = false;
excludeEnded = r16.excludeEnded;
if (excludeEnded !== void 0) {
break L13;
}
break L14;
}
c29629_1 = withApplication;
excludeEnded = r16.excludeEnded;
if (excludeEnded !== void 0) {
break L13;
}
}
c29629_2 = true;
c29629_3 = r16.entitlementType;
c29629_4 = void 0;
break L16;
}
c29629_2 = excludeEnded;
c29629_3 = r16.entitlementType;
c29629_4 = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "ENTITLEMENTS_FETCH_FOR_USER_START"
});
c25631_4 = 1;
c29629_4 = await HTTP.get({
url: Endpoints.ENTITLEMENTS_FOR_USER,
query: {
with_sku: c29629_0,
with_application: c29629_1,
entitlement_type: c29629_3,
exclude_ended: c29629_2
},
rejectWithError: true
});
Dispatcher.dispatch({
type: "ENTITLEMENTS_FETCH_FOR_USER_SUCCESS",
entitlements: c29629_4.body,
excludeEnded: c29629_2
});
c25631_4 = 0;
} catch ($e) {
let r8 = $e;
if (c25631_4 !== 0) {
while (true) {
try {
c25631_4 = 0;
Dispatcher.dispatch({
type: "ENTITLEMENTS_FETCH_FOR_USER_FAIL"
});
break L21;
} catch ($e) {
r8 = $e;
if (c25631_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export async function fetchGiftableEntitlements() {
let c25632_3 = 0;
let c29630_0;
L10: {
try {
c29630_0 = void 0;
Dispatcher.dispatch({
type: "ENTITLEMENTS_GIFTABLE_FETCH"
});
c25632_3 = 1;
c29630_0 = await httpGetWithCountryCodeQuery({
url: Endpoints.ENTITLEMENTS_GIFTABLE,
rejectWithError: true
});
Dispatcher.dispatch({
type: "ENTITLEMENTS_GIFTABLE_FETCH_SUCCESS",
entitlements: c29630_0.body
});
c25632_3 = 0;
} catch ($e) {
let r8 = $e;
if (c25632_3 !== 0) {
while (true) {
try {
c25632_3 = 0;
Dispatcher.dispatch({
type: "ENTITLEMENTS_GIFTABLE_FETCH_FAIL"
});
break L10;
} catch ($e) {
r8 = $e;
if (c25632_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
+38
View File
@@ -0,0 +1,38 @@
// Metro module 16308 (f16309).
import { Routes } from "../Constants";
import Dispatcher from "../Dispatcher";
import { getHistory, transitionTo } from "../modules/routing/router_utils";
import trackFriendListClicked from "../modules/app_analytics/track/friends_list_viewed/trackFriendListClicked";
const r16 = {
transitionToSection: function transitionToSection(a0, r2 = {}) {
let explicit = r2.explicit;
if (explicit === void 0) {
explicit = false;
}
if (getHistory().location.pathname !== Routes.FRIENDS) {
transitionTo(Routes.FRIENDS);
}
Dispatcher.dispatch({
type: "FRIENDS_SET_SECTION",
section: a0
});
if (explicit) {
trackFriendListClicked({
tab_opened: a0
});
}
},
setSection: function setSection(a0) {
Dispatcher.dispatch({
type: "FRIENDS_SET_SECTION",
section: a0
});
},
setInitialSection: (a0) => {
Dispatcher.dispatch({
type: "FRIENDS_SET_INITIAL_SECTION",
section: a0
});
}
};
export default r16;
+404
View File
@@ -0,0 +1,404 @@
// Metro module 9597 (f9598).
import LocaleStore from "../modules/user_settings/LocaleStore";
import GIFPickerViewStore from "../stores/views/GIFPickerViewStore";
import { AnalyticEvents, Endpoints, GIFPickerResultTypes, SearchTypes } from "../Constants";
import { MAX_FAVORITE_GIFS_SIZE, UserSettingsDelay } from "../modules/user_settings/UserSettingsConstants";
import AppAnalyticsUtils from "../modules/app_analytics/AppAnalyticsUtils";
import { calculateAnalyticsMetadata } from "../utils/GIFPickerUtils";
import { HTTP } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import Module12 from "../_bundle/Module12";
import { v4 } from "../_bundle/Module514";
import URLUtils from "../utils/URLUtils";
import { isAttachmentUrl, removeSignedUrlParameters, isExternalProxiedAttachmentUrl } from "../modules/messages/SignedAttachmentLinkUtils";
import { FrecencyUserSettingsActionCreators } from "../modules/user_settings/UserSettingsProtoActionCreators";
import { GIFType, FavoriteGIFs } from "../_bundle/Module1341";
import AlertActionCreators from "./AlertActionCreators";
import { intl, t } from "../intl/index.native";
import AnalyticsUtils from "../utils/AnalyticsUtils";
let c6339_11, gif_provider, c6339_14, c6339_15;
const doSearchRequest = function doSearchRequest(a0, a1, a2) {
let modifiers;
const query = a0;
const limit = a2;
const startTime = Date.now();
if (a1 != null) {
const r16 = {};
r16[a1] = 1;
modifiers = r16;
} else {
modifiers = {};
}
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_STARTED, {
search_type: SearchTypes.GIF,
load_id: GIFPickerViewStore.getAnalyticsID(),
num_modifiers: Object.keys(modifiers).length,
modifiers,
gif_provider
});
HTTP.get({
url: Endpoints.GIFS_SEARCH,
query: {
q: a0,
media_format: GIFPickerViewStore.getSelectedFormat(),
locale: LocaleStore.locale,
limit: a2
},
oldFormErrors: true,
rejectWithError: true
}).then(({ body }) => {
const r7 = {
startTime,
limit
};
const { startTime: startTime3, ...rest } = r7;
const r13 = {
offset: 0,
limit: null,
totalResults: body.length
};
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_VIEWED, {
...calculateAnalyticsMetadata(GIFPickerViewStore.getAnalyticsID(), a1, {
...r13,
...rest,
results: body.length
}),
...startTime3 == null ? {} : {
load_duration_ms: Date.now() - startTime3
},
gif_provider
});
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY_SUCCESS",
query,
items: body
});
}, () => Dispatcher.dispatch({
type: "GIF_PICKER_QUERY_FAILURE",
query
}));
};
c6339_11 = /-/g;
gif_provider = "klipy";
c6339_14 = Module12.debounce(doSearchRequest, 250);
c6339_15 = /\.(webp|avif|gif)(\?|$)/i;
export function trackSearchStart(a0) {
let modifiers;
if (a0 != null) {
const r2 = {};
r2[a0] = 1;
modifiers = r2;
} else {
modifiers = {};
}
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_STARTED, {
search_type: SearchTypes.GIF,
load_id: GIFPickerViewStore.getAnalyticsID(),
num_modifiers: Object.keys(modifiers).length,
modifiers,
gif_provider
});
}
export function trackSearchResultViewed(a0, a1, r5 = {}) {
const { startTime: startTime3, ...rest } = r5;
const r12 = {
offset: 0,
limit: null,
totalResults: a0.length
};
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_VIEWED, {
...calculateAnalyticsMetadata(GIFPickerViewStore.getAnalyticsID(), a1, {
...r12,
...rest,
results: a0.length
}),
...startTime3 == null ? {} : {
load_duration_ms: Date.now() - startTime3
},
gif_provider
});
}
export function search(a0, a1, r3 = false) {
if (a0 === "") {
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY",
query: ""
});
} else {
const r10 = arguments[3];
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY",
query: a0
});
if (r3) {
doSearchRequest(a0, a1, r10);
} else {
c6339_14(a0, a1, r10);
}
}
}
export function fetchSuggestions(a0) {
const query2 = a0;
if (a0 !== "" && a0 != null) {
HTTP.get({
url: Endpoints.GIFS_SUGGEST,
query: {
q: a0,
limit: 5,
locale: LocaleStore.locale
},
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "GIF_PICKER_SUGGESTIONS_SUCCESS",
query: query2,
items: result.body
});
});
}
}
export function resetSearch() {
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY",
query: ""
});
}
export function trackSelectGIF({ type, index, offset, limit: limit3, results, totalResults, query: query3, gifId }) {
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_SELECTED, {
...calculateAnalyticsMetadata(GIFPickerViewStore.getAnalyticsID(), type, {
offset,
limit: limit3,
results,
totalResults
}),
index_num: index,
source_object: "GIF Picker",
query: query3
});
if (gifId != null) {
HTTP.post({
url: Endpoints.GIFS_SELECT,
body: {
id: gifId,
q: query3
},
oldFormErrors: true,
rejectWithError: true
});
}
}
export function initializeSearch() {
const analyticsID = v4().replace(c6339_11, "");
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_OPENED, {
search_type: SearchTypes.GIF,
load_id: analyticsID
});
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "GIF_PICKER_INITIALIZE",
analyticsID
});
});
}
export function fetchTrending() {
HTTP.get({
url: Endpoints.GIFS_TRENDING,
query: {
locale: LocaleStore.locale,
media_format: GIFPickerViewStore.getSelectedFormat()
},
oldFormErrors: true,
rejectWithError: true
}).then(({ body }) => {
Dispatcher.dispatch({
type: "GIF_PICKER_TRENDING_FETCH_SUCCESS",
trendingCategories: body.categories,
trendingGIFPreview: body.gifs[0]
});
});
}
export function fetchTrendingGIFs(a0) {
let modifiers;
const limit2 = a0;
const startTime2 = Date.now();
const TRENDING_GIFS = GIFPickerResultTypes.TRENDING_GIFS;
if (TRENDING_GIFS != null) {
const r17 = {};
r17[TRENDING_GIFS] = 1;
modifiers = r17;
} else {
modifiers = {};
}
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_STARTED, {
search_type: SearchTypes.GIF,
load_id: GIFPickerViewStore.getAnalyticsID(),
num_modifiers: Object.keys(modifiers).length,
modifiers,
gif_provider
});
HTTP.get({
url: Endpoints.GIFS_TRENDING_GIFS,
query: {
media_format: GIFPickerViewStore.getSelectedFormat(),
locale: LocaleStore.locale,
limit: a0
},
oldFormErrors: true,
rejectWithError: true
}).then(({ body }) => {
const TRENDING_GIFS = GIFPickerResultTypes.TRENDING_GIFS;
const r6 = {
startTime: startTime2,
limit: limit2
};
const { startTime: startTime3, ...rest } = r6;
const r12 = {
offset: 0,
limit: null,
totalResults: body.length
};
AppAnalyticsUtils.trackWithMetadata(AnalyticEvents.SEARCH_RESULT_VIEWED, {
...calculateAnalyticsMetadata(GIFPickerViewStore.getAnalyticsID(), TRENDING_GIFS, {
...r12,
...rest,
results: body.length
}),
...startTime3 == null ? {} : {
load_duration_ms: Date.now() - startTime3
},
gif_provider
});
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY_SUCCESS",
items: body
});
}, () => {
Dispatcher.dispatch({
type: "GIF_PICKER_QUERY_FAILURE"
});
});
}
export function gifUrlKey(a0) {
let r3 = a0;
const r11 = URLUtils.toURLSafe(a0);
let r12 = a0;
if (r11 != null) {
if (isAttachmentUrl(r11)) {
r3 = removeSignedUrlParameters(r11).toString();
}
r12 = r3;
}
return r12;
}
export function addFavoriteGIF(c17331_0) {
FrecencyUserSettingsActionCreators.updateAsync("favoriteGifs", (a0) => {
let r51;
let r26 = Module12.max(Object.values(a0.gifs).map((item) => item.order));
if (r26 == null) {
r26 = 0;
}
if (!(/\.(mp4|webm)(\?|$)/i.test(c17331_0.src) && (c17331_0.gifSrc != null && (c17331_0.gifSrc !== "" && c17331_0.gifSrc !== c17331_0.src)))) {
const r14 = URLUtils.toURLSafe(c17331_0.src);
r51 = r14 != null && (isExternalProxiedAttachmentUrl(r14) || isAttachmentUrl(r14)) && c17331_0.gifSrc != null ? c17331_0.gifSrc : c17331_0.src;
} else {
r51 = c17331_0.gifSrc;
}
const r15 = URLUtils.toURLSafe(c17331_0.src);
const r56 = r15 != null && (isExternalProxiedAttachmentUrl(r15) || isAttachmentUrl(r15));
let r65 = r51;
if (r56) {
const r68 = c6339_15.test(r51);
r65 = r51;
if (r68) {
const r72 = URLUtils.toURLSafe(r51);
let r73 = r51;
if (r72 != null) {
const r18 = r72.pathname.toLowerCase();
const r16 = r18.endsWith(".webp");
let r80 = r18.endsWith(".avif");
const r82 = r18.endsWith(".gif");
if (!(!r16 && (!r80 && !r82))) {
if (!r80) {
r80 = r82;
}
if (r80) {
r72.searchParams.set("format", "webp");
}
r72.searchParams.set("animated", "true");
r51 = r72.toString();
}
r73 = r51;
}
r65 = r73;
}
}
const r96 = r65.startsWith("//");
const r97 = r65;
const r98 = r96 ? `https:${r97}` : r97;
const r104 = c6339_15.test(r98);
const src = r98;
const format = r104 ? GIFType.IMAGE : c17331_0.format;
const gifs = a0.gifs;
let url = c17331_0.url;
const r116 = URLUtils.toURLSafe(url);
let r117 = url;
if (r116 != null) {
if (isAttachmentUrl(r116)) {
url = removeSignedUrlParameters(r116).toString();
}
r117 = url;
}
gifs[r117] = {
...c17331_0,
src,
format,
order: r26 + 1
};
if (FavoriteGIFs.toBinary(a0).length > MAX_FAVORITE_GIFS_SIZE) {
AlertActionCreators.show({
title: intl.string(t["+XYXtZ"]),
body: intl.string(t.YSDH9n)
});
return false;
}
const total_num_favorited = Module12.size(a0.gifs);
if (total_num_favorited > 2) {
a0.hideTooltip = true;
}
AnalyticsUtils.track(AnalyticEvents.GIF_FAVORITED, {
total_num_favorited
});
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
export function removeFavoriteGIF(c17332_0) {
FrecencyUserSettingsActionCreators.updateAsync("favoriteGifs", (a0) => {
const r0 = c17332_0 in a0.gifs;
const gifs = a0.gifs;
if (r0) {
delete gifs[c17332_0];
} else {
const r9 = URLUtils.toURLSafe(c17332_0);
delete gifs[r9 != null ? isAttachmentUrl(r9) ? removeSignedUrlParameters(r9).toString() : c17332_0 : c17332_0];
}
AnalyticsUtils.track(AnalyticEvents.GIF_UNFAVORITED, {
total_num_favorited: Module12.size(a0.gifs)
});
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
export function fetchTrendingSearchTerms() {
HTTP.get({
url: Endpoints.GIFS_TRENDING_SEARCH,
query: {
limit: 5,
locale: LocaleStore.locale
},
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "GIF_PICKER_TRENDING_SEARCH_TERMS_SUCCESS",
items: result.body
});
});
}
+186
View File
@@ -0,0 +1,186 @@
// Metro module 10957 (f10958).
import { Endpoints, ActivityFlags, WebBrowserType, DiscordConnectDeeplinks } from "../Constants";
import { ActivityIntent } from "../modules/activities/Constants";
import * as _ConstantsIOS from "../ConstantsIOS";
import { DISCORD_CONNECT_EXAMPLE_APP_APPLICATION_ID } from "../ConstantsIOS";
import hasFlag from "../modules/activities/utils/hasFlag";
import Linking from "../lib/native/Linking";
import Dispatcher from "../Dispatcher";
import { HTTP } from "../_bundle/sendRequest";
import { canLaunchFrame } from "../modules/frames/utils/canLaunchFrame";
import FramesActionCreators_native from "../modules/frames/FramesActionCreators.native";
import handleJoinEmbeddedActivity from "../modules/activities/handleJoinEmbeddedActivity";
function $mk85963($env) {
return (a0) => (0, $env[0])(a0);
}
function $mk85964($env) {
return () => {
const r1 = $env.$parent;
(0, r1[1])(r1[2][6]).dispatch({
type: "ACTIVITY_JOIN_FAILED",
applicationId: $env[1]
});
return false;
};
}
let env7380 = {};
const fetchJoinSecret = function fetchJoinSecret(a0, a1) {
let env18393;
const r2 = env18393 = {
$parent: env7380
};
env18393[0] = a1;
const { userId, sessionId, application: application2, channelId: channelId2, messageId, remotePartyId } = a0;
const id = application2.id;
env18393[1] = id;
const query = channelId2 != null && messageId != null ? {
channel_id: channelId2,
message_id: messageId,
headless: true
} : void 0;
Dispatcher.dispatch({
type: "ACTIVITY_JOIN_LOADING",
applicationId: id,
remotePartyId
});
const r32 = HTTP.get({
url: Endpoints.USER_ACTIVITY_JOIN(userId, sessionId, id),
retries: 3,
query,
oldFormErrors: true,
rejectWithError: true
});
const r34 = $mk85964(r2);
return r32.then($mk85963(r2), r34);
};
const r25 = {
addGame: () => {},
toggleOverlay: () => {},
editName: () => {},
identifyGame: () => Promise.reject(new Error("not supported")),
getDetectableGames: () => {},
reportUnverifiedGame: () => {},
uploadIcon: () => {},
deleteEntry: () => {},
launch: () => Promise.resolve(),
join: async (c18394_0) => {
let r77;
let c26877_0, channelId;
L30: {
L28: {
const { application: application2, channelId: channelId2, embedded, source, locationObject = {}, analyticsLocations = [], remotePartyId } = c18394_0;
if (embedded) {
if (canLaunchFrame(application2)) {
await FramesActionCreators_native.launchFrame({
applicationId: application2.id
});
break L30;
}
channelId = channelId2;
if (channelId == null) {
channelId = void 0;
}
const r68 = await handleJoinEmbeddedActivity({
applicationId: application2.id,
activityChannelId: channelId,
source,
locationObject,
analyticsLocations
});
c26877_0 = r68;
if (r68 == null) {
c26877_0 = false;
}
r77 = c26877_0;
break L28;
}
return remotePartyId != null ? fetchJoinSecret(c18394_0, () => true) : (function joinViaDeeplink(a0) {
let r31;
let c31602_0 = a0;
const application = a0.application;
const DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI = application.id === DISCORD_CONNECT_EXAMPLE_APP_APPLICATION_ID ? _ConstantsIOS.DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI : application.deeplink_uri;
if (DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI == null && !hasFlag(a0.applicationActivity, ActivityFlags.SUPPORTS_JOIN_URL)) {
r31 = Promise.resolve(false);
} else {
let env31603;
const r32 = env31603 = {
$parent: env7380
};
env31603[0] = (a0) => {
let r43;
const join_url = a0.body.join_url;
const secret = a0.body.secret;
if (join_url != null) {
Linking.openURL(join_url, WebBrowserType.SAFARI);
let embedded2 = c31602_0.embedded;
if (embedded2 == null) {
embedded2 = false;
}
Dispatcher.dispatch({
type: "ACTIVITY_JOIN",
applicationId: application.id,
parentApplicationId: application.parent_id,
secret,
intent: ActivityIntent.PLAY,
embedded: embedded2
});
r43 = true;
} else if (DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI == null) {
Dispatcher.dispatch({
type: "ACTIVITY_JOIN_FAILED",
applicationId: application.id
});
r43 = false;
} else {
Linking.openURL(`${DISCORD_CONNECT_EXAMPLE_APP_DEEPLINK_URI.replace(/\/+$/, "")}${DiscordConnectDeeplinks.GAME_INVITE_FRAGMENT}${secret}`, WebBrowserType.SAFARI);
let embedded = c31602_0.embedded;
if (embedded == null) {
embedded = false;
}
Dispatcher.dispatch({
type: "ACTIVITY_JOIN",
applicationId: application.id,
parentApplicationId: application.parent_id,
secret,
intent: ActivityIntent.PLAY,
embedded
});
r43 = true;
}
return r43;
};
const { userId, sessionId, application: application2, channelId: channelId2, messageId, remotePartyId } = a0;
const id = application2.id;
env31603[1] = id;
const query = channelId2 != null && messageId != null ? {
channel_id: channelId2,
message_id: messageId,
headless: true
} : void 0;
Dispatcher.dispatch({
type: "ACTIVITY_JOIN_LOADING",
applicationId: id,
remotePartyId
});
const r53 = HTTP.get({
url: Endpoints.USER_ACTIVITY_JOIN(userId, sessionId, id),
retries: 3,
query,
oldFormErrors: true,
rejectWithError: true
});
const r55 = $mk85964(r32);
r31 = r53.then($mk85963(r32), r55);
}
return r31;
})(c18394_0);
}
return r77;
}
return 1;
},
joinWithSecret: function joinWithSecret(a0, a1) {
Linking.openURL(`${a0.replace(/\/+$/, "")}${DiscordConnectDeeplinks.GAME_INVITE_FRAGMENT}${a1}`, WebBrowserType.SAFARI);
}
};
export default r25;
+300
View File
@@ -0,0 +1,300 @@
// Metro module 8034 (f8035).
import ApplicationStore from "../modules/applications/ApplicationStore";
import CollectiblesCategoryStore from "../modules/collectibles/CollectiblesCategoryStore";
import { isUnknownCollectiblesItemRecord } from "../modules/collectibles/records/UnknownCollectiblesItemRecord";
import { COLLECTIBLES_APPLICATION_ID, Endpoints, RPCCommands } from "../Constants";
import { PREMIUM_SUBSCRIPTION_APPLICATION } from "../modules/premium/PremiumConstants";
import Dispatcher from "../Dispatcher";
import * as _GiftCodeUtils from "../utils/GiftCodeUtils";
import ApplicationActionCreators from "../modules/applications/ApplicationActionCreators";
import { fetchCollectiblesProduct } from "../modules/collectibles/CollectiblesActionCreators";
import { ClientOutdatedAcceptGiftError } from "../errors/index";
import { HTTP } from "../_bundle/sendRequest";
import CodedLinkActionCreators from "../modules/coded_links/web/CodedLinkActionCreators";
import * as _GiftCodeActionCreators from "./native/GiftCodeActionCreators";
export async function resolveGiftCode(c26086_0, c26086_1, c26086_2) {
let r46, r183;
let c26086_5;
let c26086_6 = 0;
let c29877_1, c29877_2, c29877_0, c29877_3, c29877_4, c29877_5;
L25: {
try {
L13: {
L10: {
c29877_1 = void 0;
c29877_2 = void 0;
c29877_0 = c26086_0;
if (c26086_1 !== void 0) {
c29877_1 = c26086_1;
r46 = c26086_2;
if (r46 !== void 0) {
break L10;
}
} else {
c29877_1 = false;
r46 = c26086_2;
if (r46 !== void 0) {
break L10;
}
}
c29877_2 = false;
c29877_3 = void 0;
c29877_4 = void 0;
break L13;
}
c29877_2 = r46;
c29877_3 = void 0;
c29877_4 = void 0;
}
await void 0;
Dispatcher.dispatch({
type: "GIFT_CODE_RESOLVE",
code: c29877_0
});
c26086_6 = 1;
c29877_3 = await _GiftCodeUtils.resolveGiftCode(c29877_0, c29877_1, c29877_2);
if (c29877_3.application_id != null && c29877_3.application_id !== PREMIUM_SUBSCRIPTION_APPLICATION && ApplicationStore.getApplication(c29877_3.application_id) == null) {
c26086_6 = 2;
await ApplicationActionCreators.fetchApplication(c29877_3.application_id);
c26086_6 = 1;
}
if (c29877_3.application_id === COLLECTIBLES_APPLICATION_ID) {
await fetchCollectiblesProduct(c29877_3.sku_id);
c29877_4 = CollectiblesCategoryStore.getProduct(c29877_3.sku_id);
const r212 = c29877_4;
if ((r212 == null ? void 0 : r212.items.some(isUnknownCollectiblesItemRecord)) === true) {
throw new ClientOutdatedAcceptGiftError("Client update required to redeem this gift");
}
}
Dispatcher.dispatch({
type: "GIFT_CODE_RESOLVE_SUCCESS",
giftCode: c29877_3
});
r183 = {
giftCode: c29877_3
};
c26086_6 = 0;
} catch ($e) {
const r42 = $e;
let r8 = r42;
c26086_5 = r42;
let r43 = c26086_6;
if (r43 !== 0) {
while (true) {
if (r43 === 1) {
try {
const r311 = c26086_5;
c26086_6 = 0;
c29877_5 = r311;
Dispatcher.dispatch({
type: "GIFT_CODE_RESOLVE_FAILURE",
code: c29877_0,
error: c29877_5
});
throw c29877_5;
} catch (r308) {
r8 = r308;
c26086_5 = r308;
r43 = c26086_6;
if (r43 === 0) {
break;
}
}
} else {
try {
c26086_6 = 1;
if (c29877_3.application_id === COLLECTIBLES_APPLICATION_ID) {
await fetchCollectiblesProduct(c29877_3.sku_id);
c29877_4 = CollectiblesCategoryStore.getProduct(c29877_3.sku_id);
const r288 = c29877_4;
if ((r288 == null ? void 0 : r288.items.some(isUnknownCollectiblesItemRecord)) === true) {
throw new ClientOutdatedAcceptGiftError("Client update required to redeem this gift");
}
}
Dispatcher.dispatch({
type: "GIFT_CODE_RESOLVE_SUCCESS",
giftCode: c29877_3
});
r183 = {
giftCode: c29877_3
};
c26086_6 = 0;
break L25;
} catch (r231) {
r8 = r231;
c26086_5 = r231;
r43 = c26086_6;
if (r43 === 0) {
break;
}
}
}
}
}
throw r8;
}
}
return r183;
}
const r35 = {
resolveGiftCode,
fetchUserGiftCodesForSKU: async function fetchUserGiftCodesForSKU(skuId, r4 = null) {
const subscriptionPlanId = r4;
let c26087_3 = 0;
let c29878_0;
L10: {
try {
c29878_0 = void 0;
Dispatcher.dispatch({
type: "GIFT_CODES_FETCH",
skuId,
subscriptionPlanId
});
c26087_3 = 1;
c29878_0 = await HTTP.get({
url: Endpoints.USER_GIFT_CODES,
query: {
sku_id: skuId,
subscription_plan_id: subscriptionPlanId
},
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "GIFT_CODES_FETCH_SUCCESS",
giftCodes: c29878_0.body,
skuId,
subscriptionPlanId
});
c26087_3 = 0;
} catch ($e) {
let r12 = $e;
if (c26087_3 !== 0) {
while (true) {
try {
c26087_3 = 0;
Dispatcher.dispatch({
type: "GIFT_CODES_FETCH_FAILURE",
skuId,
subscriptionPlanId
});
break L10;
} catch ($e) {
r12 = $e;
if (c26087_3 === 0) {
break;
}
}
}
}
throw r12;
}
}
},
createGiftCode: async function createGiftCode(skuId2, r5 = null) {
let body;
const subscriptionPlanId2 = r5;
let r4 = arguments[2];
if (r4 === void 0) {
r4 = null;
}
const gift_style = r4;
let c26088_3 = 0;
let c29879_0;
try {
c29879_0 = void 0;
Dispatcher.dispatch({
type: "GIFT_CODE_CREATE_START",
skuId: skuId2,
subscriptionPlanId: subscriptionPlanId2
});
c26088_3 = 1;
c29879_0 = await HTTP.post({
url: Endpoints.USER_GIFT_CODE_CREATE,
body: {
sku_id: skuId2,
subscription_plan_id: subscriptionPlanId2,
gift_style
},
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "GIFT_CODE_CREATE_SUCCESS",
giftCode: c29879_0.body
});
body = c29879_0.body;
c26088_3 = 0;
} catch ($e) {
let r13 = $e;
if (c26088_3 !== 0) {
while (true) {
try {
c26088_3 = 0;
Dispatcher.dispatch({
type: "GIFT_CODE_CREATE_FAILURE",
skuId: skuId2,
subscriptionPlanId: subscriptionPlanId2
});
} catch ($e) {
r13 = $e;
if (c26088_3 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r13;
}
return body;
},
revokeGiftCode: async (code) => {
let c26089_3 = 0;
L10: {
try {
Dispatcher.dispatch({
type: "GIFT_CODE_REVOKE",
code
});
c26089_3 = 1;
await HTTP.del({
url: Endpoints.USER_GIFT_CODE_REVOKE(code),
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "GIFT_CODE_REVOKE_SUCCESS",
code
});
c26089_3 = 0;
} catch ($e) {
let r8 = $e;
if (c26089_3 !== 0) {
while (true) {
try {
c26089_3 = 0;
Dispatcher.dispatch({
type: "GIFT_CODE_REVOKE_FAILURE",
code
});
break L10;
} catch ($e) {
r8 = $e;
if (c26089_3 === 0) {
break;
}
}
}
}
throw r8;
}
}
},
openNativeGiftCodeModal: (a0) => {
CodedLinkActionCreators.openNativeAppModal(a0, RPCCommands.GIFT_CODE_BROWSER);
},
..._GiftCodeActionCreators.default
};
export default r35;
+869
View File
@@ -0,0 +1,869 @@
// Metro module 5105 (f5106).
import BulkBanStore from "../modules/guild_mod_dash_member_safety/BulkBanStore";
import AuthenticationStore from "../stores/AuthenticationStore";
import ExpandedGuildFolderStore from "../stores/ExpandedGuildFolderStore";
import GuildChannelStore from "../stores/GuildChannelStore";
import GuildStore from "../stores/GuildStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import SelectedGuildStore from "../stores/SelectedGuildStore";
import UserStore from "../stores/UserStore";
import { UserFlags, Endpoints, JoinGuildSources, Routes, AbortCodes, MAX_USER_GUILDS_PREMIUM, MAX_USER_GUILDS, AnalyticEvents } from "../Constants";
import { AgeGateSource } from "../modules/age_gate/AgeGateConstants";
import AlertActionCreators from "./AlertActionCreators";
import { intl, t } from "../intl/index.native";
import Dispatcher from "../Dispatcher";
import openQuarantineModeInfoModal_native from "../modules/quarantine/openQuarantineModeInfoModal.native";
import { rejectWithMigratedError, HTTP } from "../_bundle/sendRequest";
import { transitionTo } from "../modules/routing/router_utils";
import "../_bundle/asyncRequire";
import { openAgeGateModal } from "../modules/age_gate/AgeGateModalActionCreators";
import * as _GuildCapUpsellHooks from "../modules/premium/GuildCapUpsellHooks";
import { getChannelIdForGuildTransition } from "../modules/routing/getChannelIdForGuildTransition";
import safeTransitionTo_native from "../modules/links/safeTransitionTo.native";
import { stopLurking } from "../modules/lurker_mode/LurkerActionCreators";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import BulkBanPubSubExperiment from "../modules/guild_mod_dash_member_safety/web/BulkBanPubSubExperiment";
import { NONE } from "../utils/PermissionUtils";
import { deserialize } from "../_bundle/HighLow";
import GuildTemplateTooltipActionCreators from "../modules/guild_templates/GuildTemplateTooltipActionCreators";
import V6OrEarlierAPIError from "../errors/V6OrEarlierAPIError";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import getPreviousSafeRouteForNsfwReturn_native from "../modules/age_gate/getPreviousSafeRouteForNsfwReturn.native";
import { isChannelContentGated } from "../modules/age_gate/AgeGateUtils";
import { isChannelSpoilerGated } from "../modules/spoiler_channels/SpoilerChannelUtils";
function $mk114647($env) {
return () => {
const r4 = $env;
return Dispatcher.dispatch({
type: "GUILD_JOIN",
guildId: r4[0],
lurker: r4[7],
source: r4[2],
loadId: r4[3]
});
};
}
function $mk114648($env) {
return function showGuildAtCapacityAlert() {
AlertActionCreators.show({
title: intl.string(t.ZZlox4),
body: intl.string(t.ZUEGFn)
});
};
}
let deleteGuild, waitForGuild, _excluded;
let env3070 = {};
const showTooManyUserGuildsAlert = function showTooManyUserGuildsAlert(a0) {
AlertActionCreators.show({
title: intl.string(t.cTaRxF),
body: intl.formatToPlainString(t["VSd+Aj"], {
quantity: a0
})
});
};
deleteGuild = function deleteGuild(a0) {
Dispatcher.dispatch({
type: "GUILD_DELETE",
guild: {
id: a0
}
});
};
waitForGuild = function waitForGuild(c14622_0) {
return new Promise((c25333_0) => GuildStore.addConditionalChangeListener(() => {
const guild = GuildStore.getGuild(c14622_0);
let r8 = guild == null;
if (!r8) {
c25333_0(guild);
r8 = false;
}
return r8;
}));
};
_excluded = ["icon", "unicodeEmoji"];
const r52 = {
joinGuild: async function joinGuild(c25332_0, c25332_1) {
let r234, r273, promise;
let lurker, c25332_3, c25332_4, c25332_5;
let c25332_6 = 0;
const r15 = env3070;
L49: {
L48: {
L37: {
try {
let env29451;
c25332_4 = r15;
const r41 = env29451 = {
$parent: r15
};
c25332_3 = r41;
env29451[1] = void 0;
env29451[0] = c25332_0;
let r42 = c25332_1;
if (r42 === void 0) {
r42 = {};
}
env29451[1] = r42;
env29451[2] = void 0;
env29451[3] = void 0;
env29451[4] = void 0;
env29451[5] = void 0;
env29451[6] = void 0;
env29451[7] = void 0;
env29451[8] = void 0;
env29451[9] = void 0;
env29451[10] = void 0;
env29451[11] = void 0;
env29451[12] = void 0;
await void 0;
env29451[2] = env29451[1].source;
env29451[3] = env29451[1].loadId;
env29451[4] = env29451[1].lurkLocation;
env29451[5] = env29451[1].autoNavigate;
env29451[6] = env29451[5] === void 0 || env29451[5];
const lurker2 = env29451[1].lurker;
lurker = lurker2;
if (lurker2 == null) {
lurker = false;
}
env29451[7] = lurker;
env29451[8] = UserStore.getCurrentUser();
const r21 = env29451[8];
if (r21 == null ? void 0 : r21.hasFlag(UserFlags.QUARANTINED)) {
openQuarantineModeInfoModal_native();
promise = new Promise((resolve, reject) => reject(new Error()));
break L49;
}
Dispatcher.wait($mk114647(c25332_3));
c25332_6 = 1;
env29451[9] = SelectedGuildStore.getGuildId();
env29451[10] = env29451[0] === env29451[9] ? GuildStore.getGuild(env29451[0]) != null ? SelectedChannelStore.getChannelId(env29451[0]) : null : null;
const r125 = {
url: Endpoints.GUILD_JOIN(env29451[0]),
query: {
lurker: env29451[7],
session_id: env29451[7] ? AuthenticationStore.getSessionId() : null,
recommendation_load_id: env29451[3],
location: env29451[7] ? env29451[4] != null ? env29451[4] : null : null,
from_directory: env29451[2] === JoinGuildSources.DIRECTORY_ENTRY || null
},
context: {
source: env29451[2]
},
oldFormErrors: true,
body: {},
rejectWithError: rejectWithMigratedError()
};
env29451[11] = await HTTP.put(r125);
if (env29451[11].body.join_request != null) {
Dispatcher.dispatch({
type: "USER_GUILD_JOIN_REQUEST_UPDATE",
guildId: env29451[0],
request: env29451[11].body.join_request
});
}
if (GuildStore.getGuild(env29451[0]) == null && env29451[11].body.show_verification_form) {
if (env29451[6]) {
transitionTo(Routes.GUILD_MEMBER_VERIFICATION(env29451[0]));
r234 = env29451[11];
c25332_6 = 0;
break L37;
}
}
if (env29451[11].body.welcome_screen != null) {
Dispatcher.dispatch({
type: "WELCOME_SCREEN_UPDATE",
guildId: env29451[11].body.id,
welcomeScreen: env29451[11].body.welcome_screen
});
}
if (env29451[11].body.approximate_presence_count != null) {
Dispatcher.dispatch({
type: "ONLINE_GUILD_MEMBER_COUNT_UPDATE",
guildId: env29451[11].body.id,
count: env29451[11].body.approximate_presence_count
});
}
if (!env29451[7] && env29451[6]) {
env29451[12] = (await import("../modules/guild_onboarding/doGuildOnboarding.native")).default;
await (0, env29451[12])({
guildId: env29451[0],
returnChannelId: env29451[10]
});
}
r273 = env29451[11];
c25332_6 = 0;
break L48;
} catch ($e) {
const r39 = $e;
let r8 = r39;
c25332_5 = r39;
if (c25332_6 !== 0) {
while (true) {
try {
const r340 = c25332_5;
c25332_6 = 0;
env29451[13] = r340;
if (env29451[13].body?.code === AbortCodes.USER_GUILD_JOIN_LARGE_GUILD_UNDERAGE_DISALLOWED) {
openAgeGateModal(AgeGateSource.JOIN_LARGE_GUILD_UNDERAGE);
}
if (env29451[13].body?.code === AbortCodes.TOO_MANY_USER_GUILDS) {
const hasIncreasedGuildCap = _GuildCapUpsellHooks.hasIncreasedGuildCap(UserStore.getCurrentUser());
if (hasIncreasedGuildCap) {
showTooManyUserGuildsAlert(MAX_USER_GUILDS_PREMIUM);
} else {
showTooManyUserGuildsAlert(MAX_USER_GUILDS);
}
}
if (env29451[13].body?.code === AbortCodes.GUILD_AT_CAPACITY) {
$mk114648(env3070)();
}
if (env29451[7] && env29451[13].body?.code === AbortCodes.UNKNOWN_GUILD) {
(0, deleteGuild)(env29451[0]);
}
throw env29451[13];
} catch (r337) {
r8 = r337;
c25332_5 = r337;
if (c25332_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
return r234;
}
return r273;
}
return promise;
},
waitForGuild,
transitionToGuildSync: async (c14623_0, c14623_1, c14623_2, c14623_3) => {
let welcomeModalChannelId, c25334_3;
let env29452;
c25334_3 = void 0;
const r12 = env29452 = {
$parent: env3070
};
let c25334_2 = r12;
env29452[0] = void 0;
env29452[1] = void 0;
const getChannelId2 = function getChannelId(a0, a1) {
return a1 == null ? getChannelIdForGuildTransition(a0) : a1;
};
env29452[0] = getChannelId2((await waitForGuild(c14623_0)).id, c14623_2);
env29452[1] = c14623_1;
if ((c14623_1 == null ? void 0 : c14623_1.hasOwnProperty("welcomeModalChannelId")) && c14623_1.welcomeModalChannelId == null) {
welcomeModalChannelId = env29452[0];
if (welcomeModalChannelId == null) {
welcomeModalChannelId = void 0;
}
env29452[1] = {
...c14623_1,
welcomeModalChannelId
};
}
safeTransitionTo_native(Routes.CHANNEL(c14623_0, env29452[0], c14623_3), env29452[1]);
await new Promise(setImmediate);
},
deleteGuild,
selectGuild: (a0) => {
stopLurking(a0);
},
createGuild: (a0) => {
Dispatcher.dispatch({
type: "GUILD_CREATE",
guild: a0
});
},
setServerMute: (a0, a1, a2) => HTTP.patch({
url: Endpoints.GUILD_MEMBER(a0, a1),
body: {
mute: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
setServerDeaf: (a0, a1, a2) => HTTP.patch({
url: Endpoints.GUILD_MEMBER(a0, a1),
body: {
deaf: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
setChannel: (a0, a1, a2) => {
HTTP.patch({
url: Endpoints.GUILD_MEMBER(a0, a1),
body: {
channel_id: a2
},
oldFormErrors: true,
rejectWithError: true
});
},
setMemberFlags: (a0, a1, a2) => {
HTTP.patch({
url: Endpoints.GUILD_MEMBER(a0, a1),
body: {
flags: a2
},
oldFormErrors: true,
rejectWithError: true
});
},
kickUser: (a0, a1, a2, a3) => {
const guildId = a0;
const userId = a1;
return HTTP.del({
url: Endpoints.GUILD_MEMBER(a0, a1),
query: {
reason: a2,
moderator_report_id: a3
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
Dispatcher.dispatch({
type: "GUILD_MEMBER_REMOVE_LOCAL",
guildId,
userId
});
});
},
setCommunicationDisabledUntil: ({ guildId: guildId4, userId: userId2, communicationDisabledUntilTimestamp, duration, reason, location: location2, moderatorReportId }) => TrackedHTTPUtils.patch({
url: Endpoints.GUILD_MEMBER(guildId4, userId2),
reason,
body: {
communication_disabled_until: communicationDisabledUntilTimestamp,
moderator_report_id: moderatorReportId
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_COMMUNICATION_DISABLED_UPDATE,
properties: {
guild_id: guildId4,
target_user_id: userId2,
duration: duration ?? null,
reason: reason ?? null,
communication_disabled_until: communicationDisabledUntilTimestamp,
location: location2 ?? null
}
},
rejectWithError: rejectWithMigratedError()
}),
banUser: (a0, a1, a2, a3, a4) => HTTP.put({
url: Endpoints.GUILD_BAN(a0, a1),
reason: a3,
body: {
delete_message_seconds: a2,
moderator_report_id: a4
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
unbanUser: (a0, a1) => HTTP.del({
url: Endpoints.GUILD_BAN(a0, a1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
banMultipleUsers: function banMultipleUsers(a0, a1, a2, a3, r2 = false) {
return HTTP.post({
url: r2 ? Endpoints.BULK_GUILD_BAN_V2(a0) : Endpoints.BULK_GUILD_BAN(a0),
body: {
user_ids: a1,
delete_message_seconds: a2
},
reason: a3,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
},
startBulkBan: async function startBulkBan(c14625_0, c14625_1, c14625_2, c14625_3) {
const _this = this;
let body3;
let c25335_4 = 0;
let c29453_0, c29453_1, c29453_2, c29453_3, c29453_4, c29453_5, c29453_6;
L24: {
L12: {
try {
c29453_0 = void 0;
c29453_1 = void 0;
c29453_2 = void 0;
c29453_3 = void 0;
c29453_4 = void 0;
c29453_5 = void 0;
c29453_6 = void 0;
const usePubSub = BulkBanPubSubExperiment.getConfig({
location: "startBulkBan"
}).usePubSub;
c29453_0 = usePubSub;
c25335_4 = 1;
c29453_1 = await _this.banMultipleUsers(c14625_0, c14625_1, c14625_2, c14625_3, usePubSub);
if (c29453_0) {
if (BulkBanStore.consumeCompletedBeforeStarted(c14625_0, AuthenticationStore.getId())) {
c25335_4 = 0;
break L12;
}
}
Dispatcher.dispatch({
type: "GUILD_BULK_BAN_STARTED",
guildId: c14625_0
});
if (!c29453_0) {
const body4 = c29453_1.body;
body3 = body4;
if (body4 == null) {
body3 = {};
}
c29453_2 = body3;
c29453_3 = c29453_2.banned_users;
c29453_4 = c29453_3 === void 0 ? [] : c29453_3;
c29453_5 = c29453_2.failed_users;
c29453_6 = c29453_5 === void 0 ? [] : c29453_5;
Dispatcher.dispatch({
type: "GUILD_BULK_BAN_UPDATE",
guildId: c14625_0,
bulkBan: {
bannedUsers: c29453_4,
failedUsers: c29453_6,
targetUserIds: c14625_1
}
});
}
c25335_4 = 0;
break L24;
} catch ($e) {
let r8 = $e;
if (c25335_4 !== 0) {
while (true) {
try {
c25335_4 = 0;
Dispatcher.dispatch({
type: "GUILD_BULK_BAN_FAILED",
guildId: c14625_0
});
break L24;
} catch ($e) {
r8 = $e;
if (c25335_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
return void 0;
}
},
createRole: async function createRole(c14626_0, c14626_1, c14626_2, c14626_3, r8 = {}) {
let r121;
let skipSelect = r8.skipSelect;
if (skipSelect === void 0) {
skipSelect = false;
}
let c14626_4 = skipSelect;
let color, colors, primary_color, c25336_5;
let c25336_6 = 0;
let c29454_0, c29454_1, c29454_2;
try {
c29454_0 = void 0;
c29454_1 = void 0;
let name = c14626_1;
if (!(name != null && name !== "")) {
name = intl.string(t.QBMHvB);
}
color = c14626_2;
if (c14626_2 == null) {
color = 0;
}
colors = c14626_3;
if (c14626_3 == null) {
primary_color = c14626_2;
if (c14626_2 == null) {
primary_color = 0;
}
colors = {
primary_color,
secondary_color: null,
tertiary_color: null
};
}
const body4 = {
name,
color,
colors,
permissions: NONE
};
c25336_6 = 1;
c29454_0 = await HTTP.post({
url: Endpoints.GUILD_ROLES(c14626_0),
oldFormErrors: true,
body: body4,
rejectWithError: rejectWithMigratedError()
});
c29454_1 = c29454_0.body;
c29454_1.permissions = deserialize(c29454_1.permissions);
if (!c14626_4) {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_ROLE_SELECT",
roleId: c29454_0.body.id,
role: c29454_1
});
}
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14626_0);
r121 = c29454_1;
c25336_6 = 0;
} catch ($e) {
const r38 = $e;
let r16 = r38;
c25336_5 = r38;
if (c25336_6 !== 0) {
while (true) {
try {
const r144 = c25336_5;
c25336_6 = 0;
c29454_2 = r144;
throw new V6OrEarlierAPIError(c29454_2);
} catch (r140) {
r16 = r140;
c25336_5 = r140;
if (c25336_6 === 0) {
break;
}
}
}
}
throw r16;
}
return r121;
},
updateRole: async (c14627_0, c14627_1, c14627_2) => {
let c25337_1;
c25337_1 = void 0;
const { icon, unicodeEmoji, ...rest } = c14627_2;
const icon2 = icon !== null ? (icon == null ? void 0 : icon.startsWith("data:")) ? icon : void 0 : icon;
let c29455_0 = await HTTP.patch({
url: Endpoints.GUILD_ROLE(c14627_0, c14627_1),
body: {
...rest,
icon: icon2,
unicode_emoji: unicodeEmoji
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14627_0);
return c29455_0;
},
updateRolePermissions: (a0, a1, a2) => HTTP.patch({
url: Endpoints.GUILD_ROLE(a0, a1),
body: {
permissions: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}),
deleteRole: (a0, a1) => {
HTTP.del({
url: Endpoints.GUILD_ROLE(a0, a1),
oldFormErrors: true,
rejectWithError: true
}).then(() => {
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(a0);
});
},
batchChannelUpdate: async (c14629_0, body) => {
let c25338_1;
c25338_1 = void 0;
let c29456_0 = await HTTP.patch({
url: Endpoints.GUILD_CHANNELS(c14629_0),
body,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14629_0);
return c29456_0;
},
batchRoleUpdate: async (c14630_0, body2) => {
let c25339_1;
c25339_1 = void 0;
let c29457_0 = await HTTP.patch({
url: Endpoints.GUILD_ROLES(c14630_0),
body: body2,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
GuildTemplateTooltipActionCreators.checkGuildTemplateDirty(c14630_0);
return c29457_0;
},
requestMembers: function requestMembers(a0, query2 = "", limit3 = 10, presences = true) {
return Dispatcher.dispatch({
type: "GUILD_MEMBERS_REQUEST",
guildIds: Array.isArray(a0) ? a0 : [a0],
query: query2,
limit: limit3,
presences
});
},
searchRecentMembers: (a0, a1) => {
const r2 = a1 == null ? {} : a1;
return Dispatcher.dispatch({
type: "GUILD_SEARCH_RECENT_MEMBERS",
guildId: a0,
query: r2.query,
continuationToken: r2.continuationToken
});
},
requestMembersById: function requestMembersById(a0, a1, presences = true) {
return Dispatcher.dispatch({
type: "GUILD_MEMBERS_REQUEST",
guildIds: Array.isArray(a0) ? a0 : [a0],
userIds: Array.isArray(a1) ? a1 : [a1],
presences
});
},
move: (a0, a1, a2, a3) => {
Dispatcher.dispatch({
type: "GUILD_MOVE",
fromIndex: a0,
toIndex: a1,
fromFolderIndex: a2,
toFolderIndex: a3
});
},
moveById: function moveById(a0, a1, moveToBelow = false, combine = false) {
if (a0 === a1) {
throw new Error(`GuildActionCreators.moveById: \`sourceId\` and \`targetId\` cannot be the same value: ${a0}`);
}
Dispatcher.dispatch({
type: "GUILD_MOVE_BY_ID",
sourceId: a0,
targetId: a1,
moveToBelow,
combine
});
},
createGuildFolderLocal: (a0, a1) => {
AnalyticsUtils.track(AnalyticEvents.GUILD_FOLDER_CREATED);
Dispatcher.dispatch({
type: "GUILD_FOLDER_CREATE_LOCAL",
sourceIds: a0,
name: a1
});
},
editGuildFolderLocal: (a0, a1, a2) => {
Dispatcher.dispatch({
type: "GUILD_FOLDER_EDIT_LOCAL",
targetId: a0,
sourceIds: a1,
name: a2
});
},
deleteGuildFolderLocal: (a0) => {
Dispatcher.dispatch({
type: "GUILD_FOLDER_DELETE_LOCAL",
targetId: a0
});
},
toggleGuildFolderExpand: (a0) => {
AnalyticsUtils.track(AnalyticEvents.GUILD_FOLDER_CLICKED, {
source: "sidebar",
action: ExpandedGuildFolderStore.isFolderExpanded(a0) ? "collapsed" : "expanded"
});
Dispatcher.dispatch({
type: "TOGGLE_GUILD_FOLDER_EXPAND",
folderId: a0
});
},
setGuildFolderExpanded: (a0, a1) => {
Dispatcher.dispatch({
type: "SET_GUILD_FOLDER_EXPANDED",
folderId: a0,
expanded: a1
});
},
collapseAllFolders: () => {
Dispatcher.dispatch({
type: "GUILD_FOLDER_COLLAPSE"
});
},
nsfwAgree: (a0) => {
Dispatcher.dispatch({
type: "GUILD_NSFW_AGREE",
guildId: a0
});
},
nsfwReturnToSafety: (a0) => {
L9: {
const previousSafeRouteForNsfwReturn_native = getPreviousSafeRouteForNsfwReturn_native(a0);
if (previousSafeRouteForNsfwReturn_native == null) {
if (a0 != null) {
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
if (defaultChannel != null) {
if (!isChannelContentGated(defaultChannel) && !isChannelSpoilerGated(defaultChannel)) {
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
break L9;
}
}
transitionTo(Routes.FRIENDS, {
navigationReplace: false,
openChannel: true
});
} else {
transitionTo(Routes.FRIENDS, {
navigationReplace: false,
openChannel: true
});
}
} else {
transitionTo(Routes.CHANNEL(previousSafeRouteForNsfwReturn_native.guildId, previousSafeRouteForNsfwReturn_native.channelId));
}
}
},
spoilerAgree: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_SPOILER_AGREE",
channelId: a0
});
},
clearSpoilerAgree: (a0) => {
Dispatcher.dispatch({
type: "CHANNEL_SPOILER_AGREE_CLEAR",
channelId: a0
});
},
escapeToDefaultChannel: (a0) => {
const defaultChannel = GuildChannelStore.getDefaultChannel(a0);
if (defaultChannel != null) {
transitionTo(Routes.CHANNEL(a0, defaultChannel.id));
} else {
transitionTo(Routes.FRIENDS);
}
},
fetchApplications: async (c14631_0, channel_id) => {
let c25340_1;
c25340_1 = void 0;
const r11 = {
url: Endpoints.GUILD_APPLICATIONS(c14631_0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
};
if (channel_id != null) {
r11.query = {
channel_id
};
}
let c29458_0 = (await HTTP.get(r11)).body;
Dispatcher.dispatch({
type: "GUILD_APPLICATIONS_FETCH_SUCCESS",
guildId: c14631_0,
applications: c29458_0
});
},
fetchGuildBansBatch: async function fetchGuildBansBatch(guildId2, r6 = 1000) {
const limit = r6;
let r5 = arguments[2];
if (r5 === void 0) {
r5 = null;
}
const after = r5;
const query2 = {
limit
};
if (after != null) {
query2.after = after;
}
await HTTP.get({
url: Endpoints.GUILD_BANS(guildId2),
oldFormErrors: true,
query: query2,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_LOADED_BANS_BATCH",
bans: result.body,
guildId: guildId2
});
});
},
searchGuildBans: async function searchGuildBans(guildId3, query, user_ids, r4 = 10) {
const limit2 = r4;
const query2 = {
limit: limit2
};
if (user_ids != null && user_ids.length > 0) {
query2.user_ids = user_ids;
}
if (query != null && query.trim().length > 0) {
query2.query = query;
}
await HTTP.get({
url: Endpoints.GUILD_BANS_SEARCH(guildId3),
oldFormErrors: true,
query: query2,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_LOADED_BANS_BATCH",
bans: result.body,
userIds: user_ids,
guildId: guildId3
});
});
},
fetchGuildBans: async (c14634_0) => {
await HTTP.get({
url: Endpoints.GUILD_BANS(c14634_0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "GUILD_SETTINGS_LOADED_BANS",
bans: result.body
});
});
},
fetchGuildRoleConnectionsEligibility: (a0, a1) => {
const roleId = a1;
return HTTP.get({
url: Endpoints.GUILD_ROLE_CONNECTIONS_ELIGIBILITY(a0, a1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(({ body: body4 }) => {
Dispatcher.dispatch({
type: "GUILD_ROLE_CONNECTION_ELIGIBILITY_FETCH_SUCCESS",
roleId,
roleConnectionEligibility: body4
});
return body4;
});
},
assignGuildRoleConnection: async (c14636_0, c14636_1) => {
await HTTP.post({
url: Endpoints.GUILD_ROLE_CONNECTIONS_ASSIGN(c14636_0, c14636_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
},
unassignGuildRoleConnection: async (c14637_0, c14637_1) => {
await HTTP.post({
url: Endpoints.GUILD_ROLE_CONNECTIONS_UNASSIGN(c14637_0, c14637_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
},
getGuildRoleConnectionsConfigurations: async (c14638_0) => (await HTTP.get({
url: Endpoints.GUILD_ROLE_CONNECTIONS_CONFIGURATIONS(c14638_0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body
};
export default r52;
export { waitForGuild };
+20
View File
@@ -0,0 +1,20 @@
// Metro module 8181 (f8182).
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
export function fetchGuildAffinities() {
return HTTP.get({
url: Endpoints.GUILD_AFFINITIES,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "LOAD_GUILD_AFFINITIES_SUCCESS",
guildAffinities: result.body.guild_affinities
});
}, () => {
Dispatcher.dispatch({
type: "LOAD_GUILD_AFFINITIES_FAILURE"
});
});
}
@@ -0,0 +1,74 @@
// Metro module 6071 (f6072).
import Dispatcher from "../Dispatcher";
import { MINIMUM_RANGE } from "../lib/guild/GuildChannelSubscriptions";
export function subscribeMembers(a0, a1) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_MEMBERS_ADD",
guildId: a0,
userIds: a1
});
}
export function unsubscribeMembers(a0, a1) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_MEMBERS_REMOVE",
guildId: a0,
userIds: a1
});
}
export function subscribeToMemberUpdates(a0) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_ADD_MEMBER_UPDATES",
guildId: a0
});
}
export function unsubscribeFromMemberUpdates(a0) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_REMOVE_MEMBER_UPDATES",
guildId: a0
});
}
export function subscribeGuild(a0) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS",
guildId: a0
});
}
export function subscribeChannel(a0, a1, a2) {
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_CHANNEL",
guildId: a0,
channelId: a1,
ranges: a2
});
}
export function subscribeChannelDimensions({ guildId, channelId, y: r7, height, rowHeight }) {
const r25 = Math.max(0, Math.ceil(Math.ceil(0.5 * height / rowHeight)) + 0);
const r26 = -r25;
const r34 = Math.max(0, Math.ceil(Math.ceil(r7 / rowHeight)) + r26);
const r35 = r7 + height;
let r36 = r25;
if (r36 === void 0) {
r36 = 0;
}
const ranges = [];
const r49 = Math.max(0, Math.ceil(Math.ceil(r35 / rowHeight)) + r36);
let r50 = r34;
if (r50 > 0) {
const r51 = Math;
const r59 = 0 + (MINIMUM_RANGE - 1);
ranges.push([0, r59]);
r50 = r51.max(r59 + 1, r34);
}
let r76 = Math.floor(r50 / MINIMUM_RANGE) * MINIMUM_RANGE;
while (r76 <= r49) {
const r84 = r76 + (MINIMUM_RANGE - 1);
ranges.push([r76, r84]);
r76 = r84 + 1;
}
Dispatcher.dispatch({
type: "GUILD_SUBSCRIPTIONS_CHANNEL",
guildId,
channelId,
ranges
});
}
+162
View File
@@ -0,0 +1,162 @@
// Metro module 11834 (f11835).
import { Endpoints } from "../Constants";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import { exact } from "../_bundle/Module1385";
import { rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
const r18 = {
signup: (a0, a1) => TrackedHTTPUtils.post({
url: Endpoints.HUB_WAITLIST_SIGNUP,
body: {
email: a0,
school: a1
},
trackedActionData: {
event: NetworkActionNames.HUB_WAITLIST_SIGNUP,
properties: (a0) => {
const r6 = a0 == null ? void 0 : a0.body?.email_domain;
return exact({
is_edu_email: r6 != null ? r6.split(".").indexOf("edu") !== -1 : false
});
}
},
rejectWithError: rejectWithMigratedError()
}),
sendVerificationEmail: async (email, allow_multiple_guilds, guild_id) => (await TrackedHTTPUtils.post({
url: Endpoints.HUB_EMAIL_VERIFY_SEND,
body: {
email,
guild_id,
allow_multiple_guilds,
use_verification_code: true
},
trackedActionData: {
event: NetworkActionNames.HUB_EMAIL_VERIFY_SEND,
properties: (a0) => exact({
has_matching_guild: a0 == null ? void 0 : a0.body?.has_matching_guild
})
},
rejectWithError: rejectWithMigratedError()
})).body,
verify: async (token) => {
let c27189_2;
let c27189_3 = 0;
let c30462_0, c30462_1, c30462_2;
L15: {
try {
c30462_0 = void 0;
c30462_1 = void 0;
if (token != null) {
c27189_3 = 1;
c30462_0 = await TrackedHTTPUtils.post({
url: Endpoints.HUB_EMAIL_VERIFY,
body: {
token
},
trackedActionData: {
event: NetworkActionNames.HUB_EMAIL_VERIFY
},
rejectWithError: rejectWithMigratedError()
});
c30462_1 = c30462_0.body.guild?.id;
Dispatcher.dispatch({
type: "HUB_VERIFY_EMAIL_SUCCESS",
guildId: c30462_1
});
c27189_3 = 0;
break L15;
}
} catch ($e) {
const r27 = $e;
let r8 = r27;
c27189_2 = r27;
if (c27189_3 !== 0) {
while (true) {
try {
const r90 = c27189_2;
c27189_3 = 0;
c30462_2 = r90;
Dispatcher.dispatch({
type: "HUB_VERIFY_EMAIL_FAILURE",
errors: c30462_2.body
});
break L15;
} catch (r86) {
r8 = r86;
c27189_2 = r86;
if (c27189_3 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
},
verifyCode: async (code, guild_id2, email2) => {
let body;
let c27190_2;
let c27190_3 = 0;
let c30463_0, c30463_1, c30463_2;
L14: {
try {
c30463_0 = void 0;
c30463_1 = void 0;
if (code != null) {
c27190_3 = 1;
c30463_0 = await TrackedHTTPUtils.post({
url: Endpoints.HUB_EMAIL_VERIFY_CODE,
body: {
code,
guild_id: guild_id2,
email: email2
},
trackedActionData: {
event: NetworkActionNames.HUB_EMAIL_VERIFY
},
rejectWithError: rejectWithMigratedError()
});
c30463_1 = c30463_0.body.guild?.id;
Dispatcher.dispatch({
type: "HUB_VERIFY_EMAIL_SUCCESS",
guildId: c30463_1
});
body = c30463_0.body;
c27190_3 = 0;
break L14;
}
} catch ($e) {
const r27 = $e;
let r8 = r27;
c27190_2 = r27;
if (c27190_3 !== 0) {
while (true) {
try {
const r94 = c27190_2;
c27190_3 = 0;
c30463_2 = r94;
Dispatcher.dispatch({
type: "HUB_VERIFY_EMAIL_FAILURE",
errors: c30463_2.body
});
throw c30463_2;
} catch (r90) {
r8 = r90;
c27190_2 = r90;
if (c27190_3 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
return body;
}
};
export default r18;
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,26 @@
// Metro module 10086 (f10087).
import "../stores/InviteSuggestionsStore";
import { fetchUserAffinitiesV2 } from "../modules/user_affinities/UserAffinitiesActionCreators";
import Dispatcher from "../Dispatcher";
export function loadInviteSuggestions({ omitUserIds, guild, channel, applicationId, inviteTargetType }) {
return fetchUserAffinitiesV2().then(() => {
let omitUserIds2 = omitUserIds;
if (omitUserIds == null) {
omitUserIds2 = new Set();
}
Dispatcher.dispatch({
type: "LOAD_INVITE_SUGGESTIONS",
omitUserIds: omitUserIds2,
guild,
channel,
applicationId,
inviteTargetType
});
});
}
export function searchInviteSuggestions(a0) {
Dispatcher.dispatch({
type: "INVITE_SUGGESTIONS_SEARCH",
query: a0
});
}
+18
View File
@@ -0,0 +1,18 @@
// Metro module 5845 (f5846).
import Dispatcher from "../Dispatcher";
export function pushLayer(a0) {
Dispatcher.dispatch({
type: "LAYER_PUSH",
component: a0
});
}
export function popLayer() {
Dispatcher.dispatch({
type: "LAYER_POP"
});
}
export function popAllLayers() {
Dispatcher.dispatch({
type: "LAYER_POP_ALL"
});
}
+120
View File
@@ -0,0 +1,120 @@
// Metro module 13775 (f13776).
import MFAStore from "../stores/MFAStore";
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
const r18 = {
enable: (a0) => HTTP.post({
url: Endpoints.MFA_TOTP_ENABLE,
body: {
code: a0.code,
secret: a0.secret
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => Dispatcher.dispatch({
type: "MFA_ENABLE_SUCCESS",
token: result.body.token,
codes: result.body.backup_codes
})),
disable: () => {
HTTP.post({
url: Endpoints.MFA_TOTP_DISABLE,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => Dispatcher.dispatch({
type: "MFA_DISABLE_SUCCESS",
token: result.body.token
}));
},
enableSMS: () => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE"
});
return HTTP.post({
url: Endpoints.MFA_SMS_ENABLE,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE_COMPLETE"
});
return result;
}, (a0) => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE_COMPLETE"
});
throw a0;
});
},
disableSMS: (a0) => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE"
});
return HTTP.post({
url: Endpoints.MFA_SMS_DISABLE,
body: {
password: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE_COMPLETE"
});
return result;
}, (a0) => {
Dispatcher.dispatch({
type: "MFA_SMS_TOGGLE_COMPLETE"
});
throw a0;
});
},
sendMFABackupCodesVerificationKeyEmail: (a0) => HTTP.post({
url: Endpoints.MFA_SEND_VERIFICATION_KEY,
body: {
password: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => Dispatcher.dispatch({
type: "MFA_SEND_VERIFICATION_KEY",
nonces: {
viewNonce: result.body.nonce,
regenerateNonce: result.body.regenerate_nonce
}
}), (a0) => {
throw a0;
}),
confirmViewBackupCodes: (a0, a1) => {
const key = a0;
const nonces = MFAStore.getNonces();
let viewNonce = nonces.viewNonce;
const regenerateNonce = nonces.regenerateNonce;
if (a1) {
viewNonce = regenerateNonce;
}
return HTTP.post({
url: Endpoints.MFA_CODES_VERIFICATION,
body: {
key: a0,
nonce: viewNonce,
regenerate: a1
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => Dispatcher.dispatch({
type: "MFA_VIEW_BACKUP_CODES",
codes: result.body.backup_codes,
key
}), (a0) => {
throw a0;
});
},
clearBackupCodes: () => {
Dispatcher.dispatch({
type: "MFA_CLEAR_BACKUP_CODES"
});
}
};
export default r18;
+14
View File
@@ -0,0 +1,14 @@
// Metro module 12295 (f12296).
import Dispatcher from "../Dispatcher";
export function trustDomain(a0) {
Dispatcher.dispatch({
type: "MASKED_LINK_ADD_TRUSTED_DOMAIN",
url: a0
});
}
export function trustProtocol(a0) {
Dispatcher.dispatch({
type: "MASKED_LINK_ADD_TRUSTED_PROTOCOL",
url: a0
});
}
+74
View File
@@ -0,0 +1,74 @@
// Metro module 15278 (f15279).
import { Endpoints, MAX_MENTIONS_PER_FETCH } from "../Constants";
import Dispatcher from "../Dispatcher";
import { HTTP } from "../_bundle/sendRequest";
const r17 = {
setGuildFilter: (a0) => {
Dispatcher.dispatch({
type: "SET_RECENT_MENTIONS_FILTER",
guildFilter: a0.guildFilter,
roleFilter: a0.roleFilter,
everyoneFilter: a0.everyoneFilter
});
},
clearMentions: () => {
Dispatcher.dispatch({
type: "CLEAR_MENTIONS"
});
},
truncateMentions: (a0) => {
Dispatcher.dispatch({
type: "TRUNCATE_MENTIONS",
size: a0
});
},
fetchRecentMentions: ({ before, limit = MAX_MENTIONS_PER_FETCH, guildId = null, roles = true, everyone = true, feature }) => {
Dispatcher.dispatch({
type: "LOAD_RECENT_MENTIONS",
guildId
});
return HTTP.get({
url: Endpoints.MENTIONS,
query: {
before,
limit,
guild_id: guildId,
roles,
everyone,
feature
},
retries: 2,
oldFormErrors: true,
rejectWithError: true
}).then(({ body }) => {
Dispatcher.dispatch({
type: "LOAD_RECENT_MENTIONS_SUCCESS",
messages: body,
isAfter: before != null,
hasMoreAfter: body.length >= MAX_MENTIONS_PER_FETCH
});
}, () => {
Dispatcher.dispatch({
type: "LOAD_RECENT_MENTIONS_FAILURE"
});
});
},
deleteRecentMention: (a0) => {
HTTP.del({
url: Endpoints.MENTIONS_MESSAGE_ID(a0),
retries: 2,
oldFormErrors: true,
rejectWithError: true
});
Dispatcher.dispatch({
type: "RECENT_MENTION_DELETE",
id: a0
});
},
setRecentMentionsStale: () => {
Dispatcher.dispatch({
type: "SET_RECENT_MENTIONS_STALE"
});
}
};
export default r17;
File diff suppressed because it is too large. Load diff
+98
View File
@@ -0,0 +1,98 @@
// Metro module 4395 (f4396).
import { AppContext } from "../Constants";
import uniqueId from "../_bundle/uniqueId";
import { pushModal, popModal, popModalsAboveKey, popAllModals } from "../modules/main_tabs_v2/helpers/NavigationRouteUtils.native";
import getDeprecatedModalData from "../utils/getDeprecatedModalData";
import Dispatcher from "../Dispatcher";
import { getRootNavigationRef } from "../modules/main_tabs_v2/RootNavigationRef.native";
import ModalDispatchQueue from "../modules/main_tabs_v2/native/modal/ModalDispatchQueue";
const r16 = {
push: function push(a0, a1, key = uniqueId("modal")) {
let appContext = arguments[4];
if (appContext === void 0) {
appContext = AppContext.APP;
}
const r10 = arguments[3];
pushModal({
key,
modal: getDeprecatedModalData(a0, {}, a1, key),
...r10
});
Dispatcher.dispatch({
type: "MODAL_PUSH",
modal: a0,
props: a1,
key,
appContext
});
return key;
},
pushLazy: function pushLazy(a0, c14224_2) {
let r11 = arguments[2];
if (r11 === void 0) {
r11 = uniqueId("modal");
}
let c14224_3 = r11;
let c14224_0 = arguments[3];
const rootNavigationRef = getRootNavigationRef();
return rootNavigationRef != null && rootNavigationRef.isReady() ? (a0 instanceof Promise ? a0.then((result) => result.default) : a0()).then((result) => this.push(result, c14224_2, c14224_3, c14224_0)) : new Promise((c25155_0) => ModalDispatchQueue.enqueue(() => c25155_0(this.pushLazy(a0, c14224_2, c14224_3, c14224_0))));
},
updateAnimation: (a0, a1) => {
Dispatcher.dispatch({
type: "MODAL_UPDATE",
key: a0,
props: {},
partial: true,
animation: a1
});
},
pop: () => {
popModal();
Dispatcher.dispatch({
type: "MODAL_POP"
});
},
popWithKey: (a0, a1) => {
popModal(a0, a1);
Dispatcher.dispatch({
type: "MODAL_POP",
key: a0,
onExited: a1
});
},
popAboveKey: (a0) => popModalsAboveKey(a0),
popAll: () => {
popAllModals();
Dispatcher.dispatch({
type: "MODAL_POP_ALL"
});
Dispatcher.dispatch({
type: "EMAIL_VERIFICATION_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "GUILD_SETTINGS_CLOSE"
});
Dispatcher.dispatch({
type: "HIDE_ACTION_SHEET"
});
Dispatcher.dispatch({
type: "DISPLAYED_INVITE_CLEAR"
});
Dispatcher.dispatch({
type: "NOTIFICATION_SETTINGS_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "QUICKSWITCHER_HIDE"
});
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_CLOSE"
});
Dispatcher.dispatch({
type: "CONNECTIONS_GRID_MODAL_HIDE"
});
Dispatcher.dispatch({
type: "USER_PROFILE_MODAL_CLOSE"
});
}
};
export default r16;
+14
View File
@@ -0,0 +1,14 @@
// Metro module 12052 (f12053).
import { Endpoints } from "../Constants";
import { HTTP } from "../_bundle/sendRequest";
const r15 = {
updateNote: (a0, a1) => HTTP.put({
url: Endpoints.NOTE(a0),
body: {
note: a1
},
oldFormErrors: true,
rejectWithError: true
})
};
export default r15;
+23
View File
@@ -0,0 +1,23 @@
// Metro module 15635 (f15636).
import Dispatcher from "../Dispatcher";
const r13 = {
show: (a0, a1, a2, a3, a4) => {
Dispatcher.dispatch({
type: "NOTICE_SHOW",
notice: {
id: a4,
type: a0,
message: a1,
buttonText: a2,
callback: a3
}
});
},
dismiss: (a0) => {
Dispatcher.dispatch({
type: "NOTICE_DISMISS",
...a0
});
}
};
export default r13;
+115
View File
@@ -0,0 +1,115 @@
// Metro module 14477 (f14478).
import { AnalyticEvents, DesktopNotificationTypes, NotificationPermissionTypes } from "../Constants";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import Dispatcher from "../Dispatcher";
const r18 = {
setDesktopType: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
notifications_enabled: a0 === DesktopNotificationTypes.ALL
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_DESKTOP_TYPE",
desktopType: a0
});
},
setTTSType: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
tts_type: a0.toString()
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_TTS_TYPE",
ttsType: a0
});
},
setDisabledSounds: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
disabled_sounds: a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_DISABLED_SOUNDS",
sounds: a0
});
},
toggleDisableAllSounds: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
all_sounds_enabled: !a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_TOGGLE_ALL_DISABLED"
});
},
setDisableUnreadBadge: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
unread_badge_enabled: !a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_DISABLE_UNREAD_BADGE",
disableUnreadBadge: a0
});
},
setTaskbarFlash: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
show_taskbar_flash: a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_TASKBAR_FLASH",
taskbarFlash: a0
});
},
setNotifyMessagesInSelectedChannel: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
notify_messages_in_selected_channel: a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_NOTIFY_MESSAGES_IN_SELECTED_CHANNEL",
notify: a0
});
},
setScreenDowntimeReminder: (a0) => {
AnalyticsUtils.track(AnalyticEvents.LOCAL_SETTINGS_UPDATED, {
screen_downtime_reminder: a0
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_SCREEN_DOWNTIME_REMINDER",
screenDowntimeReminder: a0
});
},
setPermissionsState: (a0, a1) => {
AnalyticsUtils.track(AnalyticEvents.ENABLE_NOTIFICATIONS, {
enabled: a0 === NotificationPermissionTypes.ENABLED,
source: a1
});
Dispatcher.dispatch({
type: "NOTIFICATIONS_SET_PERMISSION_STATE",
enabled: a0,
source: a1
});
},
showNotification: (a0, a1, a2, a3, a4) => {
Dispatcher.dispatch({
type: "NOTIFICATION_CREATE",
icon: a0,
title: a1,
body: a2,
trackingProps: a3,
options: {
...a4,
onClick: (a0) => {
const onClick2 = a4.onClick;
if (onClick2 != null) {
onClick2.call(a4, a0);
}
Dispatcher.dispatch({
type: "NOTIFICATION_CLICK"
});
}
}
});
},
clickedNotification: () => {
Dispatcher.dispatch({
type: "NOTIFICATION_CLICK"
});
}
};
export default r18;
@@ -0,0 +1,155 @@
// Metro module 5135 (f5136).
import UserGuildSettingsStore from "../stores/UserGuildSettingsStore";
import { Endpoints } from "../Constants";
import { NotificationSettingsUpdateType } from "../modules/notifications/NotificationConstants";
import { ChannelNotificationSettingsFlags } from "../modules/user_settings/UserSettingsConstants";
import Dispatcher from "../Dispatcher";
import { getCurrentGuildSettings, trackGuildNotificationSettingsUpdate, getManyCurrentChannelSettings, trackChannelNotificationSettingsUpdate, getCurrentChannelSettings, NotificationLabel } from "../utils/NotificationSettingsUtils";
import UserGuildSettingsManager from "../modules/user_settings/UserGuildSettingsManager";
import SnowflakeUtils from "../utils/SnowflakeUtils";
import { AccessibilityAnnouncer } from "../design/shared";
import { intl, t } from "../intl/index.native";
import { setFlag } from "../_bundle/Module1384";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
const r26 = {
open: (a0) => {
Dispatcher.dispatch({
type: "NOTIFICATION_SETTINGS_MODAL_OPEN",
guildId: a0
});
},
close: () => {
Dispatcher.dispatch({
type: "NOTIFICATION_SETTINGS_MODAL_CLOSE"
});
},
updateGuildNotificationSettings: (a0, a1, a2, a3) => {
const currentGuildSettings = getCurrentGuildSettings(a0);
UserGuildSettingsManager.saveUserGuildSettings(a0, a1);
Dispatcher.dispatch({
type: "USER_GUILD_SETTINGS_GUILD_UPDATE",
guildId: a0,
settings: a1
});
trackGuildNotificationSettingsUpdate(a0, a1, currentGuildSettings, a2, a3);
},
updateGuildAndChannelNotificationSettings: (a0, a1, a2, a3) => {
const guildId = a0;
const label = a2;
const location2 = a3;
const r12 = SnowflakeUtils.keys(a1.channel_overrides);
const currentGuildSettings = getCurrentGuildSettings(a0);
const manyCurrentChannelSettings = getManyCurrentChannelSettings(a0, r12);
UserGuildSettingsManager.saveUserGuildSettings(a0, a1);
Dispatcher.dispatch({
type: "USER_GUILD_SETTINGS_GUILD_AND_CHANNELS_UPDATE",
guildId: a0,
settings: a1
});
trackGuildNotificationSettingsUpdate(a0, a1, currentGuildSettings, a2, a3);
SnowflakeUtils.keys(a1.channel_overrides).forEach((item) => {
trackChannelNotificationSettingsUpdate({
guildId,
channelId: item,
change: a1.channel_overrides[item],
previous: manyCurrentChannelSettings.get(item),
label,
location: location2
});
});
},
updateChannelOverrideSettings: (a0, a1, a2, a3, a4) => {
const currentChannelSettings = getCurrentChannelSettings(a0, a1);
const channel_overrides = {};
channel_overrides[a1] = a2;
UserGuildSettingsManager.saveUserGuildSettings(a0, {
channel_overrides
});
Dispatcher.dispatch({
type: "USER_GUILD_SETTINGS_CHANNEL_UPDATE",
guildId: a0,
channelId: a1,
settings: a2
});
AccessibilityAnnouncer.announce(intl.string(t.MlIsJ8));
trackChannelNotificationSettingsUpdate({
guildId: a0,
channelId: a1,
change: a2,
previous: currentChannelSettings,
label: a3,
location: a4
});
},
updateChannelOverrideSettingsBulk: (a0, a1, label2, location3) => {
const guildId2 = a0;
const manyCurrentChannelSettings2 = getManyCurrentChannelSettings(a0, SnowflakeUtils.keys(a1));
UserGuildSettingsManager.saveUserGuildSettings(a0, {
channel_overrides: a1
});
Dispatcher.dispatch({
type: "USER_GUILD_SETTINGS_CHANNEL_UPDATE_BULK",
guildId: a0,
overrides: a1
});
SnowflakeUtils.keys(a1).forEach((item) => trackChannelNotificationSettingsUpdate({
guildId: guildId2,
channelId: item,
change: a1[item],
previous: manyCurrentChannelSettings2.get(item),
label: label2,
location: location3
}));
},
updateAppDMOverrideSettings: (a0, a1, a2, a3, a4) => {
const currentChannelSettings = getCurrentChannelSettings(a0, a1);
const channel_overrides = {};
channel_overrides[a1] = a3;
UserGuildSettingsManager.saveUserGuildSettings(a0, {
channel_overrides
});
Dispatcher.dispatch({
type: "USER_GUILD_SETTINGS_CHANNEL_UPDATE",
guildId: a0,
channelId: a1,
settings: a3
});
AccessibilityAnnouncer.announce(intl.string(t.MlIsJ8));
trackChannelNotificationSettingsUpdate({
updateType: NotificationSettingsUpdateType.AUTHORIZED_APP_DM,
guildId: a0,
channelId: a1,
applicationId: a2,
change: a3,
previous: currentChannelSettings,
label: a4
});
},
setForumThreadsCreated: function setForumThreadsCreated(a0, a1) {
const r9 = a1 ? ChannelNotificationSettingsFlags.NEW_FORUM_THREADS_ON : ChannelNotificationSettingsFlags.NEW_FORUM_THREADS_OFF;
const r7 = a1 ? ChannelNotificationSettingsFlags.NEW_FORUM_THREADS_OFF : ChannelNotificationSettingsFlags.NEW_FORUM_THREADS_ON;
this.updateChannelOverrideSettings(a0.guild_id, a0.id, {
flags: UserGuildSettingsStore.getChannelFlags(a0) & ~r7 | r9
}, NotificationLabel.forumThreadsCreated(a1));
},
setAccountFlag: async (c14696_0, c14696_1) => {
let c25360_1;
c25360_1 = void 0;
const flags = setFlag(UserGuildSettingsStore.accountNotificationSettings.flags, c14696_0, c14696_1);
let c29466_0 = flags;
await HTTP.patch({
url: Endpoints.ACCOUNT_NOTIFICATION_SETTINGS,
body: {
flags
},
rejectWithError: rejectWithMigratedError()
});
await Dispatcher.dispatch({
type: "NOTIFICATION_SETTINGS_UPDATE",
settings: {
flags: c29466_0
}
});
}
};
export default r26;
+38
View File
@@ -0,0 +1,38 @@
// Metro module 15745 (f15746).
import Dispatcher from "../Dispatcher";
const r12 = {
clearVADWarning: () => {
Dispatcher.dispatch({
type: "PERMISSION_CLEAR_VAD_WARNING"
});
},
clearSuppressWarning: function clearSuppressWarning(forever = false) {
Dispatcher.dispatch({
type: "PERMISSION_CLEAR_SUPPRESS_WARNING",
forever
});
},
clearPTTAdminWarning: () => {
Dispatcher.dispatch({
type: "PERMISSION_CLEAR_PTT_ADMIN_WARNING"
});
},
requestElevatedProcess: (a0) => {
Dispatcher.dispatch({
type: "PERMISSION_REQUEST_ELEVATED_PROCESS",
pid: a0
});
},
clearElevatedProcess: () => {
Dispatcher.dispatch({
type: "PERMISSION_CLEAR_ELEVATED_PROCESS"
});
},
continueNonelevatedProcess: (a0) => {
Dispatcher.dispatch({
type: "PERMISSION_CONTINUE_NONELEVATED_PROCESS",
pid: a0
});
}
};
export default r12;
+42
View File
@@ -0,0 +1,42 @@
// Metro module 15446 (f15447).
import { Endpoints } from "../Constants";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
const r18 = {
updateEstimate: async function updateEstimate(c22005_0, r4 = 7) {
const days = r4;
const include_roles = arguments[2];
return (await HTTP.get({
url: Endpoints.GUILD_PRUNE(c22005_0),
query: {
days,
include_roles
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body.pruned;
},
updateEstimateV2: async function updateEstimateV2(c22006_0, r4 = 7) {
const days2 = r4;
const include_roles2 = arguments[2];
await HTTP.get({
url: Endpoints.GUILD_PRUNE_V2(c22006_0),
query: {
days: days2,
include_roles: include_roles2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
},
prune: (a0, a1, a2) => HTTP.post({
url: Endpoints.GUILD_PRUNE(a0),
body: {
days: a1,
compute_prune_count: false,
include_roles: a2
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})
};
export default r18;
+58
View File
@@ -0,0 +1,58 @@
// Metro module 10831 (f10832).
import RTCDebugStore from "../stores/RTCDebugStore";
import Dispatcher from "../Dispatcher";
import trackVoiceAndVideoSettingsUpdate from "../modules/user_settings/voice/trackVoiceAndVideoSettingsUpdate";
import DiscordNative from "../lib/DiscordNative";
export const open = function(a0) {
Dispatcher.dispatch({
type: "RTC_DEBUG_MODAL_OPEN",
section: a0
});
Dispatcher.dispatch({
type: "RTC_DEBUG_POPOUT_WINDOW_OPEN"
});
};
export function close() {
Dispatcher.dispatch({
type: "RTC_DEBUG_MODAL_CLOSE"
});
}
export function openReplay() {
Dispatcher.dispatch({
type: "RTC_DEBUG_MODAL_OPEN_REPLAY"
});
}
export function setSection(a0) {
Dispatcher.dispatch({
type: "RTC_DEBUG_MODAL_SET_SECTION",
section: a0
});
}
export function setShouldRecordNextConnection(a0) {
trackVoiceAndVideoSettingsUpdate("connection_replay_log_enabled", a0, RTCDebugStore.shouldRecordNextConnection());
Dispatcher.dispatch({
type: "RTC_DEBUG_SET_RECORDING_FLAG",
value: a0
});
}
export function setSimulcastDebugOverride(a0, a1, a2) {
Dispatcher.dispatch({
type: "RTC_DEBUG_SET_SIMULCAST_OVERRIDE",
userId: a0,
context: a1,
quality: a2
});
}
export function chooseReplayPath() {
DiscordNative.fileManager.showOpenDialog({
filters: [{
name: "All Files",
extensions: ["*"]
}]
}).then((result) => {
Dispatcher.dispatch({
type: "RTC_DEBUG_MODAL_OPEN_REPLAY_AT_PATH",
path: result.length !== 0 ? result[0] : ""
});
});
}
+16
View File
@@ -0,0 +1,16 @@
// Metro module 16310 (f16311).
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
export function fetchRTCLatencyTestRegions(a0) {
return HTTP.get({
url: `https:${window.GLOBAL_ENV.RTC_LATENCY_ENDPOINT}?v=${a0}`,
rejectWithError: rejectWithMigratedError()
});
}
export function completeRTCLatencyTest(a0, a1) {
Dispatcher.dispatch({
type: "RTC_LATENCY_TEST_COMPLETE",
latencyRankedRegions: a0,
geoRankedRegions: a1
});
}
+131
View File
@@ -0,0 +1,131 @@
// Metro module 5126 (f5127).
import ActiveJoinedThreadsStore from "../modules/threads/ActiveJoinedThreadsStore";
import { isReadableType } from "../records/ChannelRecord";
import ChannelStore from "../stores/ChannelStore";
import GuildCategoryStore from "../stores/GuildCategoryStore";
import UserStore from "../stores/UserStore";
import { CURRENT_APP_CONTEXT } from "../Constants";
import Dispatcher from "../Dispatcher";
import SnowflakeUtils from "../utils/SnowflakeUtils";
let ackCategory;
const ack = function ack(a0, a1, immediate = false, force = false) {
Dispatcher.dispatch({
type: "CHANNEL_ACK",
channelId: a0,
messageId: arguments[4],
immediate,
force,
context: CURRENT_APP_CONTEXT,
location: a1
});
};
ackCategory = function ackCategory(id, a1, r5 = false, r4 = false) {
let c14674_1;
c14674_1 = void 0;
const channel = ChannelStore.getChannel(id);
if (channel != null && channel.guild_id != null) {
const categories = GuildCategoryStore.getCategories(channel.guild_id);
if (categories[id] != null) {
const r34 = categories[id].filter((item) => isReadableType(item.channel.type));
const r37 = r34.map((item) => item.channel.id);
c14674_1 = r37;
r34.forEach(({ channel: channel2 }) => {
let guild_id = channel2.guild_id;
if (guild_id == null) {
guild_id = channel.guild_id;
}
const activeJoinedThreadsForParent = ActiveJoinedThreadsStore.getActiveJoinedThreadsForParent(guild_id, channel2.id);
for (const key in activeJoinedThreadsForParent) {
c14674_1.push(key);
}
});
for (const item of r37) {
ack(item, a1, r5, r4);
}
}
}
};
export { ack };
export { ackCategory };
export function ackChannel(a0, a1) {
if (a0.isCategory()) {
ackCategory(a0.id, a1, true, true);
} else {
const isForumLikeChannel = a0.isForumLikeChannel();
const id = a0.id;
if (isForumLikeChannel) {
Dispatcher.dispatch({
type: "CHANNEL_ACK",
channelId: id,
messageId: SnowflakeUtils.fromTimestamp(Date.now()),
immediate: true,
force: true,
context: CURRENT_APP_CONTEXT,
location: a1
});
} else {
Dispatcher.dispatch({
type: "CHANNEL_ACK",
channelId: id,
messageId: void 0,
immediate: true,
force: true,
context: CURRENT_APP_CONTEXT,
location: a1
});
}
}
}
export function bulkAck(a0, a1) {
Dispatcher.dispatch({
type: "BULK_ACK",
channels: a0,
context: CURRENT_APP_CONTEXT,
onFinished: a1
});
}
export function localAck(a0) {
Dispatcher.dispatch({
type: "CHANNEL_LOCAL_ACK",
channelId: a0
});
}
export function enableAutomaticAck(a0, a1) {
Dispatcher.dispatch({
type: "ENABLE_AUTOMATIC_ACK",
channelId: a0,
windowId: a1
});
}
export function disableAutomaticAck(a0, a1) {
Dispatcher.dispatch({
type: "DISABLE_AUTOMATIC_ACK",
channelId: a0,
windowId: a1
});
}
export function ackGuildFeature(a0, a1, a2) {
Dispatcher.dispatch({
type: "GUILD_FEATURE_ACK",
id: a0,
ackType: a1,
ackedId: a2,
local: false
});
}
export function ackUserFeature(a0, a1) {
if (UserStore.getCurrentUser()?.id != null) {
Dispatcher.dispatch({
type: "USER_NON_CHANNEL_ACK",
ackType: a0,
ackedId: a1,
local: false
});
}
}
export function clearOldestUnreadMessageId(a0) {
Dispatcher.dispatch({
type: "CLEAR_OLDEST_UNREAD_MESSAGE",
channelId: a0
});
}
+34
View File
@@ -0,0 +1,34 @@
// Metro module 15642 (f15643).
import { Endpoints } from "../Constants";
import { HTTP } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
const r17 = {
fetchRegions: (a0) => {
const guildId = a0;
HTTP.get({
url: Endpoints.REGIONS(a0),
retries: 1,
oldFormErrors: true,
rejectWithError: true
}).then((result) => Dispatcher.dispatch({
type: "LOAD_REGIONS",
regions: result.body,
guildId
}), () => Dispatcher.dispatch({
type: "LOAD_REGIONS",
regions: [],
guildId
}));
},
changeCallRegion: (a0, a1) => {
HTTP.patch({
url: Endpoints.CALL(a0),
body: {
region: a1
},
oldFormErrors: true,
rejectWithError: true
});
}
};
export default r17;
+248
View File
@@ -0,0 +1,248 @@
// Metro module 8918 (f8919).
import UserStore from "../stores/UserStore";
import { AbortCodes, Endpoints, RelationshipTypes } from "../Constants";
import { ClearFriendRequestFilters } from "../modules/relationships/RelationshipConstants";
import { closeContextMenu } from "./ContextMenuActionCreators";
import AlertActionCreators from "./AlertActionCreators";
import openQuarantineModeInfoModal_native from "../modules/quarantine/openQuarantineModeInfoModal.native";
import { intl, t } from "../intl/index.native";
import { openClaimAccountModal } from "../modules/claim_account/ClaimAccountModalActionCreators.native";
import { isLimitedAccessErrorCode } from "../modules/user_limited_access/UserLimitedAccessUtils";
import { humanizeAbortCode } from "../utils/FriendsUtils";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import UserUtils from "../utils/UserUtils";
import { AccessibilityAnnouncer } from "../design/shared";
import Dispatcher from "../Dispatcher";
import ClearAllIncomingRequestsConfirmationModal from "../modules/people/ClearAllIncomingRequestsConfirmationModal";
import SafetyToastsActionCreators_native from "../modules/safety_common/SafetyToastsActionCreators.native";
let c5831_10, c5831_12;
const handleRelationshipAddError = function handleRelationshipAddError(a0, a1, discordTag) {
let body2;
const { status, body } = a0;
let r8 = body && body.code;
L19: {
if (status === 429) {
if (a1 === c5831_10.SHOW_ALWAYS) {
const r130 = {
title: intl.string(t["3D5eox"]),
body: intl.string(t.TuJriJ),
confirmText: intl.string(t.DppXIx)
};
closeContextMenu();
AlertActionCreators.show(r130);
}
} else {
if (status === 403 && r8 === AbortCodes.EMAIL_VERIFICATION_REQUIRED) {
const r87 = {
title: intl.string(t.Gqf33E),
body: intl.string(t.GHOBdx),
confirmText: intl.string(t.HbTSE6),
onConfirm: () => {
openClaimAccountModal();
}
};
closeContextMenu();
AlertActionCreators.show(r87);
break L19;
}
if (r8 === AbortCodes.USER_QUARANTINED) {
closeContextMenu();
openQuarantineModeInfoModal_native();
} else if (!isLimitedAccessErrorCode(status, r8) && r8 !== AbortCodes.RELATIONSHIP_INVALID_NO_CONFIRMATION && a1 === c5831_10.SHOW_ALWAYS) {
if (discordTag != null) {
if (!r8) {
r8 = 0;
}
body2 = humanizeAbortCode(r8, discordTag);
} else {
body2 = intl.string(t.paDJBM);
}
const r45 = {
title: intl.string(t["6moJ8s"]),
body: body2,
confirmText: intl.string(t.BddRzS)
};
closeContextMenu();
AlertActionCreators.show(r45);
}
}
}
throw a0;
};
c5831_10 = {
SHOW_ALWAYS: 0,
0: "SHOW_ALWAYS",
SHOW_ONLY_IF_ACTION_NEEDED: 1,
1: "SHOW_ONLY_IF_ACTION_NEEDED"
};
c5831_12 = {
sendRequest: ({ discordTag, context, captchaPayload, note, errorUxConfig = c5831_10.SHOW_ALWAYS }) => {
const SHOW_ALWAYS = errorUxConfig;
const [username, r13] = discordTag.split("#");
return HTTP.post({
url: Endpoints.USER_RELATIONSHIPS(),
body: {
username,
discriminator: parseInt(r13),
note,
...captchaPayload
},
context,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).catch((error) => {
handleRelationshipAddError(error, SHOW_ALWAYS, discordTag);
throw new Error("unreachable");
});
},
addRelationship: function addRelationship(a0, c16874_0) {
const { userId: userId2, context, type, fromFriendSuggestion, confirmStrangerRequest, captchaPayload } = a0;
let r18 = arguments[2];
if (r18 === void 0) {
r18 = c5831_10.SHOW_ALWAYS;
}
const SHOW_ALWAYS2 = r18;
const user = UserStore.getUser(userId2);
return HTTP.put({
url: Endpoints.USER_RELATIONSHIP(userId2),
body: {
type,
from_friend_suggestion: fromFriendSuggestion,
confirm_stranger_request: confirmStrangerRequest,
...captchaPayload
},
context,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
if (c16874_0 != null) {
c16874_0();
}
}).catch((error) => {
handleRelationshipAddError(error, SHOW_ALWAYS2, UserUtils.getUserTag(user));
throw new Error("unreachable");
});
},
acceptFriendRequest: (a0) => c5831_12.addRelationship(a0, function() {
AccessibilityAnnouncer.announce(intl.string(t["3goNa5"]));
}),
cancelFriendRequest: (a0, a1) => c5831_12.removeRelationship(a0, a1, function() {
AccessibilityAnnouncer.announce(intl.string(t.pLUaxR));
}),
removeFriend: (a0, a1) => {
c5831_12.removeRelationship(a0, a1, function() {
AccessibilityAnnouncer.announce(intl.string(t.vGSLa2));
});
},
blockUser: (a0, a1) => c5831_12.addRelationship({
userId: a0,
context: a1,
type: RelationshipTypes.BLOCKED
}, function() {
AccessibilityAnnouncer.announce(intl.string(t.mU0Vrp));
}),
unblockUser: (a0, a1) => c5831_12.removeRelationship(a0, a1, function() {
AccessibilityAnnouncer.announce(intl.string(t["9t1au7"]));
}),
removeRelationship: (a0, a1, c16875_0) => HTTP.del({
url: Endpoints.USER_RELATIONSHIP(a0),
context: a1,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
if (c16875_0 != null) {
c16875_0();
}
}).catch(() => {
AccessibilityAnnouncer.announce(intl.string(t.n6Jo3E));
}),
updateRelationship: (a0, a1) => HTTP.patch({
url: Endpoints.USER_RELATIONSHIP(a0),
body: {
nickname: a1
},
rejectWithError: rejectWithMigratedError()
}),
fetchRelationships: () => {
HTTP.get({
url: Endpoints.USER_RELATIONSHIPS(),
oldFormErrors: true,
rejectWithError: true
}).then((result) => Dispatcher.dispatch({
type: "LOAD_RELATIONSHIPS_SUCCESS",
relationships: result.body
}), () => Dispatcher.dispatch({
type: "LOAD_RELATIONSHIPS_FAILURE"
}));
},
confirmClearPendingRelationships: (a0) => {
ClearAllIncomingRequestsConfirmationModal(a0);
},
clearPendingRelationships: () => HTTP.del({
url: Endpoints.USER_RELATIONSHIPS(),
query: {
relationship_type: RelationshipTypes.PENDING_INCOMING
},
rejectWithError: rejectWithMigratedError()
}).then(() => {
Dispatcher.dispatch({
type: "RELATIONSHIP_PENDING_INCOMING_REMOVED"
});
}).catch(() => {
AccessibilityAnnouncer.announce(intl.string(t.n6Jo3E));
}),
clearPendingSpamAndIgnored: () => HTTP.del({
url: Endpoints.USER_RELATIONSHIPS(),
query: {
relationship_type: RelationshipTypes.PENDING_INCOMING
},
body: {
filters: [ClearFriendRequestFilters.SPAM, ClearFriendRequestFilters.IGNORED]
},
rejectWithError: rejectWithMigratedError()
}).then(() => {
Dispatcher.dispatch({
type: "RELATIONSHIP_PENDING_INCOMING_REMOVED"
});
}).catch(() => {
AccessibilityAnnouncer.announce(intl.string(t.n6Jo3E));
}),
ignoreUser: (a0, a1, c16876_1) => {
const userId = a0;
return HTTP.put({
url: Endpoints.IGNORE_USER(a0),
context: {
location: a1
},
rejectWithError: rejectWithMigratedError()
}).then(() => {
SafetyToastsActionCreators_native.showIgnoreSuccessToast(userId, c16876_1);
AccessibilityAnnouncer.announce(intl.string(t.Us93Ca));
Dispatcher.dispatch({
type: "RELATIONSHIP_IGNORE_USER_SUCCESS",
userId,
timestamp: Date.now()
});
}).catch(() => {
SafetyToastsActionCreators_native.showFailedToast();
AccessibilityAnnouncer.announce(intl.string(t.n6Jo3E));
});
},
unignoreUser: (a0, a1, c16877_1) => {
return HTTP.del({
url: Endpoints.IGNORE_USER(a0),
context: {
location: a1
},
rejectWithError: rejectWithMigratedError()
}).then(() => {
SafetyToastsActionCreators_native.showUnignoreSuccessToast(a0, c16877_1);
AccessibilityAnnouncer.announce(intl.string(t.QlH5w6));
}).catch(() => {
SafetyToastsActionCreators_native.showFailedToast();
AccessibilityAnnouncer.announce(intl.string(t.n6Jo3E));
});
}
};
export default c5831_12;
export { c5831_10 as RelationshipErrorUXConfig };
+663
View File
@@ -0,0 +1,663 @@
// Metro module 6499 (f6500).
import StorefrontPromotionOverrideStore from "../modules/storefront/StorefrontPromotionOverrideStore";
import SKUStore from "../stores/game_store/SKUStore";
import { Endpoints, ADYEN_PAYMENT_SOURCES } from "../Constants";
import Dispatcher from "../Dispatcher";
import { httpGetWithCountryCodeQuery } from "../utils/StoreUtils";
import { rejectWithMigratedError, HTTP, getAPIBaseURL } from "../_bundle/sendRequest";
import V6OrEarlierAPIError from "../errors/V6OrEarlierAPIError";
import * as _TestModeUtils from "../modules/game_store/TestModeUtils";
import { ShopVariantsReturnStyle } from "../_bundle/Module5847";
import { BillingError } from "../errors/index";
import { ErrorCodes } from "../errors/BillingError";
import { createGatewayCheckoutContext } from "../utils/BillingUtils";
import { createPaymentSourceToken, popupBridgeState, dispatchConfirmationError, handlePaymentConfirmation } from "../modules/billing/actions/BillingActionCreators";
import { getPurchaseToken } from "../utils/PurchaseTokenUtils";
import { isNotNullish } from "../utils/GlobalUtils";
import { HermesBuiltin } from "../_hermes/prelude";
let env4192 = {};
const c4192_13 = {
isGift: false
};
export async function fetchSKU(skuId) {
let c25898_4 = 0;
let c29783_0, c29783_1;
L13: {
try {
c29783_0 = skuId;
c29783_1 = void 0;
if (SKUStore.get(skuId) == null) {
Dispatcher.dispatch({
type: "SKU_FETCH_START",
skuId
});
c25898_4 = 1;
c29783_1 = await httpGetWithCountryCodeQuery({
url: Endpoints.STORE_SKU(skuId),
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "SKU_FETCH_SUCCESS",
sku: c29783_1.body
});
c25898_4 = 0;
break L13;
}
} catch ($e) {
let r8 = $e;
if (c25898_4 !== 0) {
while (true) {
try {
c25898_4 = 0;
Dispatcher.dispatch({
type: "SKU_FETCH_FAIL",
skuId: c29783_0
});
throw new V6OrEarlierAPIError(`Failed to fetch SKU ${c29783_0}`);
} catch ($e) {
r8 = $e;
if (c25898_4 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export async function fetchPublishedSKU(c25899_0, skuId2, variants_return_style, c25899_3) {
let c25899_7 = 0;
let c29784_0, c29784_1, c29784_2;
L27: {
try {
c29784_0 = skuId2;
c29784_1 = void 0;
c29784_2 = void 0;
if (SKUStore.get(skuId2) == null) {
Dispatcher.dispatch({
type: "SKU_FETCH_START",
skuId: skuId2
});
c25899_7 = 1;
const isTestModeForApplication = _TestModeUtils.isTestModeForApplication(c25899_0);
c29784_1 = isTestModeForApplication;
const r53 = {
url: isTestModeForApplication ? Endpoints.STORE_SKU(skuId2) : Endpoints.STORE_PUBLISHED_LISTINGS_SKU(skuId2),
rejectWithError: rejectWithMigratedError()
};
const query = {};
if (variants_return_style === ShopVariantsReturnStyle.VARIANTS_GROUP) {
query.variants_return_style = variants_return_style;
}
if (c25899_3) {
query.include_unpublished = true;
}
if (Object.keys(query).length > 0) {
r53.query = query;
}
c29784_2 = await httpGetWithCountryCodeQuery(r53);
const r100 = c29784_1;
const body = c29784_2.body;
Dispatcher.dispatch({
type: "SKU_FETCH_SUCCESS",
sku: r100 ? body : body.sku
});
if (!c29784_1) {
Dispatcher.dispatch({
type: "STORE_LISTING_FETCH_SUCCESS",
storeListing: c29784_2.body
});
}
c25899_7 = 0;
break L27;
}
} catch ($e) {
let r8 = $e;
if (c25899_7 !== 0) {
while (true) {
try {
c25899_7 = 0;
Dispatcher.dispatch({
type: "SKU_FETCH_FAIL",
skuId: c29784_0
});
throw new V6OrEarlierAPIError(`Failed to fetch SKU ${c29784_0}`);
} catch ($e) {
r8 = $e;
if (c25899_7 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export async function fetchTestSKUsForApplication(c25900_0, c25900_1) {
let c29785_1, c29785_2;
c29785_1 = void 0;
let c29785_0 = c25900_0;
if (c25900_1 !== void 0) {
c29785_1 = c25900_1;
c29785_2 = void 0;
} else {
c29785_1 = true;
c29785_2 = void 0;
}
await void 0;
if (!_TestModeUtils.isTestModeForApplication(c29785_0) && c29785_1) {
throw new Error("this should only be used in test mode");
}
c29785_2 = (await httpGetWithCountryCodeQuery({
url: Endpoints.APPLICATION_SKUS(c29785_0),
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "SKUS_FETCH_SUCCESS",
skus: c29785_2
});
return c29785_2;
}
export async function previewPurchaseSku(c25901_0) {
let body;
let c25901_3;
let c25901_4 = 0;
let c29786_0, c29786_1, c29786_2, c29786_3, c29786_4, c29786_5, c29786_6, c29786_7, c29786_8;
try {
c29786_0 = void 0;
c29786_1 = void 0;
c29786_2 = void 0;
c29786_3 = void 0;
c29786_4 = void 0;
c29786_0 = c25901_0.applicationId;
c29786_1 = c25901_0.skuId;
c29786_2 = c25901_0.paymentSourceId;
c29786_3 = c25901_0.isGift;
c29786_4 = c25901_0.currency;
c29786_5 = void 0;
c29786_6 = void 0;
c29786_7 = void 0;
await void 0;
c29786_5 = {
payment_source_id: c29786_2,
gift: c29786_3,
currency: c29786_4
};
if (_TestModeUtils.isTestModeForApplication(c29786_0)) {
c29786_5.test_mode = true;
}
c29786_6 = StorefrontPromotionOverrideStore.getPromotionIdOverride();
if (c29786_6 != null) {
c29786_5.promotion_id_override = c29786_6;
}
c25901_4 = 1;
body = (await httpGetWithCountryCodeQuery({
url: Endpoints.STORE_SKU_PURCHASE(c29786_1),
query: c29786_5,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body;
c25901_4 = 0;
} catch ($e) {
const r32 = $e;
let r8 = r32;
c25901_3 = r32;
if (c25901_4 !== 0) {
while (true) {
L30: {
try {
const r121 = c25901_3;
c25901_4 = 0;
c29786_8 = r121;
c29786_7 = c29786_8 instanceof BillingError ? c29786_8 : new BillingError(c29786_8);
if (c29786_7.code !== ErrorCodes.BILLING_BUNDLE_ALREADY_PURCHASED) {
if (c29786_7.code !== ErrorCodes.BILLING_BUNDLE_PARTIALLY_OWNED) {
if (c29786_7.code !== ErrorCodes.INVALID_BILLING_ADDRESS) {
break L30;
}
}
}
throw c29786_7;
} catch (r117) {
r8 = r117;
c25901_3 = r117;
if (c25901_4 === 0) {
break;
}
continue;
}
}
return null;
}
}
throw r8;
}
return body;
}
export async function grantChannelBranchEntitlement(applicationId, c25902_1, skuId3) {
let body;
let c25902_5;
let c25902_6 = 0;
let c29787_0, c29787_1, c29787_2, c29787_3, c29787_4;
try {
c29787_0 = applicationId;
c29787_1 = skuId3;
c29787_2 = void 0;
c29787_3 = void 0;
Dispatcher.dispatch({
type: "SKU_PURCHASE_START",
applicationId,
skuId: skuId3
});
c25902_6 = 1;
c29787_2 = await HTTP.post({
url: Endpoints.CHANNEL_ENTITLEMENT_GRANT(c25902_1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "SKU_PURCHASE_SUCCESS",
skuId: c29787_1,
entitlements: c29787_2.body,
libraryApplications: []
});
body = c29787_2.body;
c25902_6 = 0;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c25902_5 = r26;
if (c25902_6 !== 0) {
while (true) {
try {
const r89 = c25902_5;
c25902_6 = 0;
c29787_4 = r89;
c29787_3 = new BillingError(c29787_4);
Dispatcher.dispatch({
type: "SKU_PURCHASE_FAIL",
applicationId: c29787_0,
skuId: c29787_1,
error: c29787_3
});
throw c29787_3;
} catch (r85) {
r8 = r85;
c25902_5 = r85;
if (c25902_6 === 0) {
break;
}
}
}
}
throw r8;
}
return body;
}
export async function orderSKU(sku_id, payment_source_id, request_gateway_country_code, c25903_3, c25903_4) {
let r99;
let c25903_7;
let c25903_8 = 0;
let c29788_0, c29788_1, c29788_2;
try {
c29788_0 = void 0;
c29788_1 = void 0;
Dispatcher.dispatch({
type: "ORDER_CREATE_START"
});
c25903_8 = 1;
const body = {
order_line_items: [{
sku_id,
quantity: 1,
purchase_type: 1
}],
billing_facet: {
payment_source_id
},
location_facet: {
request_gateway_country_code
}
};
if (c25903_3) {
body.gifting_facet = {
is_gift: true,
gift_customization: {
recipient_id: c25903_4.recipient_id,
gift_style: c25903_4.gift_style,
emoji_id: c25903_4.emoji_id,
emoji_name: c25903_4.emoji_name,
sound_id: c25903_4.sound_id,
reward_sku_ids: c25903_4.reward_sku_ids,
custom_message_contents: c25903_4.custom_message
}
};
}
c29788_0 = (await HTTP.post({
url: Endpoints.ORDER_CREATE,
body,
rejectWithError: rejectWithMigratedError()
})).body;
c29788_1 = c29788_0.id;
Dispatcher.dispatch({
type: "ORDER_CREATE_SUCCESS",
orderId: c29788_1,
order: c29788_0
});
r99 = c29788_1;
c25903_8 = 0;
} catch ($e) {
const r30 = $e;
let r8 = r30;
c25903_7 = r30;
if (c25903_8 !== 0) {
while (true) {
try {
const r108 = c25903_7;
c25903_8 = 0;
c29788_2 = r108;
Dispatcher.dispatch({
type: "ORDER_CREATE_FAIL"
});
throw new BillingError(`Failed to create order: ${c29788_2}`);
} catch (r104) {
r8 = r104;
c25903_7 = r104;
if (c25903_8 === 0) {
break;
}
}
}
}
throw r8;
}
return r99;
}
export async function purchaseSKU(c25904_0, c25904_1, c25904_2) {
let r177, r235, r519;
let c25904_3, c25904_4, c25904_5, c25904_6, c25904_7, c25904_9;
let c25904_8 = 0;
const r19 = env4192;
let r17 = "payment id cannot be null on redirected confirmations.";
try {
let env29789;
c25904_7 = r19;
const r25 = env29789 = {
$parent: r19
};
c25904_6 = r25;
env29789[0] = c25904_0;
env29789[1] = c25904_1;
env29789[2] = void 0;
env29789[3] = void 0;
env29789[4] = void 0;
env29789[5] = void 0;
env29789[6] = void 0;
env29789[7] = void 0;
env29789[8] = void 0;
env29789[9] = void 0;
env29789[10] = void 0;
env29789[11] = void 0;
env29789[12] = void 0;
env29789[13] = void 0;
env29789[14] = void 0;
env29789[15] = void 0;
env29789[16] = void 0;
const r47 = {
...c4192_13,
...c25904_2
};
const paymentSource = r47.paymentSource;
env29789[2] = paymentSource;
env29789[3] = r47.expectedAmount;
env29789[4] = r47.expectedCurrency;
env29789[5] = r47.analyticsLoadId;
const isGift = r47.isGift;
env29789[6] = isGift;
env29789[7] = r47.giftInfoOptions;
const subscriptionPlanId = r47.subscriptionPlanId;
env29789[8] = r47.loadId;
env29789[9] = r47.countryCode;
env29789[10] = r47.quantity;
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "SKU_PURCHASE_START",
applicationId: env29789[0],
skuId: env29789[1]
});
});
env29789[11] = _TestModeUtils.isTestModeForApplication(c25904_0);
c25904_8 = 1;
const r71 = {};
c25904_5 = r71;
r71.gift = isGift;
r71.sku_subscription_plan_id = subscriptionPlanId;
const gatewayCheckoutContext = await createGatewayCheckoutContext(paymentSource);
r17 = "payment id cannot be null on redirected confirmations.";
const r100 = c25904_5;
r100.gateway_checkout_context = gatewayCheckoutContext;
r100.load_id = env29789[8];
r100.gift_info_options = env29789[7];
env29789[12] = r100;
env29789[13] = StorefrontPromotionOverrideStore.getPromotionIdOverride();
if (env29789[13] != null) {
env29789[12].promotion_id_override = env29789[13];
}
L23: {
if (env29789[11]) {
env29789[12].test_mode = true;
} else {
if (env29789[2] != null) {
env29789[12].payment_source_id = env29789[2].id;
c25904_4 = env29789[12];
const paymentSourceToken = await createPaymentSourceToken(env29789[2]);
r17 = "payment id cannot be null on redirected confirmations.";
c25904_4.payment_source_token = paymentSourceToken;
if (!ADYEN_PAYMENT_SOURCES.has(env29789[2].type)) {
if (env29789[9] != null) {
env29789[12].country_code = env29789[9];
}
if (env29789[3] != null) {
env29789[12].expected_amount = env29789[3];
}
if (env29789[4] != null) {
env29789[12].expected_currency = env29789[4];
}
env29789[12].purchase_token = getPurchaseToken();
if (env29789[10] != null) {
env29789[12].quantity = env29789[10];
}
r177 = HTTP.post({
url: Endpoints.STORE_SKU_PURCHASE(env29789[1]),
body: env29789[12],
context: {
load_id: env29789[5]
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
break L23;
}
const r40 = await popupBridgeState(env29789[2].type);
r17 = "payment id cannot be null on redirected confirmations.";
env29789[14] = r40;
const r309 = env29789[12];
const aPIBaseURL = getAPIBaseURL();
const type = env29789[2].type;
const r320 = env29789[14];
c25904_3 = r320;
if (r320 == null) {
c25904_3 = "";
}
r309.return_url = aPIBaseURL + Endpoints.BILLING_POPUP_BRIDGE_CALLBACK_REDIRECT_PREFIX(type, c25904_3, "success");
if (env29789[9] != null) {
env29789[12].country_code = env29789[9];
}
if (env29789[3] != null) {
env29789[12].expected_amount = env29789[3];
}
if (env29789[4] != null) {
env29789[12].expected_currency = env29789[4];
}
env29789[12].purchase_token = getPurchaseToken();
if (env29789[10] != null) {
env29789[12].quantity = env29789[10];
}
r177 = HTTP.post({
url: Endpoints.STORE_SKU_PURCHASE(env29789[1]),
body: env29789[12],
context: {
load_id: env29789[5]
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
break L23;
}
if (env29789[9] != null) {
env29789[12].country_code = env29789[9];
}
}
if (env29789[3] != null) {
env29789[12].expected_amount = env29789[3];
}
if (env29789[4] != null) {
env29789[12].expected_currency = env29789[4];
}
env29789[12].purchase_token = getPurchaseToken();
if (env29789[10] != null) {
env29789[12].quantity = env29789[10];
}
r177 = HTTP.post({
url: Endpoints.STORE_SKU_PURCHASE(env29789[1]),
body: env29789[12],
context: {
load_id: env29789[5]
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
}
const r36 = await r177;
r17 = "payment id cannot be null on redirected confirmations.";
env29789[15] = r36;
Dispatcher.dispatch({
type: "SKU_PURCHASE_SUCCESS",
skuId: env29789[1],
libraryApplications: env29789[15].body.library_applications != null ? env29789[15].body.library_applications.filter(isNotNullish) : [],
entitlements: env29789[15].body.entitlements,
giftCode: env29789[15].body.gift_code
});
r235 = {
...env29789[15].body,
appliedUserDiscounts: env29789[15].body.applied_user_discounts,
redirectConfirmation: false
};
c25904_8 = 0;
} catch ($e) {
const r44 = $e;
let r8 = r44;
c25904_9 = r44;
if (c25904_8 !== 0) {
while (true) {
try {
const r431 = c25904_9;
c25904_8 = 0;
env29789[17] = r431;
env29789[16] = env29789[17] instanceof BillingError ? env29789[17] : new BillingError(env29789[17]);
if (!(env29789[16].code !== ErrorCodes.CONFIRMATION_REQUIRED && env29789[16].code !== ErrorCodes.AUTHENTICATION_REQUIRED)) {
Dispatcher.dispatch({
type: "SKU_PURCHASE_AWAIT_CONFIRMATION",
skuId: env29789[1],
isGift: env29789[6]
});
}
Dispatcher.dispatch({
type: "SKU_PURCHASE_FAIL",
applicationId: env29789[0],
skuId: env29789[1],
error: env29789[16]
});
if (env29789[16].code !== ErrorCodes.CONFIRMATION_REQUIRED) {
throw env29789[16];
}
if (!env29789[17].body.payment_id) {
throw dispatchConfirmationError(r17);
}
r519 = handlePaymentConfirmation(env29789[17].body, env29789[2]);
} catch (r427) {
r8 = r427;
c25904_9 = r427;
if (c25904_8 === 0) {
break;
}
continue;
}
return r519;
}
}
throw r8;
}
return r235;
}
export async function resendPaymentVerificationEmail() {
let value, c25905_4;
let c25905_3 = 0;
let c29790_0;
try {
c25905_3 = 1;
const body = {
purchase_token: getPurchaseToken()
};
value = {};
HermesBuiltin.copyDataProperties(value, (await HTTP.post({
url: Endpoints.STORE_EMAIL_RESEND_PAYMENT_VERIFICATION,
body,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body);
c25905_3 = 0;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c25905_4 = r26;
if (c25905_3 !== 0) {
while (true) {
try {
const r74 = c25905_4;
c25905_3 = 0;
c29790_0 = r74;
throw c29790_0 instanceof BillingError ? c29790_0 : new BillingError(c29790_0);
} catch (r70) {
r8 = r70;
c25905_4 = r70;
if (c25905_3 === 0) {
break;
}
}
}
}
throw r8;
}
return value;
}
export function clearPurchaseError() {
Dispatcher.dispatch({
type: "SKU_PURCHASE_CLEAR_ERROR"
});
}
export function showPurchaseConfirmationStep() {
Dispatcher.wait(() => Dispatcher.dispatch({
type: "SKU_PURCHASE_SHOW_CONFIRMATION_STEP"
}));
}
export function updateSKUPaymentIsGift(a0) {
Dispatcher.dispatch({
type: "SKU_PURCHASE_UPDATE_IS_GIFT",
isGift: a0
});
}
+45
View File
@@ -0,0 +1,45 @@
// Metro module 5001 (f5002).
import GameConsoleStore from "../modules/game_console/GameConsoleStore";
import ChannelStore from "../stores/ChannelStore";
import MediaEngineStore from "../stores/MediaEngineStore";
import { ME, Routes, PopoutWindowKeys } from "../Constants";
import Dispatcher from "../Dispatcher";
import { transitionTo } from "../modules/routing/router_utils";
import { selectVoiceChannelAdditional } from "./SelectedChannelActionCreatorsAdditional.native";
import { remoteDisconnect } from "../modules/game_console/GameConsoleActionCreators";
PopoutWindowKeys;
const r25 = {
selectChannel: (a0) => {
const { guildId, channelId } = a0;
Dispatcher.dispatch({
type: "CHANNEL_SELECT",
guildId: guildId !== ME ? guildId : null,
channelId,
messageId: a0.messageId,
jumpType: a0.jumpType,
source: a0.source,
skipMessageFetch: a0.skipMessageFetch
});
},
selectPrivateChannel: (a0) => {
transitionTo(Routes.CHANNEL(ME, a0));
},
selectVoiceChannel: function selectVoiceChannel(a0, r9 = false, r8 = false, r7 = {}) {
const channel = ChannelStore.getChannel(a0);
const r17 = channel == null ? void 0 : channel.getGuildId();
if (MediaEngineStore.isSupported()) {
if (a0 != null) {
MediaEngineStore.getMediaEngine().interact();
}
selectVoiceChannelAdditional(a0, r17, r9, r8, r7);
}
},
disconnect: function disconnect() {
const remoteSessionId = GameConsoleStore.getRemoteSessionId();
if (remoteSessionId != null) {
remoteDisconnect(remoteSessionId);
}
this.selectVoiceChannel(null);
}
};
export default r25;
@@ -0,0 +1,89 @@
// Metro module 5002 (f5003).
import ChannelStore from "../stores/ChannelStore";
import GuildStore from "../stores/GuildStore";
import GuildVerificationStore from "../stores/GuildVerificationStore";
import PermissionStore from "../stores/PermissionStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import UserStore from "../stores/UserStore";
import VoiceStateStore from "../stores/VoiceStateStore";
import { STAGE_BOOSTING_SHEET_KEY } from "../modules/stage_channels/StageChannelsConstants";
import * as _ChannelUtils from "../utils/ChannelUtils";
import { canLurkerListen } from "../modules/stage_channels/StageChannelPermissionUtils";
import { unverifiedVoiceGate } from "../modules/toast/native/ToastUtils";
import canJoinVoiceChannel from "../modules/channel/canJoinVoiceChannel";
import { getStageHasMedia } from "../modules/stage_channels/StageMediaHooks";
import ActionSheetActionCreators from "../modules/action_sheet/native/ActionSheetActionCreators";
import collectCallFeedback from "../modules/voice_calls/collectCallFeedback";
import { v4 } from "../_bundle/Module514";
import Dispatcher from "../Dispatcher";
export function selectVoiceChannelAdditional(a0, guildId) {
let bypassIdleUpdate;
const channelId = a0;
let r10 = arguments[2];
if (r10 === void 0) {
r10 = false;
}
const video = r10;
let r9 = arguments[3];
if (r9 === void 0) {
r9 = false;
}
const stream = r9;
let r21 = arguments[4];
if (r21 === void 0) {
r21 = {};
}
let lockVoiceStateForResume2 = r21.lockVoiceStateForResume;
if (lockVoiceStateForResume2 === void 0) {
lockVoiceStateForResume2 = false;
}
const lockVoiceStateForResume = lockVoiceStateForResume2;
let bypassIdleUpdate2 = r21.bypassIdleUpdate;
if (bypassIdleUpdate2 === void 0) {
bypassIdleUpdate2 = false;
}
L24: {
bypassIdleUpdate = bypassIdleUpdate2;
const channel = ChannelStore.getChannel(a0);
const currentUser = UserStore.getCurrentUser();
if (currentUser != null) {
if (channel != null && channel.nsfw && !currentUser.nsfwAllowed) {
break L24;
}
L23: {
if (channel != null) {
const isChannelFull = _ChannelUtils.isChannelFull(channel, VoiceStateStore, GuildStore);
const check = GuildVerificationStore.getCheck(channel.guild_id);
if (!check.canChat && !canLurkerListen(channel)) {
return unverifiedVoiceGate(check);
}
const canJoinVoiceChannel2 = canJoinVoiceChannel(channel, PermissionStore);
if (isChannelFull && channel.isGuildStageVoice() && getStageHasMedia(channel.id)) {
ActionSheetActionCreators.openLazy(import("../modules/stage_channels/native/sheets/StageBoostingActionSheet"), STAGE_BOOSTING_SHEET_KEY, {
channel
});
return void 0;
}
if (!isChannelFull && canJoinVoiceChannel2) {
break L23;
}
return void 0;
}
}
collectCallFeedback(function() {
const joinVoiceId = v4();
Dispatcher.dispatch({
type: "VOICE_CHANNEL_SELECT",
guildId,
channelId,
currentVoiceChannelId: SelectedChannelStore.getVoiceChannelId(),
video,
stream,
lockVoiceStateForResume,
joinVoiceId,
bypassIdleUpdate
});
}, a0, stream, video);
}
}
}
+81
View File
@@ -0,0 +1,81 @@
// Metro module 13554 (f13555).
import ApplicationStore from "../modules/applications/ApplicationStore";
import SKUStore from "../stores/game_store/SKUStore";
import StoreListingStore from "../stores/game_store/StoreListingStore";
import { Endpoints } from "../Constants";
import { httpGetWithCountryCodeQuery } from "../utils/StoreUtils";
import { rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import * as _TestModeUtils from "../modules/game_store/TestModeUtils";
export function fetchStoreListingsForApplications(a0) {
const application_ids = a0.filter((item) => {
const application = ApplicationStore.getApplication(item);
if (application == null) {
return true;
}
const destinationSkuId = application.destinationSkuId;
return destinationSkuId == null || StoreListingStore.getForSKU(destinationSkuId) == null;
});
return application_ids.length === 0 ? Promise.resolve() : httpGetWithCountryCodeQuery({
url: Endpoints.STORE_PUBLISHED_LISTINGS_APPLICATIONS,
query: {
application_ids
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_SUCCESS",
storeListings: result.body
});
});
}
export function fetchAllStoreListingsForApplication(a0) {
return httpGetWithCountryCodeQuery({
url: Endpoints.STORE_PUBLISHED_LISTINGS_SKUS,
query: {
application_id: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_SUCCESS",
storeListings: result.body.map((item) => ({
...item,
published: true
}))
});
return result.body;
});
}
export function fetchStoreListingForSku(a0) {
const skuId = a0;
const r10 = SKUStore.get(a0);
const isTestModeForApplication = r10 != null && _TestModeUtils.isTestModeForApplication(r10.applicationId);
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_START",
skuId: a0
});
return httpGetWithCountryCodeQuery({
url: isTestModeForApplication ? Endpoints.STORE_LISTINGS_SKU(a0) : Endpoints.STORE_PUBLISHED_LISTINGS_SKU(a0),
rejectWithError: rejectWithMigratedError()
}).then((result) => {
if (isTestModeForApplication) {
Dispatcher.dispatch({
type: "STORE_LISTINGS_FETCH_SUCCESS",
storeListings: result.body
});
} else {
Dispatcher.dispatch({
type: "STORE_LISTING_FETCH_SUCCESS",
storeListing: result.body
});
}
}).catch(() => {
Dispatcher.dispatch({
type: "SKU_FETCH_FAIL",
skuId
});
});
}
+314
View File
@@ -0,0 +1,314 @@
// Metro module 4369 (f4370).
import GameConsoleStore from "../modules/game_console/GameConsoleStore";
import PopoutWindowStore_native from "../modules/popout-window/PopoutWindowStore.native";
import ApplicationStreamPreviewStore from "../stores/ApplicationStreamPreviewStore";
import ApplicationStreamingStore from "../stores/ApplicationStreamingStore";
import AuthenticationStore from "../stores/AuthenticationStore";
import ChannelStore from "../stores/ChannelStore";
import GuildStore from "../stores/GuildStore";
import SelectedChannelStore from "../stores/SelectedChannelStore";
import VoiceStateStore from "../stores/VoiceStateStore";
import { AppContext, Endpoints, PopoutWindowKeys } from "../Constants";
import { StreamTypes } from "../modules/go_live/Constants";
import Dispatcher from "../Dispatcher";
import { encodeStreamKey, decodeStreamKey } from "../modules/go_live/utils/StreamKeyUtils";
import Module38 from "../_bundle/Module38";
import { isChannelFull } from "../utils/ChannelUtils";
import ChannelRTCActionCreators from "./ChannelRTCActionCreators";
import transitionToStream_native from "../modules/go_live/utils/transitionToStream.native";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Durations from "../utils/Durations";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import { trackStreamSettingsUpdate } from "../utils/StreamQualityUtils";
import SelectedChannelActionCreators from "./SelectedChannelActionCreators";
import ChannelActionCreators from "./ChannelActionCreators";
import CallActionCreators from "./CallActionCreators";
let MAX_VALUE;
const watchStream = function watchStream(a0, a1) {
L19: {
if (GameConsoleStore.getRemoteSessionId() == null) {
const { guildId: guildId2, channelId: channelId2 } = a0;
if (guildId2 != null) {
const channel = ChannelStore.getChannel(channelId2);
Module38(channel != null, "Cannot join a null voice channel");
const isInChannel = VoiceStateStore.isInChannel(channelId2);
if (isInChannel ? !isInChannel : isChannelFull(channel, VoiceStateStore, GuildStore)) {
break L19;
}
}
const streamKey = encodeStreamKey(a0);
let allowMultiple = a1?.forceMultiple || ApplicationStreamingStore.getAllActiveStreamsForChannel(channelId2).filter((item) => item.ownerId !== AuthenticationStore.getId()).length >= MAX_VALUE;
Dispatcher.dispatch({
type: "STREAM_WATCH",
streamKey,
allowMultiple
});
let r55 = a1?.forceFocus !== true;
if (r55) {
if (!allowMultiple) {
allowMultiple = a1?.noFocus;
}
r55 = allowMultiple;
}
if (!r55) {
ChannelRTCActionCreators.selectParticipant(a0.channelId, streamKey);
}
}
}
};
MAX_VALUE = Number.MAX_VALUE;
export function startStream(a0, a1, a2) {
Dispatcher.dispatch({
type: "STREAM_START",
streamType: a0 != null ? StreamTypes.GUILD : StreamTypes.CALL,
guildId: a0,
channelId: a1,
appContext: AppContext.APP,
...a2
});
}
export function setStreamPaused(a0, a1) {
Dispatcher.dispatch({
type: "STREAM_SET_PAUSED",
streamKey: encodeStreamKey(a0),
paused: a1
});
}
export { watchStream };
export function toggleSelfStreamHidden(a0, a1) {
Dispatcher.dispatch({
type: "STREAM_UPDATE_SELF_HIDDEN",
channelId: a0,
selfStreamHidden: a1
});
}
export function watchStreamAndTransitionToStream(a0, a1) {
L8: {
const { guildId: guildId2, channelId: channelId2 } = a0;
if (guildId2 != null) {
const channel = ChannelStore.getChannel(channelId2);
Module38(channel != null, "Cannot join a null voice channel");
const isInChannel = VoiceStateStore.isInChannel(channelId2);
if (isInChannel ? !isInChannel : isChannelFull(channel, VoiceStateStore, GuildStore)) {
break L8;
}
}
watchStream(a0, a1);
let r33 = PopoutWindowStore_native.getWindowOpen(PopoutWindowKeys.CHANNEL_CALL_POPOUT);
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (r33) {
r33 = voiceChannelId === channelId2;
}
if (!r33) {
transitionToStream_native(a0);
}
}
}
export function stopStream(a0, canShowFeedback = true, r2 = true) {
if (r2) {
if (canShowFeedback === void 0) {
canShowFeedback = true;
}
Dispatcher.dispatch({
type: "STREAM_CLOSE",
streamKey: a0,
canShowFeedback
});
}
Dispatcher.dispatch({
type: "STREAM_STOP",
streamKey: a0,
appContext: AppContext.APP
});
}
export function closeStream(a0, canShowFeedback = true) {
Dispatcher.dispatch({
type: "STREAM_CLOSE",
streamKey: a0,
canShowFeedback
});
}
export async function fetchStreamPreview(guildId, channelId, ownerId) {
let c25060_5;
let c25060_6 = 0;
let c29319_0, c29319_1, c29319_2, c29319_3;
L16: {
try {
c29319_0 = void 0;
c29319_1 = void 0;
c29319_2 = void 0;
if (ApplicationStreamPreviewStore.shouldFetchPreview(guildId, channelId, ownerId)) {
const streamKey = encodeStreamKey({
streamType: guildId != null ? StreamTypes.GUILD : StreamTypes.CALL,
guildId,
channelId,
ownerId
});
c29319_0 = streamKey;
Dispatcher.dispatch({
type: "STREAM_PREVIEW_FETCH_START",
streamKey
});
c25060_6 = 1;
c29319_1 = await HTTP.get({
url: Endpoints.STREAM_PREVIEW(streamKey),
query: {
version: Date.now()
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "STREAM_PREVIEW_FETCH_SUCCESS",
streamKey: c29319_0,
previewURL: c29319_1.body.url
});
c25060_6 = 0;
break L16;
}
} catch ($e) {
const r33 = $e;
let r8 = r33;
c25060_5 = r33;
if (c25060_6 !== 0) {
while (true) {
try {
const r109 = c25060_5;
c25060_6 = 0;
c29319_3 = r109;
if (c29319_3.status === 429) {
c29319_2 = c29319_3.body.retry_after * Durations.Millis.SECOND;
}
Dispatcher.dispatch({
type: "STREAM_PREVIEW_FETCH_FAIL",
streamKey: c29319_0,
retryAfter: c29319_2
});
break L16;
} catch (r106) {
r8 = r106;
c25060_5 = r106;
if (c25060_6 === 0) {
break;
}
}
}
}
throw r8;
}
return void 0;
}
}
export function setLayout(a0) {
Dispatcher.dispatch({
type: "STREAM_LAYOUT_UPDATE",
layout: a0
});
}
export async function notifyStreamStart(c25061_0) {
let c25061_4 = 0;
L10: {
try {
c25061_4 = 1;
await TrackedHTTPUtils.post({
url: Endpoints.STREAM_NOTIFY(c25061_0),
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.STREAM_NOTIFY
},
rejectWithError: true
});
c25061_4 = 0;
} catch ($e) {
let r8 = $e;
if (c25061_4 !== 0) {
while (true) {
try {
c25061_4 = 0;
break L10;
} catch ($e) {
r8 = $e;
if (c25061_4 === 0) {
break;
}
}
}
}
throw r8;
}
}
}
export function updateStreamSettings(a0) {
if (a0.noTrack !== true) {
trackStreamSettingsUpdate(a0.preset, a0.resolution, a0.frameRate, a0.soundshareEnabled);
}
Dispatcher.dispatch({
type: "STREAM_UPDATE_SETTINGS",
...a0
});
}
export function changeStreamRegion(a0, a1) {
HTTP.patch({
url: Endpoints.STREAM(a0),
body: {
region: a1
},
oldFormErrors: true,
rejectWithError: true
});
}
export function stopOwnStream(canShowFeedback = true) {
const currentUserActiveStream = ApplicationStreamingStore.getCurrentUserActiveStream();
if (currentUserActiveStream != null) {
const streamKey = encodeStreamKey(currentUserActiveStream);
if (canShowFeedback === void 0) {
canShowFeedback = true;
}
if (canShowFeedback === void 0) {
canShowFeedback = true;
}
Dispatcher.dispatch({
type: "STREAM_CLOSE",
streamKey,
canShowFeedback
});
Dispatcher.dispatch({
type: "STREAM_STOP",
streamKey,
appContext: AppContext.APP
});
}
}
export function joinPrivateChannelAndWatchStream(a0, a1) {
const id = AuthenticationStore.getId();
let c14144_1 = decodeStreamKey(a1);
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (voiceChannelId != null && voiceChannelId !== a0) {
SelectedChannelActionCreators.disconnect();
}
ChannelActionCreators.addRecipient(a0, id, void 0, () => {
CallActionCreators.call(a0, false, false, null, () => {
L8: {
const { guildId: guildId2, channelId: channelId2 } = c14144_1;
if (guildId2 != null) {
const channel = ChannelStore.getChannel(channelId2);
Module38(channel != null, "Cannot join a null voice channel");
const isInChannel = VoiceStateStore.isInChannel(channelId2);
if (isInChannel ? !isInChannel : isChannelFull(channel, VoiceStateStore, GuildStore)) {
break L8;
}
}
watchStream(c14144_1, void 0);
let r33 = PopoutWindowStore_native.getWindowOpen(PopoutWindowKeys.CHANNEL_CALL_POPOUT);
const voiceChannelId = SelectedChannelStore.getVoiceChannelId();
if (r33) {
r33 = voiceChannelId === channelId2;
}
if (!r33) {
transitionToStream_native(c14144_1);
}
}
});
});
}
+111
View File
@@ -0,0 +1,111 @@
// Metro module 6301 (f6302).
import BillingInfoStore from "../stores/billing/BillingInfoStore";
import { Endpoints } from "../Constants";
import { ACTIVE_PREMIUM_SKUS, PremiumSubscriptionSKUs } from "../modules/premium/PremiumConstants";
import Dispatcher from "../Dispatcher";
import { fetchIpCountryCode } from "../modules/billing/actions/BillingActionCreators";
import { HTTP } from "../_bundle/sendRequest";
import { captureBillingException } from "../utils/BillingUtils";
import V6OrEarlierAPIError from "../errors/V6OrEarlierAPIError";
const fetchSubscriptionPlansForSKU = async function fetchSubscriptionPlansForSKU(skuId, country_code, payment_source_id, include_unpublished, revenue_surface, payment_gateway) {
let body;
let c25782_8;
let c25782_9 = 0;
let c29719_0, c29719_1, c29719_2, c29719_3, c29719_4;
try {
c29719_0 = skuId;
c29719_1 = void 0;
c29719_2 = void 0;
c29719_3 = void 0;
Dispatcher.dispatch({
type: "SUBSCRIPTION_PLANS_FETCH",
skuId
});
c25782_9 = 1;
const r47 = {
url: Endpoints.STORE_PUBLISHED_LISTINGS_SUBSCRIPTION_PLANS(skuId),
oldFormErrors: true,
rejectWithError: true,
retries: 10
};
c29719_1 = r47;
const query = {};
if (country_code != null) {
query.country_code = country_code;
}
if (payment_source_id != null) {
query.payment_source_id = payment_source_id;
}
if (include_unpublished != null) {
query.include_unpublished = include_unpublished;
}
if (revenue_surface != null) {
query.revenue_surface = revenue_surface;
}
if (payment_gateway != null) {
query.payment_gateway = payment_gateway;
}
r47.query = query;
if (BillingInfoStore.ipCountryCodeLoaded) {
c29719_2 = await HTTP.get(c29719_1);
Dispatcher.dispatch({
type: "SUBSCRIPTION_PLANS_FETCH_SUCCESS",
skuId: c29719_0,
subscriptionPlans: c29719_2.body
});
body = c29719_2.body;
c25782_9 = 0;
} else {
await fetchIpCountryCode();
c29719_2 = await HTTP.get(c29719_1);
Dispatcher.dispatch({
type: "SUBSCRIPTION_PLANS_FETCH_SUCCESS",
skuId: c29719_0,
subscriptionPlans: c29719_2.body
});
body = c29719_2.body;
c25782_9 = 0;
}
} catch ($e) {
const r37 = $e;
let r8 = r37;
c25782_8 = r37;
if (c25782_9 !== 0) {
while (true) {
try {
const r167 = c25782_8;
c25782_9 = 0;
c29719_4 = r167;
Dispatcher.dispatch({
type: "SUBSCRIPTION_PLANS_FETCH_FAILURE",
skuId: c29719_0
});
captureBillingException(c29719_4);
c29719_3 = new V6OrEarlierAPIError(c29719_4);
c29719_3.message = `Failed to fetch subscription plans for SKU ${c29719_0}`;
throw c29719_3;
} catch (r163) {
r8 = r163;
c25782_8 = r163;
if (c25782_9 === 0) {
break;
}
}
}
}
throw r8;
}
return body;
};
export { fetchSubscriptionPlansForSKU };
export function fetchSubscriptionPlansBySKUs(a0, c15651_0, c15651_1) {
return Promise.all(a0.filter((item) => item !== PremiumSubscriptionSKUs.NONE).map((item) => fetchSubscriptionPlansForSKU(item, c15651_0, void 0, void 0, void 0, c15651_1)));
}
export function fetchPremiumSubscriptionPlans(c15652_0, c15652_1, c15652_2, c15652_3) {
return Promise.all(ACTIVE_PREMIUM_SKUS.filter((item) => item !== PremiumSubscriptionSKUs.NONE).map((item) => fetchSubscriptionPlansForSKU(item, c15652_0, c15652_1, void 0, c15652_2, c15652_3)));
}
export function resetSubscriptionPlanData() {
Dispatcher.dispatch({
type: "SUBSCRIPTION_PLANS_RESET"
});
}
+90
View File
@@ -0,0 +1,90 @@
// Metro module 9275 (f9276).
import SurveyStore, { SURVEY_REFETCH_INTERVAL } from "../stores/SurveyStore";
import { AnalyticEvents, Endpoints, NoticeTypes } from "../Constants";
import Dispatcher from "../Dispatcher";
import AnalyticsUtils from "../utils/AnalyticsUtils";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module503";
import { exact } from "../_bundle/Module1385";
import { rejectWithMigratedError } from "../_bundle/sendRequest";
export function overrideSurvey(a0) {
Dispatcher.dispatch({
type: "SURVEY_OVERRIDE",
id: a0
});
}
export function surveyHide(a0, a1) {
Dispatcher.dispatch({
type: "SURVEY_HIDE",
key: a0
});
if (a1) {
AnalyticsUtils.track(AnalyticEvents.APP_NOTICE_CLOSED, {
notice_type: NoticeTypes.SURVEY,
survey_id: a0,
dismissed: a1
});
} else {
AnalyticsUtils.track(AnalyticEvents.APP_NOTICE_PRIMARY_CTA_OPENED, {
notice_type: NoticeTypes.SURVEY
});
}
}
export function surveyFetch(a0, a1) {
const query = {};
if (a0 != null) {
query.survey_override = a0;
}
if (a1 != null) {
query.disable_auto_seen = a1;
}
return TrackedHTTPUtils.get({
url: Endpoints.USER_SURVEY,
query,
trackedActionData: {
event: NetworkActionNames.USER_SURVEY_FETCH,
properties: (a0) => exact({
key: (a0 == null ? void 0 : a0.body?.survey)?.key
})
},
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "SURVEY_FETCHED",
survey: result == null ? void 0 : result.body?.survey
});
return result == null ? void 0 : result.body?.survey;
}, () => {
Dispatcher.dispatch({
type: "SURVEY_FETCHED",
survey: null
});
});
}
export function surveySeen(a0) {
let key;
L4: {
key = a0;
const lastSeenTimestamp = SurveyStore.getLastSeenTimestamp();
if (lastSeenTimestamp !== null) {
if (lastSeenTimestamp != null && Date.now() - lastSeenTimestamp >= SURVEY_REFETCH_INTERVAL) {
break L4;
}
return void 0;
}
}
Dispatcher.dispatch({
type: "SURVEY_SEEN",
key: a0
});
return TrackedHTTPUtils.post({
url: Endpoints.USER_SURVEY_SEEN(a0),
trackedActionData: {
event: NetworkActionNames.USER_SURVEY_SEEN,
properties: () => exact({
key
})
},
rejectWithError: rejectWithMigratedError()
});
}
+17
View File
@@ -0,0 +1,17 @@
// Metro module 11168 (f11169).
import Dispatcher from "../Dispatcher";
const r13 = {
startTyping: (a0) => {
Dispatcher.dispatch({
type: "TYPING_START_LOCAL",
channelId: a0
});
},
stopTyping: (a0) => {
Dispatcher.dispatch({
type: "TYPING_STOP_LOCAL",
channelId: a0
});
}
};
export default r13;
@@ -0,0 +1,83 @@
// Metro module 6186 (f6187).
import Dispatcher from "../Dispatcher";
const r12 = {
popFirstFile: (a0) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_POP_FILE",
channelId: a0
});
},
addFiles: (a0) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_ADD_FILES",
channelId: a0.channelId,
files: a0.files,
draftType: a0.draftType
});
},
addFile: (a0) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_ADD_FILES",
channelId: a0.channelId,
files: [a0.file],
draftType: a0.draftType,
allowOptimization: a0.allowOptimization
});
},
remove: (a0, a1, a2) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_REMOVE_FILE",
channelId: a0,
id: a1,
draftType: a2
});
},
removeFiles: (a0, a1, a2) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_REMOVE_FILES",
channelId: a0,
attachmentIds: a1,
draftType: a2
});
},
clearAll: (a0, a1) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_CLEAR_ALL_FILES",
channelId: a0,
draftType: a1
});
},
update: (a0, a1, a2, a3) => {
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_UPDATE_FILE",
channelId: a0,
id: a1,
filename: a3.filename,
description: a3.description,
thumbnail: a3.thumbnail,
spoiler: a3.spoiler,
draftType: a2
});
},
setUploads: (a0) => {
const { uploads, channelId, draftType } = a0;
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_SET_UPLOADS",
channelId,
uploads: a0.resetState ? uploads.map((upload) => upload.resetState()) : uploads,
draftType
});
},
setFile: (a0) => {
const file = a0.file;
Dispatcher.dispatch({
type: "UPLOAD_ATTACHMENT_SET_FILE",
channelId: a0.channelId,
id: a0.id,
file,
draftType: a0.draftType,
allowOptimization: a0.allowOptimization
});
}
};
export default r12;
+244
View File
@@ -0,0 +1,244 @@
// Metro module 7985 (f7986).
import UserRecord from "../records/UserRecord";
import UserStore from "../stores/UserStore";
import { Endpoints } from "../Constants";
import { PSEUDO_GUILD_IDS } from "../modules/routing/RouteConstants";
import Logger from "../modules/debug/Logger";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Dispatcher from "../Dispatcher";
import TrackedHTTPUtils from "../utils/TrackedHTTPUtils";
import { NetworkActionNames } from "../_bundle/Module663";
import Module38 from "../_bundle/Module38";
import { APIError } from "../errors/index";
let c5051_8 = new Logger("UserProfileModalActionCreators");
export function fetchCurrentUser(r2 = {}) {
const withAnalyticsToken2 = r2.withAnalyticsToken;
const withAnalyticsToken = withAnalyticsToken2 !== void 0 && withAnalyticsToken2;
return HTTP.get({
url: Endpoints.ME,
query: {
with_analytics_token: withAnalyticsToken
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "CURRENT_USER_UPDATE",
user: result.body,
analyticsToken: withAnalyticsToken ? result.body.analytics_token : void 0
});
return new UserRecord(result.body);
});
}
export function acceptAgreements(terms = true, privacy = true) {
return TrackedHTTPUtils.patch({
url: Endpoints.USER_AGREEMENTS,
trackedActionData: {
event: NetworkActionNames.USER_ACCEPT_AGREEMENTS
},
body: {
terms,
privacy
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => true, () => false);
}
export function setFlag(a0, a1) {
const currentUser = UserStore.getCurrentUser();
Module38(currentUser != null, "setFlag: user cannot be undefined");
const flags = currentUser.flags;
return HTTP.patch({
url: Endpoints.ME,
oldFormErrors: true,
body: {
flags: a1 ? flags | a0 : flags & ~a0
},
rejectWithError: rejectWithMigratedError()
});
}
export function getUser(a0) {
const user = UserStore.getUser(a0);
return user != null ? Promise.resolve(user) : HTTP.get({
url: Endpoints.USER(a0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
Dispatcher.dispatch({
type: "USER_UPDATE",
user: result.body
});
return UserStore.getUser(a0);
});
}
export function insertStaticUser(a0) {
Dispatcher.dispatch({
type: "USER_UPDATE",
user: a0
});
return UserStore.getUser(a0.id);
}
export async function fetchProfile(c26069_0, c26069_1, c26069_2) {
let c26069_5;
let c26069_6 = 0;
let c29869_1, c29869_2, c29869_3, c29869_4, c29869_5, c29869_6, c29869_7, c29869_8, c29869_9, c29869_0, c29869_10, c29869_11, c29869_12, c29869_13;
try {
c29869_1 = void 0;
c29869_2 = void 0;
c29869_3 = void 0;
c29869_4 = void 0;
c29869_5 = void 0;
c29869_6 = void 0;
c29869_7 = void 0;
c29869_8 = void 0;
c29869_9 = void 0;
c29869_0 = c26069_0;
let r38 = c26069_1;
if (r38 === void 0) {
r38 = {};
}
c29869_1 = r38.type;
c29869_2 = r38.withMutualGuilds;
c29869_3 = r38.withMutualFriendsCount;
c29869_4 = r38.withMutualFriends;
c29869_5 = r38.guildId;
c29869_6 = r38.connectionsRoleId;
c29869_7 = r38.joinRequestId;
c29869_8 = r38.abortSignal;
c29869_9 = c26069_2;
c29869_10 = void 0;
c29869_11 = void 0;
c29869_12 = void 0;
await void 0;
c29869_10 = Date.now();
Dispatcher.dispatch({
type: "USER_PROFILE_FETCH_START",
userId: c29869_0,
guildId: c29869_5,
withMutualFriends: c29869_4
});
c26069_6 = 1;
c29869_11 = c29869_5 == null ? void 0 : PSEUDO_GUILD_IDS.includes(c29869_5) ? void 0 : c29869_5;
c29869_12 = await HTTP.get({
url: Endpoints.USER_PROFILE(c29869_0),
query: {
type: c29869_1,
with_mutual_guilds: c29869_2,
with_mutual_friends: c29869_4,
with_mutual_friends_count: c29869_3 && (c29869_4 == null || !c29869_4),
guild_id: c29869_11,
connections_role_id: c29869_6,
join_request_id: c29869_7
},
signal: c29869_8,
rejectWithError: true
});
const r137 = c29869_9;
if (r137 != null) {
r137(c29869_12.body, c29869_5);
}
Dispatcher.dispatch({
type: "USER_UPDATE",
user: c29869_12.body.user
});
Dispatcher.dispatch({
type: "USER_PROFILE_FETCH_SUCCESS",
userProfile: c29869_12.body,
fetchStartedAt: c29869_10,
guildId: c29869_5
});
if (c29869_5 != null && c29869_12.body.guild_member != null) {
Dispatcher.dispatch({
type: "GUILD_MEMBER_PROFILE_UPDATE",
guildId: c29869_5,
guildMember: c29869_12.body.guild_member
});
}
c26069_6 = 0;
} catch ($e) {
const r35 = $e;
let r8 = r35;
c26069_5 = r35;
if (c26069_6 !== 0) {
while (true) {
try {
const r192 = c26069_5;
c26069_6 = 0;
c29869_13 = r192;
if (c29869_13 != null && c29869_13?.body != null) {
c5051_8.warn(`fetchProfile error: ${c29869_13.body.code} - ${c29869_13.body.message}`);
}
Dispatcher.dispatch({
type: "USER_PROFILE_FETCH_FAILURE",
apiError: new APIError(c29869_13),
fetchStartedAt: c29869_10,
userId: c29869_0,
guildId: c29869_5
});
throw c29869_13;
} catch (r189) {
r8 = r189;
c26069_5 = r189;
if (c26069_6 === 0) {
break;
}
}
}
}
throw r8;
}
}
export async function fetchMutualFriends(userId, signal) {
let c26070_4;
let c26070_5 = 0;
let c29870_0, c29870_1, c29870_2;
try {
c29870_0 = userId;
c29870_1 = void 0;
Dispatcher.dispatch({
type: "MUTUAL_FRIENDS_FETCH_START",
userId
});
c26070_5 = 1;
c29870_1 = await HTTP.get({
url: Endpoints.USER_RELATIONSHIPS(userId),
oldFormErrors: true,
signal,
rejectWithError: rejectWithMigratedError()
});
Dispatcher.dispatch({
type: "MUTUAL_FRIENDS_FETCH_SUCCESS",
userId: c29870_0,
mutualFriends: c29870_1.body
});
c26070_5 = 0;
} catch ($e) {
const r33 = $e;
let r8 = r33;
c26070_4 = r33;
if (c26070_5 !== 0) {
while (true) {
try {
const r92 = c26070_4;
c26070_5 = 0;
c29870_2 = r92;
if (c29870_2?.body != null) {
c5051_8.warn(`fetchMutualFriends error: ${c29870_2.body.code} - ${c29870_2.body.message}`);
}
Dispatcher.dispatch({
type: "MUTUAL_FRIENDS_FETCH_FAILURE",
userId: c29870_0
});
throw c29870_2;
} catch (r89) {
r8 = r89;
c26070_4 = r89;
if (c26070_5 === 0) {
break;
}
}
}
}
throw r8;
}
}
+67
View File
@@ -0,0 +1,67 @@
// Metro module 10944 (f10945).
import PresenceStore from "../stores/PresenceStore";
import { Endpoints } from "../Constants";
import Dispatcher from "../Dispatcher";
import { getSpotifyMetadataFromActivity } from "../modules/spotify/SpotifyUtils";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
export function sync(a0, a1) {
Dispatcher.dispatch({
type: "ACTIVITY_SYNC",
activity: a0,
userId: a1
});
}
export function play(a0, a1) {
const activity = a0;
const userId = a1;
getSpotifyMetadataFromActivity(a0, a1).then((result) => Dispatcher.dispatch({
type: "ACTIVITY_PLAY",
activity,
userId,
metadata: result
})).catch(() => Dispatcher.dispatch({
type: "ACTIVITY_PLAY",
activity,
userId
}));
}
export async function getMetadata(c26875_0, c26875_1) {
let r89, activityMetadata, metadata;
let c26875_3;
let c30311_0, c30311_1;
L18: {
L17: {
L10: {
c26875_3 = void 0;
c30311_0 = c26875_1;
c30311_1 = void 0;
metadata = c26875_0.metadata;
if (metadata != null && Object.keys(metadata).length > 0) {
break L10;
}
activityMetadata = PresenceStore.getActivityMetadata(c26875_1);
if (activityMetadata != null) {
break L18;
}
if (c26875_0.session_id == null) {
throw new Error("null/undefined session_id");
}
c30311_1 = (await HTTP.get({
url: Endpoints.USER_ACTIVITY_METADATA(c26875_1, c26875_0.session_id, c26875_0.application_id),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
})).body;
Dispatcher.dispatch({
type: "ACTIVITY_METADATA_UPDATE",
metadata: c30311_1,
userId: c30311_0
});
r89 = c30311_1;
break L17;
}
return metadata;
}
return r89;
}
return activityMetadata;
}
@@ -0,0 +1,294 @@
// Metro module 9226 (f9227).
import { DEVICE_TOKEN, DEVICE_VOIP_TOKEN, Endpoints, Routes } from "../Constants";
import { DEVICE_PUSH_VOIP_PROVIDER, getDevicePushProvider } from "../modules/push_notifications/PushNotificationConstants";
import Dispatcher from "../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import AuthenticationActionCreators from "./AuthenticationActionCreators";
import { transitionTo } from "../modules/routing/router_utils";
import { Storage } from "../_bundle/Module595";
import InlineUploader from "../lib/uploader_inline/InlineUploader";
import { SafetyScannedUploadSurface } from "../lib/uploader_inline/safetyScannedUploadSurfaces";
import { trackUserAvatarUpdated } from "../modules/user_profile/utils/trackUserAvatarUpdated";
import UserSettingsModalActionCreators from "./UserSettingsModalActionCreators";
const saveProfileAndAccountRequest = async function saveProfileAndAccountRequest(c26397_0, c26397_1) {
let c26397_3;
let c30065_4;
c26397_3 = void 0;
let c30065_0 = c26397_0;
let r30 = c26397_1;
if (r30 === void 0) {
r30 = {};
}
let c30065_1 = r30;
c30065_4 = void 0;
await void 0;
let c30065_2 = await HTTP.patch({
url: Endpoints.ME,
oldFormErrors: true,
body: c30065_0,
headers: c30065_1.headers,
rejectWithError: rejectWithMigratedError()
});
let c30065_3 = c30065_2.body;
if (c30065_3.token) {
c30065_4 = c30065_3.token;
delete c30065_3["token"];
Dispatcher.dispatch({
type: "UPDATE_TOKEN",
token: c30065_4,
userId: c30065_3.id
});
if (c30065_0?.password != null && c30065_0?.new_password != null) {
Dispatcher.dispatch({
type: "PASSWORD_UPDATED",
userId: c30065_3.id
});
}
}
Dispatcher.dispatch({
type: "CURRENT_USER_UPDATE",
user: c30065_3
});
return c30065_2;
};
export function accountDetailsInit() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_INIT"
});
}
export function accountDetailsClose() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_CLOSE"
});
}
export function disableAccount(a0, a1) {
return HTTP.post({
url: a1 ? Endpoints.DELETE_ACCOUNT : Endpoints.DISABLE_ACCOUNT,
body: {
password: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
AuthenticationActionCreators.logoutInternal();
transitionTo(Routes.DEFAULT_LOGGED_OUT);
});
}
export { saveProfileAndAccountRequest };
export function saveProfileAndAccountChanges({ username, discriminator, email, emailToken, password: password2, avatar, avatarDescription, avatarId, avatarDecoration, newPassword: newPassword2, globalName, legacyUsername, nameplate, primaryGuildId, displayNameStyles, avatarOriginalMd5 }) {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT"
});
const r30 = {
username,
email,
email_token: emailToken,
password: password2,
avatar,
avatar_description: avatarDescription,
avatar_id: avatarId,
discriminator,
global_name: globalName,
legacy_username: legacyUsername,
new_password: newPassword2
};
if (avatarDecoration !== void 0) {
let avatar_decoration_sku_id = avatarDecoration?.skuId;
if (avatar_decoration_sku_id == null) {
avatar_decoration_sku_id = null;
}
r30.avatar_decoration_sku_id = avatar_decoration_sku_id;
}
if (nameplate !== void 0) {
let nameplate_sku_id = nameplate?.skuId;
if (nameplate_sku_id == null) {
nameplate_sku_id = null;
}
r30.nameplate_sku_id = nameplate_sku_id;
}
if (primaryGuildId !== void 0) {
r30.primary_guild_id = primaryGuildId;
}
if (displayNameStyles != null) {
r30.display_name_font_id = displayNameStyles.fontId;
r30.display_name_effect_id = displayNameStyles.effectId;
r30.display_name_colors = displayNameStyles.colors;
} else if (displayNameStyles === null) {
r30.display_name_font_id = null;
r30.display_name_effect_id = null;
r30.display_name_colors = null;
}
const push_token = Storage.get(DEVICE_TOKEN);
const devicePushProvider = getDevicePushProvider();
if (devicePushProvider != null && push_token != null) {
r30.push_provider = devicePushProvider;
r30.push_token = push_token;
}
const push_voip_token = Storage.get(DEVICE_VOIP_TOKEN);
if (DEVICE_PUSH_VOIP_PROVIDER != null && push_voip_token != null) {
r30.push_voip_provider = DEVICE_PUSH_VOIP_PROVIDER;
r30.push_voip_token = push_voip_token;
}
const r61 = {};
r61[SafetyScannedUploadSurface.USER_DEFAULT_PROFILE_AVATAR] = avatarOriginalMd5;
return saveProfileAndAccountRequest(r30, {
headers: InlineUploader.buildHeadersForMd5(r61)
}).then((result) => {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT_SUCCESS"
});
if (!(avatar == null && avatarId == null)) {
Dispatcher.dispatch({
type: "RECENT_AVATARS_UPDATE"
});
}
return result;
}, (a0) => {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_SUBMIT_FAILURE",
errors: a0.body
});
return a0;
});
}
export function getHarvestStatus() {
return HTTP.get({
url: Endpoints.USER_HARVEST,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
}
export function requestHarvest(a0) {
return HTTP.post({
url: Endpoints.USER_HARVEST,
body: {
backends: a0
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
});
}
export function clearErrors() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_CLEAR_ERRORS"
});
}
export function resetPendingAccountChanges() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_ACCOUNT_CHANGES"
});
}
export function resetAllPending() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_CHANGES"
});
}
export function resetAllTryItOut() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_TRY_IT_OUT_CHANGES"
});
}
export function resetAndCloseUserProfileForm() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_AND_CLOSE_FORM"
});
}
export function resetPendingLegacyUsernameDisabled() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_LEGACY_USERNAME_DISABLED"
});
}
export function resetPendingPrimaryGuildChanges() {
Dispatcher.dispatch({
type: "USER_PROFILE_SETTINGS_RESET_PENDING_PRIMARY_GUILD_CHANGES"
});
}
export function updateAccount(a0) {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_UPDATE_ACCOUNT",
settings: a0
});
}
export function resetAccount() {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_RESET"
});
}
export function saveAccountChanges(a0, a1) {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_SUBMIT"
});
const { username, email, emailToken, password, avatar: avatar2, newPassword, discriminator } = a0;
const close = a1.close;
const body = {
username,
email,
email_token: emailToken,
password,
avatar: avatar2,
new_password: newPassword,
discriminator: discriminator != null ? discriminator !== "" ? discriminator : void 0 : void 0
};
const push_token = Storage.get(DEVICE_TOKEN);
const devicePushProvider = getDevicePushProvider();
if (devicePushProvider != null && push_token != null) {
body.push_provider = devicePushProvider;
body.push_token = push_token;
}
const push_voip_token = Storage.get(DEVICE_VOIP_TOKEN);
if (DEVICE_PUSH_VOIP_PROVIDER != null && push_voip_token != null) {
body.push_voip_provider = DEVICE_PUSH_VOIP_PROVIDER;
body.push_voip_token = push_voip_token;
}
return HTTP.patch({
url: Endpoints.ME,
oldFormErrors: true,
body,
rejectWithError: rejectWithMigratedError()
}).then((result) => {
const body = result.body;
const token = body.token;
delete body["token"];
Dispatcher.dispatch({
type: "UPDATE_TOKEN",
token,
userId: body.id
});
Dispatcher.dispatch({
type: "CURRENT_USER_UPDATE",
user: body
});
if (avatar2 !== void 0) {
trackUserAvatarUpdated({
avatarHash: body.avatar
});
}
if (newPassword != null) {
Dispatcher.dispatch({
type: "USER_PASSWORD_UPDATE",
user: body,
newPassword
});
}
if (password != null && newPassword != null) {
Dispatcher.dispatch({
type: "PASSWORD_UPDATED",
userId: body.id
});
}
if (close) {
UserSettingsModalActionCreators.close();
} else {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_SUBMIT_COMPLETE"
});
}
return result;
}, (a0) => {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_SUBMIT_FAILURE",
errors: a0.body
});
return a0;
});
}
+233
View File
@@ -0,0 +1,233 @@
// Metro module 6206 (f6207).
import ClientThemesBackgroundStore from "../modules/client_themes/ClientThemesBackgroundStore";
import SelectivelySyncedUserSettingsStore from "../modules/user_settings/SelectivelySyncedUserSettingsStore";
import ThemeStore from "../modules/user_settings/ThemeStore";
import { ThemeTypes } from "../Constants";
import { SystemThemeState, SystemTheme } from "../modules/user_settings/ThemeConstants";
import { PreloadedUserSettingsActionCreators, UserSettingsDelay } from "../modules/user_settings/UserSettingsProtoActionCreators";
import { Theme, GuildFolder } from "../_bundle/Module1306";
import { UInt32Value, StringValue, Int64Value, UInt64Value } from "../_bundle/Module1337";
import Dispatcher from "../Dispatcher";
import { InlineAttachmentMedia, InlineEmbedMedia, RenderEmbeds, RenderReactions, AnimateEmoji, AnimateStickers, GifAutoPlay, ClientThemeSettings, DeveloperMode } from "../modules/user_settings/UserSettings";
SystemTheme;
const r28 = {
overrideLocale: (a0) => {
Dispatcher.dispatch({
type: "USER_SETTINGS_LOCALE_OVERRIDE",
locale: a0
});
},
updatedUnsyncedSettings: (a0) => {
Dispatcher.dispatch({
type: "UNSYNCED_USER_SETTINGS_UPDATE",
settings: a0
});
},
setShouldSyncTextSettings: (a0) => {
Dispatcher.dispatch({
type: "SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE",
changes: {
text: {
shouldSync: a0,
settings: a0 ? {} : {
inlineAttachmentMedia: InlineAttachmentMedia.getSetting(),
inlineEmbedMedia: InlineEmbedMedia.getSetting(),
renderEmbeds: RenderEmbeds.getSetting(),
renderReactions: RenderReactions.getSetting(),
animateEmoji: AnimateEmoji.getSetting(),
animateStickers: AnimateStickers.getSetting(),
gifAutoPlay: GifAutoPlay.getSetting()
}
}
}
});
},
setShouldSyncAppearanceSettings: async (c15571_0) => {
let c25743_0;
let c25743_2 = 0;
const r10 = void 0;
L23: {
try {
c25743_0 = r10;
if (c15571_0) {
c25743_2 = 1;
await PreloadedUserSettingsActionCreators.updateAsync("appearance", (a0) => {
a0.theme = ThemeTypes.DARK === ThemeStore.theme ? Theme.DARK : ThemeTypes.LIGHT === ThemeStore.theme ? Theme.LIGHT : ThemeTypes.DARKER === ThemeStore.theme ? Theme.DARKER : ThemeTypes.MIDNIGHT === ThemeStore.theme ? Theme.MIDNIGHT : Theme.DARK;
const id = ClientThemesBackgroundStore.gradientPreset?.id;
const customUserThemeSettings2 = ClientThemeSettings.getSetting()?.customUserThemeSettings;
a0.clientThemeSettings = {
backgroundGradientPresetId: id != null ? UInt32Value.create({
value: id
}) : void 0,
customUserThemeSettings: customUserThemeSettings2 != null ? {
colors: customUserThemeSettings2.colors,
gradientColorStops: customUserThemeSettings2.gradientColorStops,
gradientAngle: customUserThemeSettings2.gradientAngle,
baseMix: customUserThemeSettings2.baseMix
} : void 0
};
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
c25743_2 = 0;
Dispatcher.dispatch({
type: "SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE",
changes: {
appearance: {
shouldSync: c15571_0,
settings: c15571_0 ? {} : {
theme: ThemeStore.theme,
clientThemeSettings: {
backgroundGradientPresetId: ClientThemesBackgroundStore.gradientPreset?.id
},
developerMode: DeveloperMode.getSetting()
}
}
}
});
break L23;
}
Dispatcher.dispatch({
type: "SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE",
changes: {
appearance: {
shouldSync: c15571_0,
settings: c15571_0 ? {} : {
theme: ThemeStore.theme,
clientThemeSettings: {
backgroundGradientPresetId: ClientThemesBackgroundStore.gradientPreset?.id
},
developerMode: DeveloperMode.getSetting()
}
}
}
});
} catch ($e) {
let r29 = $e;
if (c25743_2 !== 0) {
while (true) {
try {
c25743_2 = 0;
} catch ($e) {
r29 = $e;
if (c25743_2 === 0) {
break;
}
continue;
}
return void 0;
}
}
throw r29;
}
return void 0;
}
},
applySettingsOverride: (a0) => {
Dispatcher.dispatch({
type: "USER_SETTINGS_OVERRIDE_APPLY",
settings: a0
});
},
clearSettingsOverride: function clearSettingsOverride() {
Dispatcher.dispatch({
type: "USER_SETTINGS_OVERRIDE_CLEAR",
settings: Array.prototype.slice.call(arguments, 0)
});
},
updateLocale: (value) => PreloadedUserSettingsActionCreators.updateAsync("localization", (a0) => {
a0.locale = StringValue.create({
value
});
}, UserSettingsDelay.INFREQUENT_USER_ACTION),
updateTheme: (a0) => {
let c15573_0 = a0;
Dispatcher.dispatch({
type: "SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE",
changes: {
appearance: {
settings: {
theme: a0
}
}
}
});
if (SelectivelySyncedUserSettingsStore.shouldSync("appearance")) {
PreloadedUserSettingsActionCreators.updateAsync("appearance", (a0) => {
a0.theme = ThemeTypes.DARK === c15573_0 ? Theme.DARK : ThemeTypes.LIGHT === c15573_0 ? Theme.LIGHT : ThemeTypes.DARKER === c15573_0 ? Theme.DARKER : ThemeTypes.MIDNIGHT === c15573_0 ? Theme.MIDNIGHT : Theme.DARK;
}, UserSettingsDelay.INFREQUENT_USER_ACTION);
}
}
};
export default r28;
export function saveGuildFolders(c15574_0) {
return PreloadedUserSettingsActionCreators.updateAsync("guildFolders", (a0) => {
a0.folders = c15574_0.map((item) => {
const r15 = GuildFolder.create({
guildIds: item.guildIds
});
if (item.folderId != null) {
r15.id = Int64Value.create({
value: String(item.folderId)
});
}
if (item.folderColor != null) {
r15.color = UInt64Value.create({
value: String(item.folderColor)
});
}
if (item.folderName != null && item.folderName !== "") {
r15.name = StringValue.create({
value: String(item.folderName)
});
}
return r15;
});
}, UserSettingsDelay.FREQUENT_USER_ACTION);
}
export function saveClientTheme(a0) {
const { backgroundGradientPresetId, customUserThemeSettings, theme, useSystemTheme } = a0;
let r7 = arguments[1];
if (r7 === void 0) {
r7 = UserSettingsDelay.INFREQUENT_USER_ACTION;
}
const r2 = theme === "system";
let useSystemTheme2 = r2 ? SystemThemeState.ON : SystemThemeState.OFF;
if (useSystemTheme != null) {
useSystemTheme2 = useSystemTheme;
}
Dispatcher.dispatch({
type: "UNSYNCED_USER_SETTINGS_UPDATE",
settings: {
useSystemTheme: useSystemTheme2
}
});
Dispatcher.dispatch({
type: "SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE",
changes: {
appearance: {
settings: {
clientThemeSettings: {
backgroundGradientPresetId,
customUserThemeSettings
},
theme: r2 ? void 0 : theme
}
}
}
});
if (SelectivelySyncedUserSettingsStore.shouldSync("appearance")) {
return PreloadedUserSettingsActionCreators.updateAsync("appearance", (a0) => {
a0.theme = ThemeTypes.DARK === theme ? Theme.DARK : ThemeTypes.LIGHT === theme ? Theme.LIGHT : ThemeTypes.DARKER === theme ? Theme.DARKER : ThemeTypes.MIDNIGHT === theme ? Theme.MIDNIGHT : Theme.DARK;
a0.clientThemeSettings = {
backgroundGradientPresetId: backgroundGradientPresetId != null ? UInt32Value.create({
value: backgroundGradientPresetId
}) : void 0,
customUserThemeSettings: customUserThemeSettings != null ? {
colors: customUserThemeSettings.colors,
gradientColorStops: customUserThemeSettings.gradientColorStops,
gradientAngle: customUserThemeSettings.gradientAngle,
baseMix: customUserThemeSettings.baseMix
} : void 0
};
}, r7);
}
}
@@ -0,0 +1,16 @@
// Metro module 6505 (f6506).
import Dispatcher from "../Dispatcher";
const r13 = {
close: () => {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_CLOSE"
});
},
setSection: (a0) => {
Dispatcher.dispatch({
type: "USER_SETTINGS_MODAL_SET_SECTION",
section: a0
});
}
};
export default r13;
+121
View File
@@ -0,0 +1,121 @@
// Metro module 15670 (f15671).
import { AbortCodes, Endpoints } from "../Constants";
import Dispatcher from "../Dispatcher";
import { HTTP, rejectWithMigratedError } from "../_bundle/sendRequest";
import Module12 from "../_bundle/Module12";
import AlertActionCreators from "./AlertActionCreators";
import { intl, t } from "../intl/index.native";
const _excluded = ["Spidey Bot", "Captain Hook"];
const r18 = {
fetchForGuild: (a0) => {
const guildId = a0;
Dispatcher.dispatch({
type: "WEBHOOKS_FETCHING",
guildId: a0
});
HTTP.get({
url: Endpoints.GUILD_WEBHOOKS(a0),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then((result) => Dispatcher.dispatch({
type: "WEBHOOKS_UPDATE",
guildId,
webhooks: result.body
})).catch((a0) => {
Dispatcher.dispatch({
type: "WEBHOOKS_UPDATE",
guildId,
error: a0.body.message
});
});
},
fetchForChannel: (a0, a1) => {
const guildId2 = a0;
const channelId = a1;
Dispatcher.dispatch({
type: "WEBHOOKS_FETCHING",
guildId: a0,
channelId: a1
});
HTTP.get({
url: Endpoints.CHANNEL_WEBHOOKS(a1),
oldFormErrors: true,
rejectWithError: true
}).then((result) => Dispatcher.dispatch({
type: "WEBHOOKS_UPDATE",
guildId: guildId2,
channelId,
webhooks: result.body
})).catch((a0) => {
Dispatcher.dispatch({
type: "WEBHOOKS_UPDATE",
guildId: guildId2,
error: a0.body.message
});
});
},
create: (guildId3, a1, a2) => {
const name = a2 == null ? _excluded[Module12.random(0, _excluded.length - 1)] : a2;
return HTTP.post({
url: Endpoints.CHANNEL_WEBHOOKS(a1),
body: {
name
},
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "WEBHOOK_CREATE",
guildId: guildId3,
webhook: body
});
return body;
}).catch(({ body, status }) => {
if (body != null && body.code === AbortCodes.TOO_MANY_WEBHOOKS) {
AlertActionCreators.show({
title: intl.string(t.cCqsca),
body: intl.string(t["w+QZoX"])
});
} else if (status === 429) {
AlertActionCreators.show({
title: intl.string(t.cCqsca),
body: intl.string(t["YBM+UW"])
});
} else {
AlertActionCreators.show({
title: intl.string(t.cCqsca),
body: intl.string(t["/4TwKf"])
});
}
return null;
});
},
delete: (guildId4, a1) => {
const webhookId = a1;
return HTTP.del({
url: Endpoints.WEBHOOK(a1),
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(() => {
Dispatcher.dispatch({
type: "WEBHOOK_DELETE",
guildId: guildId4,
webhookId
});
});
},
update: (guildId5, a1, a2) => HTTP.patch({
url: Endpoints.WEBHOOK(a1),
body: a2,
oldFormErrors: true,
rejectWithError: rejectWithMigratedError()
}).then(({ body }) => {
Dispatcher.dispatch({
type: "WEBHOOK_UPDATE",
guildId: guildId5,
webhook: body
});
return body;
})
};
export default r18;
+131
View File
@@ -0,0 +1,131 @@
// Metro module 4529 (f4530).
import ActionSheetActionCreators from "../../modules/action_sheet/native/ActionSheetActionCreators";
import Dispatcher from "../../Dispatcher";
import { dismissAlert, openAlert } from "../../design/components/AlertModal/native/useAlertStore.native";
import { intl, t } from "../../intl/index.native";
import { isMobileVisualRefreshEnabled } from "../../modules/themes/experiments/MobileVisualRefreshExperiment";
import { AlertModal, AlertActionButton } from "../../design/components/AlertModal/native/AlertModal.native";
import { getAlertButtonVariant } from "../../components_native/common/Alert";
let c2735_6 = null;
let c2735_7 = 0;
const r23 = {
openLazy: (a0) => {
const { importer: importer2, hideActionSheet = true } = a0;
let c14303_0 = hideActionSheet;
let isDismissable2 = a0.isDismissable;
if (isDismissable2 === void 0) {
isDismissable2 = false;
}
const isDismissable = isDismissable2;
return importer2().then((result) => {
if (c14303_0) {
ActionSheetActionCreators.hideActionSheet();
}
Dispatcher.dispatch({
type: "ALERT_OPEN",
alert: result,
isDismissable
});
});
},
close: () => {
const r4 = c2735_6;
if (r4 != null) {
c2735_6 = null;
dismissAlert(r4);
}
Dispatcher.dispatch({
type: "ALERT_CLOSE"
});
},
show: function show(a0) {
const { hideActionSheet = true, isDismissable: isDismissable2, confirmText: confirmText2 = intl.string(t.BddRzS) } = a0;
let confirmText, c14304_1, c14304_2, onConfirm2, onCancel2, c14304_5;
L56: {
confirmText = confirmText2;
const { hideActionSheet: _hideActionSheet, isDismissable, confirmText: _confirmText, ...rest } = a0;
c14304_1 = rest;
c14304_2 = void 0;
onConfirm2 = void 0;
onCancel2 = void 0;
c14304_5 = void 0;
if (isMobileVisualRefreshEnabled("AlertActionCreators")) {
const r43 = {
...rest,
confirmText,
isDismissable: isDismissable2
};
const { body, confirmText: confirmText3 } = r43;
const r1 = body != null && typeof body !== "string" && !Array.isArray(body);
if (!(r43.title == null || r43.title === "" || confirmText3 != null && typeof confirmText3 !== "string" || r1 || r43.footer != null || r43.helpText != null || r43.renderConfirmButton != null || r43.renderConfirmIcon != null || r43.renderConfirmRightIcon != null || r43.noDefaultButtons === true || r43.secondaryConfirmText != null || r43.onConfirmSecondary != null || r43.isConfirmButtonDisabled === true || r43.confirming != null || r43.style != null || r43.fillCancelText === true || r43.autoCloseOnConfirm === false || r43.onClose != null)) {
if (hideActionSheet) {
ActionSheetActionCreators.hideActionSheet();
}
if (c2735_6 != null) {
dismissAlert(c2735_6);
}
Dispatcher.dispatch({
type: "ALERT_CLOSE"
});
const r102 = +c2735_7;
c2735_7 = r102 + 1;
const r105 = "legacy-alert-" + r102;
c14304_2 = r105;
c2735_6 = r105;
const { title, body: body2, children, confirmColor, cancelText } = rest;
onConfirm2 = rest.onConfirm;
onCancel2 = rest.onCancel;
c14304_5 = false;
openAlert(r105, <AlertModal title={title} content={body2} extraContent={children} actions={<>
<AlertActionButton variant={getAlertButtonVariant(confirmColor)} text={confirmText} onPress={function onPress() {
c14304_5 = true;
if (onConfirm2 != null) {
onConfirm2();
}
}} />
{cancelText != null ? <AlertActionButton variant="secondary" text={cancelText} onPress={function onPress() {
c14304_5 = true;
if (onCancel2 != null) {
onCancel2();
}
}} /> : null}
</>} />, () => {
if (!c14304_5 && onCancel2 != null) {
onCancel2();
}
if (c2735_6 === c14304_2) {
c2735_6 = null;
}
}, {
dismissable: isDismissable2 === true
});
break L56;
}
}
if (c2735_6 != null) {
dismissAlert(c2735_6);
c2735_6 = null;
}
this.openLazy({
importer: () => import("../../components_native/common/Alert").then(({ default: Component }) => (a0) => <Component {...a0} {...c14304_1} confirmText={confirmText} />),
hideActionSheet,
isDismissable: isDismissable2
});
}
},
confirm: function confirm(c14305_0) {
return new Promise((c25242_0) => {
this.show({
onConfirm: () => {
c25242_0(true);
},
cancelText: intl.string(t["ETE/oC"]),
onCancel: () => {
c25242_0(false);
},
...c14305_0
});
});
}
};
export default r23;
File diff suppressed because it is too large. Load diff
+19
View File
@@ -0,0 +1,19 @@
// Metro module 5023 (f5024).
import ModalActionCreators from "../ModalActionCreators";
let c3028_3 = "PREMIUM_GUILD_SUBSCRIBE_MODAL_KEY";
export function openApplyBoostModal(a0) {
ModalActionCreators.pushLazy(import("../../components_native/premium/premium_guild_subscribe_modal/PremiumGuildSubscribeModal"), {
guildId: a0
}, c3028_3);
}
export function openTransferModal({ guildBoostSlots, guildId, intent, onResult }) {
ModalActionCreators.pushLazy(import("../../components_native/premium/premium_guild_subscribe_modal/PremiumGuildSubscribeModal"), {
guildId,
guildBoostSlots,
intent,
onResult
}, c3028_3);
}
export function closeApplyBoostModal() {
ModalActionCreators.popWithKey(c3028_3);
}
@@ -0,0 +1,26 @@
// Metro module 16734 (f16735).
import { NativeModules } from "react-native";
import AlertActionCreators from "../AlertActionCreators";
import { intl, t } from "../../intl/index.native";
let c12062_4 = false;
const r18 = {
prepareUpdate: (a0) => {
if (a0) {
AlertActionCreators.show({
title: intl.string(t.GQZdmI),
body: intl.string(t.Fizu9y),
confirmText: intl.string(t.UefCDS),
cancelText: intl.string(t["1SzcG6"]),
onConfirm: () => NativeModules.BundleUpdaterManager.reload()
});
c12062_4 = true;
}
},
deferUpdate: () => {
if (c12062_4) {
c12062_4 = false;
NativeModules.BundleUpdaterManager.reload();
}
}
};
export default r18;
@@ -0,0 +1,35 @@
// Metro module 8276 (f8277).
import { CREATEABLE_NON_VOCAL_CHANNEL_NAME_TYPES } from "../../records/ChannelRecord";
import ChannelStore from "../../stores/ChannelStore";
import { transitionToChannel } from "../../modules/routing/transitionToChannel";
import ModalActionCreators from "../ModalActionCreators";
let c5271_5 = "CREATE_CHANNEL_MODAL_KEY";
const r20 = {
CREATE_CHANNEL_MODAL_KEY: "CREATE_CHANNEL_MODAL_KEY",
open: function(a0, a1, a2, a3) {
if (a1 != null) {
let channelType = a0;
const r17 = import("../../components_native/CreateChannelModal");
if (a0 == null) {
channelType = void 0;
}
ModalActionCreators.pushLazy(r17, {
channelType,
guildId: a1,
categoryId: a2 == null ? void 0 : a2,
cloneChannelId: a3 == null ? void 0 : a3,
onChannelCreated: (a0, a1) => {
this.close();
const channel = ChannelStore.getChannel(a0);
if (a1 != null && channel != null && CREATEABLE_NON_VOCAL_CHANNEL_NAME_TYPES.has(channel.type)) {
transitionToChannel(a0);
}
}
}, c5271_5);
}
},
close: () => {
ModalActionCreators.popWithKey(c5271_5);
}
};
export default r20;
@@ -0,0 +1,19 @@
// Metro module 11847 (f11848).
import GuildChannelStore from "../../stores/GuildChannelStore";
import { InstantInviteSources } from "../../Constants";
import { showInstantInviteActionSheet } from "../../modules/instant_invite/native/InstantInviteUtils";
export function showInstantInviteModal(c19213_0) {
GuildChannelStore.addConditionalChangeListener(() => {
const defaultChannel = GuildChannelStore.getDefaultChannel(c19213_0);
let r9 = defaultChannel == null;
if (!r9) {
setImmediate(() => {
showInstantInviteActionSheet(defaultChannel, {
source: InstantInviteSources.GUILD_CREATE
});
});
r9 = false;
}
return r9;
});
}
@@ -0,0 +1,22 @@
// Metro module 8649 (f8650).
import * as _DisplayedInviteStore from "../../stores/native/DisplayedInviteStore";
import Dispatcher from "../../Dispatcher";
import InstantInviteActionCreators from "../InstantInviteActionCreators";
export function showInvite(a0, a1, a2) {
const r1 = a2 == null ? {} : a2;
const { deeplinkAttemptId, fromDeeplink, location: location2 } = r1;
_DisplayedInviteStore;
Dispatcher.dispatch({
type: "DISPLAYED_INVITE_SHOW",
code: a0,
username: a1,
deeplinkAttemptId,
fromDeeplink
});
InstantInviteActionCreators.resolveInvite(a0, location2);
}
export function clearDisplayedInvite() {
Dispatcher.dispatch({
type: "DISPLAYED_INVITE_CLEAR"
});
}
@@ -0,0 +1,22 @@
// Metro module 9177 (f9178).
import { AnalyticEvents } from "../../Constants";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import ModalActionCreators from "../ModalActionCreators";
import Dispatcher from "../../Dispatcher";
let c6023_4 = "EMAIL_VERIFICATION_MODAL_KEY";
const r18 = {
open: function(isChangeEmail = false) {
if (isChangeEmail) {
AnalyticsUtils.track(AnalyticEvents.USER_ACCOUNT_EMAIL_CHANGE_ATTEMPTED);
}
ModalActionCreators.pushLazy(import("../../modules/verification/native/components/EmailVerificationModal"), {
isChangeEmail
}, c6023_4);
},
close: () => {
Dispatcher.wait(() => {
ModalActionCreators.popWithKey(c6023_4);
});
}
};
export default r18;
File diff suppressed because it is too large. Load diff
+124
View File
@@ -0,0 +1,124 @@
// Metro module 8036 (f8037).
import { AnalyticEvents, Endpoints } from "../../Constants";
import { getIsPaymentsBlocked } from "../../modules/billing/experiments/BlockedPaymentsCountryExperiment";
import openBlockedPaymentsCountryActionSheet from "../../modules/billing/native/openBlockedPaymentsCountryActionSheet";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
import { BillingError } from "../../errors/index";
import ModalActionCreators from "../ModalActionCreators";
let c5090_6;
export async function redeemGiftCode(c26090_0) {
let r143;
let c26090_3;
let c26090_4 = 0;
let c29880_0, c29880_1, c29880_2, c29880_3, c29880_4, c29880_5, c29880_6, c29880_7, c29880_8, c29880_9, c29880_10;
L24: {
try {
c29880_0 = void 0;
c29880_1 = void 0;
c29880_2 = void 0;
c29880_3 = void 0;
c29880_0 = c26090_0.code;
let options = c26090_0.options;
if (options === void 0) {
options = c5090_6;
}
c29880_1 = options;
c29880_2 = c26090_0.onRedeemed;
c29880_3 = c26090_0.onError;
c29880_4 = void 0;
c29880_5 = void 0;
c29880_6 = void 0;
c29880_7 = void 0;
c29880_8 = void 0;
c29880_9 = void 0;
await void 0;
if (getIsPaymentsBlocked()) {
openBlockedPaymentsCountryActionSheet();
break L24;
}
c29880_4 = c29880_1.channelId;
c29880_5 = c29880_4 !== void 0 ? c29880_4 : null;
c29880_6 = c29880_1.paymentSource;
c29880_7 = c29880_6 !== void 0 ? c29880_6 : null;
Dispatcher.dispatch({
type: "GIFT_CODE_REDEEM",
code: c29880_0
});
c26090_4 = 1;
c29880_8 = await HTTP.post({
url: Endpoints.GIFT_CODE_REDEEM(c29880_0),
body: {
channel_id: c29880_5,
payment_source_id: c29880_7?.id
},
oldFormErrors: true,
rejectWithError: false
});
Dispatcher.dispatch({
type: "GIFT_CODE_REDEEM_SUCCESS",
code: c29880_0
});
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "gift_accept"
});
const r139 = c29880_2;
if (r139 != null) {
r139();
}
r143 = {
code: c29880_0,
entitlement: c29880_8
};
c26090_4 = 0;
} catch ($e) {
const r31 = $e;
let r8 = r31;
c26090_3 = r31;
if (c26090_4 !== 0) {
while (true) {
try {
const r153 = c26090_3;
c26090_4 = 0;
c29880_10 = r153;
c29880_9 = new BillingError(c29880_10);
Dispatcher.dispatch({
type: "GIFT_CODE_REDEEM_FAILURE",
code: c29880_0,
error: c29880_9
});
AnalyticsUtils.track(AnalyticEvents.OPEN_MODAL, {
type: "gift_accept",
location: null
});
const r181 = c29880_3;
if (r181 != null) {
r181(c29880_9);
}
throw c29880_9;
} catch (r149) {
r8 = r149;
c26090_3 = r149;
if (c26090_4 === 0) {
break;
}
}
}
}
throw r8;
}
return r143;
}
}
export function openGiftCodeRedeemModal(a0) {
ModalActionCreators.pushLazy(import("../../modules/premium/native/gift_code_modal/GiftCodeRedeemModal"), {
code: a0
}, "GIFT_CODE_REDEEM_MODAL_KEY");
}
c5090_6 = Object.freeze({});
const r25 = {
redeemGiftCode,
openGiftCodeRedeemModal
};
export default r25;
+45
View File
@@ -0,0 +1,45 @@
// Metro module 16455 (f16456).
import { Endpoints } from "../../Constants";
import Dispatcher from "../../Dispatcher";
import { HTTP } from "../../_bundle/sendRequest";
export function batchChannelUpdate(a0, a1) {
if (!(a1.length <= 0)) {
const onEnd2 = function onEnd() {
return Dispatcher.dispatch({
type: "GUILD_SETTINGS_SUBMIT_SUCCESS"
});
};
Dispatcher.dispatch({
type: "GUILD_SETTINGS_SUBMIT"
});
HTTP.patch({
url: Endpoints.GUILD_CHANNELS(a0),
body: a1,
oldFormErrors: true,
rejectWithError: true
}).then(onEnd2, onEnd2);
}
}
export function batchRoleUpdate(a0, a1) {
if (!(a1.length <= 0)) {
const onEnd2 = function onEnd() {
return Dispatcher.dispatch({
type: "GUILD_SETTINGS_SUBMIT_SUCCESS"
});
};
Dispatcher.dispatch({
type: "GUILD_SETTINGS_SUBMIT"
});
HTTP.patch({
url: Endpoints.GUILD_ROLES(a0),
body: a1,
oldFormErrors: true,
rejectWithError: true
}).then(onEnd2, onEnd2);
}
}
const r17 = {
batchChannelUpdate,
batchRoleUpdate
};
export default r17;
@@ -0,0 +1,18 @@
// Metro module 10260 (f10261).
import Dispatcher from "../../Dispatcher";
const r13 = {
enqueueNotification: (a0) => {
Dispatcher.dispatch({
type: "ENQUEUE_IN_APP_NOTIFICATION",
notification: a0
});
},
clearNotification: () => {
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "CLEAR_IN_APP_NOTIFICATION"
});
});
}
};
export default r13;
@@ -0,0 +1,33 @@
// Metro module 15482 (f15483).
import { Endpoints, MAX_MESSAGES_PER_CHANNEL } from "../../Constants";
import { HTTP } from "../../_bundle/sendRequest";
import Dispatcher from "../../Dispatcher";
const r18 = {
fetchMessages: (a0, a1) => {
const channelId = a0;
const around = a1;
HTTP.get({
url: Endpoints.MESSAGES(a0),
query: {
limit: MAX_MESSAGES_PER_CHANNEL,
around: a1
},
retries: 2,
oldFormErrors: true,
rejectWithError: true
}).then((result) => {
Dispatcher.dispatch({
type: "LOAD_MESSAGES_AROUND_SUCCESS",
channelId,
messages: result.body,
around
});
});
},
clearMessages: () => {
Dispatcher.dispatch({
type: "CLEAR_MESSAGES_AROUND_SUCCESS"
});
}
};
export default r18;
@@ -0,0 +1,15 @@
// Metro module 9257 (f9258).
import Dispatcher from "../../Dispatcher";
const r13 = {
openCountrySelector: () => {
Dispatcher.dispatch({
type: "VERIFICATION_OPEN_COUNTRY_SELECTOR"
});
},
setCountrySelectorClosed: () => {
Dispatcher.dispatch({
type: "VERIFICATION_CLOSE_COUNTRY_SELECTOR"
});
}
};
export default r13;
@@ -0,0 +1,171 @@
// Metro module 11507 (f11508).
import MultiAccountStore from "../../modules/multi_account/MultiAccountStore";
import AuthenticationStore from "../../stores/AuthenticationStore";
import { DEVICE_TOKEN, DEVICE_VOIP_TOKEN, Endpoints } from "../../Constants";
import { BUNDLE_ID, DEVICE_PUSH_VOIP_PROVIDER, IS_QUEST_RELEASE, getDevicePushProvider } from "../../modules/push_notifications/PushNotificationConstants";
import Logger from "../../modules/debug/Logger";
import { getToken } from "../../_bundle/setSecondaryToken";
import { HTTP } from "../../_bundle/sendRequest";
import SentryUtils_native from "../../utils/SentryUtils.native";
import { updatePushSyncToken, invalidatePushSyncTokens } from "../../modules/multi_account/MultiAccountActionCreators";
import { Storage } from "../../_bundle/Module595";
import TrackedHTTPUtils from "../../utils/TrackedHTTPUtils";
import { isAndroid } from "../../utils/PlatformUtils";
import { NetworkActionNames } from "../../_bundle/Module503";
import { isNotNullish } from "../../utils/GlobalUtils";
import Dispatcher from "../../Dispatcher";
let c7842_14;
const getOrRefreshPushSyncToken = async function getOrRefreshPushSyncToken(c27089_0) {
let r78, pushSyncToken;
let c27089_3;
let c27089_4 = 0;
let c30411_0, c30411_1, c30411_2;
L15: {
L14: {
try {
c30411_0 = c27089_0;
c30411_1 = void 0;
if (c27089_0.pushSyncToken == null) {
const token = getToken(c27089_0.id);
if (token == null) {
break L15;
}
c27089_4 = 1;
c30411_1 = (await HTTP.get({
url: Endpoints.DEVICES_SYNC_TOKEN,
headers: {
authorization: token
},
rejectWithError: false
})).body.token;
c27089_4 = 0;
updatePushSyncToken(c30411_0.id, c30411_1);
r78 = c30411_1;
break L14;
}
pushSyncToken = c27089_0.pushSyncToken;
} catch ($e) {
const r26 = $e;
let r8 = r26;
c27089_3 = r26;
if (c27089_4 !== 0) {
while (true) {
try {
const r87 = c27089_3;
c27089_4 = 0;
c30411_2 = r87;
SentryUtils_native.captureException(c30411_2);
} catch (r83) {
r8 = r83;
c27089_3 = r83;
if (c27089_4 === 0) {
break;
}
continue;
}
return null;
}
}
throw r8;
}
return pushSyncToken;
}
return r78;
}
return null;
};
c7842_14 = new Logger("PushNotificationActionCreators");
const r42 = {
registerDevice: function registerDevice(a0, r3 = false) {
c7842_14.log(`Registering push notification token: ${a0}, is voip:${r3}, multi-account:${MultiAccountStore.canUseMultiAccountNotifications}`);
const r27 = r3;
Storage.set(r27 ? DEVICE_VOIP_TOKEN : DEVICE_TOKEN, a0);
return MultiAccountStore.canUseMultiAccountNotifications ? this.syncDevice(a0, r27) : TrackedHTTPUtils.post({
url: Endpoints.DEVICES,
body: {
provider: r27 ? DEVICE_PUSH_VOIP_PROVIDER : getDevicePushProvider(),
token: a0,
bypass_server_throttling_supported: isAndroid() && !IS_QUEST_RELEASE,
bundle_id: BUNDLE_ID
},
oldFormErrors: true,
trackedActionData: {
event: NetworkActionNames.USER_REGISTER_DEVICE_TOKEN
},
rejectWithError: false
});
},
syncDevice: async function syncDevice(c18905_0, r4 = false) {
let c18905_1 = r4;
let c27090_1;
let env30412;
c27090_1 = void 0;
const r16 = env30412 = {};
let c27090_0 = r16;
env30412[0] = void 0;
env30412[1] = void 0;
env30412[2] = void 0;
env30412[0] = AuthenticationStore.getId();
env30412[1] = await Promise.all(MultiAccountStore.getValidUsers().sort(function({ id }, b) {
const r6 = env30412[0];
return id !== r6 ? b.id === r6 ? 1 : 0 : -1;
}).map(getOrRefreshPushSyncToken));
if (!(env30412[1].length < 1) && env30412[1][0] != null) {
env30412[2] = await HTTP.put({
url: Endpoints.DEVICES_SYNC,
body: {
provider: c18905_1 ? DEVICE_PUSH_VOIP_PROVIDER : (0, getDevicePushProvider)(),
token: c18905_0,
push_sync_tokens: env30412[1].filter(isNotNullish),
bypass_server_throttling_supported: isAndroid() && !IS_QUEST_RELEASE,
bundle_id: BUNDLE_ID
},
rejectWithError: false
});
if (env30412[2].body.invalid_push_sync_tokens.length > 0) {
invalidatePushSyncTokens(env30412[2].body.invalid_push_sync_tokens);
}
}
},
unregisterDevice: (a0) => {
c7842_14.log(`Unregistering push notification token: ${a0}`);
return TrackedHTTPUtils.delete({
url: Endpoints.DEVICES,
body: {
provider: getDevicePushProvider(),
token: a0
},
trackedActionData: {
event: NetworkActionNames.USER_UNREGISTER_DEVICE_TOKEN
},
rejectWithError: false
});
}
};
export default r42;
export function setPushPermissionState(permissionState) {
Dispatcher.wait(() => {
Dispatcher.dispatch({
type: "PUSH_NOTIFICATION_PERMISSION_SET_STATE",
permissionState
});
});
}
export function setPushPermissionReactivationSeen(a0) {
Dispatcher.dispatch({
type: "PUSH_NOTIFICATION_PERMISSION_REACTIVATION_SEEN",
promptType: a0
});
}
export function setPushNotificationPermissionEligibleForPrompt(a0) {
Dispatcher.dispatch({
type: "PUSH_NOTIFICATION_PERMISSION_SET_ELIGIBLE",
promptType: a0
});
}
export function updateNotificationAuthorizationStatus(a0) {
Dispatcher.dispatch({
type: "PUSH_NOTIFICATION_AUTHORIZATION_STATUS_UPDATE",
authorizationStatus: a0
});
}
+37
View File
@@ -0,0 +1,37 @@
// Metro module 10939 (f10940).
import DraftStore, { DraftType } from "../../stores/DraftStore";
import UploadStore from "../../stores/UploadStore";
import Dispatcher from "../../Dispatcher";
const r20 = {
restoreFailedUpload: (a0, a1) => {
Dispatcher.dispatch({
type: "UPLOAD_RESTORE_FAILED_UPLOAD",
messageId: a0,
file: a1
});
},
cancel: (a0, a1) => {
Dispatcher.dispatch({
type: "UPLOAD_CANCEL_REQUEST",
channelId: a0,
file: a1
});
const messageForFile = UploadStore.getMessageForFile(a1.id);
if (messageForFile != null && DraftStore.getDraft(messageForFile.channel_id, DraftType.ChannelMessage) === "") {
Dispatcher.dispatch({
type: "DRAFT_SAVE",
channelId: messageForFile.channel_id,
draft: messageForFile.content,
draftType: DraftType.ChannelMessage
});
}
},
cancelUploadItem: (a0, a1) => {
Dispatcher.dispatch({
type: "UPLOAD_ITEM_CANCEL_REQUEST",
file: a0,
itemId: a1
});
}
};
export default r20;