remove deprecated stuff
This commit is contained in:
parent
fd55e1e627
commit
549fb57b23
5 changed files with 20 additions and 89 deletions
|
|
@ -1,9 +0,0 @@
|
||||||
package app.revanced.patches.all.misc.connectivity.telephony.sim.spoof
|
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
|
||||||
|
|
||||||
@Deprecated("Patch was renamed", ReplaceWith("SpoofSIMProviderPatch"))
|
|
||||||
@Suppress("unused")
|
|
||||||
val spoofSimCountryPatch = bytecodePatch {
|
|
||||||
dependsOn(spoofSIMProviderPatch)
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +0,0 @@
|
||||||
package app.revanced.patches.idaustria.detection.root
|
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
|
||||||
import app.revanced.patches.idaustria.detection.deviceintegrity.removeDeviceIntegrityChecksPatch
|
|
||||||
|
|
||||||
@Deprecated("Patch was superseded", ReplaceWith("removeDeviceIntegrityChecksPatch"))
|
|
||||||
@Suppress("unused")
|
|
||||||
val rootDetectionPatch = bytecodePatch {
|
|
||||||
dependsOn(removeDeviceIntegrityChecksPatch)
|
|
||||||
}
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
package app.revanced.patches.music.misc.androidauto
|
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
|
||||||
|
|
||||||
@Deprecated("This patch is useless by itself and has been merged into another patch.", ReplaceWith("unlockAndroidAutoMediaBrowserPatch"))
|
|
||||||
@Suppress("unused")
|
|
||||||
val bypassCertificateChecksPatch = bytecodePatch(
|
|
||||||
description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.",
|
|
||||||
) {
|
|
||||||
dependsOn(unlockAndroidAutoMediaBrowserPatch)
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +1,31 @@
|
||||||
package app.revanced.patches.shared.misc.hex
|
package app.revanced.patches.shared.misc.hex
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.Patch
|
||||||
import app.revanced.patcher.patch.PatchException
|
import app.revanced.patcher.patch.PatchException
|
||||||
import app.revanced.patcher.patch.rawResourcePatch
|
import app.revanced.patcher.patch.rawResourcePatch
|
||||||
import kotlin.collections.component1
|
import kotlin.collections.component1
|
||||||
import kotlin.collections.component2
|
import kotlin.collections.component2
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
fun hexPatch(ignoreMissingTargetFiles: Boolean = false, block: HexPatchBuilder.() -> Unit) =
|
fun hexPatch(ignoreMissingTargetFiles: Boolean = false, block: HexPatchBuilder.() -> Unit): Patch {
|
||||||
hexPatch(ignoreMissingTargetFiles, fun(): Set<Replacement> = HexPatchBuilder().apply(block))
|
val replacementsSupplier = HexPatchBuilder().apply(block)
|
||||||
|
|
||||||
|
return rawResourcePatch {
|
||||||
|
apply {
|
||||||
|
replacementsSupplier.apply(block).groupBy { it.targetFilePath }
|
||||||
|
.forEach { (targetFilePath, replacements) ->
|
||||||
|
val targetFile = get(targetFilePath, true)
|
||||||
|
if (ignoreMissingTargetFiles && !targetFile.exists()) return@forEach
|
||||||
|
|
||||||
|
// TODO: Use a file channel to read and write the file instead of reading the whole file into memory,
|
||||||
|
// in order to reduce memory usage.
|
||||||
|
val targetFileBytes = targetFile.readBytes()
|
||||||
|
replacements.forEach { it.replacePattern(targetFileBytes) }
|
||||||
|
targetFile.writeBytes(targetFileBytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Suppress("JavaDefaultMethodsNotOverriddenByDelegation")
|
@Suppress("JavaDefaultMethodsNotOverriddenByDelegation")
|
||||||
class HexPatchBuilder internal constructor(
|
class HexPatchBuilder internal constructor(
|
||||||
|
|
@ -35,28 +53,6 @@ class HexPatchBuilder internal constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The replacements being passed using a function is intended.
|
|
||||||
// Previously the replacements were a property of the patch. Getter were being delegated to that property.
|
|
||||||
// This late evaluation was being leveraged in app.revanced.patches.all.misc.hex.HexPatch.
|
|
||||||
// Without the function, the replacements would be evaluated at the time of patch creation.
|
|
||||||
// This isn't possible because the delegated property is not accessible at that time.
|
|
||||||
@Deprecated("Use the hexPatch function with the builder parameter instead.")
|
|
||||||
fun hexPatch(ignoreMissingTargetFiles: Boolean = false, replacementsSupplier: () -> Set<Replacement>) =
|
|
||||||
rawResourcePatch {
|
|
||||||
apply {
|
|
||||||
replacementsSupplier().groupBy { it.targetFilePath }.forEach { (targetFilePath, replacements) ->
|
|
||||||
val targetFile = get(targetFilePath, true)
|
|
||||||
if (ignoreMissingTargetFiles && !targetFile.exists()) return@forEach
|
|
||||||
|
|
||||||
// TODO: Use a file channel to read and write the file instead of reading the whole file into memory,
|
|
||||||
// in order to reduce memory usage.
|
|
||||||
val targetFileBytes = targetFile.readBytes()
|
|
||||||
replacements.forEach { it.replacePattern(targetFileBytes) }
|
|
||||||
targetFile.writeBytes(targetFileBytes)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a pattern to search for and its replacement pattern in a file.
|
* Represents a pattern to search for and its replacement pattern in a file.
|
||||||
*
|
*
|
||||||
|
|
@ -71,17 +67,6 @@ class Replacement(
|
||||||
) {
|
) {
|
||||||
val replacementBytesPadded = replacementBytes + ByteArray(bytes.size - replacementBytes.size)
|
val replacementBytesPadded = replacementBytes + ByteArray(bytes.size - replacementBytes.size)
|
||||||
|
|
||||||
@Deprecated("Use the constructor with ByteArray parameters instead.")
|
|
||||||
constructor(
|
|
||||||
pattern: String,
|
|
||||||
replacementPattern: String,
|
|
||||||
targetFilePath: String,
|
|
||||||
) : this(
|
|
||||||
byteArrayOf(pattern),
|
|
||||||
byteArrayOf(replacementPattern),
|
|
||||||
targetFilePath
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replaces the [bytes] with the [replacementBytes] in the [targetFileBytes].
|
* Replaces the [bytes] with the [replacementBytes] in the [targetFileBytes].
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
package app.revanced.patches.strava.upselling
|
|
||||||
|
|
||||||
import app.revanced.patcher.patch.bytecodePatch
|
|
||||||
import app.revanced.patches.strava.distractions.hideDistractionsPatch
|
|
||||||
|
|
||||||
@Suppress("unused")
|
|
||||||
@Deprecated("Superseded by \"Hide distractions\" patch", ReplaceWith("hideDistractionsPatch"))
|
|
||||||
val disableSubscriptionSuggestionsPatch = bytecodePatch(
|
|
||||||
name = "Disable subscription suggestions",
|
|
||||||
) {
|
|
||||||
compatibleWith("com.strava")
|
|
||||||
|
|
||||||
dependsOn(
|
|
||||||
hideDistractionsPatch.apply {
|
|
||||||
options["Upselling"] = true
|
|
||||||
options["Promotions"] = false
|
|
||||||
options["Who to Follow"] = false
|
|
||||||
options["Suggested Challenges"] = false
|
|
||||||
options["Join Challenge"] = false
|
|
||||||
options["Joined a club"] = false
|
|
||||||
options["Your activity from X years ago"] = false
|
|
||||||
},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue