forked from Aliucord/AliucordRN
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patchSettings: Fix settings crash and patching (Aliucord#26)
Signed-off-by: nikosszzz <[email protected]>
- Loading branch information
Showing
9 changed files
with
72 additions
and
46 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,23 @@ | ||
import { ApplicationCommand, ApplicationCommandType, Commands, CommandSection } from "../api/Commands"; | ||
import { ApplicationCommand, ApplicationCommandType, Commands } from "../api/Commands"; | ||
import { Plugin } from "../entities/Plugin"; | ||
import { getByProps } from "../metro"; | ||
import { after } from "../utils/patcher"; | ||
|
||
export default class CommandHandler extends Plugin { | ||
start() { | ||
const commands = getByProps("getBuiltInCommands"); | ||
commands.BUILT_IN_SECTIONS["aliucord"] = Commands._aliucordSection; | ||
after<any, ApplicationCommand[], any>(commands, "getBuiltInCommands", context => { | ||
if (context.args[0] != ApplicationCommandType.CHAT) return; | ||
context.result = [...context.result, ...Commands._commands]; | ||
}); | ||
|
||
const discovery = getByProps("useApplicationCommandsDiscoveryState"); | ||
after(discovery, "useApplicationCommandsDiscoveryState", context => { | ||
const res = context.result as any; | ||
if (!res.discoverySections.find((s: any) => s.key === Commands._aliucordSection.id) && Commands._commands.length) { | ||
res.discoveryCommands.push(...Commands._commands); | ||
res.commands.push(...Commands._commands.filter( | ||
command => !res.commands.some((cmd: ApplicationCommand) => cmd.name === command.name)) | ||
); | ||
|
||
res.discoverySections.push({ | ||
data: Commands._commands, | ||
key: Commands._aliucordSection.id, | ||
section: Commands._aliucordSection | ||
}); | ||
|
||
const offsets = res.sectionsOffset; | ||
offsets.push(offsets[offsets.length - 1] + commands.BUILT_IN_COMMANDS.length - 1); | ||
} | ||
|
||
if (!res.applicationCommandSections.find((s: CommandSection) => s.id === Commands._aliucordSection.id) && Commands._commands.length) { | ||
res.applicationCommandSections.push(Commands._aliucordSection); | ||
} | ||
const assets = getByProps("getApplicationIconURL"); | ||
after(assets, "getApplicationIconURL", context => { | ||
const [props] = context.args; | ||
if (props.id === Commands._aliucordSection.id) | ||
context.result = Commands._aliucordSection.icon; | ||
}); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Forms, React } from "../metro"; | ||
import { getAssetId } from "../utils/getAssetId"; | ||
|
||
const { FormSection, FormRow } = Forms; | ||
|
||
export default function ThemesPage() { | ||
return ( | ||
<> | ||
<FormSection title="Themes" android_noDivider={true}> | ||
<FormRow | ||
leading={<FormRow.Icon source={getAssetId("ic_warning_24px")} />} | ||
label="Coming soon" | ||
/> | ||
</FormSection> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,17 @@ | ||
import { Forms, React } from "../metro"; | ||
import { getAssetId } from "../utils/getAssetId"; | ||
|
||
const { FormSection, FormRow } = Forms; | ||
|
||
export default function UpdaterPage() { | ||
return null; | ||
return ( | ||
<> | ||
<FormSection title="Updater" android_noDivider={true}> | ||
<FormRow | ||
leading={<FormRow.Icon source={getAssetId("ic_share_ios")} />} | ||
label="Coming soon" | ||
/> | ||
</FormSection> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters