mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 02:54:37 +02:00
feat(music/settings) when installing for the first time, a reboot dialog is shown
This commit is contained in:
parent
c5a68bf714
commit
5fda8e2c99
@ -9,6 +9,7 @@ import app.revanced.patcher.patch.annotations.DependsOn
|
||||
import app.revanced.patches.music.utils.integrations.patch.IntegrationsPatch
|
||||
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.PreferenceFingerprint
|
||||
import app.revanced.patches.music.utils.settings.bytecode.fingerprints.SettingsHeadersFragmentFingerprint
|
||||
import app.revanced.util.bytecode.BytecodeHelper.injectInit
|
||||
import app.revanced.util.integrations.Constants.MUSIC_INTEGRATIONS_PATH
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@ -47,6 +48,8 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw PreferenceFingerprint.exception
|
||||
|
||||
context.injectInit("FirstRun", "initializationRVX", false)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
@ -64,7 +64,7 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||
)
|
||||
)
|
||||
|
||||
context.injectInit("MicroGPatch", "checkAvailability")
|
||||
context.injectInit("MicroGPatch", "checkAvailability", true)
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ class NavBarIndexHookPatch : BytecodePatch(
|
||||
|
||||
LithoFilterPatch.addFilter("$PATCHES_PATH/ads/NavBarIndexFilter;")
|
||||
|
||||
context.injectInit("NavBarIndexPatch", "initializeIndex")
|
||||
context.injectInit("NavBarIndexPatch", "initializeIndex", true)
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ class SettingsBytecodePatch : BytecodePatch(
|
||||
}
|
||||
} ?: throw ThemeSetterSystemFingerprint.exception
|
||||
|
||||
context.injectInit("FirstRun", "initializationRVX")
|
||||
context.injectInit("FirstRun", "initializationRVX", true)
|
||||
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ class SponsorBlockBytecodePatch : BytecodePatch(
|
||||
*/
|
||||
VideoIdWithoutShortsPatch.injectCall("$INTEGRATIONS_PLAYER_CONTROLLER_CLASS_DESCRIPTOR->setCurrentVideoId(Ljava/lang/String;)V")
|
||||
|
||||
context.injectInit("FirstRun", "initializationSB")
|
||||
context.injectInit("FirstRun", "initializationSB", true)
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,23 +3,37 @@ package app.revanced.util.bytecode
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
|
||||
import app.revanced.util.integrations.Constants.UTILS_PATH
|
||||
|
||||
internal object BytecodeHelper {
|
||||
|
||||
internal fun BytecodeContext.injectInit(
|
||||
methods: String,
|
||||
descriptor: String
|
||||
descriptor: String,
|
||||
isYouTube: Boolean
|
||||
) {
|
||||
this.classes.forEach { classDef ->
|
||||
val activityClass =
|
||||
if (isYouTube)
|
||||
"/WatchWhileActivity;"
|
||||
else
|
||||
"/MusicActivity;"
|
||||
|
||||
val integrationPath =
|
||||
if (isYouTube)
|
||||
UTILS_PATH
|
||||
else
|
||||
MUSIC_UTILS_PATH
|
||||
|
||||
classes.forEach { classDef ->
|
||||
classDef.methods.forEach { method ->
|
||||
if (classDef.type.endsWith("/WatchWhileActivity;") && method.name == "onCreate") {
|
||||
if (classDef.type.endsWith(activityClass) && method.name == "onCreate") {
|
||||
val hookMethod =
|
||||
this.proxy(classDef).mutableClass.methods.first { it.name == "onCreate" }
|
||||
|
||||
hookMethod.addInstruction(
|
||||
2,
|
||||
"invoke-static/range {p0 .. p0}, $UTILS_PATH/$methods;->$descriptor(Landroid/content/Context;)V"
|
||||
"invoke-static/range {p0 .. p0}, $integrationPath/$methods;->$descriptor(Landroid/content/Context;)V"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +91,7 @@
|
||||
<string name="revanced_hide_sample_button_title">Hide sample button</string>
|
||||
<string name="revanced_hook_button_container_download_summary">Replaces the offline download button in the button container with an external download button.</string>
|
||||
<string name="revanced_hook_button_container_download_title">Hook download button</string>
|
||||
<string name="revanced_reboot_first_run">Restart to load the layout normally</string>
|
||||
<string name="revanced_reboot_message">Refresh and restart</string>
|
||||
<string name="revanced_reset">Reset</string>
|
||||
<string name="revanced_ryd_about">About</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user