11import { after } from "@lib/api/patcher" ;
2- import { findInReactTree } from "@lib/utils" ;
32import { TableRow } from "@metro/common/components" ;
43import { findByNameLazy , findByPropsLazy } from "@metro/wrappers" ;
54import { registeredSections } from "@ui/settings" ;
65
76import { CustomPageRenderer , wrapOnPress } from "./shared" ;
8- import { Strings } from "@core/i18n" ;
9- import { TableRowIcon } from "@metro/common/components" ;
7+ import { findInReactTree } from "@lib/utils" ;
108
119const settingConstants = findByPropsLazy ( "SETTING_RENDERER_CONFIG" ) ;
10+ const createListModule = findByPropsLazy ( "createList" ) ;
1211const SettingsOverviewScreen = findByNameLazy ( "SettingsOverviewScreen" , false ) ;
1312
1413function useIsFirstRender ( ) {
@@ -72,6 +71,29 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
7271 } ) ;
7372 } ) ;
7473
74+ try {
75+ unpatches . push ( after ( "createList" , createListModule , function ( args , ret ) {
76+ const [ config ] = args ;
77+
78+ if ( config ?. sections && Array . isArray ( config . sections ) ) {
79+ const sections = config . sections ;
80+ // Credit to @palmdevs - https://discord.com/channels/1196075698301968455/1243605828783571024/1307940348378742816
81+ let index = - ~ sections . findIndex ( ( i : any ) => i . settings ?. includes ( "ACCOUNT" ) ) || 1 ;
82+
83+ Object . keys ( registeredSections ) . forEach ( sect => {
84+ const alreadyExists = sections . some ( ( s : any ) => s . label === sect ) ;
85+ if ( ! alreadyExists ) {
86+ sections . splice ( index ++ , 0 , {
87+ label : sect ,
88+ title : sect ,
89+ settings : registeredSections [ sect ] . map ( a => a . key )
90+ } ) ;
91+ }
92+ } ) ;
93+ }
94+ return ret ;
95+ } , ) ) ;
96+ } catch {
7597 unpatches . push ( after ( "default" , SettingsOverviewScreen , ( _ , ret ) => {
7698 if ( useIsFirstRender ( ) ) return ; // :shrug:
7799
@@ -87,4 +109,5 @@ export function patchTabsUI(unpatches: (() => void | boolean)[]) {
87109 } ) ;
88110 } ) ;
89111 } ) ) ;
90- }
112+ }
113+ } ;
0 commit comments