195 lines
11 KiB
TypeScript
195 lines
11 KiB
TypeScript
/* Metro module 11787; source: modules/messages/useShowConvoStarterInDM.tsx; dependencies: [31, 4621, 4814, 3793, 1878, 661, 1386, 11290, 566, 2] */
|
|
import UserStore from '../../stores/UserStore.tsx'; /* Metro dependency 1878 */
|
|
import RelationshipStore from '../../stores/RelationshipStore.tsx'; /* Metro dependency 3793 */
|
|
import MessageRequestStore from '../message_request/MessageRequestStore.tsx'; /* Metro dependency 4621 */
|
|
import MessageStore from '../../stores/MessageStore.tsx'; /* Metro dependency 4814 */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
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 ChannelConstantsModule from '../channel/ChannelConstants.tsx'; /* Metro dependency 1386 */
|
|
import * as UseStrangerDangerWarningModule from '../self_mod/stranger_danger/hooks/useStrangerDangerWarning.tsx'; /* Metro dependency 11290 */
|
|
|
|
function _fun90283(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#90283, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11973:6, offset: 0x02032dfe, size: 248 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/messages/useShowConvoStarterInDM.tsx');
|
|
exports.MAX_MESSAGES_ALLOWED_FOR_GREETING = 25;
|
|
exports.useShowConvoStarterInDM = useShowConvoStarterInDM;
|
|
function useShowConvoStarterInDM(a0) { // fn#90284, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11973:365, offset: 0x02032ef6, size: 285 bytes, params: 2, frame: 21
|
|
const env0_0 = a0;
|
|
const env0_1 = useRef(false);
|
|
const env0_2 = useRef(a0.id);
|
|
const r8 = a0.isDM() && !a0.isSystemDM() && !a0.rawRecipients.some(function(a0) {
|
|
return a0.bot;
|
|
});
|
|
const r6 = r8 ? a0.getRecipientId() : null;
|
|
const value6 = (UseStrangerDangerWarningModule).useStrangerDangerWarning(a0.id);
|
|
const hasFlag = a0.hasFlag;
|
|
const HAS_ONLY_SYSTEM_MESSAGES = ChannelFlags.HAS_ONLY_SYSTEM_MESSAGES;
|
|
return (FluxModule).useStateFromStores([MessageStore, MessageRequestStore,
|
|
RelationshipStore, UserStore], _fun90286, [value6, r8, a0.id, r6, Reflect.apply(hasFlag, a0,
|
|
[HAS_ONLY_SYSTEM_MESSAGES])]);
|
|
function _fun90286() { // fn#90286, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11973:640, offset: 0x02033013, size: 367 bytes, params: 1, frame: 14
|
|
var r4;
|
|
var r0;
|
|
var value2;
|
|
var messageRequestStoreBinding;
|
|
var isMessageRequest;
|
|
var user;
|
|
var messageStoreBinding;
|
|
var getMessages;
|
|
var value5;
|
|
var hasCurrentUserSentWaveBlockingMessage;
|
|
var hasCurrentUserSentWaveBlockingMessage2;
|
|
const current = env0_2.current;
|
|
let id = env0_0.id;
|
|
if (current !== id) {
|
|
env0_1.current = false;
|
|
env0_2.current = env0_0.id;
|
|
}
|
|
if (env0_5 == null) {
|
|
if (env0_3) {
|
|
value2 = environment.__proto__;
|
|
messageRequestStoreBinding = MessageRequestStore;
|
|
isMessageRequest = messageRequestStoreBinding.isMessageRequest;
|
|
id = env0_0.id;
|
|
if (Reflect.apply(isMessageRequest, messageRequestStoreBinding, [id])) {
|
|
return false;
|
|
}
|
|
if (env0_4 == null) {
|
|
if (env0_4 == null) {
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
user = UserStore.getUser(env0_4);
|
|
if (user == null) {
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
if (user.hasFlag(UserFlags.PROVISIONAL_ACCOUNT)) {
|
|
return false;
|
|
}
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
if (RelationshipStore.getRelationshipType(env0_4) === RelationshipTypes.BLOCKED) {
|
|
return false;
|
|
}
|
|
if (env0_4 == null) {
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
user = UserStore.getUser(env0_4);
|
|
if (user == null) {
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
if (user.hasFlag(UserFlags.PROVISIONAL_ACCOUNT)) {
|
|
return false;
|
|
}
|
|
messageStoreBinding = MessageStore;
|
|
getMessages = messageStoreBinding.getMessages;
|
|
id = env0_0.id;
|
|
value5 = Reflect.apply(getMessages, messageStoreBinding, [id]);
|
|
r4 = !value5.hasMoreBefore && !value5.hasMoreAfter;
|
|
r4 = r4 && value5.length < 25;
|
|
messageStoreBinding = MessageStore;
|
|
hasCurrentUserSentWaveBlockingMessage = messageStoreBinding.hasCurrentUserSentWaveBlockingMessage;
|
|
id = env0_0.id;
|
|
hasCurrentUserSentWaveBlockingMessage2 = Reflect.apply(hasCurrentUserSentWaveBlockingMessage,
|
|
messageStoreBinding,
|
|
[id]);
|
|
r0 = value5.ready || env0_1.current;
|
|
r0 = r0 && (env0_6 || r4);
|
|
r0 = r0 && !hasCurrentUserSentWaveBlockingMessage2;
|
|
env0_1.current = r0;
|
|
return r0;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun90283, 11787, [31, 4621, 4814, 3793, 1878, 661, 1386, 11290, 566,
|
|
2]) /* metro module 11787, dependencies: [31, 4621, 4814, 3793, 1878, 661, 1386, 11290, 566, 2] */;
|