165 lines
9.1 KiB
TypeScript
165 lines
9.1 KiB
TypeScript
/* Metro module 14776; source: modules/notification_center/useNotificationCenterItemsLoader.tsx; dependencies: [5, 57, 31, 5215, 4623, 14775, 4865, 566, 14777, 5097, 8422, 2] */
|
|
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 env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const env0_4 = importDefault(57) /* metro dependency 57 */;
|
|
const env0_5 = importAll(31) /* metro dependency 31 */;
|
|
const recentMentionsStore = importDefault(5215) /* metro dependency 5215: RecentMentionsStore */;
|
|
const notificationCenterItemsStore = importDefault(4623) /* metro dependency 4623: NotificationCenterItemsStore */;
|
|
const notificationCenterStore = importDefault(14775) /* metro dependency 14775: NotificationCenterStore */;
|
|
const env0_9 = (require(4865) /* metro dependency 4865: ReadStateConstants */).ReadStateTypes;
|
|
const closure = useNotificationCenterItemsLoader;
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/notification_center/useNotificationCenterItemsLoader.tsx');
|
|
exports.PAGE_SIZE_WITH_MENTIONS = 8;
|
|
exports.PAGE_SIZE = 20;
|
|
exports.useNotificationCenterItemsLoader = closure;
|
|
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 env0_4 = 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] = env0_4(binding.useState(false), 2);
|
|
const {initialized, loading, items, hasMore, cursor,
|
|
errored} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([NotificationCenterItemsStore],
|
|
function() {
|
|
return {initialized: NotificationCenterItemsStore.initialized, loading: NotificationCenterItemsStore.loading,
|
|
items: NotificationCenterItemsStore.items, hasMore: NotificationCenterItemsStore.hasMore,
|
|
cursor: NotificationCenterItemsStore.cursor, errored: NotificationCenterItemsStore.errored};
|
|
});
|
|
const {roleFilter,
|
|
everyoneFilter} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([RecentMentionsStore],
|
|
function() {
|
|
return {everyoneFilter: RecentMentionsStore.everyoneFilter, roleFilter: RecentMentionsStore.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 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 object2 = {initialized: initialized, loading: loading};
|
|
object2.items = items2.filter(function(a0) {
|
|
return a0.kind === 'notification-center-item';
|
|
});
|
|
object2.hasMore = hasMore;
|
|
object2.loadMore = loadMore;
|
|
return object2;
|
|
}
|
|
|
|
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__;
|
|
(require(14777) /* metro dependency 14777: NotificationCenterItemsActions */).setNotificationCenterActive(true);
|
|
return _fun111574;
|
|
}
|
|
|
|
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 _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 ? env0_5 && 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 _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 (require(14777) /* metro dependency 14777: NotificationCenterItemsActions */).setNotificationCenterActive(false);
|
|
}
|
|
|
|
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* _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);
|
|
}
|
|
}
|
|
}
|
|
|