decord/source/components_native/channel_settings/ChannelSettingsChangeRTCRegion.tsx

124 lines
4.6 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 16200
// Function ID: 16201
2026-07-29 08:29:29 +00:00
// Name: handleSetRegion
2026-08-25 06:04:03 +00:00
// Dependencies: [853, 19, 1391, 16159, 21, 4380, 712, 4108, 1236, 8167, 8135, 8136, 8118, 589, 38, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-25 06:04:03 +00:00
// Module 16200 (handleSetRegion)
2026-08-24 06:08:38 +00:00
import _modDef38 from "module_38" /* 38 */;
import ThemesDefault from "Themes" /* 712 */;
import getSystemLocale from "getSystemLocale" /* 1236 */;
2026-08-25 06:04:03 +00:00
import Form from "Form" /* 8118 */;
import TableRadioRow from "TableRadioRow" /* 8135 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_toArray" /* 853 */;
import closure_4 from "ensureGuildLoaded" /* 1391 */;
2026-08-25 06:04:03 +00:00
import closure_5 from "initialize" /* 16159 */;
2026-08-24 06:08:38 +00:00
import { jsx } from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
const AUTOMATIC_RTC_REGION = "AUTOMATIC_RTC_REGION";
createCacheKey = { form: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWER, paddingHorizontal: ThemesDefault.space.PX_16 };
2026-07-29 08:29:29 +00:00
createCacheKey[0] = createCacheKey;
2026-08-24 06:08:38 +00:00
let closure_8 = createCacheKey.createLegacyClassComponentStyles(createCacheKey);
const PureComponent = importAllResult.PureComponent;
2026-07-29 08:29:29 +00:00
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;
2026-08-24 06:08:38 +00:00
regions = closure_5.getRegions(channel.getGuildId());
2026-07-29 08:29:29 +00:00
obj = { id: AUTOMATIC_RTC_REGION, name: null, sample_hostname: "", sample_port: 0, vip: false, deprecated: false, optimal: false, hidden: false };
intl = require("getSystemLocale").intl;
obj[1] = intl.string(require("getSystemLocale").t.JEmsap);
items = [];
items[0] = obj;
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;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
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;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (id == null) {
id = tmp3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.selectedRegionId = id;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj.regions = items;
applyArgumentsResult.state = obj;
return applyArgumentsResult;
}
}
const prototype = ChannelSettingsChangeRTCRegion.prototype;
prototype["handleSetRegion"] = function handleSetRegion(arg0) {
let self = this;
self = this;
let tmp = arg0;
2026-08-24 06:08:38 +00:00
c0 = arg0;
2026-07-29 08:29:29 +00:00
let tmp2 = arg0;
if (arg0 == null) {
tmp2 = AUTOMATIC_RTC_REGION;
}
this.state.selectedRegionId = tmp2;
if (tmp === AUTOMATIC_RTC_REGION) {
c0 = null;
tmp = null;
}
2026-08-25 06:04:03 +00:00
self(8167).updateChannel({ rtcRegion: tmp });
2026-07-29 08:29:29 +00:00
self.setState({ submitting: true }, () => {
2026-08-24 06:08:38 +00:00
let obj = self(closure_1_2[9]);
2026-07-29 08:29:29 +00:00
obj = { rtcRegion: c0 };
obj.saveChannel(self.props.channel.id, obj);
});
};
prototype["renderRegion"] = function renderRegion(label) {
2026-08-24 06:08:38 +00:00
return jsx(TableRadioRow.TableRadioRow, { label: label.name, value: label.id }, label.id);
2026-07-29 08:29:29 +00:00
};
prototype["renderRegions"] = function renderRegions() {
const self = this;
const substr = callback(this.state.regions).slice(0);
const mapped = substr.map(this.renderRegion, this);
2026-08-25 06:04:03 +00:00
return jsx(self(8136).TableRadioGroup, {
2026-07-29 08:29:29 +00:00
defaultValue: this.state.selectedRegionId,
onChange(arg0) {
return self.handleSetRegion(arg0);
},
hasIcons: false,
children: mapped
});
};
prototype["render"] = function render() {
2026-08-24 06:08:38 +00:00
const tmp = callback2(this.context);
return jsx(Form.Form, { style: callback2(this.context).form, children: this.renderRegions() });
2026-07-29 08:29:29 +00:00
};
ChannelSettingsChangeRTCRegion.contextType = require("ManaContext").ThemeContext;
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("components_native/channel_settings/ChannelSettingsChangeRTCRegion.tsx");
2026-07-20 16:05:17 +00:00
export default function ConnectedChannelSettingsChangeRTCRegion(channelId) {
2026-07-23 10:11:24 +00:00
channelId = channelId.channelId;
2026-08-24 06:08:38 +00:00
const items = [closure_4];
const channel = channelId(589).useStateFromStores(items, () => closure_1_4.getChannel(channelId));
_modDef38(null != channel, "ConnectedChannelSettingsChangeRTCRegion: channel cannot be undefined");
2026-07-29 08:29:29 +00:00
return <ChannelSettingsChangeRTCRegion channel={channel} />;
2026-07-20 16:05:17 +00:00
};