Files
discord-decomp/sources/stores/native/ShareStore.tsx
T
2026-07-28 01:06:53 +03:00

158 lines
8.0 KiB
TypeScript

/* Metro module 12950; source: stores/native/ShareStore.tsx; dependencies: [6, 7, 15, 17, 18, 27, 1226, 1379, 1867, 1934, 3969, 1878, 661, 1360, 480, 683, 566, 694, 2] */
import ClassCallCheck from '../../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
import CreateClass from '../../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
import PossibleConstructorReturn from '../../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
import Module00017 from '../../by-id/module-00017.js'; /* Metro dependency 17 */
import Inherits from '../../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
import Flux from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import AuthenticationStore from '../AuthenticationStore.tsx'; /* Metro dependency 1226 */
import ChannelStore from '../ChannelStore.tsx'; /* Metro dependency 1379 */
import GuildStore from '../GuildStore.tsx'; /* Metro dependency 1867 */
import UserStore from '../UserStore.tsx'; /* Metro dependency 1878 */
import SelectedChannelStore from '../SelectedChannelStore.tsx'; /* Metro dependency 1934 */
import SelectedGuildStore from '../SelectedGuildStore.tsx'; /* Metro dependency 3969 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ConstantsModule from '../../Constants.tsx'; /* Metro dependency 661 */
function _fun98646(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#98646, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13140:6, offset: 0x021b15d7, size: 475 bytes, params: 8, frame: 20
const env0_0 = require;
const closure = function(a0) {
env0_5 = a0.token;
return false;
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Store = (Flux).Store;
let value = _fun98651(Store);
value.displayName = 'ShareStore';
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */, {CHANNEL_SELECT: function(a0) {
env0_3 = a0.guildId;
env0_4 = a0.channelId;
return false;
}, LOGOUT: function() {
var ShareManager = NativeModules.ShareManager;
ShareManager.setSelectedChannel(null, null);
ShareManager = NativeModules.ShareManager;
ShareManager.setAuthenticationToken(null, importDefault(dependencyMap[15]).getSuperPropertiesBase64());
env0_5 = null;
return false;
}, REGISTER_SUCCESS: closure, LOGIN_SUCCESS: closure, UPDATE_TOKEN: closure, START_SESSION: function() {
env0_5 = AuthenticationStore.getToken();
return false;
}, APP_STATE_UPDATE: APP_STATE_UPDATE_98657});
(FileImportTrackerModule).fileFinishedImporting('stores/native/ShareStore.tsx');
exports.default = value;
function _isNativeReflectConstruct_98647() { // fn#98647, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13140:261, offset: 0x021b17b2, size: 98 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_98647_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun98651(a0) { // fn#98651, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13140:511, offset: 0x021b1828, size: 72 bytes, params: 2, frame: 15
const ShareStore2 = ShareStore;
Inherits(ShareStore2, a0);
return CreateClass(ShareStore2, [{key: 'initialize', value: function() {
this.waitFor(AuthenticationStore, ChannelStore, GuildStore, SelectedChannelStore, SelectedGuildStore,
UserStore);
}}]);
function ShareStore() { // fn#98652, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13140:523, offset: 0x021b1870, size: 113 bytes, params: 1, frame: 20
const value = environment.__proto__;
env1_6(this, ShareStore);
const value3 = env1_9(ShareStore);
return env1_8(this, _isNativeReflectConstruct_98647() ? global.Reflect.construct(value3, arguments,
env1_9(this).constructor) : value3.apply(this, arguments));
}
}
function APP_STATE_UPDATE_98657({state}) { // fn#98657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13140:1344, offset: 0x021b199a, size: 398 bytes, params: 2, frame: 22
var r6;
var r10;
var r5;
var value2;
var guild;
var JSON;
var stringify;
var channelStoreBinding;
var getChannel;
var selectedChannelStoreBinding;
var value5;
var object;
var recipients;
var value6;
var ShareManager;
var moduleValue;
var setAuthenticationToken;
var binding;
var defaultImport;
const INACTIVE = AppStates.INACTIVE;
if (state === INACTIVE) {
value2 = null;
if (value2 != env0_4) {
guild = GuildStore.getGuild(env0_3);
r6 = value2 != guild ? global.JSON.stringify(guild) : value2;
channelStoreBinding = ChannelStore;
getChannel = channelStoreBinding.getChannel;
selectedChannelStoreBinding = SelectedChannelStore;
value5 = Reflect.apply(getChannel, channelStoreBinding, [selectedChannelStoreBinding.getChannelId()]);
if (value2 != value5) {
JSON = global.JSON;
stringify = JSON.stringify;
object = {};
copyDataProperties(object, value5.toJS(), undefined);
recipients = value5.recipients;
r10 = value2 != recipients ? recipients : [];
value6 = r10.map(UserStore.getUser);
object['recipients'] = value6.filter((require(1360) /* metro dependency 1360: GlobalUtils */).isNotNullish);
r5 = Reflect.apply(stringify, JSON, [object]);
} else {
r5 = value2;
}
NativeModules.ShareManager.setSelectedChannel(r5, r6);
}
}
if (env0_5 != null) {
moduleValue = require(480) /* metro dependency 480: AnalyticsUtils */;
moduleValue.extendSuperProperties({client_app_state: state});
ShareManager = NativeModules.ShareManager;
setAuthenticationToken = ShareManager.setAuthenticationToken;
binding = env0_5;
defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */;
Reflect.apply(setAuthenticationToken, ShareManager, [binding, defaultImport.getSuperPropertiesBase64()]);
if (state !== AppStates.INACTIVE) {
}
}
return false;
}
}
global.__d(_fun98646, 12950, [6, 7, 15, 17, 18, 27, 1226, 1379, 1867, 1934, 3969, 1878, 661, 1360, 480, 683, 566,
694,
2]) /* metro module 12950, dependencies: [6, 7, 15, 17, 18, 27, 1226, 1379, 1867, 1934, 3969, 1878, 661, 1360, 480, 683, 566, 694, 2] */;