/* Metro module 11317; source: modules/messages/native/ChatBanner.tsx; dependencies: [31, 27, 4257, 4605, 11318, 661, 33, 4501, 697, 11319, 11320, 566, 21, 1357, 683, 4863, 6609, 4573, 1244, 4578, 6860, 7153, 5278, 5097, 8222, 2] */
import AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */
import MobileVisualRefreshExperiment from '../../themes/experiments/MobileVisualRefreshExperiment.tsx'; /* Metro dependency 1357 */
import GatewayConnectionStore from '../../gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */
import ReadStateStore from '../../../stores/ReadStateStore.tsx'; /* Metro dependency 4605 */
import ThreadActionCreators from '../../threads/ThreadActionCreators.tsx'; /* Metro dependency 7153 */
import UseShowChannelOptInNotice from '../../opt_in_channels/useShowChannelOptInNotice.tsx'; /* Metro dependency 11319 */
import UseAllowedChatOverlays from '../useAllowedChatOverlays.tsx'; /* Metro dependency 11320 */
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 FluxModule from '../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
import * as IndexNativeModule from '../../../intl/index.native.tsx'; /* Metro dependency 1244 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ButtonNativeModule from '../../../design/components/Button/native/Button.native.tsx'; /* Metro dependency 4578 */
import * as AppAnalyticsUtilsModule from '../../app_analytics/AppAnalyticsUtils.tsx'; /* Metro dependency 4863 */
import * as PressablesModule from '../../../design/void/Pressables/native/Pressables.tsx'; /* Metro dependency 5278 */
import * as OptInChannelsActionCreatorsModule from '../../opt_in_channels/OptInChannelsActionCreators.tsx'; /* Metro dependency 6609 */
import * as ThreadHooksModule from '../../threads/ThreadHooks.tsx'; /* Metro dependency 6860 */
import * as ChatOverlayConstantsModule from '../ChatOverlayConstants.tsx'; /* Metro dependency 11318 */
function _fun86326(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#86326, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:6, offset: 0x01f90ec2, size: 713 bytes, params: 8, frame: 26
const env0_0 = require;
const OptInChannelBanner2 = OptInChannelBanner;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const StyleSheet = value.StyleSheet;
const env0_4 = value.View;
value = require(661) /* metro dependency 661: Constants */;
const env0_8 = value.AnalyticsObjectTypes;
const env0_9 = value.AnalyticsObjects;
const env0_10 = value.AnalyticEvents;
const env0_11 = value.AnalyticsSections;
value = require(33) /* metro dependency 33 */;
const env0_12 = value.jsx;
const env0_13 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
object.threadBannerContainer = {'alignSelf': 'stretch', 'minHeight': 60, 'flexDirection': 'row',
'paddingHorizontal': 16, 'paddingVertical': 12, 'alignItems': 'center', 'flexGrow': 0, 'zIndex': 100,
backgroundColor: BACKGROUND_SURFACE_HIGH};
object.threadBannerTitle = {'flex': 1, 'lineHeight': 18};
object.threadBannerButton = {'flexGrow': 0, 'paddingVertical': 7, 'paddingHorizontal': 16, 'marginLeft': 16};
const BACKGROUND_BRAND = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BRAND;
object.newMessageBar = {'backgroundColor': null, 'flexDirection': 'row', 'justifyContent': 'center',
'alignItems': 'center', 'overflow': 'hidden', 'zIndex': 100, 'minHeight': 45, backgroundColor: BACKGROUND_BRAND};
object.newMessageBarTextContainer = {'flex': 1, 'paddingLeft': 16, 'paddingVertical': 10};
object.newMessageBarCloseButton = {paddingHorizontal: 12};
const object5 = {'flexDirection': 'row', 'justifyContent': 'space-between', 'alignItems': 'center',
'overflow': 'hidden', 'padding': 8, 'paddingLeft': 16, 'paddingRight': 16, 'zIndex': 100};
const CHAT_BANNER_BG = (importDefault(697) /* metro dependency 697: native */).colors.CHAT_BANNER_BG;
object5.backgroundColor = CHAT_BANNER_BG;
object5.borderBottomWidth = StyleSheet.hairlineWidth;
let CHAT_BORDER = (importDefault(697) /* metro dependency 697: native */).colors.CHAT_BORDER;
object5.borderBottomColor = CHAT_BORDER;
object.optInChannelBannerContainer = object5;
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
object.optInChannelBannerLegacyBorder = {borderBottomWidth: 1, borderBottomColor: BORDER_SUBTLE};
const object6 = {};
object6.borderTopWidth = StyleSheet.hairlineWidth;
CHAT_BORDER = (importDefault(697) /* metro dependency 697: native */).colors.CHAT_BORDER;
object6.borderTopColor = CHAT_BORDER;
object.topBorder = object6;
object.optInChannelBannerText = {flex: 1};
object.optInChannelBannerButtonContainer = {'flexShrink': 0, 'marginLeft': 8};
const env0_14 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/messages/native/ChatBanner.tsx');
exports.default = ChatBanner;
exports.OptInChannelBanner = OptInChannelBanner2;
function OptInChannelBanner({channel, topBorder}) { // fn#86327, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:1536, offset: 0x01f9118b, size: 439 bytes, params: 2, frame: 25
const styles = useStyles();
const value2 = (MobileVisualRefreshExperiment)('OptInChannelBanner');
ReactModule.useEffect(_fun86328, [channel]);
const value3 = ReactModule.useCallback(_fun86329, [channel]);
const items2 = [styles.optInChannelBannerContainer];
items2[1] = value2 ? null : styles.optInChannelBannerLegacyBorder;
topBorder = topBorder ? styles.topBorder : null;
items2[2] = topBorder;
const Text = (TextModule).Text;
const intl = (IndexNativeModule).intl;
const text = (
{intl.string((IndexNativeModule).t.iOWmmB)}
);
const Button = (ButtonNativeModule).Button;
return (
{text}
);
function _fun86328() { // fn#86328, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:1645, offset: 0x01f91342, size: 143 bytes, params: 1, frame: 21
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_VIEWED = AnalyticEvents.CHANNEL_BANNER_VIEWED;
const object = {};
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const collectGuildAnalyticsMetadata = value.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, value, [Reflect.apply(getGuildId,
channelBinding, [])]), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, appAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), value);
object['banner_type'] = 'channel_opt_in';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_VIEWED, object]);
}
function _fun86329() { // fn#86329, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:1854, offset: 0x01f913d1, size: 215 bytes, params: 1, frame: 24
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_CTA_CLICKED = AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED;
const object = {};
const collectGuildAnalyticsMetadata = AppAnalyticsUtilsModule.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, AppAnalyticsUtilsModule,
[Reflect.apply(getGuildId, channelBinding, [])]), undefined);
copyDataProperties(object, AppAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), undefined);
object['banner_type'] = 'channel_opt_in';
object['cta_type'] = 'add channel';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_CTA_CLICKED, object]);
const setOptInChannel = OptInChannelsActionCreatorsModule.setOptInChannel;
const guild_id = channelBinding.guild_id;
const id = channelBinding.id;
const CHANNEL = AnalyticsSections.CHANNEL;
Reflect.apply(setOptInChannel, OptInChannelsActionCreatorsModule, [guild_id, id, true, {section: CHANNEL}]);
}
}
function ArchivedLockedThreadChatBanner({channel}) { // fn#86330, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:2542, offset: 0x01f914a8, size: 420 bytes, params: 2, frame: 27
const styles = useStyles();
ReactModule.useEffect(_fun86331, [channel]);
const value2 = (ThreadHooksModule).useCanUnarchiveThread(channel);
const Text = (TextModule).Text;
const isForumPost2 = channel.isForumPost();
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
return (
{isForumPost2 ? Reflect.apply(string, intl, [t['833FDn']]) : Reflect.apply(string, intl, [t.rEeodK])}
{value2 && {((Button) => )((require(4578) /* metro dependency 4578: ButtonNative */).Button)}}
);
function _fun86331() { // fn#86331, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:2618, offset: 0x01f9164c, size: 141 bytes, params: 1, frame: 21
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_VIEWED = AnalyticEvents.CHANNEL_BANNER_VIEWED;
const object = {};
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const collectGuildAnalyticsMetadata = value.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, value, [Reflect.apply(getGuildId,
channelBinding, [])]), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, appAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), value);
object['banner_type'] = 'thread';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_VIEWED, object]);
}
function ArchivedLockedThreadChatBannerOnPress() { // fn#86332, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:3250, owner: ArchivedLockedThreadChatBanner.onPress, offset: 0x01f916d9, size: 182 bytes, params: 1, frame: 22
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_CTA_CLICKED = AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED;
const object = {};
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const collectGuildAnalyticsMetadata = value.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, value, [Reflect.apply(getGuildId,
channelBinding, [])]), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, appAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), value);
object['banner_type'] = 'thread';
object['cta_type'] = 'unarchive';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_CTA_CLICKED, object]);
(ThreadActionCreators).unarchiveThread(channelBinding, false);
}
}
function LockedThreadChatBanner({channel}) { // fn#86333, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:3488, offset: 0x01f9178f, size: 420 bytes, params: 2, frame: 27
const styles = useStyles();
ReactModule.useEffect(_fun86334, [channel]);
const value2 = (ThreadHooksModule).useIsThreadModerator(channel);
const Text = (TextModule).Text;
const isForumPost2 = channel.isForumPost();
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
return (
{isForumPost2 ? Reflect.apply(string, intl, [t.E7oO8u]) : Reflect.apply(string, intl, [t['V/JF2N']])}
{value2 && {((Button) => )((require(4578) /* metro dependency 4578: ButtonNative */).Button)}}
);
function _fun86334() { // fn#86334, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:3556, offset: 0x01f9164c, size: 141 bytes, params: 1, frame: 21
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_VIEWED = AnalyticEvents.CHANNEL_BANNER_VIEWED;
const object = {};
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const collectGuildAnalyticsMetadata = value.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, value, [Reflect.apply(getGuildId,
channelBinding, [])]), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, appAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), value);
object['banner_type'] = 'thread';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_VIEWED, object]);
}
function LockedThreadChatBannerOnPress() { // fn#86335, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:4184, owner: LockedThreadChatBanner.onPress, offset: 0x01f91933, size: 177 bytes, params: 1, frame: 22
let value = environment.__proto__;
const defaultImport = AnalyticsUtils;
const track = defaultImport.track;
const CHANNEL_BANNER_CTA_CLICKED = AnalyticEvents.CHANNEL_BANNER_CTA_CLICKED;
const object = {};
value = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
const collectGuildAnalyticsMetadata = value.collectGuildAnalyticsMetadata;
const channelBinding = channel;
const getGuildId = channelBinding.getGuildId;
copyDataProperties(object, Reflect.apply(collectGuildAnalyticsMetadata, value, [Reflect.apply(getGuildId,
channelBinding, [])]), value);
const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */;
copyDataProperties(object, appAnalyticsUtilsModule.collectChannelAnalyticsMetadata(channelBinding), value);
object['banner_type'] = 'thread';
object['cta_type'] = 'unlock';
Reflect.apply(track, defaultImport, [CHANNEL_BANNER_CTA_CLICKED, object]);
(ThreadActionCreators).unlockThread(channelBinding);
}
}
function NewMessagesChatBar({channel, unreadCount, oldestUnreadTimestamp, handleScrollToNewMessages}) { // fn#86336, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:4413, offset: 0x01f919e4, size: 555 bytes, params: 2, frame: 36
var r23;
var r1;
var r0;
var readStateStoreBinding;
const t = (IndexNativeModule).t;
const PressableOpacity = (PressablesModule).PressableOpacity;
const intl = (IndexNativeModule).intl;
var items2;
const styles = useStyles();
const useStateFromStores = FluxModule.useStateFromStores;
if (Reflect.apply(useStateFromStores, FluxModule, [[GatewayConnectionStore], function() {
return GatewayConnectionStore.isConnected();
}, []])) {
if (unreadCount <= 0) {
r1 = null;
} else {
readStateStoreBinding = ReadStateStore;
r23 = readStateStoreBinding.isEstimated(channel.id) ? t.wvtbbG : t['BctFH/'];
var viewBindingProps = {style: styles.newMessageBar};
items2 = [
{((Text) => {intl.format(r23,
{count: unreadCount,
timestamp: oldestUnreadTimestamp})})((require(4573) /* metro dependency 4573: Text */).Text)}
,
];
items2[1] = (
{((XSmallBoldIcon) => )((require(8222) /* metro dependency 8222: XSmallBoldIcon */).XSmallBoldIcon)}
);
r1 = (
{items2}
);
}
r0 = r1;
} else {
r0 = null;
}
return r0;
}
function ChatBanner({channel, handleScrollToNewMessages}) { // fn#86339, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:5381, offset: 0x01f91c71, size: 330 bytes, params: 2, frame: 22
const value2 = (UseShowChannelOptInNotice)(channel);
const value3 = (UseAllowedChatOverlays)();
const value4 = (FluxModule).useStateFromStoresObject([ReadStateStore], _fun86340,
[channel.id]);
const unreadCount = value4.unreadCount;
return (
channel.isArchivedLockedThread()
? (
)
: (
channel.isLockedThread()
? (
)
: (
unreadCount > 0 && value3.includes(ChatOverlays.NEW_MESSAGES)
? (
)
: (
value2 && value3.includes(ChatOverlays.OPT_IN_CHANNEL)
? (
)
: null
)
)
)
);
function _fun86340() { // fn#86340, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11503:5513, offset: 0x01f91dbb, size: 114 bytes, params: 1, frame: 15
var r1;
let value = environment.__proto__;
const readStateStoreBinding = ReadStateStore;
const getOldestUnreadTimestamp = readStateStoreBinding.getOldestUnreadTimestamp;
const channelBinding = channel;
const value3 = Reflect.apply(getOldestUnreadTimestamp, readStateStoreBinding, [channelBinding.id]);
const object = {};
object.unreadCount = ReadStateStore.getUnreadCount(channelBinding.id);
if (value3 !== 0) {
r1 = value3;
} else {
value = importDefault(21) /* metro dependency 21: SnowflakeUtils */;
value = value.extractTimestamp(channel.id);
r1 = value;
}
object.oldestUnreadTimestamp = r1;
return object;
}
}
}
global.__d(_fun86326, 11317, [31, 27, 4257, 4605, 11318, 661, 33, 4501, 697, 11319, 11320, 566, 21, 1357, 683, 4863,
6609, 4573, 1244, 4578, 6860, 7153, 5278, 5097, 8222,
2]) /* metro module 11317, dependencies: [31, 27, 4257, 4605, 11318, 661, 33, 4501, 697, 11319, 11320, 566, 21, 1357, 683, 4863, 6609, 4573, 1244, 4578, 6860, 7153, 5278, 5097, 8222, 2] */;