299 lines
17 KiB
TypeScript
299 lines
17 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] */
|
|
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
|
|
import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import SelectedChannelStore from '../../../stores/SelectedChannelStore.tsx'; /* Metro dependency 1934 */
|
|
import ReanimatedRexport from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import GatewayConnectionStore from '../../gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */
|
|
import AccessibilityStore from '../../a11y/AccessibilityStore.tsx'; /* Metro dependency 4502 */
|
|
import MessageStore from '../../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
|
|
import AppStateStore from '../../../stores/native/AppStateStore.tsx'; /* Metro dependency 7030 */
|
|
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 ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
|
|
import * as ReanimatedRexportModule from '../../reanimated/ReanimatedRexport.tsx'; /* Metro dependency 4017 */
|
|
import * as CreateStylesModule from '../../../design/components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
|
|
import * as ChatLoadingIndicatorExperimentModule from './ChatLoadingIndicatorExperiment.tsx'; /* Metro dependency 9716 */
|
|
|
|
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 createStyles = CreateStylesModule.createStyles;
|
|
const object2 = {'height': 8, 'width': 8};
|
|
object2.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
|
|
object2.backgroundColor = BACKGROUND_BRAND;
|
|
const env0_16 = Reflect.apply(createStyles, CreateStylesModule, [{container: {'flexDirection': 'row',
|
|
'alignItems': 'center', 'gap': 4}, pulse: object2}]);
|
|
const env0_18 = ReactModule.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)}]};}'};
|
|
(FileImportTrackerModule).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 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 _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);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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} = (FluxModule).useStateFromStoresObject([MessageStore,
|
|
GatewayConnectionStore, SelectedChannelStore], _fun76332);
|
|
const renderField2 = renderField;
|
|
const Text = (TextModule).Text;
|
|
const items2 = [renderField2('messages.cached', messagesCached, false), '\n', renderField2('messages.ready',
|
|
messagesReady, true), '\n', renderField2('connected', connected, true), '\n'];
|
|
let r6 = messagesCached || !messagesReady;
|
|
r6 = !r6 ? !connected : r6;
|
|
items2[6] = renderField2('should show chat indicator', r6);
|
|
return (
|
|
<Text variant="text-md/normal" color="text-default">
|
|
{items2}
|
|
</Text>
|
|
);
|
|
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 object;
|
|
let value = environment.__proto__;
|
|
const channelId = SelectedChannelStore.getChannelId();
|
|
const isConnected2 = GatewayConnectionStore.isConnected();
|
|
if (channelId == null) {
|
|
object = {'messagesCached': false, 'messagesReady': false};
|
|
} else {
|
|
value = MessageStore.getMessages(channelId);
|
|
object = {};
|
|
object.messagesCached = value.cached;
|
|
object.messagesReady = value.ready;
|
|
}
|
|
object.connected = isConnected2;
|
|
return object;
|
|
}
|
|
|
|
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 = (TextModule).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 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 = (ChatLoadingIndicatorExperimentModule).ChatLoadingIndicatorExperiment;
|
|
const useConfig = ChatLoadingIndicatorExperiment.useConfig;
|
|
const env0_1 = Reflect.apply(useConfig, ChatLoadingIndicatorExperiment,
|
|
[{location: 'ChatLoadingIndicatorGuard'}]).enabled;
|
|
const value2 = (FluxModule).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 _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 _fun76337() { // fn#76337, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2576, offset: 0x017112ca, size: 18 bytes, params: 1, frame: 11
|
|
env1_3(true);
|
|
}
|
|
|
|
function _fun76338() { // fn#76338, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9901:2600, offset: 0x00e59c84, size: 24 bytes, params: 1, frame: 11
|
|
global.clearTimeout(env0_0);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
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 useAnimatedStyle = ReanimatedRexportModule.useAnimatedStyle;
|
|
const ChannelHeaderLoadingIndicatorT2 = ChannelHeaderLoadingIndicatorT;
|
|
object = {useReducedMotion: useReducedMotion};
|
|
object.withRepeat = ReanimatedRexportModule.withRepeat;
|
|
object.withSequence = ReanimatedRexportModule.withSequence;
|
|
object.withTiming = (require(4504) /* metro dependency 4504: timing */).withTiming;
|
|
const Easing = ReanimatedRexportModule.Easing;
|
|
object.Easing = Easing;
|
|
ChannelHeaderLoadingIndicatorT2.__closure = object;
|
|
ChannelHeaderLoadingIndicatorT2.__workletHash = 17454673879926;
|
|
ChannelHeaderLoadingIndicatorT2.__initData = env0_19;
|
|
const value3 = Reflect.apply(useAnimatedStyle, ReanimatedRexportModule, [ChannelHeaderLoadingIndicatorT2]);
|
|
const View2 = (ReanimatedRexport).View;
|
|
const view = <View2 style={[styles.pulse, value3]} />;
|
|
const Text = (TextModule).Text;
|
|
const intl = (IndexNativeModule).intl;
|
|
const string = intl.string;
|
|
const JwIJMV = (IndexNativeModule).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 _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 object;
|
|
const Easing = (require(4017) /* metro dependency 4017: ReanimatedRexport */).Easing;
|
|
var value3;
|
|
var moduleValue4;
|
|
var object4;
|
|
var value;
|
|
const object5 = {};
|
|
if (useReducedMotion) {
|
|
object5.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;
|
|
object = {duration: 1500};
|
|
object.easing = Easing.bezier(0.4, 0, 0.2, 1);
|
|
value3 = Reflect.apply(withTiming, moduleValue3, [0.5, object]);
|
|
moduleValue4 = require(4504) /* metro dependency 4504: timing */;
|
|
withTiming = moduleValue4.withTiming;
|
|
object4 = {duration: 1500};
|
|
object4.easing = Easing.bezier(0.4, 0, 0.2, 1);
|
|
object5.transform = [{scale: Reflect.apply(withRepeat, value, [Reflect.apply(withSequence, moduleValue, [value2,
|
|
value3, Reflect.apply(withTiming, moduleValue4, [1, object4])]), -1])}];
|
|
}
|
|
return object5;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun76326, 9715, [57, 31, 27, 4502, 4257, 4814, 1934, 1878, 7030, 661, 33, 4501, 697, 4496, 4596, 1962,
|
|
566, 4573, 9716, 4017, 4504, 1244, 5278,
|
|
2]) /* metro module 9715, 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] */;
|