mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: use patcher for resourcePatch detection (#337)
Co-authored-by: Aunali321 <aunvakil.aa@gmail.com>
This commit is contained in:
parent
ca0657e8f9
commit
5418c36716
@ -71,7 +71,7 @@ dependencies {
|
|||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
|
||||||
// ReVanced
|
// ReVanced
|
||||||
implementation "app.revanced:revanced-patcher:5.1.0"
|
implementation "app.revanced:revanced-patcher:5.1.1"
|
||||||
|
|
||||||
// Signing & aligning
|
// Signing & aligning
|
||||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package app.revanced.manager.flutter
|
package app.revanced.manager.flutter
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.annotation.NonNull
|
import androidx.annotation.NonNull
|
||||||
@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
||||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||||
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
||||||
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
|
||||||
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
||||||
if (patchBundleFilePath != null &&
|
if (patchBundleFilePath != null &&
|
||||||
originalFilePath != null &&
|
originalFilePath != null &&
|
||||||
@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches != null &&
|
selectedPatches != null &&
|
||||||
cacheDirPath != null &&
|
cacheDirPath != null &&
|
||||||
mergeIntegrations != null &&
|
mergeIntegrations != null &&
|
||||||
resourcePatching != null &&
|
|
||||||
keyStoreFilePath != null
|
keyStoreFilePath != null
|
||||||
) {
|
) {
|
||||||
runPatcher(
|
runPatcher(
|
||||||
@ -67,7 +66,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches,
|
selectedPatches,
|
||||||
cacheDirPath,
|
cacheDirPath,
|
||||||
mergeIntegrations,
|
mergeIntegrations,
|
||||||
resourcePatching,
|
|
||||||
keyStoreFilePath
|
keyStoreFilePath
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -90,7 +88,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches: List<String>,
|
selectedPatches: List<String>,
|
||||||
cacheDirPath: String,
|
cacheDirPath: String,
|
||||||
mergeIntegrations: Boolean,
|
mergeIntegrations: Boolean,
|
||||||
resourcePatching: Boolean,
|
|
||||||
keyStoreFilePath: String
|
keyStoreFilePath: String
|
||||||
) {
|
) {
|
||||||
val originalFile = File(originalFilePath)
|
val originalFile = File(originalFilePath)
|
||||||
@ -102,7 +99,8 @@ class MainActivity : FlutterActivity() {
|
|||||||
|
|
||||||
Thread {
|
Thread {
|
||||||
try {
|
try {
|
||||||
val patches = DexPatchBundle(
|
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
DexPatchBundle(
|
||||||
patchBundleFilePath,
|
patchBundleFilePath,
|
||||||
DexClassLoader(
|
DexClassLoader(
|
||||||
patchBundleFilePath,
|
patchBundleFilePath,
|
||||||
@ -111,6 +109,9 @@ class MainActivity : FlutterActivity() {
|
|||||||
javaClass.classLoader
|
javaClass.classLoader
|
||||||
)
|
)
|
||||||
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
||||||
|
} else {
|
||||||
|
TODO("VERSION.SDK_INT < CUPCAKE")
|
||||||
|
}
|
||||||
|
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
@ -139,7 +140,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
PatcherOptions(
|
PatcherOptions(
|
||||||
inputFile,
|
inputFile,
|
||||||
cacheDirPath,
|
cacheDirPath,
|
||||||
resourcePatching,
|
|
||||||
Aapt.binary(applicationContext).absolutePath,
|
Aapt.binary(applicationContext).absolutePath,
|
||||||
cacheDirPath,
|
cacheDirPath,
|
||||||
logger = ManagerLogger()
|
logger = ManagerLogger()
|
||||||
|
@ -142,7 +142,6 @@ class PatcherAPI {
|
|||||||
List<Patch> selectedPatches,
|
List<Patch> selectedPatches,
|
||||||
) async {
|
) async {
|
||||||
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
||||||
bool resourcePatching = await needsResourcePatching(selectedPatches);
|
|
||||||
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
||||||
if (includeSettings) {
|
if (includeSettings) {
|
||||||
try {
|
try {
|
||||||
@ -186,7 +185,6 @@ class PatcherAPI {
|
|||||||
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
||||||
'cacheDirPath': cacheDir.path,
|
'cacheDirPath': cacheDir.path,
|
||||||
'mergeIntegrations': mergeIntegrations,
|
'mergeIntegrations': mergeIntegrations,
|
||||||
'resourcePatching': resourcePatching,
|
|
||||||
'keyStoreFilePath': _keyStoreFile.path,
|
'keyStoreFilePath': _keyStoreFile.path,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user