chore: merge branch dev to main (#1600)

This commit is contained in:
oSumAtrIX 2023-02-10 06:06:48 +01:00 committed by GitHub
commit 750ed80dd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 328 additions and 11 deletions

View file

@ -1,3 +1,18 @@
# [2.160.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.160.0-dev.1...v2.160.0-dev.2) (2023-02-10)
### Features
* **reddit:** `hide-subreddit-banner` patch ([13a1381](https://github.com/revanced/revanced-patches/commit/13a138122875b30e82df68a680e413f6ad7ba382))
* **reddit:** bump patches compatibility to `v2023.05.0` ([0a72fa1](https://github.com/revanced/revanced-patches/commit/0a72fa10bf009192157e04e0788daf5462324a0e))
# [2.160.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.159.0...v2.160.0-dev.1) (2023-02-10)
### Features
* **instagram:** `hide-timeline-ads` patch ([61668e6](https://github.com/revanced/revanced-patches/commit/61668e67083b74a08f8015308f4afe548e16a9ad))
# [2.159.0](https://github.com/revanced/revanced-patches/compare/v2.158.0...v2.159.0) (2023-02-03)

View file

@ -151,7 +151,8 @@ The official Patch bundle provided by ReVanced and the community.
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `general-reddit-ads` | Removes general ads from the Reddit frontpage and subreddits. | 2022.43.0 |
| `general-reddit-ads` | Removes general ads from the Reddit frontpage and subreddits. | 2023.05.0 |
| `hide-subreddit-banner` | Hides banner ads from comments on subreddits. | 2023.05.0 |
| `premium-icon-reddit` | Unlocks premium Reddit app icons. | all |
</details>
@ -197,6 +198,14 @@ The official Patch bundle provided by ReVanced and the community.
| `enable-on-demand` | Enables listening to songs on-demand, allowing to play any song from playlists, albums or artists without limitations. This does not remove ads. | all |
</details>
### [📦 `com.instagram.android`](https://play.google.com/store/apps/details?id=com.instagram.android)
<details>
| 💊 Patch | 📜 Description | 🏹 Target Version |
|:--------:|:--------------:|:-----------------:|
| `hide-timeline-ads` | Removes ads from the timeline. | all |
</details>
### [📦 `org.citra.citra_emu`](https://play.google.com/store/apps/details?id=org.citra.citra_emu)
<details>

View file

@ -20,7 +20,7 @@ repositories {
}
dependencies {
implementation("app.revanced:revanced-patcher:6.4.2")
implementation("app.revanced:revanced-patcher:6.4.3")
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
// Required for meta
implementation("com.google.code.gson:gson:2.10.1")

View file

@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.159.0
version = 2.160.0-dev.2

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,7 @@
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
object MediaFingerprint : MethodFingerprint(
strings = listOf("is_paid_partnership", "story_ad_headline", "is_panorama")
)

View file

@ -0,0 +1,26 @@
package app.revanced.patches.instagram.patches.ads.timeline.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 ShowAdFingerprint : MethodFingerprint(
"Z",
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
listOf("L", "L", "Z", "Z"),
opcodes = listOf(
Opcode.INVOKE_STATIC,
Opcode.MOVE_RESULT,
Opcode.IF_NEZ,
Opcode.RETURN,
Opcode.CONST_4,
Opcode.GOTO,
Opcode.CONST_4,
Opcode.GOTO,
Opcode.CONST_4,
Opcode.GOTO,
Opcode.CONST_4,
Opcode.RETURN,
),
)

View file

@ -0,0 +1,18 @@
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
import org.jf.dexlib2.Opcode
object GenericMediaAdFingerprint : MediaAdFingerprint(
opcodes = listOf(
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.INVOKE_INTERFACE,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST_4,
Opcode.IF_EQZ,
Opcode.CONST_4,
Opcode.RETURN,
)
) {
override fun toString() = result!!.method.toString()
}

View file

@ -0,0 +1,23 @@
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.Method
abstract class MediaAdFingerprint(
returnType: String? = "Z",
access: Int? = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters: Iterable<String>? = listOf(),
opcodes: Iterable<Opcode>?,
customFingerprint: ((methodDef: Method) -> Boolean)? = null
) : MethodFingerprint(
returnType,
access,
parameters,
opcodes,
customFingerprint = customFingerprint
) {
abstract override fun toString(): String
}

View file

@ -0,0 +1,29 @@
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.ReferenceInstruction
import org.jf.dexlib2.iface.reference.MethodReference
object PaidPartnershipAdFingerprint : MediaAdFingerprint(
"V",
null,
listOf("L", "L"),
listOf(
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.IPUT_BOOLEAN,
Opcode.IPUT_BOOLEAN
),
customFingerprint = { methodDef ->
methodDef.definingClass.endsWith("ClipsEditMetadataController;")
}
) {
override fun toString() = result!!.let {
val adCheckIndex = it.scanResult.patternScanResult!!.startIndex
val adCheckInstruction = it.method.implementation!!.instructions.elementAt(adCheckIndex)
val adCheckMethod = (adCheckInstruction as ReferenceInstruction).reference as MethodReference
adCheckMethod.toString()
}
}

View file

@ -0,0 +1,21 @@
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
import org.jf.dexlib2.Opcode
object ShoppingAdFingerprint : MediaAdFingerprint(
opcodes = listOf(
Opcode.IF_EQZ,
Opcode.IGET_OBJECT,
Opcode.IGET_OBJECT,
Opcode.IF_EQZ,
Opcode.IGET_OBJECT,
Opcode.IF_EQZ,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.XOR_INT_LIT8,
Opcode.IF_EQZ,
)
) {
override fun toString() = result!!.method.toString()
}

View file

@ -0,0 +1,108 @@
package app.revanced.patches.instagram.patches.ads.timeline.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.*
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.removeInstruction
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.patcher.patch.annotations.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.GenericMediaAdFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.MediaAdFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.PaidPartnershipAdFingerprint
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.ShoppingAdFingerprint
import org.jf.dexlib2.iface.instruction.FiveRegisterInstruction
import org.jf.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("hide-timeline-ads")
@Description("Removes ads from the timeline.")
@Compatibility([Package("com.instagram.android")])
@Version("0.0.1")
class HideTimelineAdsPatch : BytecodePatch(
listOf(
ShowAdFingerprint,
MediaFingerprint,
PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes.
)
) {
override fun execute(context: BytecodeContext): PatchResult {
// region Resolve required methods to check for ads.
ShowAdFingerprint.result ?: return ShowAdFingerprint.toErrorResult()
PaidPartnershipAdFingerprint.result ?: return PaidPartnershipAdFingerprint.toErrorResult()
MediaFingerprint.result?.let {
GenericMediaAdFingerprint.resolve(context, it.classDef)
ShoppingAdFingerprint.resolve(context, it.classDef)
return@let
} ?: return MediaFingerprint.toErrorResult()
// endregion
ShowAdFingerprint.result!!.apply {
// region Create instructions.
val scanStart = scanResult.patternScanResult!!.startIndex
val jumpIndex = scanStart - 1
val mediaInstanceRegister = (mutableMethod.instruction(scanStart) as FiveRegisterInstruction).registerC
val freeRegister = (mutableMethod.instruction(jumpIndex) as OneRegisterInstruction).registerA
val returnFalseLabel = "an_ad"
val checkForAdInstructions =
listOf(GenericMediaAdFingerprint, PaidPartnershipAdFingerprint, ShoppingAdFingerprint)
.map(MediaAdFingerprint::toString)
.joinToString("\n") {
"""
invoke-virtual {v$mediaInstanceRegister}, $it
move-result v$freeRegister
if-nez v$freeRegister, :$returnFalseLabel
""".trimIndent()
}.let { "$it\nconst/4 v0, 0x1\nreturn v0" }
// endregion
// region Patch.
val insertIndex = scanStart + 3
mutableMethod.addInstructions(
insertIndex,
checkForAdInstructions,
listOf(
ExternalLabel(
returnFalseLabel,
mutableMethod.instruction(mutableMethod.implementation!!.instructions.size - 2 /* return false = ad */)
)
)
)
// endregion
// region Jump to checks for ads from previous patch.
mutableMethod.apply {
addInstructions(
jumpIndex + 1,
"if-nez v$freeRegister, :start_check",
listOf(ExternalLabel("start_check", instruction(insertIndex)))
)
}.removeInstruction(jumpIndex)
// endregion
}
return PatchResultSuccess()
}
}

View file

@ -0,0 +1,13 @@
package app.revanced.patches.reddit.ad.banner.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.reddit.frontpage", arrayOf("2023.05.0")
)]
)
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
internal annotation class HideBannerCompatibility

View file

@ -0,0 +1,48 @@
package app.revanced.patches.reddit.ad.banner.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.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.reddit.ad.banner.annotations.HideBannerCompatibility
@Patch
@Name("hide-subreddit-banner")
@Description("Hides banner ads from comments on subreddits.")
@HideBannerCompatibility
@Version("0.0.1")
class HideBannerPatch : ResourcePatch {
override fun execute(context: ResourceContext): PatchResult {
context.xmlEditor[RESOURCE_FILE_PATH].use {
it.file.getElementsByTagName("merge").item(0).childNodes.apply {
val attributes = arrayOf("height", "width")
for (i in 1 until length) {
val view = item(i)
if (
view.hasAttributes() &&
view.attributes.getNamedItem("android:id").nodeValue.endsWith("ad_view_stub")
) {
attributes.forEach { attribute ->
view.attributes.getNamedItem("android:layout_$attribute").nodeValue = "0.0dip"
}
break
}
}
}
}
return PatchResultSuccess()
}
private companion object {
const val RESOURCE_FILE_PATH = "res/layout/merge_listheader_link_detail.xml"
}
}

View file

@ -5,7 +5,7 @@ import app.revanced.patcher.annotation.Package
@Compatibility(
[Package(
"com.reddit.frontpage", arrayOf("2022.43.0")
"com.reddit.frontpage", arrayOf("2022.43.0", "2023.05.0")
)]
)
@Target(AnnotationTarget.CLASS)

View file

@ -1,9 +1,9 @@
package app.revanced.patches.youtube.misc.microg.shared
object Constants {
internal const val REVANCED_APP_NAME = "YouTube ReVanced"
internal const val REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
internal const val PACKAGE_NAME = "com.google.android.youtube"
internal const val SPOOFED_PACKAGE_NAME = PACKAGE_NAME
internal const val SPOOFED_PACKAGE_SIGNATURE = "24bb24c05e47e0aefa68a58a766179d9b613a600"
internal object Constants {
const val REVANCED_APP_NAME = "YouTube ReVanced"
const val REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
const val PACKAGE_NAME = "com.google.android.youtube"
const val SPOOFED_PACKAGE_NAME = PACKAGE_NAME
const val SPOOFED_PACKAGE_SIGNATURE = "24bb24c05e47e0aefa68a58a766179d9b613a600"
}