mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-20 09:33:57 +00:00
Compare commits
4 Commits
v2.148.0-d
...
v2.148.0-d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49cca5a258 | ||
|
|
63f5af5c3b | ||
|
|
82df77460f | ||
|
|
3227d66dc2 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# [2.148.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.148.0-dev.3...v2.148.0-dev.4) (2022-12-29)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **twitter:** `hide-views-stats` patch ([#1371](https://github.com/revanced/revanced-patches/issues/1371)) ([2f04a06](https://github.com/revanced/revanced-patches/commit/2f04a06e3b782931870d973fd0937f8731062f12))
|
||||||
|
|
||||||
|
# [2.148.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.148.0-dev.2...v2.148.0-dev.3) (2022-12-26)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **youtube/general-ads:** don't early return when not necessary ([#1353](https://github.com/revanced/revanced-patches/issues/1353)) ([003a400](https://github.com/revanced/revanced-patches/commit/003a400ce41ff543fb5484c576f5ec2df0a87273))
|
||||||
|
|
||||||
# [2.148.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.148.0-dev.1...v2.148.0-dev.2) (2022-12-26)
|
# [2.148.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.148.0-dev.1...v2.148.0-dev.2) (2022-12-26)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -120,6 +120,17 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `show-deleted-messages` | Shows deleted chat messages behind a clickable spoiler. | all |
|
| `show-deleted-messages` | Shows deleted chat messages behind a clickable spoiler. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
### [📦 `com.twitter.android`](https://play.google.com/store/apps/details?id=com.twitter.android)
|
||||||
|
<details>
|
||||||
|
|
||||||
|
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
||||||
|
|:--------:|:--------------:|:-----------------:|
|
||||||
|
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
|
||||||
|
| `hide-views-stats` | Hides the view stats under tweets. | all |
|
||||||
|
| `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. | all |
|
||||||
|
</details>
|
||||||
|
|
||||||
### [📦 `com.spotify.music`](https://play.google.com/store/apps/details?id=com.spotify.music)
|
### [📦 `com.spotify.music`](https://play.google.com/store/apps/details?id=com.spotify.music)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
@@ -130,16 +141,6 @@ The official Patch bundle provided by ReVanced and the community.
|
|||||||
| `spotify-theme` | Applies a custom theme. | all |
|
| `spotify-theme` | Applies a custom theme. | all |
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
### [📦 `com.twitter.android`](https://play.google.com/store/apps/details?id=com.twitter.android)
|
|
||||||
<details>
|
|
||||||
|
|
||||||
| 💊 Patch | 📜 Description | 🏹 Target Version |
|
|
||||||
|:--------:|:--------------:|:-----------------:|
|
|
||||||
| `dynamic-color` | Replaces the default Twitter Blue with the users Material You palette. | all |
|
|
||||||
| `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. | all |
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### [📦 `com.reddit.frontpage`](https://play.google.com/store/apps/details?id=com.reddit.frontpage)
|
### [📦 `com.reddit.frontpage`](https://play.google.com/store/apps/details?id=com.reddit.frontpage)
|
||||||
<details>
|
<details>
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 2.148.0-dev.2
|
version = 2.148.0-dev.4
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.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 HideViewsCompatibility
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object InlineActionTypesFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Ljava/util/List",
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
strings = listOf(
|
||||||
|
"getCurrentMemoizing()",
|
||||||
|
"android_animated_reply_icon_enabled",
|
||||||
|
"reply_voting_android_position_before_favorite_enabled"
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object TweetStatsContainerConstructorFingerprint : MethodFingerprint(
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CHECK_CAST,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.INVOKE_VIRTUAL
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object TweetStatsContainerWrapperConstructorFingerprint : MethodFingerprint(
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
parameters = listOf("L"),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import org.jf.dexlib2.AccessFlags
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
object TweetStatsViewDelegateBinderFingerprint : MethodFingerprint(
|
||||||
|
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.CONST_16,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.CONST_16,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.RETURN_OBJECT
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.patch
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.removeInstruction
|
||||||
|
import app.revanced.patcher.extensions.removeInstructions
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
|
||||||
|
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
|
||||||
|
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.PatchResultSuccess
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.twitter.layout.hideviews.fingerprints.InlineActionTypesFingerprint
|
||||||
|
import app.revanced.patches.twitter.layout.hideviews.fingerprints.TweetStatsContainerConstructorFingerprint
|
||||||
|
import app.revanced.patches.twitter.layout.hideviews.fingerprints.TweetStatsContainerWrapperConstructorFingerprint
|
||||||
|
import app.revanced.patches.twitter.layout.hideviews.fingerprints.TweetStatsViewDelegateBinderFingerprint
|
||||||
|
import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
|
class HideViewsBytecodePatch : BytecodePatch(
|
||||||
|
listOf(
|
||||||
|
InlineActionTypesFingerprint,
|
||||||
|
TweetStatsContainerWrapperConstructorFingerprint,
|
||||||
|
TweetStatsContainerConstructorFingerprint,
|
||||||
|
TweetStatsViewDelegateBinderFingerprint
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
|
removeViewsFromTimeline(context)
|
||||||
|
removeTweetStatViewInitializer(context)
|
||||||
|
removeTweetStatViewWrapperInitializer(context)
|
||||||
|
removeViewDelegateBinderSubscription()
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeViewsFromTimeline(context: BytecodeContext) {
|
||||||
|
val addViewsToActionBarMethodFingerprint = object : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
)
|
||||||
|
) {}
|
||||||
|
transformMethodAtPattern(
|
||||||
|
context,
|
||||||
|
InlineActionTypesFingerprint,
|
||||||
|
addViewsToActionBarMethodFingerprint
|
||||||
|
) { patternScanResult, method ->
|
||||||
|
method.removeInstruction(patternScanResult.endIndex - 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeTweetStatViewInitializer(context: BytecodeContext) {
|
||||||
|
val returnFingerprint = object : MethodFingerprint(
|
||||||
|
opcodes = listOf(Opcode.RETURN_VOID)
|
||||||
|
) {}
|
||||||
|
transformMethodAtPattern(
|
||||||
|
context,
|
||||||
|
TweetStatsContainerConstructorFingerprint,
|
||||||
|
returnFingerprint
|
||||||
|
) { patternScanResult, method ->
|
||||||
|
method.removeInstructions(patternScanResult.endIndex - 3, 2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeTweetStatViewWrapperInitializer(context: BytecodeContext) {
|
||||||
|
val wrapperReturnFingerprint = object : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.RETURN_VOID,
|
||||||
|
)
|
||||||
|
) {}
|
||||||
|
transformMethodAtPattern(
|
||||||
|
context,
|
||||||
|
TweetStatsContainerWrapperConstructorFingerprint,
|
||||||
|
wrapperReturnFingerprint
|
||||||
|
) { patternScanResult, method ->
|
||||||
|
method.removeInstructions(patternScanResult.startIndex - 4, 3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeViewDelegateBinderSubscription() {
|
||||||
|
transformMethod(TweetStatsViewDelegateBinderFingerprint) { result, method ->
|
||||||
|
method.removeInstructions(result.scanResult.patternScanResult!!.startIndex - 4, 9)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun transformMethodAtPattern(
|
||||||
|
context: BytecodeContext, methodFingerprint: MethodFingerprint,
|
||||||
|
patternFingerprint: MethodFingerprint, transformer: TransformerAtPattern
|
||||||
|
) {
|
||||||
|
transformMethod(methodFingerprint) { result, method ->
|
||||||
|
val patternResult = patternFingerprint.also {
|
||||||
|
it.resolve(context, method, result.classDef)
|
||||||
|
}.result!!
|
||||||
|
transformer(patternResult.scanResult.patternScanResult!!, method)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun transformMethod(methodFingerprint: MethodFingerprint, transformer: Transformer) {
|
||||||
|
val result = methodFingerprint.result!!
|
||||||
|
val method = result.mutableMethod
|
||||||
|
transformer(result, method)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private typealias Transformer = (MethodFingerprintResult, MutableMethod) -> Unit
|
||||||
|
|
||||||
|
private typealias TransformerAtPattern = (MethodFingerprintResult.MethodFingerprintScanResult.PatternScanResult, MutableMethod) -> Unit
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package app.revanced.patches.twitter.layout.hideviews.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.*
|
||||||
|
import app.revanced.patcher.patch.annotations.DependsOn
|
||||||
|
import app.revanced.patcher.patch.annotations.Patch
|
||||||
|
import app.revanced.patches.twitter.layout.hideviews.annotations.HideViewsCompatibility
|
||||||
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
@Patch
|
||||||
|
@DependsOn([HideViewsBytecodePatch::class])
|
||||||
|
@Name("hide-views-stats")
|
||||||
|
@Description("Hides the view stats under tweets.")
|
||||||
|
@HideViewsCompatibility
|
||||||
|
@Version("0.0.1")
|
||||||
|
class HideViewsResourcePatch : ResourcePatch {
|
||||||
|
override fun execute(context: ResourceContext): PatchResult {
|
||||||
|
arrayOf(
|
||||||
|
"res/layout/condensed_tweet_stats.xml",
|
||||||
|
"res/layout/focal_tweet_stats.xml"
|
||||||
|
).forEach { file ->
|
||||||
|
context.xmlEditor[file].use { editor ->
|
||||||
|
val tags = editor.file.getElementsByTagName("com.twitter.ui.tweet.TweetStatView")
|
||||||
|
List(tags.length) { tags.item(it) as Element }
|
||||||
|
.filter { it.getAttribute("android:id").contains("views_stat") }
|
||||||
|
.forEach { it.parentNode.removeChild(it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return PatchResultSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,9 @@ import org.jf.dexlib2.Opcode
|
|||||||
object CanScrollVerticallyFingerprint : MethodFingerprint(
|
object CanScrollVerticallyFingerprint : MethodFingerprint(
|
||||||
"Z",
|
"Z",
|
||||||
parameters = emptyList(),
|
parameters = emptyList(),
|
||||||
opcodes = listOf(Opcode.INSTANCE_OF),
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
),
|
||||||
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }
|
customFingerprint = { methodDef -> methodDef.definingClass.endsWith("SwipeRefreshLayout;") }
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import app.revanced.extensions.toErrorResult
|
|||||||
import app.revanced.patcher.annotation.Description
|
import app.revanced.patcher.annotation.Description
|
||||||
import app.revanced.patcher.annotation.Version
|
import app.revanced.patcher.annotation.Version
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.addInstructions
|
import app.revanced.patcher.extensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.instruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.PatchResult
|
import app.revanced.patcher.patch.PatchResult
|
||||||
import app.revanced.patcher.patch.PatchResultSuccess
|
import app.revanced.patcher.patch.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.annotations.VerticalScrollCompatibility
|
||||||
import app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
|
import app.revanced.patches.youtube.misc.fix.verticalscroll.fingerprints.CanScrollVerticallyFingerprint
|
||||||
|
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
|
@Description("Fixes issues with scrolling on the home screen when the first component is of type EmptyComponent.")
|
||||||
@VerticalScrollCompatibility
|
@VerticalScrollCompatibility
|
||||||
@@ -20,13 +22,17 @@ class VerticalScrollPatch : BytecodePatch(
|
|||||||
override fun execute(context: BytecodeContext): PatchResult {
|
override fun execute(context: BytecodeContext): PatchResult {
|
||||||
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
val result = CanScrollVerticallyFingerprint.result ?: return CanScrollVerticallyFingerprint.toErrorResult()
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(
|
with(result) {
|
||||||
0,
|
val method = mutableMethod
|
||||||
"""
|
|
||||||
const/4 v0, 0x0
|
val moveResultIndex = scanResult.patternScanResult!!.endIndex
|
||||||
return v0
|
val moveResultRegister = (method.instruction(moveResultIndex) as OneRegisterInstruction).registerA
|
||||||
"""
|
|
||||||
)
|
method.addInstruction(
|
||||||
|
moveResultIndex + 1,
|
||||||
|
"const/4 v$moveResultRegister, 0x0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return PatchResultSuccess()
|
return PatchResultSuccess()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user