/* Metro module 11358; source: modules/opt_in_channels/useBatchUpdateChannelSettings.tsx; dependencies: [31, 5090, 4864, 661, 694, 566, 6609, 11359, 11356, 2] */ import Dispatcher from '../../Dispatcher.tsx'; /* Metro dependency 694 */ import UserGuildSettingsStore from '../../stores/UserGuildSettingsStore.tsx'; /* Metro dependency 4864 */ import CategoryCollapseStore from '../../stores/CategoryCollapseStore.tsx'; /* Metro dependency 5090 */ 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 */ function _fun87016(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#87016, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:6, offset: 0x01fabe02, size: 186 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); (FileImportTrackerModule).fileFinishedImporting('modules/opt_in_channels/useBatchUpdateChannelSettings.tsx'); exports.default = useBatchUpdateChannelSettings; function resetStoreState_87017(a0) { // fn#87017, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:154, offset: 0x01fa9ef0, size: 54 bytes, params: 2, frame: 13 (Dispatcher).dispatch({type: 'CLEAR_PENDING_CHANNEL_AND_ROLE_UPDATES', guildId: a0}); } function useBatchUpdateChannelSettings(a0) { // fn#87018, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:359, offset: 0x01fabebc, size: 159 bytes, params: 2, frame: 16 const env0_0 = a0; const pendingChannelUpdates = (FluxModule).useStateFromStores([UserGuildSettingsStore], _fun87019); ReactModule.useEffect(_fun87020, [a0]); ReactModule.useEffect(_fun87022, [a0, pendingChannelUpdates]); object = {}; object.onChannelClick = ReactModule.useCallback(_fun87023, []); return object; function _fun87019() { // fn#87019, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:439, offset: 0x01fabf5b, size: 29 bytes, params: 1, frame: 11 return UserGuildSettingsStore.getPendingChannelUpdates(env0_0); } function _fun87020() { // fn#87020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:495, offset: 0x01fabf78, size: 32 bytes, params: 1, frame: 11 resetStoreState_87017(env0_0); return _fun87021; function _fun87021() { // fn#87021, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:519, offset: 0x01fabf98, size: 23 bytes, params: 1, frame: 11 resetStoreState_87017(env1_0); } } function _fun87022() { // fn#87022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:562, offset: 0x01fabfaf, size: 62 bytes, params: 1, frame: 13 var value2; var moduleValue; if (pendingChannelUpdates != null) { value2 = environment.__proto__; moduleValue = require(6609) /* metro dependency 6609: OptInChannelsActionCreators */; moduleValue.updateOptInChannelsBatched(env0_0, pendingChannelUpdates); } } function _fun87023(a0, a1, a2) { // fn#87023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11544:656, offset: 0x01fabfed, size: 355 bytes, params: 4, frame: 22 var optIntoAllChannelsForExistingMember; var Set; var value4; var set; var value6; let value = environment.__proto__; const isChannelOptedIn2 = UserGuildSettingsStore.isChannelOptedIn(a0, a1); const value2 = !isChannelOptedIn2; if ((isChannelOptedIn2 ? value2 : CategoryCollapseStore.isCollapsed(a2)) && a2 != null) { (require(11359) /* metro dependency 11359: CategoryCollapseActionCreators */).categoryExpand(a2); } const optInOnboardingUtilsModule = require(11356) /* metro dependency 11356: OptInOnboardingUtils */; if (optInOnboardingUtilsModule.hasNotSetUpChannelOptIn(a0)) { if (a1 === a2) { value = optInOnboardingUtilsModule; optIntoAllChannelsForExistingMember = value.optIntoAllChannelsForExistingMember; Set = global.Set; value6 = Object.create(Set.prototype, {constructor: {value: Set}}); set = new Set([a1]); Reflect.apply(optIntoAllChannelsForExistingMember, value, [a0, {include: set instanceof Object ? set : value6}]); } else { value = require(11356) /* metro dependency 11356: OptInOnboardingUtils */; optIntoAllChannelsForExistingMember = value.optIntoAllChannelsForExistingMember; Set = global.Set; value4 = Object.create(Set.prototype, {constructor: {value: Set}}); set = new Set([a1]); Reflect.apply(optIntoAllChannelsForExistingMember, value, [a0, {exclude: set instanceof Object ? set : value4}]); } } else { (require(6609) /* metro dependency 6609: OptInChannelsActionCreators */).updateOptInChannelsImmediate(a0, a1, value2, {section: AnalyticsSections.CHANNEL_BROWSER}); } } } } global.__d(_fun87016, 11358, [31, 5090, 4864, 661, 694, 566, 6609, 11359, 11356, 2]) /* metro module 11358, dependencies: [31, 5090, 4864, 661, 694, 566, 6609, 11359, 11356, 2] */;