diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 00000000..dfdd7b6a
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,103 @@
+{
+ "version": "2.0.0",
+ "tasks": [
+ {
+ "label": "Build (Serializer)",
+ "type": "shell",
+ "command": "flutter packages pub run build_runner build --delete-conflicting-outputs",
+ "problemMatcher": []
+ },
+ {
+ "label": "Build (Android)",
+ "type": "shell",
+ "command": "flutter build apk",
+ "problemMatcher": [],
+ "group": {
+ "kind": "build",
+ "isDefault": true
+ }
+ },
+ {
+ "label": "Install (Android)",
+ "type": "shell",
+ "command": "adb install build\\app\\outputs\\flutter-apk\\app-release.apk",
+ "problemMatcher": []
+ },
+ {
+ "label": "Clean (Flutter)",
+ "type": "shell",
+ "command": "flutter clean && flutter pub get",
+ "problemMatcher": []
+ },
+ {
+ "label": "Clean (Serializer)",
+ "type": "shell",
+ "command": "flutter packages pub run build_runner clean",
+ "problemMatcher": []
+ },
+ {
+ "label": "Build all (Android)",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Build (Serializer)",
+ "Build (Android)"
+ ],
+ "problemMatcher": []
+ },
+ {
+ "label": "Clean all",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Clean (Flutter)",
+ "Clean (Serializer)"
+ ],
+ "problemMatcher": []
+ },
+ {
+ "label": "Clean all & Build all (Android)",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Clean all",
+ "Build all (Android)"
+ ],
+ "problemMatcher": []
+ },
+ {
+ "label": "Clean all & Install (Android)",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Clean all",
+ "Build all (Android)",
+ "Install (Android)",
+ ],
+ "problemMatcher": []
+ },
+ {
+ "label": "Build & Install (Android)",
+ "dependsOrder": "sequence",
+ "dependsOn": [
+ "Build (Android)",
+ "Install (Android)"
+ ],
+ "problemMatcher": []
+ },
+ {
+ "label": "Validate dependencies",
+ "type": "shell",
+ "command": "flutter pub pub run dependency_validator",
+ "problemMatcher": []
+ },
+ {
+ "label": "Show upgradable dependencies",
+ "type": "shell",
+ "command": "flutter pub outdated",
+ "problemMatcher": []
+ },
+ {
+ "label": "Validate translations",
+ "type": "shell",
+ "command": "flutter pub run flutter_i18n diff en.json pt.json",
+ "problemMatcher": []
+ }
+ ]
+}
diff --git a/android/app/build.gradle b/android/app/build.gradle
index d1216884..7f0fff27 100644
--- a/android/app/build.gradle
+++ b/android/app/build.gradle
@@ -43,10 +43,7 @@ android {
}
defaultConfig {
- // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "app.revanced.revanced_manager_flutter"
- // You can update the following values to match your application needs.
- // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
@@ -55,8 +52,6 @@ android {
buildTypes {
release {
- // TODO: Add your own signing config for the release build.
- // Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
@@ -68,4 +63,7 @@ flutter {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+
+ // ReVanced
+ implementation "app.revanced:revanced-patcher:3.3.1"
}
diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml
index fd9dcd6b..0480c468 100644
--- a/android/app/src/debug/AndroidManifest.xml
+++ b/android/app/src/debug/AndroidManifest.xml
@@ -1,8 +1,4 @@
-
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 61043029..59ca22ac 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
@@ -17,10 +17,6 @@
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
-
-
diff --git a/android/app/src/main/kotlin/app/revanced/revanced_manager_flutter/MainActivity.kt b/android/app/src/main/kotlin/app/revanced/revanced_manager_flutter/MainActivity.kt
index b6784df9..a9ea2e68 100644
--- a/android/app/src/main/kotlin/app/revanced/revanced_manager_flutter/MainActivity.kt
+++ b/android/app/src/main/kotlin/app/revanced/revanced_manager_flutter/MainActivity.kt
@@ -1,6 +1,87 @@
package app.revanced.revanced_manager_flutter
+import androidx.annotation.NonNull
+import app.revanced.patcher.data.Data
+import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
+import app.revanced.patcher.extensions.PatchExtensions.description
+import app.revanced.patcher.extensions.PatchExtensions.patchName
+import app.revanced.patcher.extensions.PatchExtensions.version
+import app.revanced.patcher.patch.Patch
+import app.revanced.patcher.util.patch.implementation.DexPatchBundle
+import dalvik.system.DexClassLoader
import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugin.common.MethodChannel
-class MainActivity: FlutterActivity() {
+class MainActivity : FlutterActivity() {
+ private val CHANNEL = "app.revanced/patcher"
+ private var patches = mutableListOf>>()
+
+ override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
+ super.configureFlutterEngine(flutterEngine)
+ MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
+ when (call.method) {
+ "loadPatches" -> {
+ val pathBundlesPaths = call.argument>("pathBundlesPaths")
+ if (pathBundlesPaths != null) {
+ loadPatches(pathBundlesPaths)
+ result.success("OK")
+ } else {
+ result.notImplemented()
+ }
+ }
+ "getCompatiblePackages" -> result.success(getCompatiblePackages())
+ "getFilteredPatches" -> {
+ val targetPackage = call.argument("targetPackage")
+ val targetVersion = call.argument("targetVersion")
+ val ignoreVersion = call.argument("ignoreVersion")
+ if (targetPackage != null && targetVersion != null && ignoreVersion != null) {
+ result.success(getFilteredPatches(targetPackage, targetVersion, ignoreVersion))
+ } else {
+ result.notImplemented()
+ }
+ }
+ else -> result.notImplemented()
+ }
+ }
+ }
+
+ fun loadPatches(pathBundlesPaths: List) {
+ pathBundlesPaths.forEach { path ->
+ patches.addAll(DexPatchBundle(
+ path, DexClassLoader(
+ path,
+ context.cacheDir.path,
+ null,
+ javaClass.classLoader
+ )
+ ).loadPatches())
+ }
+ }
+
+ fun getCompatiblePackages(): List {
+ val filteredPackages = mutableListOf()
+ patches.forEach patch@{ patch ->
+ patch.compatiblePackages?.forEach { pkg ->
+ filteredPackages.add(pkg.name)
+ }
+ }
+ return filteredPackages.distinct()
+ }
+
+ fun getFilteredPatches(targetPackage: String, targetVersion: String, ignoreVersion: Boolean): List