Compare commits

...

14 Commits

Author SHA1 Message Date
semantic-release-bot
3da4a85f63 chore(release): 2.163.0-dev.6 [skip ci]
# [2.163.0-dev.6](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.5...v2.163.0-dev.6) (2023-02-22)

### Features

* **photomath:** `unlock-plus` patch ([#1633](https://github.com/revanced/revanced-patches/issues/1633)) ([1241701](1241701ac7))
2023-02-22 11:14:20 +00:00
nik2143
1241701ac7 feat(photomath): unlock-plus patch (#1633)
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 12:12:34 +01:00
oSumAtrIX
154dcf6cb4 ci: add backmerge target branch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 06:45:15 +01:00
semantic-release-bot
b110348af0 chore(release): 2.163.0-dev.5 [skip ci]
# [2.163.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.4...v2.163.0-dev.5) (2023-02-22)

### Bug Fixes

* use correct fingerprint ([b2e4691](b2e4691e88))
* **youtube/hide-time:** use correct integrations class ([5a7ce48](5a7ce48847))

### Features

* use better patch descriptions ([3153f73](3153f73ceb))
2023-02-22 05:11:10 +00:00
oSumAtrIX
3153f73ceb feat: use better patch descriptions
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 06:08:57 +01:00
oSumAtrIX
5ca5d4c64a refactor(youtube/hide-info-cards): fix casing
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 06:06:00 +01:00
oSumAtrIX
5a7ce48847 fix(youtube/hide-time): use correct integrations class
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:59:15 +01:00
oSumAtrIX
dfccd1cc0a refactor(youtube/hide-time): use correct label name
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:59:00 +01:00
oSumAtrIX
0606f3a9be refactor(youtube/hide-seekbar): use correct label name
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:58:48 +01:00
oSumAtrIX
b2e4691e88 fix: use correct fingerprint
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:55:29 +01:00
semantic-release-bot
6d20931db7 chore(release): 2.163.0-dev.4 [skip ci]
# [2.163.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.3...v2.163.0-dev.4) (2023-02-22)

### Bug Fixes

* **twitter:** make `hide-promoted-ads` patch compatible with any version ([531d491](531d4913ab))
* **youtube/open-links-directly:** reference correct integrations method ([98df006](98df006527))

### Features

* **twitter:** `hide-recommended-users` patch ([72d8316](72d8316ed2))
2023-02-22 04:40:29 +00:00
oSumAtrIX
72d8316ed2 feat(twitter): hide-recommended-users patch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:38:14 +01:00
oSumAtrIX
531d4913ab fix(twitter): make hide-promoted-ads patch compatible with any version
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-22 05:37:52 +01:00
oSumAtrIX
98df006527 fix(youtube/open-links-directly): reference correct integrations method
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
2023-02-20 19:13:55 +01:00
34 changed files with 448 additions and 133 deletions

View File

@@ -39,7 +39,7 @@
[
"@saithodev/semantic-release-backmerge",
{
backmergeBranches: ["dev"],
backmergeBranches: [{"from": "dev", "to": "main"}],
clearWorkspace: true
}
]

View File

@@ -1,3 +1,36 @@
# [2.163.0-dev.6](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.5...v2.163.0-dev.6) (2023-02-22)
### Features
* **photomath:** `unlock-plus` patch ([#1633](https://github.com/revanced/revanced-patches/issues/1633)) ([a7f5330](https://github.com/revanced/revanced-patches/commit/a7f5330e602c36492e329000dc9f0a1eda218770))
# [2.163.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.4...v2.163.0-dev.5) (2023-02-22)
### Bug Fixes
* use correct fingerprint ([84fe9c3](https://github.com/revanced/revanced-patches/commit/84fe9c36461586f25ace146e0e29597e3dfc99ca))
* **youtube/hide-time:** use correct integrations class ([539ccf4](https://github.com/revanced/revanced-patches/commit/539ccf43a884ab3ff812884279aa75f42ba872d5))
### Features
* use better patch descriptions ([931aa0f](https://github.com/revanced/revanced-patches/commit/931aa0fba631d1740986131219eff94c4c1b2306))
# [2.163.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.3...v2.163.0-dev.4) (2023-02-22)
### Bug Fixes
* **twitter:** make `hide-promoted-ads` patch compatible with any version ([3dbc5ff](https://github.com/revanced/revanced-patches/commit/3dbc5ff2722559211232999ae29e7fabafe3b857))
* **youtube/open-links-directly:** reference correct integrations method ([e14893e](https://github.com/revanced/revanced-patches/commit/e14893ec89d002287123196396946fff557b7ef4))
### Features
* **twitter:** `hide-recommended-users` patch ([e8c9a91](https://github.com/revanced/revanced-patches/commit/e8c9a91a92fafcc79ce521f62c3865827df55d0f))
# [2.163.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.163.0-dev.2...v2.163.0-dev.3) (2023-02-20)

View File

@@ -36,7 +36,7 @@ The official Patch bundle provided by ReVanced and the community.
| `hide-crowdfunding-box` | Hides the crowdfunding box between the player and video description. | 18.03.36 |
| `hide-email-address` | Hides the email address in the account switcher. | 18.03.36 |
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.03.36 |
| `hide-info-cards` | Hides info-cards in videos. | 18.03.36 |
| `hide-info-cards` | Hides info cards in videos. | 18.03.36 |
| `hide-my-mix` | Hides mix playlists. | 18.03.36 |
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
| `hide-seekbar` | Hides the seekbar. | 18.03.36 |
@@ -132,9 +132,10 @@ The official Patch bundle provided by ReVanced and the community.
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
| `hide-ads` | Hides ads. | all |
| `hide-recommended-users` | Hides recommended users. | all |
| `hide-views-stats` | Hides the view stats under tweets. | 9.71.0-release.0 |
| `monochrome-icon` | Adds a monochrome icon. | all |
| `timeline-ads` | Removes ads from the Twitter timeline. Might require clearing app data to remove already cached ads. | 9.71.0-release.0 |
</details>
### [📦 `com.spotify.music`](https://play.google.com/store/apps/details?id=com.spotify.music)
@@ -263,6 +264,14 @@ The official Patch bundle provided by ReVanced and the community.
| `unlock-paid-widgets` | Unlocks paid widgets of the app | all |
</details>
### [📦 `com.microblink.photomath`](https://play.google.com/store/apps/details?id=com.microblink.photomath)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `unlock-plus` | Unlocks plus features. | all |
</details>
### [📦 `io.yuka.android`](https://play.google.com/store/apps/details?id=io.yuka.android)
<details>

View File

@@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.163.0-dev.3
version = 2.163.0-dev.6

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.photomath.detection.signature.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.microblink.photomath")])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class DisableSignatureDetectionCompatibility

View File

@@ -0,0 +1,21 @@
package app.revanced.patches.photomath.detection.signature.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object CheckSignatureFingerprint : MethodFingerprint(
strings = listOf(
"currentSignature"
),
opcodes = listOf(
Opcode.CONST_STRING,
Opcode.CONST_STRING,
Opcode.INVOKE_STATIC,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
)
)

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.photomath.detection.signature.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object MainOnCreateFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
customFingerprint = { methodDef ->
methodDef.definingClass == "Lcom/microblink/photomath/PhotoMath;" && methodDef.name == "onCreate"
}
)

View File

@@ -0,0 +1,42 @@
package app.revanced.patches.photomath.detection.signature.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patches.photomath.detection.signature.annotations.DisableSignatureDetectionCompatibility
import app.revanced.patches.photomath.detection.signature.fingerprints.CheckSignatureFingerprint
import app.revanced.patches.photomath.detection.signature.fingerprints.MainOnCreateFingerprint
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Description("Disables detection of incorrect signature.")
@DisableSignatureDetectionCompatibility
@Version("0.0.1")
class SignatureDetectionPatch : BytecodePatch(
listOf(
MainOnCreateFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
val mainOnCreate = MainOnCreateFingerprint.result!!
val patternResult = CheckSignatureFingerprint.also {
it.resolve(context, mainOnCreate.method, mainOnCreate.classDef)
}.result!!.scanResult.patternScanResult!!
mainOnCreate.mutableMethod.apply {
val signatureCheckInstruction = instruction(patternResult.endIndex)
val checkRegister = (signatureCheckInstruction as OneRegisterInstruction).registerA
replaceInstruction(signatureCheckInstruction.location.index, "const/4 v$checkRegister, 0x1")
}
return PatchResultSuccess()
}
}

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.photomath.misc.unlockplus.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.microblink.photomath")])
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class UnlockPlusCompatibilty

View File

@@ -0,0 +1,16 @@
package app.revanced.patches.photomath.misc.unlockplus.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
object IsPlusUnlockedFingerprint : MethodFingerprint(
returnType = "Z",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
strings = listOf(
"genius"
),
customFingerprint = {
methodDef -> methodDef.definingClass.endsWith("/User;")
}
)

View File

@@ -0,0 +1,43 @@
package app.revanced.patches.photomath.misc.unlockplus.patch
import app.revanced.extensions.toErrorResult
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.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.photomath.detection.signature.patch.SignatureDetectionPatch
import app.revanced.patches.photomath.misc.unlockplus.annotations.UnlockPlusCompatibilty
import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlockedFingerprint
@Patch
@Name("unlock-plus")
@DependsOn([SignatureDetectionPatch::class])
@Description("Unlocks plus features.")
@UnlockPlusCompatibilty
@Version("0.0.1")
class UnlockPlusPatch : BytecodePatch(
listOf(
IsPlusUnlockedFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
IsPlusUnlockedFingerprint.result?.mutableMethod?.apply {
addInstructions(
0,
"""
const/4 v0, 0x1
return v0
"""
)
} ?: return IsPlusUnlockedFingerprint.toErrorResult()
return PatchResultSuccess()
}
}

View File

@@ -1,18 +0,0 @@
package app.revanced.patches.twitter.ad.timeline.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object TimelineTweetJsonParserFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.IPUT_OBJECT,
Opcode.GOTO,
Opcode.SGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CHECK_CAST,
Opcode.IPUT_OBJECT,
Opcode.RETURN_VOID,
), strings = listOf("tweetPromotedMetadata", "promotedMetadata", "hasModeratedReplies", "conversationAnnotation"),
customFingerprint = { methodDef -> methodDef.name == "parseField" }
)

View File

@@ -1,77 +0,0 @@
package app.revanced.patches.twitter.ad.timeline.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.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.twitter.ad.timeline.annotations.TimelineAdsCompatibility
import app.revanced.patches.twitter.ad.timeline.fingerprints.TimelineTweetJsonParserFingerprint
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.builder.BuilderInstruction
import org.jf.dexlib2.builder.instruction.BuilderInstruction22c
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.FieldReference
import org.jf.dexlib2.iface.reference.StringReference
@Patch
@Name("timeline-ads")
@Description("Removes ads from the Twitter timeline. Might require clearing app data to remove already cached ads.")
@TimelineAdsCompatibility
@Version("0.0.1")
class TimelineAdsPatch : BytecodePatch(
listOf(TimelineTweetJsonParserFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
if (removePromotedAds())
return PatchResultError("The instruction for the tweet id field could not be found")
return PatchResultSuccess()
}
private fun removePromotedAds(): Boolean {
val (parserFingerprintResult, parserMethod, instructions) = TimelineTweetJsonParserFingerprint.unwrap()
// Anchor index
val tweetIdFieldInstructionIndex = instructions.indexOfFirst { instruction ->
if (instruction.opcode.ordinal != Opcode.CONST_STRING.ordinal) return@indexOfFirst false
if (((instruction as? ReferenceInstruction)?.reference as StringReference).string != "tweetSocialProof") return@indexOfFirst false
// Use the above conditions as an anchor to find the index for the instruction with the field we need
return@indexOfFirst true
} - 2 // This is where the instruction with the field is located
// Reference to the tweetId field for of the timeline tweet
val tweetIdFieldReference =
(parserMethod.instruction(tweetIdFieldInstructionIndex) as? BuilderInstruction22c)?.reference as? FieldReference
?: return true
// Set the tweetId field to null
// This will cause twitter to not show the promoted ads, because we set it to null, when the tweet is promoted
parserFingerprintResult.mutableMethod.addInstructions(
parserFingerprintResult.scanResult.patternScanResult!!.startIndex + 1,
"""
const/4 v2, 0x0
iput-object v2, p0, Lcom/twitter/model/json/timeline/urt/JsonTimelineTweet;->${tweetIdFieldReference.name}:Ljava/lang/String;
"""
)
return false
}
private fun MethodFingerprint.unwrap(): Triple<MethodFingerprintResult, MutableMethod, MutableList<BuilderInstruction>> {
val parserFingerprintResult = this.result!!
val parserMethod = parserFingerprintResult.mutableMethod
val instructions = parserMethod.implementation!!.instructions
return Triple(parserFingerprintResult, parserMethod, instructions)
}
}

View File

@@ -0,0 +1,9 @@
package app.revanced.patches.twitter.misc.hook.json.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object JsonHookPatchFingerprint : MethodFingerprint(
customFingerprint = { methodDef -> methodDef.name == "<clinit>" },
opcodes = listOf(Opcode.IGET_OBJECT)
)

View File

@@ -0,0 +1,10 @@
package app.revanced.patches.twitter.misc.hook.json.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object JsonInputStreamFingerprint : MethodFingerprint(
customFingerprint = { methodDef ->
if (methodDef.parameterTypes.size == 0) false
else methodDef.parameterTypes.first() == "Ljava/io/InputStream;"
}
)

View File

@@ -0,0 +1,7 @@
package app.revanced.patches.twitter.misc.hook.json.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object LoganSquareFingerprint : MethodFingerprint(
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("LoganSquare;") }
)

View File

@@ -0,0 +1,114 @@
package app.revanced.patches.twitter.misc.hook.json.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.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprintResult
import app.revanced.patcher.patch.*
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonHookPatchFingerprint
import app.revanced.patches.twitter.misc.hook.json.fingerprints.JsonInputStreamFingerprint
import app.revanced.patches.twitter.misc.hook.json.fingerprints.LoganSquareFingerprint
import java.io.InvalidClassException
@Name("json-hook")
@Description("Hooks the stream which reads JSON responses.")
@Version("0.0.1")
class JsonHookPatch : BytecodePatch(
listOf(LoganSquareFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
// Make sure the integrations are present.
val jsonHookPatch = context.findClass { it.type == JSON_HOOK_PATCH_CLASS_DESCRIPTOR }
?: return PatchResultError("Could not find integrations.")
// Allow patch to inject hooks into the patches integrations.
jsonHookPatchFingerprintResult = JsonHookPatchFingerprint.also {
it.resolve(context, jsonHookPatch.immutableClass)
}.result ?: return PatchResultError("Unexpected integrations.")
// Conveniently find the type to hook a method in, via a named field.
val jsonFactory = LoganSquareFingerprint.result
?.classDef
?.fields
?.firstOrNull { it.name == "JSON_FACTORY" }
?.type
.let { type ->
context.findClass { it.type == type }?.mutableClass
} ?: return PatchResultError("Could not find required class.")
// Hook the methods first parameter.
JsonInputStreamFingerprint
.also { it.resolve(context, jsonFactory) }
.result
?.mutableMethod
?.addInstructions(
0,
"""
invoke-static { p1 }, $JSON_HOOK_PATCH_CLASS_DESCRIPTOR->parseJsonHook(Ljava/io/InputStream;)Ljava/io/InputStream;
move-result-object p1
"""
) ?: return PatchResultError("Could not find method to hook.")
return PatchResultSuccess()
}
/**
* Create a hook class.
* The class has to extend on **JsonHook**.
* The class has to be a Kotlin object class, or at least have an INSTANCE field of itself.
*
* @param context The [BytecodeContext] of the current patch.
* @param descriptor The class descriptor of the hook.
*/
internal class Hook(context: BytecodeContext, private val descriptor: String) {
private var added = false
/**
* Add the hook.
*/
internal fun add() {
if (added) return
jsonHookPatchFingerprintResult.apply {
mutableMethod.apply {
addInstructions(
scanResult.patternScanResult!!.startIndex,
"""
sget-object v1, $descriptor->INSTANCE:$descriptor
invoke-virtual {v0, v1}, Lkotlin/collections/builders/ListBuilder;->add(Ljava/lang/Object;)Z
"""
)
}
}
added = true
}
init {
context.findClass { it.type == descriptor }?.let {
it.mutableClass.also { classDef ->
if (
classDef.superclass != JSON_HOOK_CLASS_DESCRIPTOR ||
!classDef.fields.any { field -> field.name == "INSTANCE" }
) throw InvalidClassException(classDef.type, "Not a hook class")
}
} ?: throw ClassNotFoundException("Failed to find hook class")
}
}
private companion object {
const val JSON_HOOK_CLASS_NAMESPACE = "app/revanced/twitter/patches/hook/json"
const val JSON_HOOK_PATCH_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/JsonHookPatch;"
const val BASE_PATCH_CLASS_NAME = "BaseJsonHook"
const val JSON_HOOK_CLASS_DESCRIPTOR = "L$JSON_HOOK_CLASS_NAMESPACE/$BASE_PATCH_CLASS_NAME;"
private lateinit var jsonHookPatchFingerprintResult: MethodFingerprintResult
}
}

View File

@@ -0,0 +1,17 @@
package app.revanced.patches.twitter.misc.hook.patch
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.twitter.misc.hook.json.patch.JsonHookPatch
@DependsOn([JsonHookPatch::class])
abstract class BaseHookPatchPatch(private val hookClassDescriptor: String) : BytecodePatch() {
override fun execute(context: BytecodeContext) = try {
PatchResultSuccess().also { JsonHookPatch.Hook(context, hookClassDescriptor).add() }
} catch (ex: Exception) {
PatchResultError(ex)
}
}

View File

@@ -1,13 +1,13 @@
package app.revanced.patches.twitter.ad.timeline.annotations
package app.revanced.patches.twitter.misc.hook.patch.ads.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.twitter.android", arrayOf("9.65.3-release.0")
"com.twitter.android"
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class TimelineAdsCompatibility
internal annotation class HideAdsCompatibility

View File

@@ -0,0 +1,22 @@
package app.revanced.patches.twitter.misc.hook.patch.ads.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.twitter.misc.hook.json.patch.JsonHookPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
import app.revanced.patches.twitter.misc.hook.patch.ads.annotations.HideAdsCompatibility
@Patch
@Name("hide-ads")
@DependsOn([JsonHookPatch::class])
@Description("Hides ads.")
@HideAdsCompatibility
@Version("0.0.1")
class HideAdsPatch : BaseHookPatchPatch(HOOK_CLASS_DESCRIPTOR) {
private companion object {
const val HOOK_CLASS_DESCRIPTOR = "Lapp/revanced/twitter/patches/hook/patch/ads/AdsHook;"
}
}

View File

@@ -0,0 +1,13 @@
package app.revanced.patches.twitter.misc.hook.patch.recommendation.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.twitter.android"
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class HideRecommendedUsersCompatibility

View File

@@ -0,0 +1,23 @@
package app.revanced.patches.twitter.misc.hook.patch.recommendation.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.twitter.misc.hook.json.patch.JsonHookPatch
import app.revanced.patches.twitter.misc.hook.patch.BaseHookPatchPatch
import app.revanced.patches.twitter.misc.hook.patch.recommendation.annotations.HideRecommendedUsersCompatibility
@Patch
@Name("hide-recommended-users")
@DependsOn([JsonHookPatch::class])
@Description("Hides recommended users.")
@HideRecommendedUsersCompatibility
@Version("0.0.1")
class HideRecommendedUsersPatch : BaseHookPatchPatch(HOOK_CLASS_DESCRIPTOR) {
private companion object {
const val HOOK_CLASS_DESCRIPTOR =
"Lapp/revanced/twitter/patches/hook/patch/recommendation/RecommendedUsersHook;"
}
}

View File

@@ -180,10 +180,10 @@ class GeneralAdsResourcePatch : ResourcePatch {
),
SwitchPreference(
"revanced_adremover_info_panel",
StringResource("revanced_adremover_info_panel_enabled_title", "Hide info-panels"),
StringResource("revanced_adremover_info_panel_enabled_title", "Hide info panels"),
true,
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Info-panels are hidden"),
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Info-panels are shown")
StringResource("revanced_adremover_info_panel_enabled_summary_on", "Info panels are hidden"),
StringResource("revanced_adremover_info_panel_enabled_summary_off", "Info panels are shown")
),
SwitchPreference(
"revanced_adremover_medical_panel",

View File

@@ -34,10 +34,10 @@ class AutoCaptionsPatch : BytecodePatch(
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_autocaptions_enabled",
StringResource("revanced_autocaptions_enabled_title", "Disable auto-captions"),
StringResource("revanced_autocaptions_enabled_title", "Disable auto captions"),
false,
StringResource("revanced_autocaptions_summary_on", "Auto-captions are disabled"),
StringResource("revanced_autocaptions_summary_off", "Auto-captions are enabled")
StringResource("revanced_autocaptions_summary_on", "Auto captions are disabled"),
StringResource("revanced_autocaptions_summary_off", "Auto captions are enabled")
)
)

View File

@@ -10,10 +10,10 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultError
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.annotations.PivotBarCompatibility
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.InitializeButtonsFingerprint
import app.revanced.patches.youtube.layout.buttons.pivotbar.shared.fingerprints.PivotBarConstructorFingerprint
@DependsOn([ResourceMappingPatch::class])
@PivotBarCompatibility

View File

@@ -44,11 +44,11 @@ class HidePlayerButtonsPatch : BytecodePatch(
false,
StringResource(
"revanced_hide_player_buttons_summary_on",
"The buttons are hidden"
"Buttons are hidden"
),
StringResource(
"revanced_hide_player_buttons_summary_off",
"The buttons are shown"
"Buttons are shown"
)
)
)

View File

@@ -28,10 +28,10 @@ class HideEndscreenCardsResourcePatch : ResourcePatch {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_endscreen_cards",
StringResource("revanced_hide_endscreen_cards_title", "Hide end-screen cards"),
StringResource("revanced_hide_endscreen_cards_title", "Hide end screen cards"),
true,
StringResource("revanced_hide_endscreen_cards_summary_on", "End-screen cards are hidden"),
StringResource("revanced_hide_endscreen_cards_summary_off", "End-screen cards are shown")
StringResource("revanced_hide_endscreen_cards_summary_on", "End screen cards are hidden"),
StringResource("revanced_hide_endscreen_cards_summary_off", "End screen cards are shown")
),
)

View File

@@ -25,10 +25,10 @@ import org.jf.dexlib2.builder.instruction.BuilderInstruction35c
@Patch
@DependsOn([IntegrationsPatch::class, HideInfocardsResourcePatch::class])
@Name("hide-info-cards")
@Description("Hides info-cards in videos.")
@Description("Hides info cards in videos.")
@HideInfocardsCompatibility
@Version("0.0.1")
class HideInfocardsPatch : BytecodePatch(
class HideInfoCardsPatch : BytecodePatch(
listOf(
InfocardsIncognitoParentFingerprint,
InfocardsMethodCallFingerprint,
@@ -47,7 +47,7 @@ class HideInfocardsPatch : BytecodePatch(
addInstructions(
invokeInstructionIndex,
"invoke-static {v${(instruction(invokeInstructionIndex) as? BuilderInstruction35c)?.registerC}}," +
" Lapp/revanced/integrations/patches/HideInfocardsPatch;->hideInfocardsIncognito(Landroid/view/View;)V"
" Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsIncognito(Landroid/view/View;)V"
)
}
@@ -59,7 +59,7 @@ class HideInfocardsPatch : BytecodePatch(
hideInfocardsCallMethod.addInstructions(
invokeInterfaceIndex, """
invoke-static {}, Lapp/revanced/integrations/patches/HideInfocardsPatch;->hideInfocardsMethodCall()Z
invoke-static {}, Lapp/revanced/integrations/patches/HideInfoCardsPatch;->hideInfoCardsMethodCall()Z
move-result v$toggleRegister
if-nez v$toggleRegister, :hide_info_cards
""",

View File

@@ -24,10 +24,10 @@ class HideInfocardsResourcePatch : ResourcePatch {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_infocards",
StringResource("revanced_hide_infocards_title", "Hide info-cards"),
StringResource("revanced_hide_infocards_title", "Hide info cards"),
true,
StringResource("revanced_hide_infocards_summary_on", "Info-cards are hidden"),
StringResource("revanced_hide_infocards_summary_off", "Info-cards are shown")
StringResource("revanced_hide_infocards_summary_on", "Info cards are hidden"),
StringResource("revanced_hide_infocards_summary_off", "Info cards are shown")
)
)

View File

@@ -46,9 +46,9 @@ class HideSeekbarPatch : BytecodePatch(
const/4 v0, 0x0
invoke-static { }, Lapp/revanced/integrations/patches/HideSeekbarPatch;->hideSeekbar()Z
move-result v0
if-eqz v0, :hide_time_and_seekbar
if-eqz v0, :hide_seekbar
return-void
:hide_time_and_seekbar
:hide_seekbar
nop
"""
)

View File

@@ -41,11 +41,11 @@ class HideTimePatch : BytecodePatch(
TimeCounterFingerprint.result!!.mutableMethod.addInstructions(
0, """
invoke-static { }, Lapp/revanced/integrations/patches/HideTimeAndSeekbarPatch;->hideTimeAndSeekbar()Z
invoke-static { }, Lapp/revanced/integrations/patches/HideTimePatch;->hideTime()Z
move-result v0
if-eqz v0, :hide_time_and_seekbar
if-eqz v0, :hide_time
return-void
:hide_time_and_seekbar
:hide_time
nop
"""
)

View File

@@ -13,6 +13,8 @@ import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.tabletminiplayer.annotations.TabletMiniPlayerCompatibility
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerDimensionsCalculatorFingerprint
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerOverrideFingerprint
@@ -20,8 +22,6 @@ import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPla
import app.revanced.patches.youtube.layout.tabletminiplayer.fingerprints.MiniPlayerResponseModelSizeCheckFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@@ -40,10 +40,10 @@ class TabletMiniPlayerPatch : BytecodePatch(
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_tablet_miniplayer",
StringResource("revanced_tablet_miniplayer_title", "Enable the tablet Mini-player"),
StringResource("revanced_tablet_miniplayer_title", "Enable tablet mini player"),
false,
StringResource("revanced_tablet_miniplayer_summary_on", "Tablet Mini-player is enabled"),
StringResource("revanced_tablet_miniplayer_summary_off", "Tablet Mini-player is disabled")
StringResource("revanced_tablet_miniplayer_summary_on", "Mini player is enabled"),
StringResource("revanced_tablet_miniplayer_summary_off", "Mini player is disabled")
)
)

View File

@@ -52,7 +52,7 @@ class OpenLinksDirectlyPatch : BytecodePatch(
"invoke-static {v$uriRegister}," +
"Lapp/revanced/integrations/patches/OpenLinksDirectlyPatch;" +
"->" +
"transformRedirectUri(Ljava/lang/String;)Landroid/net/Uri;"
"parseRedirectUri(Ljava/lang/String;)Landroid/net/Uri;"
)
}
}