101 lines
3.6 KiB
TypeScript
101 lines
3.6 KiB
TypeScript
// Metro module 6070 (f6071).
|
|
import _objectWithoutProperties from "../../_bundle/_objectWithoutProperties";
|
|
import * as Module19 from "react";
|
|
import { forwardRef, useEffect } from "react";
|
|
import Module12 from "../../_bundle/Module12";
|
|
import { subscribeMembers, unsubscribeMembers } from "../../actions/GuildSubscriptionsActionCreators";
|
|
import shallowEqual from "../../_bundle/shallowEqual";
|
|
import SentryUtils_native from "../../utils/SentryUtils.native";
|
|
import { $callWithNewTarget, $deriveClass } from "../../_hermes/prelude";
|
|
const _excluded = ["forwardedRef"];
|
|
let c3850_7 = false;
|
|
export default function subscribeGuildMembers(c15456_0) {
|
|
return (a0) => {
|
|
let Component3, c25692_2;
|
|
let Component2 = a0;
|
|
let displayName = a0.displayName;
|
|
if (displayName == null) {
|
|
displayName = a0.name;
|
|
}
|
|
if (displayName == null) {
|
|
displayName = "Component";
|
|
}
|
|
const displayName2 = `SubscribeGuildMembersContainer(${displayName})`;
|
|
const r16 = $deriveClass(function WrappedComponent(a0) {
|
|
const r4 = new.target;
|
|
const prototypeOf = Object.getPrototypeOf(c25692_2);
|
|
const r2 = Object.create(r4.prototype);
|
|
const r11 = $callWithNewTarget(prototypeOf, r2, r4, a0);
|
|
const r12 = r11 instanceof Object ? r11 : r2;
|
|
const _subscriptions = c15456_0(a0);
|
|
Module12.forEach(_subscriptions, (a0, a1) => subscribeMembers(a1, a0));
|
|
r12._subscriptions = _subscriptions;
|
|
return r12;
|
|
}, Module19.Component);
|
|
const prototype = r16.prototype;
|
|
Object.defineProperty(prototype, "componentDidUpdate", {
|
|
value: function componentDidUpdate(a0) {
|
|
if (!shallowEqual(this.props, a0)) {
|
|
const _subscriptions = c15456_0(this.props);
|
|
if (!(this._subscriptions != null && Module12.isEqual(this._subscriptions, _subscriptions))) {
|
|
if (this._subscriptions != null) {
|
|
Module12.forEach(this._subscriptions, (a0, a1) => unsubscribeMembers(a1, a0));
|
|
}
|
|
Module12.forEach(_subscriptions, (a0, a1) => subscribeMembers(a1, a0));
|
|
this._subscriptions = _subscriptions;
|
|
}
|
|
}
|
|
},
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(prototype, "componentWillUnmount", {
|
|
value: function componentWillUnmount() {
|
|
if (this._subscriptions != null) {
|
|
Module12.forEach(this._subscriptions, (a0, a1) => unsubscribeMembers(a1, a0));
|
|
}
|
|
},
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(prototype, "render", {
|
|
value: function render() {
|
|
const props = this.props;
|
|
return <Component2 ref={props.forwardedRef} {..._objectWithoutProperties(props, _excluded)} />;
|
|
},
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
c25692_2 = r16;
|
|
r16.displayName = displayName2;
|
|
Component3 = r16;
|
|
const r24 = forwardRef((a0, a1) => <Component3 {...a0} forwardedRef={a1} />);
|
|
r24.displayName = `ForwardRef(${displayName2})`;
|
|
return r24;
|
|
};
|
|
};
|
|
export const MAX_GUILD_MEMBER_SUBSCRIPTIONS = 50;
|
|
export function useSubscribeGuildMembers(a0, a1) {
|
|
let c15457_0 = a0;
|
|
const reason = a1;
|
|
useEffect(() => {
|
|
Module12.forEach(c15457_0, (a0, a1) => {
|
|
const r2 = c3850_7;
|
|
if (r2 ? !r2 : a0.length > 50) {
|
|
c3850_7 = true;
|
|
SentryUtils_native.captureMessage("SubscribeGuildMembers called with more than 50 userIds.", {
|
|
extra: {
|
|
count: a0.length,
|
|
guildId: a1,
|
|
reason
|
|
}
|
|
});
|
|
}
|
|
subscribeMembers(a1, a0);
|
|
});
|
|
return () => {
|
|
Module12.forEach(c15457_0, (a0, a1) => unsubscribeMembers(a1, a0));
|
|
};
|
|
}, [a0, a1]);
|
|
}
|