bump v2.147.0

This commit is contained in:
inotia00
2022-12-23 17:49:31 +09:00
parent 74aecf4720
commit 187d905bdb
1034 changed files with 21004 additions and 11645 deletions

View File

@ -0,0 +1,9 @@
package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object SwipeControlsHostActivityFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.definingClass == "Lapp/revanced/integrations/swipecontrols/SwipeControlsHostActivity;" && methodDef.name == "<init>"
}
)

View File

@ -0,0 +1,9 @@
package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object WatchWhileActivityFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
methodDef.definingClass.endsWith("WatchWhileActivity;") && methodDef.name == "<init>"
}
)

View File

@ -0,0 +1,67 @@
package app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patcher.util.TypeUtil.traverseClassHierarchy
import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.SwipeControlsHostActivityFingerprint
import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.fingerprints.WatchWhileActivityFingerprint
import app.revanced.patches.youtube.misc.hdrbrightness.bytecode.patch.HDRBrightnessBytecodePatch
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.extensions.transformMethods
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.immutable.ImmutableMethod
@Name("swipe-controls-bytecode-patch")
@YouTubeCompatibility
@Version("0.0.3")
@DependsOn(
[
HDRBrightnessBytecodePatch::class,
PlayerTypeHookPatch::class
]
)
class SwipeControlsBytecodePatch : BytecodePatch(
listOf(
SwipeControlsHostActivityFingerprint,
WatchWhileActivityFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
val wrapperClass = SwipeControlsHostActivityFingerprint.result!!.mutableClass
val targetClass = WatchWhileActivityFingerprint.result!!.mutableClass
// inject the wrapper class from integrations into the class hierarchy of WatchWhileActivity
wrapperClass.setSuperClass(targetClass.superclass)
targetClass.setSuperClass(wrapperClass.type)
// ensure all classes and methods in the hierarchy are non-final, so we can override them in integrations
context.traverseClassHierarchy(targetClass) {
accessFlags = accessFlags and AccessFlags.FINAL.value.inv()
transformMethods {
ImmutableMethod(
definingClass,
name,
parameters,
returnType,
accessFlags and AccessFlags.FINAL.value.inv(),
annotations,
hiddenApiRestrictions,
implementation
).toMutable()
}
}
return PatchResultSuccess()
}
}

View File

@ -0,0 +1,60 @@
package app.revanced.patches.youtube.swipe.swipecontrols.resource.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patches.youtube.swipe.swipecontrols.bytecode.patch.SwipeControlsBytecodePatch
import app.revanced.patches.youtube.misc.settings.resource.patch.SettingsPatch
import app.revanced.shared.annotation.YouTubeCompatibility
import app.revanced.shared.util.resources.ResourceHelper
import app.revanced.shared.util.resources.ResourceUtils
import app.revanced.shared.util.resources.ResourceUtils.copyResources
@Patch
@Name("swipe-controls")
@Description("Adds volume and brightness swipe controls.")
@DependsOn(
[
SettingsPatch::class,
SwipeControlsBytecodePatch::class
]
)
@YouTubeCompatibility
@Version("0.0.1")
class SwipeControlsPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
/*
add settings
*/
ResourceHelper.addSettings(
context,
"PREFERENCE_CATEGORY: REVANCED_SETTINGS",
"PREFERENCE: SWIPE_SETTINGS",
"SETTINGS: SWIPE_CONTROLS"
)
ResourceHelper.patchSuccess(
context,
"swipe-controls"
)
context.copyResources(
"youtube/swipecontrols",
ResourceUtils.ResourceGroup(
"drawable",
"ic_sc_brightness_auto.xml",
"ic_sc_brightness_manual.xml",
"ic_sc_volume_mute.xml",
"ic_sc_volume_normal.xml"
)
)
return PatchResultSuccess()
}
}