chore: Merge branch dev to main (#3325)

This commit is contained in:
oSumAtrIX 2023-11-27 20:07:20 +01:00 committed by GitHub
commit 1f80ee0395
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 69 additions and 54 deletions

View file

@ -1,3 +1,17 @@
## [2.201.1-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.201.1-dev.1...v2.201.1-dev.2) (2023-11-23)
### Bug Fixes
* **Spotify - Hide premium navbar:** Support latest version ([b87005d](https://github.com/ReVanced/revanced-patches/commit/b87005de0c40293f85d3997f43b353a87a925156))
## [2.201.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.201.0...v2.201.1-dev.1) (2023-11-23)
### Bug Fixes
* **YouTube - Hide layout components:** Clarify custom filter usage ([cc16db5](https://github.com/ReVanced/revanced-patches/commit/cc16db56d1c9925852265fcebb459d9620cd1b92))
# [2.201.0](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.201.0) (2023-11-23) # [2.201.0](https://github.com/ReVanced/revanced-patches/compare/v2.200.0...v2.201.0) (2023-11-23)

View file

@ -1,4 +1,4 @@
org.gradle.parallel = true org.gradle.parallel = true
org.gradle.caching = true org.gradle.caching = true
kotlin.code.style = official kotlin.code.style = official
version = 2.201.0 version = 2.201.1-dev.2

View file

@ -1,51 +1,32 @@
package app.revanced.patches.spotify.navbar package app.revanced.patches.spotify.navbar
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch import app.revanced.patches.spotify.navbar.fingerprints.AddNavBarItemFingerprint
import app.revanced.patches.spotify.navbar.fingerprints.AddPremiumNavbarTabFingerprint
import app.revanced.patches.spotify.navbar.fingerprints.AddPremiumNavbarTabParentFingerprint
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.WideLiteralInstruction
@Patch( @Patch(
name = "Hide premium navbar", name = "Hide premium navbar",
description = "Removes the premium tab from the navbar.", description = "Removes the premium tab from the navbar.",
dependencies = [ResourceMappingPatch::class], dependencies = [PremiumNavbarTabResourcePatch::class],
compatiblePackages = [CompatiblePackage("com.spotify.music")] compatiblePackages = [CompatiblePackage("com.spotify.music")]
) )
@Suppress("unused") @Suppress("unused")
object PremiumNavbarTabPatch : BytecodePatch(setOf(AddPremiumNavbarTabParentFingerprint)) { object PremiumNavbarTabPatch : BytecodePatch(
override fun execute(context: BytecodeContext) { setOf(AddNavBarItemFingerprint)
val parentResult = AddPremiumNavbarTabParentFingerprint.result!! ) {
AddPremiumNavbarTabFingerprint.resolve(context, parentResult.classDef) // If the navigation bar item is the premium tab, do not add it.
override fun execute(context: BytecodeContext) = AddNavBarItemFingerprint.result?.mutableMethod?.addInstructions(
val result = AddPremiumNavbarTabFingerprint.result!! 0,
"""
val method = result.mutableMethod const v1, ${PremiumNavbarTabResourcePatch.premiumTabId}
val methodInstructions = method.implementation!!.instructions if-ne p5, v1, :continue
val lastInstructionIdx = methodInstructions.size - 1 return-void
:continue
val premiumTabId = nop
ResourceMappingPatch.resourceMappings.single { it.type == "id" && it.name == "premium_tab" }.id """
) ?: throw AddNavBarItemFingerprint.exception
var removeAmount = 2 }
// 2nd const remove method
for ((i, instruction) in methodInstructions.asReversed().withIndex()) {
if (instruction.opcode.ordinal != Opcode.CONST.ordinal) continue
if ((instruction as WideLiteralInstruction).wideLiteral != premiumTabId) continue
val findThreshold = 10
val constIndex = lastInstructionIdx - i
val invokeInstruction = methodInstructions.subList(constIndex, constIndex + findThreshold).first {
it.opcode.ordinal == Opcode.INVOKE_VIRTUAL_RANGE.ordinal
}
method.removeInstruction(methodInstructions.indexOf(invokeInstruction))
if (--removeAmount == 0) break
}
}
}

View file

@ -0,0 +1,22 @@
package app.revanced.patches.spotify.navbar
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.mapping.misc.ResourceMappingPatch
@Patch(dependencies = [ResourceMappingPatch::class])
object PremiumNavbarTabResourcePatch : ResourcePatch() {
internal var showBottomNavigationItemsTextId = -1L
internal var premiumTabId = -1L
override fun execute(context: ResourceContext) {
premiumTabId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "premium_tab"
}.id
showBottomNavigationItemsTextId = ResourceMappingPatch.resourceMappings.single {
it.type == "bool" && it.name == "show_bottom_navigation_items_text"
}.id
}
}

View file

@ -0,0 +1,12 @@
package app.revanced.patches.spotify.navbar.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patches.spotify.navbar.PremiumNavbarTabResourcePatch
import app.revanced.util.patch.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
object AddNavBarItemFingerprint : LiteralValueFingerprint(
returnType = "V",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
literalSupplier = { PremiumNavbarTabResourcePatch.showBottomNavigationItemsTextId },
)

View file

@ -1,7 +0,0 @@
package app.revanced.patches.spotify.navbar.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
object AddPremiumNavbarTabFingerprint : MethodFingerprint(
parameters = listOf("L", "L", "L", "L", "L", "L")
)

View file

@ -1,7 +0,0 @@
package app.revanced.patches.spotify.navbar.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint
object AddPremiumNavbarTabParentFingerprint : MethodFingerprint(
strings = listOf("com.samsung.android.samsungaccount.action.REQUEST_AUTHCODE")
)

View file

@ -406,7 +406,7 @@ object HideLayoutComponentsPatch : BytecodePatch(
StringResource("revanced_custom_filter_strings_title", "Custom filter"), StringResource("revanced_custom_filter_strings_title", "Custom filter"),
StringResource( StringResource(
"revanced_custom_filter_strings_summary", "revanced_custom_filter_strings_summary",
"List of components to filter separated by new line" "List of component path builder strings to filter separated by new line"
), ),
inputType = InputType.TEXT_MULTI_LINE inputType = InputType.TEXT_MULTI_LINE
) )