/* Metro module 14776; source: modules/notification_center/useNotificationCenterItemsLoader.tsx; dependencies: [5, 57, 31, 5215, 4623, 14775, 4865, 566, 14777, 5097, 8422, 2] */ import Module00005 from '../../by-id/module-00005.js'; /* Metro dependency 5 */ import Module00057 from '../../by-id/module-00057.js'; /* Metro dependency 57 */ import NotificationCenterItemsStore from './NotificationCenterItemsStore.tsx'; /* Metro dependency 4623 */ import RecentMentionsStore from '../recents/RecentMentionsStore.tsx'; /* Metro dependency 5215 */ import NotificationCenterStore from './NotificationCenterStore.tsx'; /* Metro dependency 14775 */ 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 ReadStateConstantsModule from '../read_states/ReadStateConstants.tsx'; /* Metro dependency 4865 */ import * as NotificationCenterItemsActionsModule from './NotificationCenterItemsActions.tsx'; /* Metro dependency 14777 */ function _fun111568(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#111568, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:6, offset: 0x023a6f48, size: 260 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const useNotificationCenterItemsLoader2 = useNotificationCenterItemsLoader; (FileImportTrackerModule).fileFinishedImporting('modules/notification_center/useNotificationCenterItemsLoader.tsx'); exports.PAGE_SIZE_WITH_MENTIONS = 8; exports.PAGE_SIZE = 20; exports.useNotificationCenterItemsLoader = useNotificationCenterItemsLoader2; exports.useDesktopNotificationCenterItemsLoader = useDesktopNotificationCenterItemsLoader; function useNotificationCenterItemsLoader({isFocused, navigatedAway, isDesktop, withMentions, initialPageSize}) { // fn#111569, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:214, offset: 0x023a704c, size: 652 bytes, params: 2, frame: 32 withMentions = !(withMentions === undefined) && withMentions; const initialPageSize2 = initialPageSize; const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([NotificationCenterStore], function() { return NotificationCenterStore.shouldReload(); }); const binding = value2; const env0_6 = binding.useRef(false); const [property, env0_7] = initialPageSize2(binding.useState(false), 2); const {initialized, loading, items, hasMore, cursor, errored} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([NotificationCenterItemsStore], function() { var notificationCenterItemsStoreBinding = NotificationCenterItemsStore; return {initialized: notificationCenterItemsStoreBinding.initialized, loading: notificationCenterItemsStoreBinding.loading, items: notificationCenterItemsStoreBinding.items, hasMore: notificationCenterItemsStoreBinding.hasMore, cursor: notificationCenterItemsStoreBinding.cursor, errored: notificationCenterItemsStoreBinding.errored}; }); const {roleFilter, everyoneFilter} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([RecentMentionsStore], function() { var recentMentionsStoreBinding = RecentMentionsStore; return {everyoneFilter: recentMentionsStoreBinding.everyoneFilter, roleFilter: recentMentionsStoreBinding.roleFilter}; }); binding.useEffect(_fun111573, []); binding.useEffect(_fun111575, [isFocused, initialized]); binding.useEffect(function() { return _fun111577; }, [navigatedAway, items, isDesktop, (importDefault(8422) /* metro dependency 8422: useGetIsMounted */)(), errored]); binding.useEffect(_fun111578, [initialized, value2, isFocused, withMentions, roleFilter, everyoneFilter, initialPageSize]); const useCallback = binding.useCallback; let value = _fun111579(); value = Reflect.apply(useCallback, binding, [value, [initialized, hasMore, cursor, errored, withMentions, roleFilter, everyoneFilter]]); return {initialized: initialized, loading: loading, items: items, hasMore: hasMore, loadMore: value, loadingMore: property, setReadNotifItemToAcked: function(a0) { if (!a0.acked) { a0.acked = true; } }, errored: errored}; function _fun111573() { // fn#111573, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:798, offset: 0x023a7359, size: 49 bytes, params: 1, frame: 11 var environment; const value = environment.__proto__; (NotificationCenterItemsActionsModule).setNotificationCenterActive(true); return _fun111574; function _fun111574() { // fn#111574, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:843, offset: 0x023a738a, size: 40 bytes, params: 1, frame: 11 const value = environment.__proto__.__proto__; return (NotificationCenterItemsActionsModule).setNotificationCenterActive(false); } } function _fun111575() { // fn#111575, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:906, offset: 0x023a73b2, size: 67 bytes, params: 1, frame: 12 var moduleValue; if (initialized && isFocused) { value = environment.__proto__; moduleValue = require(5097) /* metro dependency 5097: ReadStateActionCreators */; moduleValue.ackUserFeature(ReadStateTypes.NOTIFICATION_CENTER); } } function _fun111576() { // fn#111576, offset: 0x023a73f5, size: 11 bytes, params: 1, frame: 1 return _fun111577; function _fun111577() { // fn#111577, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:1006, offset: 0x023a7400, size: 155 bytes, params: 1, frame: 13 let value = environment.__proto__; if (isDesktop) { if (!env1_15() && (errored || items.length > 100)) { value = environment.__proto__.__proto__; value = require(14777) /* metro dependency 14777: NotificationCenterItemsActions */; value.resetNotificationCenter(); } } else if (navigatedAway && items.length > 100) { value = environment.__proto__.__proto__; value = require(14777) /* metro dependency 14777: NotificationCenterItemsActions */; value.resetNotificationCenter(); } } } function _fun111578() { // fn#111578, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:1151, offset: 0x023a749b, size: 132 bytes, params: 1, frame: 15 var value3; var value4; const initializedBinding = initialized; if (initializedBinding ? ReactModule && isFocused : !initializedBinding) { value3 = environment.__proto__; value4 = 8; require(dependencyMap[value4]).fetchNotificationCenterItems({limit: initialPageSize ?? (withMentions ? value4 : 20), with_mentions: withMentions, roles_filter: roleFilter, everyone_filter: everyoneFilter}); } } function _fun111579() { // fn#111579, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:1319, offset: 0x023a751f, size: 36 bytes, params: 1, frame: 12 const env0_0 = env1_3(_fun111581); return _fun111583; function* _fun111581(a0) { // fn#111581, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:1339, offset: 0x023a754e, size: 232 bytes, params: 2, frame: 18 var environment; var binding; if (true) { value = environment.__proto__.__proto__; var r1 = RecentMentionsStore.current || !NotificationCenterStore; r1 = !r1 ? !useNotificationCenterItemsLoader : r1; r1 = !r1 ? env2_11 == null : r1; r1 = !r1 ? !a0 && env2_12 : r1; if (!r1) { RecentMentionsStore.current = true; NotificationCenterItemsStore(true); binding = env3_0; var value8 = 8; var value9 = binding(env3_2[value8]); var fetchNotificationCenterItems = value9.fetchNotificationCenterItems; binding = env2_3; yield Reflect.apply(fetchNotificationCenterItems, value9, [{after: env2_11, with_mentions: binding, roles_filter: env2_13, everyone_filter: env2_14, limit: binding ? value8 : 20}, function() { RecentMentionsStore.current = false; }]); if (false) { return undefined; } NotificationCenterItemsStore(false); } } } function _fun111583() { // fn#111583, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:1561, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } } } function useDesktopNotificationCenterItemsLoader() { // fn#111585, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14973:2013, offset: 0x023a7661, size: 106 bytes, params: 1, frame: 14 const value = useNotificationCenterItemsLoader({'isFocused': true, 'isDesktop': true}); const initialized = value.initialized; const loading = value.loading; const items2 = value.items; const hasMore = value.hasMore; const loadMore = value.loadMore; const object = {initialized: initialized, loading: loading}; object.items = items2.filter(function(a0) { return a0.kind === 'notification-center-item'; }); object.hasMore = hasMore; object.loadMore = loadMore; return object; } } global.__d(_fun111568, 14776, [5, 57, 31, 5215, 4623, 14775, 4865, 566, 14777, 5097, 8422, 2]) /* metro module 14776, dependencies: [5, 57, 31, 5215, 4623, 14775, 4865, 566, 14777, 5097, 8422, 2] */;