diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 8ae06734..6db88397 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -55,7 +55,7 @@
android:resource="@xml/file_paths" />
diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt b/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt
index 444fa970..22463f8c 100644
--- a/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt
+++ b/android/app/src/main/kotlin/app/revanced/manager/flutter/MainActivity.kt
@@ -27,13 +27,6 @@ import java.io.StringWriter
import java.util.logging.LogRecord
import java.util.logging.Logger
-import android.content.ContentResolver
-import android.content.Context
-import android.database.Cursor
-import android.net.Uri
-
-import android.util.Log
-
class MainActivity : FlutterActivity() {
private val handler = Handler(Looper.getMainLooper())
private lateinit var installerChannel: MethodChannel
@@ -46,21 +39,6 @@ class MainActivity : FlutterActivity() {
val patcherChannel = "app.revanced.manager.flutter/patcher"
val installerChannel = "app.revanced.manager.flutter/installer"
- val contentProviderUri = Uri.parse("content://app.revanced.manager.flutter.provider/settings")
- val contentResolver: ContentResolver = context.contentResolver
- val cursor: Cursor? = contentResolver.query(contentProviderUri, null, null, null, null)
-
- Log.d("app.revanced.manager.flutter.debug", "byhithere")
- if (cursor != null) {
- Log.d("app.revanced.manager.flutter.debug", "test2")
- if (cursor.moveToFirst()) {
- val helloValue = cursor.getString(cursor.getColumnIndex("settings"))
- // Process the retrieved "hello" value
- Log.d("testing2", helloValue)
- }
- cursor.close()
- }
-
val mainChannel =
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, patcherChannel)
diff --git a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/ShareProvider.kt b/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/LegacySettingsProvider.kt
similarity index 72%
rename from android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/ShareProvider.kt
rename to android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/LegacySettingsProvider.kt
index 9460b335..a5475b22 100644
--- a/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/ShareProvider.kt
+++ b/android/app/src/main/kotlin/app/revanced/manager/flutter/utils/share/LegacySettingsProvider.kt
@@ -7,11 +7,11 @@ import android.content.UriMatcher
import android.database.Cursor
import android.database.MatrixCursor
import android.net.Uri
+import android.util.Base64
import org.json.JSONObject
+import java.io.File
-import android.util.Log
-
-class ShareProvider : ContentProvider() {
+class LegacySettingsProvider : ContentProvider() {
private val authority = "app.revanced.manager.flutter.provider"
private val URI_CODE_SETTINGS = 1
@@ -27,18 +27,30 @@ class ShareProvider : ContentProvider() {
val json = JSONObject()
// Default Data
-
- // TODO: load default data
+ json.put("keystorePassword", "s3cur3p@ssw0rd")
// Load Shared Preferences
val sharedPreferences = context!!.getSharedPreferences("FlutterSharedPreferences", Context.MODE_PRIVATE)
val allEntries: Map = sharedPreferences.getAll()
for ((key, value) in allEntries.entries) {
- Log.d("map values", key + ": " + value.toString())
json.put(key.replace("flutter.", ""), value)
}
- // TODO: Load keystore
+ // Load keystore
+ val keystoreFile = File(context!!.getExternalFilesDir(null), "/revanced-manager.keystore")
+ if (keystoreFile.exists()) {
+ val keystoreBytes = keystoreFile.readBytes()
+ val keystoreBase64 = Base64.encodeToString(keystoreBytes, Base64.DEFAULT)
+ json.put("keystore", keystoreBase64)
+ }
+
+ // Load saved patches
+ val storedPatchesFile = File(context!!.filesDir.parentFile.absolutePath, "/app_flutter/selected-patches.json")
+ if (storedPatchesFile.exists()) {
+ val patchesBytes = storedPatchesFile.readBytes()
+ val patches = String(patchesBytes, Charsets.UTF_8)
+ json.put("savedPatches", patches)
+ }
return json.toString()
}