Compare commits

...

9 Commits

8 changed files with 27 additions and 29 deletions

View File

@ -71,7 +71,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// ReVanced
implementation "app.revanced:revanced-patcher:5.1.0"
implementation "app.revanced:revanced-patcher:6.0.0"
// Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")

View File

@ -1,5 +1,6 @@
package app.revanced.manager.flutter
import android.os.Build
import android.os.Handler
import android.os.Looper
import androidx.annotation.NonNull
@ -12,7 +13,7 @@ import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.util.patch.impl.DexPatchBundle
import app.revanced.patcher.util.patch.PatchBundle
import dalvik.system.DexClassLoader
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
val selectedPatches = call.argument<List<String>>("selectedPatches")
val cacheDirPath = call.argument<String>("cacheDirPath")
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
val resourcePatching = call.argument<Boolean>("resourcePatching")
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
if (patchBundleFilePath != null &&
originalFilePath != null &&
@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
selectedPatches != null &&
cacheDirPath != null &&
mergeIntegrations != null &&
resourcePatching != null &&
keyStoreFilePath != null
) {
runPatcher(
@ -67,7 +66,6 @@ class MainActivity : FlutterActivity() {
selectedPatches,
cacheDirPath,
mergeIntegrations,
resourcePatching,
keyStoreFilePath
)
} else {
@ -90,7 +88,6 @@ class MainActivity : FlutterActivity() {
selectedPatches: List<String>,
cacheDirPath: String,
mergeIntegrations: Boolean,
resourcePatching: Boolean,
keyStoreFilePath: String
) {
val originalFile = File(originalFilePath)
@ -102,16 +99,20 @@ class MainActivity : FlutterActivity() {
Thread {
try {
val patches = DexPatchBundle(
patchBundleFilePath,
DexClassLoader(
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
PatchBundle.Dex(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
DexClassLoader(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
} else {
TODO("VERSION.SDK_INT < CUPCAKE")
}
handler.post {
installerChannel.invokeMethod(
"update",
@ -139,7 +140,6 @@ class MainActivity : FlutterActivity() {
PatcherOptions(
inputFile,
cacheDirPath,
resourcePatching,
Aapt.binary(applicationContext).absolutePath,
cacheDirPath,
logger = ManagerLogger()
@ -178,7 +178,7 @@ class MainActivity : FlutterActivity() {
}
patcher.addPatches(patches)
patcher.applyPatches().forEach { (patch, res) ->
patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) {
val msg = "[success] $patch"
handler.post {
@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
}
return@forEach
}
val msg = "[error] $patch:" + res.exceptionOrNull()!!
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
handler.post {
installerChannel.invokeMethod(
"update",

View File

@ -80,7 +80,7 @@
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
},
"patchItem": {
"unsupportedWarningButton": "Unsupported version",
"unsupportedWarningButton": "Warning",
"unsupportedDialogTitle": "Warning",
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
},

View File

@ -20,8 +20,8 @@ class GithubAPI {
);
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1),
maxStale: const Duration(days: 7),
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
final Map<String, String> repoAppPath = {
'com.google.android.youtube': 'youtube',

View File

@ -142,7 +142,6 @@ class PatcherAPI {
List<Patch> selectedPatches,
) async {
bool mergeIntegrations = await needsIntegrations(selectedPatches);
bool resourcePatching = await needsResourcePatching(selectedPatches);
bool includeSettings = await needsSettingsPatch(selectedPatches);
if (includeSettings) {
try {
@ -186,7 +185,6 @@ class PatcherAPI {
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
'cacheDirPath': cacheDir.path,
'mergeIntegrations': mergeIntegrations,
'resourcePatching': resourcePatching,
'keyStoreFilePath': _keyStoreFile.path,
},
);

View File

@ -13,8 +13,8 @@ class RevancedAPI {
late Dio _dio = Dio();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1),
maxStale: const Duration(days: 7),
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
Future<void> initialize(String apiUrl) async {

View File

@ -73,9 +73,9 @@ class PatchesSelectorViewModel extends BaseViewModel {
.where((patch) =>
query.isEmpty ||
query.length < 2 ||
patch.name.toLowerCase().contains(
query.toLowerCase(),
))
patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.getSimpleName().toLowerCase().contains(query.toLowerCase())
)
.toList();
}

View File

@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
publish_to: 'none'
version: 0.0.26+26
version: 0.0.29+29
environment:
sdk: ">=2.17.5 <3.0.0"