fix: settings patches and definitions for 306203+
This commit is contained in:
parent
d9968c6e22
commit
6c63ba5a31
4 changed files with 78 additions and 64 deletions
|
|
@ -620,13 +620,16 @@ export namespace DiscordModules {
|
|||
export interface SettingsListProps {
|
||||
containerStyle?: StyleProp<ViewStyle>
|
||||
initialSetting?: string
|
||||
ListHeaderComponent?: ComponentType
|
||||
ListFooterComponent?: ComponentType
|
||||
sections: Array<{
|
||||
label?: string | ReactNode
|
||||
settings: string[]
|
||||
subLabel?: string | ReactNode
|
||||
}>
|
||||
node: {
|
||||
type: 'list'
|
||||
ListHeaderComponent?: ComponentType
|
||||
ListFooterComponent?: ComponentType
|
||||
sections: Array<{
|
||||
label?: string | ReactNode
|
||||
settings: string[]
|
||||
subLabel?: string | ReactNode
|
||||
}>
|
||||
}
|
||||
}
|
||||
|
||||
export type SettingsList = FC<SettingsListProps>
|
||||
|
|
@ -651,6 +654,7 @@ export namespace DiscordModules {
|
|||
|
||||
export interface PressableSettingsItem extends BaseSettingsItem {
|
||||
type: 'pressable'
|
||||
withArrow?: boolean
|
||||
onPress?: () => void
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,41 +35,47 @@ export default function RevengeDeveloperSettingScreen() {
|
|||
<View>
|
||||
<SettingListRenderer.SettingsList
|
||||
containerStyle={listStyles.container}
|
||||
ListHeaderComponent={DTAddrSetting}
|
||||
sections={[
|
||||
{
|
||||
settings: [
|
||||
Setting.DTAutoConnect,
|
||||
Setting.DTConnect,
|
||||
Setting.DTDisconnect,
|
||||
],
|
||||
},
|
||||
]}
|
||||
node={{
|
||||
type: 'list',
|
||||
ListHeaderComponent: DTAddrSetting,
|
||||
sections: [
|
||||
{
|
||||
settings: [
|
||||
Setting.DTAutoConnect,
|
||||
Setting.DTConnect,
|
||||
Setting.DTDisconnect,
|
||||
],
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
<View>
|
||||
<SettingListRenderer.SettingsList
|
||||
containerStyle={listStyles.container}
|
||||
ListHeaderComponent={
|
||||
RDTContext.active ? RDTAddrSetting : undefined
|
||||
}
|
||||
sections={[
|
||||
{
|
||||
settings: [
|
||||
Setting.RDTAutoConnect,
|
||||
Setting.RDTConnect,
|
||||
Setting.RDTDisconnect,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Tools',
|
||||
settings: [
|
||||
Setting.EvalJS,
|
||||
Setting.AssetBrowser,
|
||||
Setting.TestErrorBoundary,
|
||||
],
|
||||
},
|
||||
]}
|
||||
node={{
|
||||
type: 'list',
|
||||
ListHeaderComponent: RDTContext.active
|
||||
? RDTAddrSetting
|
||||
: undefined,
|
||||
sections: [
|
||||
{
|
||||
settings: [
|
||||
Setting.RDTAutoConnect,
|
||||
Setting.RDTConnect,
|
||||
Setting.RDTDisconnect,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Tools',
|
||||
settings: [
|
||||
Setting.EvalJS,
|
||||
Setting.AssetBrowser,
|
||||
Setting.TestErrorBoundary,
|
||||
],
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</Design.Stack>
|
||||
|
|
|
|||
|
|
@ -125,7 +125,8 @@ function patchSettingsOverviewScreen(exports: any) {
|
|||
const unpatchMemo = instead(React, 'useMemo', (args, orig) => {
|
||||
if (sRefresher.overviewScreen) args[1] = undefined
|
||||
|
||||
let sections = Reflect.apply(orig, React, args)
|
||||
const node = Reflect.apply(orig, React, args)
|
||||
const sections = node.sections
|
||||
|
||||
// Add our custom sections here, and only do this per instance!
|
||||
if (sectionsInst !== sections) {
|
||||
|
|
@ -138,11 +139,11 @@ function patchSettingsOverviewScreen(exports: any) {
|
|||
}
|
||||
|
||||
if (sRefresher.overviewScreen) {
|
||||
sections = sectionsInst = [...sections]
|
||||
node.sections = sectionsInst = [...sections]
|
||||
sRefresher.overviewScreen = false
|
||||
}
|
||||
|
||||
return sections
|
||||
return node
|
||||
})
|
||||
|
||||
const el = Reflect.apply(orig, undefined, args)
|
||||
|
|
|
|||
|
|
@ -4,30 +4,33 @@ import { Setting } from '../constants'
|
|||
export default function RevengeSettingScreen() {
|
||||
return (
|
||||
<SettingListRenderer.SettingsList
|
||||
sections={[
|
||||
{
|
||||
label: 'Revenge',
|
||||
settings: [
|
||||
Setting.RevengeVersion,
|
||||
Setting.LoaderVersion,
|
||||
Setting.RevengeDiscord,
|
||||
Setting.RevengeSourceRepository,
|
||||
Setting.RevengeLicense,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Versions',
|
||||
settings: [
|
||||
Setting.ReactVersion,
|
||||
Setting.ReactNativeVersion,
|
||||
Setting.HermesVersion,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Actions',
|
||||
settings: [Setting.Reload],
|
||||
},
|
||||
]}
|
||||
node={{
|
||||
type: 'list',
|
||||
sections: [
|
||||
{
|
||||
label: 'Revenge',
|
||||
settings: [
|
||||
Setting.RevengeVersion,
|
||||
Setting.LoaderVersion,
|
||||
Setting.RevengeDiscord,
|
||||
Setting.RevengeSourceRepository,
|
||||
Setting.RevengeLicense,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Versions',
|
||||
settings: [
|
||||
Setting.ReactVersion,
|
||||
Setting.ReactNativeVersion,
|
||||
Setting.HermesVersion,
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Actions',
|
||||
settings: [Setting.Reload],
|
||||
},
|
||||
],
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue