264 lines
16 KiB
TypeScript
264 lines
16 KiB
TypeScript
/* Metro module 7620; source: actions/UserSettingsAccountActionCreators.tsx; dependencies: [5, 661, 5079, 694, 507, 5076, 1230, 587, 7618, 7615, 7621, 7508, 2] */
|
|
function _fun61030(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#61030, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:6, offset: 0x0171883b, size: 393 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const closure = function() {
|
|
return _saveProfileAndAccountRequest.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_4 = value.Endpoints;
|
|
const env0_5 = value.Routes;
|
|
const env0_6 = value.DEVICE_TOKEN;
|
|
const env0_7 = value.DEVICE_VOIP_TOKEN;
|
|
value = require(5079) /* metro dependency 5079: PushNotificationConstants */;
|
|
const env0_8 = value.DEVICE_PUSH_VOIP_PROVIDER;
|
|
const env0_9 = value.getDevicePushProvider;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('actions/UserSettingsAccountActionCreators.tsx');
|
|
exports.accountDetailsInit = accountDetailsInit;
|
|
exports.accountDetailsClose = accountDetailsClose;
|
|
exports.disableAccount = disableAccount;
|
|
exports.saveProfileAndAccountRequest = closure;
|
|
exports.saveProfileAndAccountChanges = saveProfileAndAccountChanges;
|
|
exports.getHarvestStatus = function() {
|
|
var HTTP = require(dependencyMap[4]).HTTP;
|
|
return HTTP.get({'url': null, 'oldFormErrors': true, 'rejectWithError': false, url: Endpoints.USER_HARVEST});
|
|
};
|
|
exports.requestHarvest = function(a0) {
|
|
var HTTP = require(dependencyMap[4]).HTTP;
|
|
return HTTP.post({url: Endpoints.USER_HARVEST, body: {backends: a0}, oldFormErrors: true,
|
|
rejectWithError: false});
|
|
};
|
|
exports.clearErrors = clearErrors;
|
|
exports.resetPendingAccountChanges = resetPendingAccountChanges;
|
|
exports.resetAllPending = resetAllPending;
|
|
exports.resetAllTryItOut = resetAllTryItOut;
|
|
exports.resetAndCloseUserProfileForm = resetAndCloseUserProfileForm;
|
|
exports.resetPendingLegacyUsernameDisabled = resetPendingLegacyUsernameDisabled;
|
|
exports.resetPendingPrimaryGuildChanges = resetPendingPrimaryGuildChanges;
|
|
exports.updateAccount = updateAccount;
|
|
exports.resetAccount = resetAccount;
|
|
exports.saveAccountChanges = saveAccountChanges;
|
|
}
|
|
|
|
function _saveProfileAndAccountRequest() { // fn#61032, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:345, offset: 0x017189c4, size: 48 bytes, params: 1, frame: 14
|
|
return env0_3(_fun61034).apply(this, arguments);
|
|
}
|
|
|
|
function accountDetailsInit() { // fn#61035, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:978, offset: 0x01718b73, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_INIT'});
|
|
}
|
|
|
|
function accountDetailsClose() { // fn#61036, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:1085, offset: 0x01718ba4, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_CLOSE'});
|
|
}
|
|
|
|
function disableAccount(a0, a1) { // fn#61037, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:1189, offset: 0x01718bd5, size: 117 bytes, params: 3, frame: 13
|
|
const r3 = a1 ? Endpoints.DELETE_ACCOUNT : Endpoints.DISABLE_ACCOUNT;
|
|
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
return HTTP.post({url: r3, body: {password: a0}, oldFormErrors: true, rejectWithError: false}).then(function() {
|
|
importDefault(dependencyMap[5]).logoutInternal();
|
|
require(dependencyMap[6]).transitionTo(Routes.DEFAULT_LOGGED_OUT);
|
|
});
|
|
}
|
|
|
|
function saveProfileAndAccountChanges({username, discriminator, email, emailToken, password, avatar, avatarDescription, avatarId, avatarDecoration, newPassword, globalName, legacyUsername, nameplate, primaryGuildId, displayNameStyles, avatarOriginalMd5}) { // fn#61039, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:1523, offset: 0x01718c94, size: 619 bytes, params: 2, frame: 32
|
|
var object2;
|
|
var skuId;
|
|
var value3;
|
|
var value4;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_SUBMIT'});
|
|
object2 = {username: username, email: email, email_token: emailToken, password: password, avatar: avatar,
|
|
avatar_description: avatarDescription, avatar_id: avatarId, discriminator: discriminator,
|
|
global_name: globalName, legacy_username: legacyUsername, new_password: newPassword};
|
|
if (avatarDecoration !== undefined) {
|
|
value3 = null;
|
|
skuId = value3 == avatarDecoration ? undefined : avatarDecoration.skuId;
|
|
object2.avatar_decoration_sku_id = value3 != skuId ? skuId : value3;
|
|
}
|
|
if (nameplate !== undefined) {
|
|
value4 = null;
|
|
skuId = value4 == nameplate ? undefined : nameplate.skuId;
|
|
object2.nameplate_sku_id = value4 != skuId ? skuId : value4;
|
|
}
|
|
if (primaryGuildId !== undefined) {
|
|
object2.primary_guild_id = primaryGuildId;
|
|
}
|
|
if (displayNameStyles != null) {
|
|
object2.display_name_font_id = displayNameStyles.fontId;
|
|
object2.display_name_effect_id = displayNameStyles.effectId;
|
|
object2.display_name_colors = displayNameStyles.colors;
|
|
} else if (displayNameStyles === null) {
|
|
object2.display_name_font_id = null;
|
|
object2.display_name_effect_id = null;
|
|
object2.display_name_colors = null;
|
|
}
|
|
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
|
|
const value5 = Storage.get(DEVICE_TOKEN);
|
|
const devicePushProvider = getDevicePushProvider();
|
|
if (devicePushProvider != null && value5 != null) {
|
|
object2.push_provider = devicePushProvider;
|
|
object2.push_token = value5;
|
|
}
|
|
const value9 = Storage.get(DEVICE_VOIP_TOKEN);
|
|
if (DEVICE_PUSH_VOIP_PROVIDER != null && value9 != null) {
|
|
object2.push_voip_provider = DEVICE_PUSH_VOIP_PROVIDER;
|
|
object2.push_voip_token = value9;
|
|
}
|
|
const saveProfileAndAccountRequestBinding = saveProfileAndAccountRequest;
|
|
const defaultImport2 = importDefault(7618) /* metro dependency 7618: InlineUploader */;
|
|
const buildHeadersForMd5 = defaultImport2.buildHeadersForMd5;
|
|
const SafetyScannedUploadSurface = (require(7615) /* metro dependency 7615: safetyScannedUploadSurfaces */).SafetyScannedUploadSurface;
|
|
const USER_DEFAULT_PROFILE_AVATAR = SafetyScannedUploadSurface.USER_DEFAULT_PROFILE_AVATAR;
|
|
return saveProfileAndAccountRequestBinding(object2, {headers: Reflect.apply(buildHeadersForMd5, defaultImport2,
|
|
[{[USER_DEFAULT_PROFILE_AVATAR]: avatarOriginalMd5}])}).then(_fun61040, _fun61041);
|
|
}
|
|
|
|
function clearErrors() { // fn#61044, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3257, offset: 0x0171904f, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_CLEAR_ERRORS'});
|
|
}
|
|
|
|
function resetPendingAccountChanges() { // fn#61045, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3372, offset: 0x01719080, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_PENDING_ACCOUNT_CHANGES'});
|
|
}
|
|
|
|
function resetAllPending() { // fn#61046, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3508, offset: 0x017190b1, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_PENDING_CHANGES'});
|
|
}
|
|
|
|
function resetAllTryItOut() { // fn#61047, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3626, offset: 0x017190e2, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_TRY_IT_OUT_CHANGES'});
|
|
}
|
|
|
|
function resetAndCloseUserProfileForm() { // fn#61048, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3760, offset: 0x01719113, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_AND_CLOSE_FORM'});
|
|
}
|
|
|
|
function resetPendingLegacyUsernameDisabled() { // fn#61049, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:3908, offset: 0x01719144, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_PENDING_LEGACY_USERNAME_DISABLED'});
|
|
}
|
|
|
|
function resetPendingPrimaryGuildChanges() { // fn#61050, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:4077, offset: 0x01719175, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_RESET_PENDING_PRIMARY_GUILD_CHANGES'});
|
|
}
|
|
|
|
function updateAccount(a0) { // fn#61051, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:4222, offset: 0x017191a6, size: 57 bytes, params: 2, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_SETTINGS_MODAL_UPDATE_ACCOUNT',
|
|
settings: a0});
|
|
}
|
|
|
|
function resetAccount() { // fn#61052, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:4337, offset: 0x017191df, size: 49 bytes, params: 1, frame: 13
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_SETTINGS_MODAL_RESET'});
|
|
}
|
|
|
|
function saveAccountChanges({username, email, emailToken, password, avatar, newPassword, discriminator}, {close}) { // fn#61053, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:4436, offset: 0x01719210, size: 417 bytes, params: 3, frame: 20
|
|
var object2;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_SETTINGS_MODAL_SUBMIT'});
|
|
object2 = {username: username, email: email, email_token: emailToken, password: password, avatar: avatar,
|
|
new_password: newPassword};
|
|
object2.discriminator = discriminator != null ? discriminator === '' ? undefined : discriminator : undefined;
|
|
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
|
|
const value3 = Storage.get(DEVICE_TOKEN);
|
|
const devicePushProvider = getDevicePushProvider();
|
|
if (devicePushProvider != null && value3 != null) {
|
|
object2.push_provider = devicePushProvider;
|
|
object2.push_token = value3;
|
|
}
|
|
const value7 = Storage.get(DEVICE_VOIP_TOKEN);
|
|
if (DEVICE_PUSH_VOIP_PROVIDER != null && value7 != null) {
|
|
object2.push_voip_provider = DEVICE_PUSH_VOIP_PROVIDER;
|
|
object2.push_voip_token = value7;
|
|
}
|
|
const HTTP = (require(507) /* metro dependency 507: HTTPUtils */).HTTP;
|
|
const patch = HTTP.patch;
|
|
const ME = Endpoints.ME;
|
|
return Reflect.apply(patch, HTTP, [{url: ME, oldFormErrors: true, body: object2,
|
|
rejectWithError: false}]).then(_fun61054, _fun61055);
|
|
}
|
|
|
|
async function _fun61034(a0) { // fn#61034, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:426, offset: 0x01718a06, size: 365 bytes, params: 2, frame: 21
|
|
let value = a1;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
const value4 = undefined;
|
|
const r7 = value !== value4 ? value : {};
|
|
await value4;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
const HTTP = env2_0(env2_2[4]).HTTP;
|
|
const patch = HTTP.patch;
|
|
const ME = env2_4.ME;
|
|
await Reflect.apply(patch, HTTP, [{url: ME, oldFormErrors: true, body: a0, headers: r7.headers,
|
|
rejectWithError: false}]);
|
|
const value6 = undefined;
|
|
if (true) {
|
|
var body = value6.body;
|
|
var token = body.token;
|
|
if (token) {
|
|
token = body.token;
|
|
delete body.token;
|
|
env2_1(env2_2[3]).dispatch({type: 'UPDATE_TOKEN', token: token, userId: body.id});
|
|
if ((a0 == null ? value4 : a0.password) != null && (a0 == null ? value4 : a0.new_password) != null) {
|
|
env2_1(env2_2[3]).dispatch({type: 'PASSWORD_UPDATED', userId: body.id});
|
|
}
|
|
}
|
|
value = env2_1(env2_2[3]);
|
|
value.dispatch({type: 'CURRENT_USER_UPDATE', user: body});
|
|
}
|
|
return value6;
|
|
}
|
|
|
|
function _fun61040(a0) { // fn#61040, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:2739, offset: 0x01718eff, size: 118 bytes, params: 2, frame: 15
|
|
const value = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_SUBMIT_SUCCESS'});
|
|
if (!(avatar == null && avatarId == null)) {
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'RECENT_AVATARS_UPDATE'});
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
function _fun61041(a0) { // fn#61041, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:2879, offset: 0x01718f75, size: 62 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_PROFILE_SETTINGS_SUBMIT_FAILURE',
|
|
errors: a0.body});
|
|
return a0;
|
|
}
|
|
|
|
function _fun61054(a0) { // fn#61054, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:5007, offset: 0x017193b1, size: 370 bytes, params: 2, frame: 20
|
|
const body = a0.body;
|
|
const token = body.token;
|
|
delete body.token;
|
|
const value = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'UPDATE_TOKEN', token: token,
|
|
userId: body.id});
|
|
const defaultImport2 = importDefault(694) /* metro dependency 694: Dispatcher */;
|
|
defaultImport2.dispatch({type: 'CURRENT_USER_UPDATE', user: body});
|
|
if (avatar !== undefined) {
|
|
(require(7621) /* metro dependency 7621: trackUserAvatarUpdated */).trackUserAvatarUpdated({avatarHash: body.avatar});
|
|
}
|
|
if (newPassword != null) {
|
|
defaultImport2.dispatch({type: 'USER_PASSWORD_UPDATE', user: body, newPassword: newPassword});
|
|
}
|
|
if (password != null && newPassword != null) {
|
|
defaultImport2.dispatch({type: 'PASSWORD_UPDATED', userId: body.id});
|
|
}
|
|
if (close) {
|
|
(importDefault(7508) /* metro dependency 7508: UserSettingsModalActionCreators */).close();
|
|
} else {
|
|
defaultImport2.dispatch({type: 'USER_SETTINGS_MODAL_SUBMIT_COMPLETE'});
|
|
}
|
|
return a0;
|
|
}
|
|
|
|
function _fun61055(a0) { // fn#61055, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7798:5476, offset: 0x01719523, size: 62 bytes, params: 2, frame: 13
|
|
const value = environment.__proto__;
|
|
(importDefault(694) /* metro dependency 694: Dispatcher */).dispatch({type: 'USER_SETTINGS_MODAL_SUBMIT_FAILURE',
|
|
errors: a0.body});
|
|
return a0;
|
|
}
|
|
|