Files
discord-decomp/sources/modules/chat/native/ChatLoadingIndicator.tsx
T
2026-07-27 16:20:00 +03:00

260 lines
14 KiB
TypeScript

/* Metro module 9715; source: modules/chat/native/ChatLoadingIndicator.tsx; dependencies: [57, 31, 27, 4502, 4257, 4814, 1934, 1878, 7030, 661, 33, 4501, 697, 4496, 4596, 1962, 566, 4573, 9716, 4017, 4504, 1244, 5278, 2] */
function _fun76326(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#76326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:6, offset: 0x01dcae41, size: 492 bytes, params: 8, frame: 23
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(57) /* metro dependency 57 */;
const value = importAll(31) /* metro dependency 31 */;
const env0_5 = (require(27) /* metro dependency 27 */).View;
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
const gatewayConnectionStore = importDefault(4257) /* metro dependency 4257: GatewayConnectionStore */;
const messageStore = importDefault(4814) /* metro dependency 4814: MessageStore */;
const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */;
const userStore = importDefault(1878) /* metro dependency 1878: UserStore */;
const appStateStore = importDefault(7030) /* metro dependency 7030: AppStateStore */;
const env0_12 = (require(661) /* metro dependency 661: Constants */).AppStates;
const value2 = require(33) /* metro dependency 33 */;
const env0_13 = value2.jsx;
const env0_14 = value2.jsxs;
const env0_15 = value2.Fragment;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
const object3 = {'height': 8, 'width': 8};
object3.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object3.backgroundColor = BACKGROUND_BRAND;
const env0_16 = Reflect.apply(createStyles, createStylesModule, [{container: {'flexDirection': 'row',
'alignItems': 'center', 'gap': 4}, pulse: object3}]);
const env0_18 = value.memo(_fun76331);
object = {code: 'function ChatLoadingIndicatorTsx1(){const{useReducedMotion,withRepeat,withSequence,withTiming,Easing}=this.__closure;if(useReducedMotion){return{transform:[]};}return{transform:[{scale:withRepeat(withSequence(withTiming(1,{duration:0}),withTiming(0.5,{duration:1500,easing:Easing.bezier(0.4,0,0.2,1)}),withTiming(1,{duration:1500,easing:Easing.bezier(0.4,0,0.2,1)})),-1)}]};}'};
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/chat/native/ChatLoadingIndicator.tsx');
exports.useShouldChannelShowLoadingIndicator = useShouldChannelShowLoadingIndicator;
exports.ChannelHeaderLoadingIndicator = ChannelHeaderLoadingIndicator;
}
function openLoadingIndicatorDebugBody() { // fn#76327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:475, offset: 0x01dcb02d, size: 121 bytes, params: 1, frame: 13
var value;
const currentUser = UserStore.getCurrentUser();
let r1 = currentUser != null && currentUser.isStaff();
r1 = !r1 ? currentUser != null && currentUser.isStaffPersonal() : r1;
if (r1) {
value = importDefault(4496) /* metro dependency 4496: AlertActionCreators */;
value.openLazy({importer: importer_76328, isDismissable: true});
}
}
function _fun76331() { // fn#76331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:731, offset: 0x01dcb145, size: 247 bytes, params: 1, frame: 22
const {messagesCached, messagesReady,
connected} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([MessageStore,
GatewayConnectionStore, SelectedChannelStore], _fun76332);
const closure = renderField;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const items2 = [closure('messages.cached', messagesCached, false), '\n', closure('messages.ready', messagesReady,
true), '\n', closure('connected', connected, true), '\n'];
let r6 = messagesCached || !messagesReady;
r6 = !r6 ? !connected : r6;
items2[6] = closure('should show chat indicator', r6);
return (
<Text variant="text-md/normal" color="text-default">
{items2}
</Text>
);
}
function useShouldChannelShowLoadingIndicator(a0) { // fn#76334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2145, offset: 0x01dcb3a0, size: 208 bytes, params: 2, frame: 18
const env0_0 = a0;
const ChatLoadingIndicatorExperiment = (require(9716) /* metro dependency 9716: ChatLoadingIndicatorExperiment */).ChatLoadingIndicatorExperiment;
const useConfig = ChatLoadingIndicatorExperiment.useConfig;
const env0_1 = Reflect.apply(useConfig, ChatLoadingIndicatorExperiment,
[{location: 'ChatLoadingIndicatorGuard'}]).enabled;
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([MessageStore,
GatewayConnectionStore, AppStateStore], _fun76335);
const binding = env0_4;
const value = env0_3(binding.useState(false), 2);
const property = value[0];
var env0_3 = value[1];
binding.useEffect(_fun76336, [value2]);
return property;
}
function ChannelHeaderLoadingIndicator() { // fn#76339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2670, offset: 0x01dcb52f, size: 495 bytes, params: 1, frame: 24
var object2;
const styles = useStyles();
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
function() {
return AccessibilityStore.useReducedMotion;
});
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], _fun76341);
const reanimatedRexportModule = require(4017) /* metro dependency 4017: ReanimatedRexport */;
const useAnimatedStyle = reanimatedRexportModule.useAnimatedStyle;
const closure = ChannelHeaderLoadingIndicatorT;
object2 = {useReducedMotion: useReducedMotion};
object2.withRepeat = reanimatedRexportModule.withRepeat;
object2.withSequence = reanimatedRexportModule.withSequence;
object2.withTiming = (require(4504) /* metro dependency 4504: timing */).withTiming;
const Easing = reanimatedRexportModule.Easing;
object2.Easing = Easing;
closure.__closure = object2;
closure.__workletHash = 17454673879926;
closure.__initData = env0_19;
const value3 = Reflect.apply(useAnimatedStyle, reanimatedRexportModule, [closure]);
const View2 = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const view = <View2 style={[styles.pulse, value3]} />;
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const JwIJMV = (require(1244) /* metro dependency 1244: indexNative */).t.JwIJMV;
const view2 = <View style={styles.container}>{view}<Text variant="text-xs/medium" color="text-muted">{Reflect.apply(string,
intl, [JwIJMV])}</Text></View>;
if (value2) {
const PressableOpacity = (require(5278) /* metro dependency 5278: Pressables */).PressableOpacity;
return (
<PressableOpacity onPress={openLoadingIndicatorDebugBody}>
{view2}
</PressableOpacity>
);
} else {
return view2;
}
}
function openLoadingIndicatorDebugBodyImporter() { // fn#76328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:587, owner: openLoadingIndicatorDebugBody.importer, offset: 0x01dcb0a6, size: 64 bytes, params: 1, frame: 13
var environment;
let value = environment.__proto__;
value = require(dependencyMap[15]);
value = value(dependencyMap[14], dependencyMap.paths);
return value.then(function({default: env0_0}) {
return _fun76330;
});
}
function _fun76332() { // fn#76332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:791, offset: 0x01dcb23c, size: 104 bytes, params: 1, frame: 12
var object2;
let value = environment.__proto__;
const channelId = SelectedChannelStore.getChannelId();
const isConnected2 = GatewayConnectionStore.isConnected();
if (channelId == null) {
object2 = {'messagesCached': false, 'messagesReady': false};
} else {
value = MessageStore.getMessages(channelId);
object2 = {};
object2.messagesCached = value.cached;
object2.messagesReady = value.ready;
}
object2.connected = isConnected2;
return object2;
}
function renderField(a0, a1, a2) { // fn#76333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:1058, offset: 0x01dcb2a4, size: 252 bytes, params: 4, frame: 24
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const value = environment.__proto__;
const jsxRuntimeEnv1_15Binding = jsxRuntimeEnv1_15;
const items2 = [a0, ':', ' '];
const r10 = a1 ? 'text-feedback-positive' : 'text-feedback-critical';
const value4 = 'false';
items2[3] = <Text variant="text-md/normal" color={r10}>{a1 ? 'true' : value4}</Text>;
const value6 = null;
items2[4] = value6 != a2 ? a1 === a2 ? value6 : <Text variant="text-md/normal" color="text-muted">{' '}{'(should be '}{a2 ? 'true' : value4}{' to hide loading indicator)'}</Text> : value6;
return (
<>
{items2}
</>
);
}
function _fun76335() { // fn#76335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2337, offset: 0x01dcb470, size: 122 bytes, params: 1, frame: 12
var r0;
var value2;
var isConnected2;
var messages;
if (enabled) {
if (env0_0 == null) {
return false;
}
value2 = environment.__proto__;
if (AppStateStore.getState() !== AppStates.ACTIVE) {
return false;
}
messages = MessageStore.getMessages(env0_0);
isConnected2 = GatewayConnectionStore.isConnected();
r0 = messages.cached || !messages.ready;
r0 = !r0 ? !isConnected2 : r0;
return r0;
}
return false;
}
function _fun76336() { // fn#76336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2547, offset: 0x01dcb4ea, size: 69 bytes, params: 1, frame: 14
if (env0_2) {
var env0_0 = global.setTimeout(_fun76337, 3000);
return _fun76338;
}
env0_3(false);
}
function _fun76341() { // fn#76341, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2818, offset: 0x01dcb71e, size: 64 bytes, params: 1, frame: 12
var r1;
let value = environment.__proto__;
value = UserStore.getCurrentUser();
const value2 = undefined;
let r0 = value == null ? value2 : value.isStaff();
if (!r0) {
if (value == null) {
r1 = value2;
} else {
value = value.isStaffPersonal();
r1 = value;
}
r0 = r1;
}
return r0;
}
function ChannelHeaderLoadingIndicatorT() { // fn#76342, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2956, owner: ChannelHeaderLoadingIndicator.t, offset: 0x01dcb75e, size: 321 bytes, params: 1, frame: 33
var withRepeat;
var moduleValue;
var withSequence;
var withTiming;
var value2;
var moduleValue3;
var object2;
const Easing = (require(4017) /* metro dependency 4017: ReanimatedRexport */).Easing;
var value3;
var moduleValue4;
var object3;
var value;
const object6 = {};
if (useReducedMotion) {
object6.transform = [];
} else {
value = environment.__proto__;
value = require(4017) /* metro dependency 4017: ReanimatedRexport */;
withRepeat = value.withRepeat;
moduleValue = require(4017) /* metro dependency 4017: ReanimatedRexport */;
withSequence = moduleValue.withSequence;
value2 = (require(4504) /* metro dependency 4504: timing */).withTiming(1, {duration: 0});
moduleValue3 = require(4504) /* metro dependency 4504: timing */;
withTiming = moduleValue3.withTiming;
object2 = {duration: 1500};
object2.easing = Easing.bezier(0.4, 0, 0.2, 1);
value3 = Reflect.apply(withTiming, moduleValue3, [0.5, object2]);
moduleValue4 = require(4504) /* metro dependency 4504: timing */;
withTiming = moduleValue4.withTiming;
object3 = {duration: 1500};
object3.easing = Easing.bezier(0.4, 0, 0.2, 1);
object6.transform = [{scale: Reflect.apply(withRepeat, value, [Reflect.apply(withSequence, moduleValue, [value2,
value3, Reflect.apply(withTiming, moduleValue4, [1, object3])]), -1])}];
}
return object6;
}
function _fun76329({default: env0_0}) { // fn#76329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:621, offset: 0x01dcb0e6, size: 23 bytes, params: 2, frame: 2
return _fun76330;
}
function _fun76330(a0) { // fn#76330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:636, offset: 0x01dcb0fd, size: 72 bytes, params: 2, frame: 15
const value = environment.__proto__.__proto__.__proto__;
return ((Component) => <Component {...a0} {...{['title']: 'Chat Loading indicator'}}>{((Component) => <Component />)(env3_18)}</Component>)(env0_0);
}