Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4791.js (118.4 MB)
121 lines
4.6 KiB
TypeScript
121 lines
4.6 KiB
TypeScript
// Module ID: 16940
|
|
// Function ID: 16941
|
|
// Name: ChannelSettingsChangeRTCRegion
|
|
// Dependencies: [718, 19, 1957, 16896, 21, 4606, 576, 4317, 1114, 8716, 5739, 5736, 8684, 504, 38, 2]
|
|
// Exports: default
|
|
|
|
// Module 16940 (ChannelSettingsChangeRTCRegion)
|
|
import _modDef38 from "module_38" /* 38 */;
|
|
import nativeDefault from "native" /* 576 */;
|
|
import util from "util" /* 1114 */;
|
|
import TableRadioGroup from "TableRadioGroup" /* 5736 */;
|
|
import TableRadioRow from "TableRadioRow" /* 5739 */;
|
|
import Form from "Form" /* 8684 */;
|
|
import ChannelSettingsActionCreatorsDefault from "ChannelSettingsActionCreators" /* 8716 */;
|
|
import _toArray from "_toArray" /* 718 */;
|
|
import noop from "module_19" /* 19 */;
|
|
import ChannelStore from "ChannelStore" /* 1957 */;
|
|
import RegionStore from "RegionStore" /* 16896 */;
|
|
|
|
require = fn;
|
|
const jsx = fn(21).jsx;
|
|
const AUTOMATIC_RTC_REGION = "AUTOMATIC_RTC_REGION";
|
|
const createStyles = fn(4606);
|
|
let obj2 = { form: { backgroundColor: nativeDefault.colors.BACKGROUND_BASE_LOWER, paddingHorizontal: nativeDefault.space.PX_16 } };
|
|
let closure_8 = createStyles.createLegacyClassComponentStyles(obj2);
|
|
const PureComponent = noop.PureComponent;
|
|
class ChannelSettingsChangeRTCRegion extends PureComponent {
|
|
constructor() {
|
|
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
|
|
closure_0 = applyArgumentsResult;
|
|
obj = { regions: [], submitting: false, selectedRegionId: AUTOMATIC_RTC_REGION };
|
|
channel = applyArgumentsResult.props.channel;
|
|
tmp3 = AUTOMATIC_RTC_REGION;
|
|
regions = closure_5.getRegions(channel.getGuildId());
|
|
obj1 = { id: AUTOMATIC_RTC_REGION, name: null, sample_hostname: "", sample_port: 0, vip: false, deprecated: false, optimal: false, hidden: false };
|
|
intl = closure_0(closure_2[8]).intl;
|
|
obj1.name = intl.string(closure_0(closure_2[8]).t.JEmsap);
|
|
items = [];
|
|
items[0] = obj1;
|
|
if (null != regions) {
|
|
push = items.push;
|
|
items1 = [];
|
|
num = 0;
|
|
tmp4 = items1;
|
|
arraySpreadResult = HermesBuiltin.arraySpread(regions.filter((deprecated) => {
|
|
deprecated = deprecated.deprecated;
|
|
let tmp = !deprecated;
|
|
if (!deprecated) {
|
|
tmp = !deprecated.hidden;
|
|
}
|
|
return tmp;
|
|
}), 0);
|
|
tmp6 = push;
|
|
tmp7 = items1;
|
|
tmp8 = items;
|
|
applyResult = HermesBuiltin.apply(items1, items);
|
|
found = regions.find((id) => id.id === applyArgumentsResult.props.channel.rtcRegion);
|
|
id = undefined;
|
|
if (found != null) {
|
|
id = found.id;
|
|
}
|
|
if (id == null) {
|
|
id = tmp3;
|
|
}
|
|
obj.selectedRegionId = id;
|
|
}
|
|
obj.regions = items;
|
|
applyArgumentsResult.state = obj;
|
|
return applyArgumentsResult;
|
|
}
|
|
}
|
|
const prototype = ChannelSettingsChangeRTCRegion.prototype;
|
|
prototype["handleSetRegion"] = function handleSetRegion(arg0) {
|
|
const self = this;
|
|
let tmp = arg0;
|
|
c0 = arg0;
|
|
let tmp2 = arg0;
|
|
if (arg0 == null) {
|
|
tmp2 = AUTOMATIC_RTC_REGION;
|
|
}
|
|
this.state.selectedRegionId = tmp2;
|
|
if (tmp === AUTOMATIC_RTC_REGION) {
|
|
c0 = null;
|
|
tmp = null;
|
|
}
|
|
self(8716).updateChannel({ rtcRegion: tmp });
|
|
self.setState({ submitting: true }, () => {
|
|
ChannelSettingsActionCreatorsDefault.saveChannel(self.props.channel.id, { rtcRegion });
|
|
});
|
|
};
|
|
prototype["renderRegion"] = function renderRegion(label) {
|
|
return jsx(TableRadioRow.TableRadioRow, { label: label.name, value: label.id }, label.id);
|
|
};
|
|
prototype["renderRegions"] = function renderRegions() {
|
|
const self = this;
|
|
const substr = _toArray(this.state.regions).slice(0);
|
|
const mapped = substr.map(this.renderRegion, this);
|
|
return jsx(TableRadioGroup.TableRadioGroup, {
|
|
defaultValue: this.state.selectedRegionId,
|
|
onChange(arg0) {
|
|
return self.handleSetRegion(arg0);
|
|
},
|
|
hasIcons: false,
|
|
children: mapped
|
|
});
|
|
};
|
|
prototype["render"] = function render() {
|
|
const tmp = closure_8(this.context);
|
|
return jsx(Form.Form, { style: closure_8(this.context).form, children: this.renderRegions() });
|
|
};
|
|
ChannelSettingsChangeRTCRegion.contextType = fn(4317).ThemeContext;
|
|
const size = fn(2);
|
|
const result = size.fileFinishedImporting("components_native/channel_settings/ChannelSettingsChangeRTCRegion.tsx");
|
|
|
|
export default function ConnectedChannelSettingsChangeRTCRegion(channelId) {
|
|
channelId = channelId.channelId;
|
|
const items = [ChannelStore];
|
|
const channel = channelId(504).useStateFromStores(items, () => ChannelStore.getChannel(channelId));
|
|
_modDef38(null != channel, "ConnectedChannelSettingsChangeRTCRegion: channel cannot be undefined");
|
|
return <ChannelSettingsChangeRTCRegion channel={channel} />;
|
|
};
|