Compare commits
60 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c6b93320f | ||
|
|
2f3bb6cfe4 | ||
|
|
0e1fa1a5d6 | ||
|
|
38fb3444e4 | ||
|
|
f10b5aebac | ||
|
|
5a3884e159 | ||
|
|
41ac2b0df8 | ||
|
|
52e7d76c9d | ||
|
|
3aa80cacc0 | ||
|
|
dd52c379b4 | ||
|
|
5d073bddf2 | ||
|
|
7d09169c06 | ||
|
|
ce6f11f3f2 | ||
|
|
d0fb6ac3c0 | ||
|
|
ae801a2918 | ||
|
|
257fd46e27 | ||
|
|
bb96c3ed63 | ||
|
|
6bd218277d | ||
|
|
83ad7605c4 | ||
|
|
5fbc8ff7a0 | ||
|
|
bb4b59eee6 | ||
|
|
4cfb620d63 | ||
|
|
55739a9c78 | ||
|
|
482599bb4e | ||
|
|
3aaf49fee0 | ||
|
|
0424ee235c | ||
|
|
a178afce99 | ||
|
|
ef3685c817 | ||
|
|
e74fce8574 | ||
|
|
73e4ae1416 | ||
|
|
bcf3b36b13 | ||
|
|
9c3626c8ed | ||
|
|
a3dca8c142 | ||
|
|
ef0c59f693 | ||
|
|
31756884b6 | ||
|
|
0a2a495ab0 | ||
|
|
8300cc4071 | ||
|
|
9f58757caf | ||
|
|
5d296038b7 | ||
|
|
9f85450c6c | ||
|
|
cba4e175a3 | ||
|
|
cf3fa935ce | ||
|
|
6de7e2e098 | ||
|
|
30d9b5f6fe | ||
|
|
ec31667591 | ||
|
|
a82b0cd74d | ||
|
|
34e67d396f | ||
|
|
cdb492910c | ||
|
|
9f3a30d9f2 | ||
|
|
598f7571de | ||
|
|
85cd176347 | ||
|
|
2f78af7f08 | ||
|
|
a4b5fc4796 | ||
|
|
a0a0d0a939 | ||
|
|
eef9c2bf31 | ||
|
|
84813d34c6 | ||
|
|
aad7e06f2e | ||
|
|
f759af8a3f | ||
|
|
301618e467 | ||
|
|
2b5a0286ed |
@@ -44,7 +44,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "app.revanced.manager.flutter"
|
applicationId "app.revanced.manager.flutter"
|
||||||
minSdkVersion 21
|
minSdkVersion 26
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
@@ -57,6 +57,10 @@ android {
|
|||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
exclude '/prebuilt/**'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
@@ -67,9 +71,9 @@ 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:4.2.3"
|
implementation "app.revanced:revanced-patcher:4.4.2"
|
||||||
|
|
||||||
// Signing & aligning
|
// Signing & aligning
|
||||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||||
implementation("com.android.tools.build:apksig:7.2.1")
|
implementation("com.android.tools.build:apksig:7.2.2")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="app.revanced.manager.flutter">
|
package="app.revanced.manager.flutter">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="ReVanced Manager"
|
android:label="ReVanced Manager"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true"
|
||||||
|
android:extractNativeLibs="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
@@ -1,333 +0,0 @@
|
|||||||
package app.revanced.manager.flutter
|
|
||||||
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import androidx.annotation.NonNull
|
|
||||||
import app.revanced.manager.flutter.utils.Aapt
|
|
||||||
import app.revanced.manager.flutter.utils.aligning.ZipAligner
|
|
||||||
import app.revanced.manager.flutter.utils.signing.Signer
|
|
||||||
import app.revanced.manager.flutter.utils.zip.ZipFile
|
|
||||||
import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
|
|
||||||
import app.revanced.patcher.Patcher
|
|
||||||
import app.revanced.patcher.PatcherOptions
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
|
||||||
import app.revanced.patcher.util.patch.impl.DexPatchBundle
|
|
||||||
import dalvik.system.DexClassLoader
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
|
||||||
import io.flutter.embedding.engine.FlutterEngine
|
|
||||||
import io.flutter.plugin.common.MethodChannel
|
|
||||||
import io.flutter.plugin.common.MethodChannel.Result
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class MainActivity : FlutterActivity() {
|
|
||||||
private val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher"
|
|
||||||
private val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
|
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
|
||||||
private lateinit var installerChannel: MethodChannel
|
|
||||||
|
|
||||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
|
||||||
super.configureFlutterEngine(flutterEngine)
|
|
||||||
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
|
|
||||||
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
|
||||||
mainChannel.setMethodCallHandler { call, result ->
|
|
||||||
when (call.method) {
|
|
||||||
"runPatcher" -> {
|
|
||||||
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
|
|
||||||
val originalFilePath = call.argument<String>("originalFilePath")
|
|
||||||
val inputFilePath = call.argument<String>("inputFilePath")
|
|
||||||
val patchedFilePath = call.argument<String>("patchedFilePath")
|
|
||||||
val outFilePath = call.argument<String>("outFilePath")
|
|
||||||
val integrationsPath = call.argument<String>("integrationsPath")
|
|
||||||
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 &&
|
|
||||||
inputFilePath != null &&
|
|
||||||
patchedFilePath != null &&
|
|
||||||
outFilePath != null &&
|
|
||||||
integrationsPath != null &&
|
|
||||||
selectedPatches != null &&
|
|
||||||
cacheDirPath != null &&
|
|
||||||
mergeIntegrations != null &&
|
|
||||||
resourcePatching != null &&
|
|
||||||
keyStoreFilePath != null
|
|
||||||
) {
|
|
||||||
runPatcher(
|
|
||||||
result,
|
|
||||||
patchBundleFilePath,
|
|
||||||
originalFilePath,
|
|
||||||
inputFilePath,
|
|
||||||
patchedFilePath,
|
|
||||||
outFilePath,
|
|
||||||
integrationsPath,
|
|
||||||
selectedPatches,
|
|
||||||
cacheDirPath,
|
|
||||||
mergeIntegrations,
|
|
||||||
resourcePatching,
|
|
||||||
keyStoreFilePath
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
result.notImplemented()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> result.notImplemented()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun runPatcher(
|
|
||||||
result: MethodChannel.Result,
|
|
||||||
patchBundleFilePath: String,
|
|
||||||
originalFilePath: String,
|
|
||||||
inputFilePath: String,
|
|
||||||
patchedFilePath: String,
|
|
||||||
outFilePath: String,
|
|
||||||
integrationsPath: String,
|
|
||||||
selectedPatches: List<String>,
|
|
||||||
cacheDirPath: String,
|
|
||||||
mergeIntegrations: Boolean,
|
|
||||||
resourcePatching: Boolean,
|
|
||||||
keyStoreFilePath: String
|
|
||||||
) {
|
|
||||||
val originalFile = File(originalFilePath)
|
|
||||||
val inputFile = File(inputFilePath)
|
|
||||||
val patchedFile = File(patchedFilePath)
|
|
||||||
val outFile = File(outFilePath)
|
|
||||||
val integrations = File(integrationsPath)
|
|
||||||
val keyStoreFile = File(keyStoreFilePath)
|
|
||||||
|
|
||||||
val patches =
|
|
||||||
DexPatchBundle(
|
|
||||||
patchBundleFilePath,
|
|
||||||
DexClassLoader(
|
|
||||||
patchBundleFilePath,
|
|
||||||
cacheDirPath,
|
|
||||||
null,
|
|
||||||
javaClass.classLoader
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.loadPatches()
|
|
||||||
.filter { patch -> selectedPatches.any { it == patch.patchName } }
|
|
||||||
|
|
||||||
Thread(
|
|
||||||
Runnable {
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.1,
|
|
||||||
"header" to "",
|
|
||||||
"log" to "Copying original apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
originalFile.copyTo(inputFile, true)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.2,
|
|
||||||
"header" to "Unpacking apk...",
|
|
||||||
"log" to "Unpacking input apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val patcher =
|
|
||||||
Patcher(
|
|
||||||
PatcherOptions(
|
|
||||||
inputFile,
|
|
||||||
cacheDirPath,
|
|
||||||
resourcePatching,
|
|
||||||
Aapt.binary(applicationContext).absolutePath,
|
|
||||||
cacheDirPath,
|
|
||||||
logger =
|
|
||||||
object :
|
|
||||||
app.revanced.patcher.logging.Logger {
|
|
||||||
override fun error(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun warn(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun info(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun trace(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf("progress" to 0.3, "header" to "", "log" to "")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (mergeIntegrations) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.4,
|
|
||||||
"header" to "Merging integrations...",
|
|
||||||
"log" to "Merging integrations"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
patcher.addFiles(listOf(integrations)) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.5,
|
|
||||||
"header" to "Applying patches...",
|
|
||||||
"log" to ""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
patcher.addPatches(patches)
|
|
||||||
patcher.applyPatches().forEach { (patch, res) ->
|
|
||||||
if (res.isSuccess) {
|
|
||||||
val msg = "[success] $patch"
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.5,
|
|
||||||
"header" to "",
|
|
||||||
"log" to msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf("progress" to 0.5, "header" to "", "log" to msg)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.7,
|
|
||||||
"header" to "Repacking apk...",
|
|
||||||
"log" to "Repacking patched apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val res = patcher.save()
|
|
||||||
ZipFile(patchedFile).use { file ->
|
|
||||||
res.dexFiles.forEach {
|
|
||||||
file.addEntryCompressData(
|
|
||||||
ZipEntry.createWithName(it.name),
|
|
||||||
it.stream.readBytes()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
res.resourceFile?.let {
|
|
||||||
file.copyEntriesFromFileAligned(
|
|
||||||
ZipFile(it),
|
|
||||||
ZipAligner::getEntryAlignment
|
|
||||||
)
|
|
||||||
}
|
|
||||||
file.copyEntriesFromFileAligned(
|
|
||||||
ZipFile(inputFile),
|
|
||||||
ZipAligner::getEntryAlignment
|
|
||||||
)
|
|
||||||
}
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.9,
|
|
||||||
"header" to "Signing apk...",
|
|
||||||
"log" to ""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 1.0,
|
|
||||||
"header" to "Finished!",
|
|
||||||
"log" to "Finished!"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post { result.success(null) }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,299 @@
|
|||||||
|
package app.revanced.manager.flutter
|
||||||
|
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import androidx.annotation.NonNull
|
||||||
|
import app.revanced.manager.flutter.utils.Aapt
|
||||||
|
import app.revanced.manager.flutter.utils.aligning.ZipAligner
|
||||||
|
import app.revanced.manager.flutter.utils.signing.Signer
|
||||||
|
import app.revanced.manager.flutter.utils.zip.ZipFile
|
||||||
|
import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
|
||||||
|
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 dalvik.system.DexClassLoader
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
private const val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher"
|
||||||
|
private const val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
|
||||||
|
|
||||||
|
class MainActivity : FlutterActivity() {
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
private lateinit var installerChannel: MethodChannel
|
||||||
|
|
||||||
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||||
|
super.configureFlutterEngine(flutterEngine)
|
||||||
|
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
|
||||||
|
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
||||||
|
mainChannel.setMethodCallHandler { call, result ->
|
||||||
|
when (call.method) {
|
||||||
|
"runPatcher" -> {
|
||||||
|
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
|
||||||
|
val originalFilePath = call.argument<String>("originalFilePath")
|
||||||
|
val inputFilePath = call.argument<String>("inputFilePath")
|
||||||
|
val patchedFilePath = call.argument<String>("patchedFilePath")
|
||||||
|
val outFilePath = call.argument<String>("outFilePath")
|
||||||
|
val integrationsPath = call.argument<String>("integrationsPath")
|
||||||
|
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 &&
|
||||||
|
inputFilePath != null &&
|
||||||
|
patchedFilePath != null &&
|
||||||
|
outFilePath != null &&
|
||||||
|
integrationsPath != null &&
|
||||||
|
selectedPatches != null &&
|
||||||
|
cacheDirPath != null &&
|
||||||
|
mergeIntegrations != null &&
|
||||||
|
resourcePatching != null &&
|
||||||
|
keyStoreFilePath != null
|
||||||
|
) {
|
||||||
|
runPatcher(
|
||||||
|
result,
|
||||||
|
patchBundleFilePath,
|
||||||
|
originalFilePath,
|
||||||
|
inputFilePath,
|
||||||
|
patchedFilePath,
|
||||||
|
outFilePath,
|
||||||
|
integrationsPath,
|
||||||
|
selectedPatches,
|
||||||
|
cacheDirPath,
|
||||||
|
mergeIntegrations,
|
||||||
|
resourcePatching,
|
||||||
|
keyStoreFilePath
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun runPatcher(
|
||||||
|
result: MethodChannel.Result,
|
||||||
|
patchBundleFilePath: String,
|
||||||
|
originalFilePath: String,
|
||||||
|
inputFilePath: String,
|
||||||
|
patchedFilePath: String,
|
||||||
|
outFilePath: String,
|
||||||
|
integrationsPath: String,
|
||||||
|
selectedPatches: List<String>,
|
||||||
|
cacheDirPath: String,
|
||||||
|
mergeIntegrations: Boolean,
|
||||||
|
resourcePatching: Boolean,
|
||||||
|
keyStoreFilePath: String
|
||||||
|
) {
|
||||||
|
val originalFile = File(originalFilePath)
|
||||||
|
val inputFile = File(inputFilePath)
|
||||||
|
val patchedFile = File(patchedFilePath)
|
||||||
|
val outFile = File(outFilePath)
|
||||||
|
val integrations = File(integrationsPath)
|
||||||
|
val keyStoreFile = File(keyStoreFilePath)
|
||||||
|
|
||||||
|
val patches = DexPatchBundle(
|
||||||
|
patchBundleFilePath,
|
||||||
|
DexClassLoader(
|
||||||
|
patchBundleFilePath,
|
||||||
|
cacheDirPath,
|
||||||
|
null,
|
||||||
|
javaClass.classLoader
|
||||||
|
)
|
||||||
|
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
||||||
|
|
||||||
|
Thread {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.1,
|
||||||
|
"header" to "",
|
||||||
|
"log" to "Copying original apk"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
originalFile.copyTo(inputFile, true)
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.2,
|
||||||
|
"header" to "Unpacking apk...",
|
||||||
|
"log" to "Unpacking input apk"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val patcher =
|
||||||
|
Patcher(
|
||||||
|
PatcherOptions(
|
||||||
|
inputFile,
|
||||||
|
cacheDirPath,
|
||||||
|
resourcePatching,
|
||||||
|
Aapt.binary(applicationContext).absolutePath,
|
||||||
|
cacheDirPath,
|
||||||
|
logger = ManagerLogger()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to 0.3, "header" to "", "log" to "")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (mergeIntegrations) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.4,
|
||||||
|
"header" to "Merging integrations...",
|
||||||
|
"log" to "Merging integrations"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
patcher.addFiles(listOf(integrations)) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.5,
|
||||||
|
"header" to "Applying patches...",
|
||||||
|
"log" to ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
patcher.addPatches(patches)
|
||||||
|
patcher.applyPatches().forEach { (patch, res) ->
|
||||||
|
if (res.isSuccess) {
|
||||||
|
val msg = "[success] $patch"
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.5,
|
||||||
|
"header" to "",
|
||||||
|
"log" to msg
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
val msg = "[error] $patch:" + res.exceptionOrNull()!!
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to 0.5, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.7,
|
||||||
|
"header" to "Repacking apk...",
|
||||||
|
"log" to "Repacking patched apk"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val res = patcher.save()
|
||||||
|
ZipFile(patchedFile).use { file ->
|
||||||
|
res.dexFiles.forEach {
|
||||||
|
file.addEntryCompressData(
|
||||||
|
ZipEntry.createWithName(it.name),
|
||||||
|
it.stream.readBytes()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
res.resourceFile?.let {
|
||||||
|
file.copyEntriesFromFileAligned(
|
||||||
|
ZipFile(it),
|
||||||
|
ZipAligner::getEntryAlignment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
file.copyEntriesFromFileAligned(
|
||||||
|
ZipFile(inputFile),
|
||||||
|
ZipAligner::getEntryAlignment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.9,
|
||||||
|
"header" to "Signing apk...",
|
||||||
|
"log" to ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 1.0,
|
||||||
|
"header" to "Finished!",
|
||||||
|
"log" to "Finished!"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post { result.success(null) }
|
||||||
|
}
|
||||||
|
.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class ManagerLogger : Logger {
|
||||||
|
override fun error(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel
|
||||||
|
.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun warn(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun info(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun trace(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,4 +9,4 @@ object Aapt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun File.resolveAapt() = resolve(list { _, f -> !File(f).isDirectory && file.contains("aapt") }!!.first())
|
private fun File.resolveAapt() = resolve(list { _, f -> !File(f).isDirectory && f.contains("aapt") }!!.first())
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package app.revanced.manager.flutter.utils.zip
|
package app.revanced.manager.flutter.utils.zip
|
||||||
|
|
||||||
import java.io.DataInput
|
import java.io.DataInput
|
||||||
@@ -17,8 +19,8 @@ fun UShort.toBigEndian() = (this.toUInt() shl 16).toBigEndian().toUShort()
|
|||||||
fun ByteBuffer.getUShort() = this.short.toUShort()
|
fun ByteBuffer.getUShort() = this.short.toUShort()
|
||||||
fun ByteBuffer.getUInt() = this.int.toUInt()
|
fun ByteBuffer.getUInt() = this.int.toUInt()
|
||||||
|
|
||||||
fun ByteBuffer.putUShort(ushort: UShort) = this.putShort(ushort.toShort())
|
fun ByteBuffer.putUShort(ushort: UShort): ByteBuffer = this.putShort(ushort.toShort())
|
||||||
fun ByteBuffer.putUInt(uint: UInt) = this.putInt(uint.toInt())
|
fun ByteBuffer.putUInt(uint: UInt): ByteBuffer = this.putInt(uint.toInt())
|
||||||
|
|
||||||
fun DataInput.readUShort() = this.readShort().toUShort()
|
fun DataInput.readUShort() = this.readShort().toUShort()
|
||||||
fun DataInput.readUInt() = this.readInt().toUInt()
|
fun DataInput.readUInt() = this.readInt().toUInt()
|
||||||
@@ -10,7 +10,7 @@ import java.nio.channels.FileChannel
|
|||||||
import java.util.zip.CRC32
|
import java.util.zip.CRC32
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
|
|
||||||
class ZipFile(val file: File) : Closeable {
|
class ZipFile(file: File) : Closeable {
|
||||||
var entries: MutableList<ZipEntry> = mutableListOf()
|
var entries: MutableList<ZipEntry> = mutableListOf()
|
||||||
|
|
||||||
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
|
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
|
||||||
@@ -134,8 +134,8 @@ class ZipFile(val file: File) : Closeable {
|
|||||||
addEntry(entry, compressedBuffer)
|
addEntry(entry, compressedBuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
|
private fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
|
||||||
alignment?.let { alignment ->
|
alignment?.let {
|
||||||
//calculate where data would end up
|
//calculate where data would end up
|
||||||
val dataOffset = filePointer.filePointer + entry.LFHSize
|
val dataOffset = filePointer.filePointer + entry.LFHSize
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ data class ZipEntry(
|
|||||||
val fileNameLength = input.readUShortLE()
|
val fileNameLength = input.readUShortLE()
|
||||||
var fileName = ""
|
var fileName = ""
|
||||||
val extraFieldLength = input.readUShortLE()
|
val extraFieldLength = input.readUShortLE()
|
||||||
var extraField = ByteArray(extraFieldLength.toInt())
|
val extraField = ByteArray(extraFieldLength.toInt())
|
||||||
val fileCommentLength = input.readUShortLE()
|
val fileCommentLength = input.readUShortLE()
|
||||||
var fileComment = ""
|
var fileComment = ""
|
||||||
val diskNumber = input.readUShortLE()
|
val diskNumber = input.readUShortLE()
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 814 B |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 5.4 KiB |
BIN
android/app/src/main/res/drawable/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
19
android/app/src/main/res/values-night-v31/styles.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
the Flutter engine draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
20
android/app/src/main/res/values-v31/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
the Flutter engine draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
|
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.6.10'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
classpath 'com.android.tools.build:gradle:7.1.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#Fri Jun 23 08:50:38 CEST 2017
|
#Mon May 09 12:07:41 MSK 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-1-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
"downloadingMessage": "Downloading update!",
|
"downloadingMessage": "Downloading update!",
|
||||||
"installingMessage": "Installing update... Hang on!",
|
"installingMessage": "Installing update... Hang on!",
|
||||||
"errorDownloadMessage": "Unable to download update!",
|
"errorDownloadMessage": "Unable to download update!",
|
||||||
"errorInstallMessage": "Unable to download update!",
|
"errorInstallMessage": "Unable to install update!",
|
||||||
"noConnection": "No internet connection"
|
"noConnection": "No internet connection"
|
||||||
},
|
},
|
||||||
"applicationItem": {
|
"applicationItem": {
|
||||||
@@ -42,13 +42,18 @@
|
|||||||
},
|
},
|
||||||
"patcherView": {
|
"patcherView": {
|
||||||
"widgetTitle": "Patcher",
|
"widgetTitle": "Patcher",
|
||||||
"patchButton": "Patch"
|
"patchButton": "Patch",
|
||||||
|
"patchDialogTitle": "Warning",
|
||||||
|
"patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors can occur.\nAre you sure you want to proceed with patching a split base APK?"
|
||||||
},
|
},
|
||||||
"appSelectorCard": {
|
"appSelectorCard": {
|
||||||
"widgetTitle": "Select application",
|
"widgetTitle": "Select application",
|
||||||
"widgetTitleSelected": "Selected application",
|
"widgetTitleSelected": "Selected application",
|
||||||
"widgetSubtitle": "No application selected.",
|
"widgetSubtitle": "No application selected.",
|
||||||
"noAppsLabel": "No applications found."
|
"noAppsLabel": "No applications found.",
|
||||||
|
"currentVersion": "Current",
|
||||||
|
"recommendedVersion": "Recommended",
|
||||||
|
"anyVersion": "any"
|
||||||
},
|
},
|
||||||
"patchSelectorCard": {
|
"patchSelectorCard": {
|
||||||
"widgetTitle": "Select patches",
|
"widgetTitle": "Select patches",
|
||||||
@@ -67,12 +72,13 @@
|
|||||||
},
|
},
|
||||||
"patchesSelectorView": {
|
"patchesSelectorView": {
|
||||||
"searchBarHint": "Search patches",
|
"searchBarHint": "Search patches",
|
||||||
"doneButton": "Done"
|
"doneButton": "Done",
|
||||||
|
"noPatchesFound": "No patches found for the selected app."
|
||||||
},
|
},
|
||||||
"patchItem": {
|
"patchItem": {
|
||||||
"unsupportedWarningButton": "Unsupported version",
|
"unsupportedWarningButton": "Unsupported version",
|
||||||
"unsupportedDialogTitle": "Warning",
|
"unsupportedDialogTitle": "Warning",
|
||||||
"unsupportedDialogText": "Selecting this patch may or may not result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
||||||
},
|
},
|
||||||
"installerView": {
|
"installerView": {
|
||||||
"widgetTitle": "Installer",
|
"widgetTitle": "Installer",
|
||||||
@@ -118,8 +124,11 @@
|
|||||||
"openButton": "Open",
|
"openButton": "Open",
|
||||||
"uninstallButton": "Uninstall",
|
"uninstallButton": "Uninstall",
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
|
"unpatchButton": "Unpatch",
|
||||||
"uninstallDialogTitle": "Uninstall",
|
"uninstallDialogTitle": "Uninstall",
|
||||||
"uninstallDialogText": "Are you sure you want to uninstall this app?",
|
"uninstallDialogText": "Are you sure you want to uninstall this app?",
|
||||||
|
"unpatchDialogTitle": "Unpatch",
|
||||||
|
"unpatchDialogText": "Are you sure you want to unpatch this app?",
|
||||||
"rootDialogTitle": "Error",
|
"rootDialogTitle": "Error",
|
||||||
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
||||||
"packageNameLabel": "Package Name",
|
"packageNameLabel": "Package Name",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
@@ -7,7 +7,7 @@ part 'patched_application.g.dart';
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class PatchedApplication {
|
class PatchedApplication {
|
||||||
String name;
|
String name;
|
||||||
final String packageName;
|
String packageName;
|
||||||
String version;
|
String version;
|
||||||
final String apkFilePath;
|
final String apkFilePath;
|
||||||
@JsonKey(
|
@JsonKey(
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class GithubAPI {
|
|||||||
final Dio _dio = Dio();
|
final Dio _dio = Dio();
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(hours: 1),
|
const Duration(days: 1),
|
||||||
maxStale: const Duration(days: 7),
|
maxStale: const Duration(days: 7),
|
||||||
);
|
);
|
||||||
final Map<String, String> repoAppPath = {
|
final Map<String, String> repoAppPath = {
|
||||||
|
|||||||
@@ -165,46 +165,114 @@ class ManagerAPI {
|
|||||||
return packageInfo.version;
|
return packageInfo.version;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> reAssessSavedApps() async {
|
Future<List<PatchedApplication>> getAppsToRemove(
|
||||||
List<PatchedApplication> patchedApps = getPatchedApps();
|
List<PatchedApplication> patchedApps,
|
||||||
|
) async {
|
||||||
List<PatchedApplication> toRemove = [];
|
List<PatchedApplication> toRemove = [];
|
||||||
for (PatchedApplication app in patchedApps) {
|
for (PatchedApplication app in patchedApps) {
|
||||||
bool isRemove = await isAppUninstalled(app);
|
bool isRemove = await isAppUninstalled(app);
|
||||||
if (isRemove) {
|
if (isRemove) {
|
||||||
toRemove.add(app);
|
toRemove.add(app);
|
||||||
} else {
|
}
|
||||||
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
|
}
|
||||||
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
|
return toRemove;
|
||||||
if (!app.hasUpdates) {
|
}
|
||||||
String? currentInstalledVersion =
|
|
||||||
(await DeviceApps.getApp(app.packageName))?.versionName;
|
Future<List<PatchedApplication>> getUnsavedApps(
|
||||||
if (currentInstalledVersion != null) {
|
List<PatchedApplication> patchedApps,
|
||||||
String currentSavedVersion = app.version;
|
) async {
|
||||||
int currentInstalledVersionInt = int.parse(
|
List<PatchedApplication> unsavedApps = [];
|
||||||
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
int currentSavedVersionInt =
|
if (hasRootPermissions) {
|
||||||
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
|
List<String> installedApps = await _rootAPI.getInstalledApps();
|
||||||
if (currentInstalledVersionInt > currentSavedVersionInt) {
|
for (String packageName in installedApps) {
|
||||||
app.hasUpdates = true;
|
if (!patchedApps.any((app) => app.packageName == packageName)) {
|
||||||
}
|
ApplicationWithIcon? application =
|
||||||
|
await DeviceApps.getApp(packageName, true)
|
||||||
|
as ApplicationWithIcon?;
|
||||||
|
if (application != null) {
|
||||||
|
unsavedApps.add(
|
||||||
|
PatchedApplication(
|
||||||
|
name: application.appName,
|
||||||
|
packageName: application.packageName,
|
||||||
|
version: application.versionName!,
|
||||||
|
apkFilePath: application.apkFilePath,
|
||||||
|
icon: application.icon,
|
||||||
|
patchDate: DateTime.now(),
|
||||||
|
isRooted: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<Application> userApps = await DeviceApps.getInstalledApplications(
|
||||||
|
includeSystemApps: false,
|
||||||
|
includeAppIcons: false,
|
||||||
|
);
|
||||||
|
for (Application app in userApps) {
|
||||||
|
if (app.packageName.startsWith('app.revanced') &&
|
||||||
|
!app.packageName.startsWith('app.revanced.manager.') &&
|
||||||
|
!patchedApps.any((uapp) => uapp.packageName == app.packageName)) {
|
||||||
|
ApplicationWithIcon? application =
|
||||||
|
await DeviceApps.getApp(app.packageName, true)
|
||||||
|
as ApplicationWithIcon?;
|
||||||
|
if (application != null) {
|
||||||
|
unsavedApps.add(
|
||||||
|
PatchedApplication(
|
||||||
|
name: application.appName,
|
||||||
|
packageName: application.packageName,
|
||||||
|
version: application.versionName!,
|
||||||
|
apkFilePath: application.apkFilePath,
|
||||||
|
icon: application.icon,
|
||||||
|
patchDate: DateTime.now(),
|
||||||
|
isRooted: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unsavedApps;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> reAssessSavedApps() async {
|
||||||
|
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
|
List<PatchedApplication> unsavedApps = await getUnsavedApps(patchedApps);
|
||||||
|
patchedApps.addAll(unsavedApps);
|
||||||
|
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
||||||
patchedApps.removeWhere((a) => toRemove.contains(a));
|
patchedApps.removeWhere((a) => toRemove.contains(a));
|
||||||
|
for (PatchedApplication app in patchedApps) {
|
||||||
|
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
|
||||||
|
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
|
||||||
|
if (!app.hasUpdates) {
|
||||||
|
String? currentInstalledVersion =
|
||||||
|
(await DeviceApps.getApp(app.packageName))?.versionName;
|
||||||
|
if (currentInstalledVersion != null) {
|
||||||
|
String currentSavedVersion = app.version;
|
||||||
|
int currentInstalledVersionInt = int.parse(
|
||||||
|
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
int currentSavedVersionInt =
|
||||||
|
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
if (currentInstalledVersionInt > currentSavedVersionInt) {
|
||||||
|
app.hasUpdates = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await setPatchedApps(patchedApps);
|
await setPatchedApps(patchedApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
||||||
bool existsRoot = false;
|
bool existsRoot = false;
|
||||||
|
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
||||||
if (app.isRooted) {
|
if (app.isRooted) {
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
if (hasRootPermissions) {
|
if (hasRootPermissions) {
|
||||||
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
|
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
|
||||||
}
|
}
|
||||||
|
return !existsRoot || !existsNonRoot;
|
||||||
}
|
}
|
||||||
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
return !existsNonRoot;
|
||||||
return !existsRoot && !existsNonRoot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
|
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
|
||||||
|
|||||||
@@ -82,6 +82,24 @@ class PatcherAPI {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.contains('integrations'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.any((dep) => dep.contains('resource-')),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.contains('settings'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getOriginalFilePath(
|
Future<String> getOriginalFilePath(
|
||||||
String packageName,
|
String packageName,
|
||||||
String originalFilePath,
|
String originalFilePath,
|
||||||
@@ -101,15 +119,9 @@ class PatcherAPI {
|
|||||||
String originalFilePath,
|
String originalFilePath,
|
||||||
List<Patch> selectedPatches,
|
List<Patch> selectedPatches,
|
||||||
) async {
|
) async {
|
||||||
bool mergeIntegrations = selectedPatches.any(
|
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
||||||
(patch) => patch.dependencies.contains('integrations'),
|
bool resourcePatching = await needsResourcePatching(selectedPatches);
|
||||||
);
|
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
||||||
bool resourcePatching = selectedPatches.any(
|
|
||||||
(patch) => patch.dependencies.any((dep) => dep.contains('resource-')),
|
|
||||||
);
|
|
||||||
bool includeSettings = selectedPatches.any(
|
|
||||||
(patch) => patch.dependencies.contains('settings'),
|
|
||||||
);
|
|
||||||
if (includeSettings) {
|
if (includeSettings) {
|
||||||
try {
|
try {
|
||||||
Patch? settingsPatch = _patches.firstWhereOrNull(
|
Patch? settingsPatch = _patches.firstWhereOrNull(
|
||||||
@@ -208,4 +220,32 @@ class PatcherAPI {
|
|||||||
log.writeAsStringSync(logs);
|
log.writeAsStringSync(logs);
|
||||||
ShareExtend.share(log.path, 'file');
|
ShareExtend.share(log.path, 'file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getRecommendedVersion(String packageName) {
|
||||||
|
Map<String, int> versions = {};
|
||||||
|
for (Patch patch in _patches) {
|
||||||
|
Package? package = patch.compatiblePackages.firstWhereOrNull(
|
||||||
|
(pack) => pack.name == packageName,
|
||||||
|
);
|
||||||
|
if (package != null) {
|
||||||
|
for (String version in package.versions) {
|
||||||
|
versions.update(
|
||||||
|
version,
|
||||||
|
(value) => versions[version]! + 1,
|
||||||
|
ifAbsent: () => 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (versions.isNotEmpty) {
|
||||||
|
var entries = versions.entries.toList()
|
||||||
|
..sort((a, b) => a.value.compareTo(b.value));
|
||||||
|
versions
|
||||||
|
..clear()
|
||||||
|
..addEntries(entries);
|
||||||
|
versions.removeWhere((key, value) => value != versions.values.last);
|
||||||
|
return (versions.keys.toList()..sort()).last;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class RevancedAPI {
|
|||||||
final Dio _dio = Dio();
|
final Dio _dio = Dio();
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(hours: 1),
|
const Duration(days: 1),
|
||||||
maxStale: const Duration(days: 7),
|
maxStale: const Duration(days: 7),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,12 @@ class RootAPI {
|
|||||||
final String _serviceDDirPath = '/data/adb/service.d';
|
final String _serviceDDirPath = '/data/adb/service.d';
|
||||||
|
|
||||||
Future<bool> hasRootPermissions() async {
|
Future<bool> hasRootPermissions() async {
|
||||||
bool? isRooted = await Root.isRooted();
|
try {
|
||||||
return isRooted != null && isRooted;
|
bool? isRooted = await Root.isRooted();
|
||||||
|
return isRooted != null && isRooted;
|
||||||
|
} on Exception {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setPermissions(
|
Future<void> setPermissions(
|
||||||
@@ -55,15 +59,8 @@ class RootAPI {
|
|||||||
);
|
);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
List<String> apps = res.split('\n');
|
List<String> apps = res.split('\n');
|
||||||
List<String> toRemove = [];
|
apps.removeWhere((pack) => pack.isEmpty);
|
||||||
for (String packageName in apps) {
|
return apps.map((pack) => pack.trim()).toList();
|
||||||
bool isInstalled = await isAppInstalled(packageName);
|
|
||||||
if (!isInstalled) {
|
|
||||||
toRemove.add(packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
apps.removeWhere((a) => toRemove.contains(a));
|
|
||||||
return apps;
|
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception {
|
||||||
return List.empty();
|
return List.empty();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
var lightCustomColorScheme = ColorScheme.fromSeed(
|
var lightCustomColorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: Colors.blue,
|
seedColor: Colors.blue,
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
|
primary: const Color(0xff1B73E8),
|
||||||
);
|
);
|
||||||
|
|
||||||
var lightCustomTheme = ThemeData(
|
var lightCustomTheme = ThemeData(
|
||||||
@@ -23,8 +24,8 @@ var lightCustomTheme = ThemeData(
|
|||||||
var darkCustomColorScheme = ColorScheme.fromSeed(
|
var darkCustomColorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: Colors.blue,
|
seedColor: Colors.blue,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
primary: const Color(0xff7792BA),
|
primary: const Color(0xffA5CAFF),
|
||||||
surface: const Color(0xff0A0D11),
|
surface: const Color(0xff1B1A1D),
|
||||||
);
|
);
|
||||||
|
|
||||||
var darkCustomTheme = ThemeData(
|
var darkCustomTheme = ThemeData(
|
||||||
@@ -38,8 +39,8 @@ var darkCustomTheme = ThemeData(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
canvasColor: const Color(0xff0A0D11),
|
canvasColor: const Color(0xff1B1A1D),
|
||||||
scaffoldBackgroundColor: const Color(0xff0A0D11),
|
scaffoldBackgroundColor: const Color(0xff1B1A1D),
|
||||||
toggleableActiveColor: const Color(0xff7792BA),
|
toggleableActiveColor: const Color(0xffA5CAFF),
|
||||||
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
|
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class DynamicThemeBuilder extends StatelessWidget {
|
|||||||
2: lightDynamicTheme,
|
2: lightDynamicTheme,
|
||||||
3: darkDynamicTheme,
|
3: darkDynamicTheme,
|
||||||
},
|
},
|
||||||
fallbackTheme: darkCustomTheme,
|
fallbackTheme: lightCustomTheme,
|
||||||
),
|
),
|
||||||
builder: (context, theme) => MaterialApp(
|
builder: (context, theme) => MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
|||||||
@@ -74,7 +74,10 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getPatchedApps() {
|
void _getPatchedApps() {
|
||||||
patchedInstalledApps = _managerAPI.getPatchedApps().toList();
|
patchedInstalledApps = _managerAPI
|
||||||
|
.getPatchedApps()
|
||||||
|
.where((app) => app.hasUpdates == false)
|
||||||
|
.toList();
|
||||||
patchedUpdatableApps = _managerAPI
|
patchedUpdatableApps = _managerAPI
|
||||||
.getPatchedApps()
|
.getPatchedApps()
|
||||||
.where((app) => app.hasUpdates == true)
|
.where((app) => app.hasUpdates == true)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:flutter_i18n/flutter_i18n.dart';
|
|||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
||||||
@@ -30,7 +31,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: !model.isPatching && model.hasErrors,
|
visible: !model.isPatching && !model.hasErrors,
|
||||||
child: CustomPopupMenu(
|
child: CustomPopupMenu(
|
||||||
onSelected: (value) => model.onMenuSelection(value),
|
onSelected: (value) => model.onMenuSelection(value),
|
||||||
children: {
|
children: {
|
||||||
@@ -57,14 +58,9 @@ class InstallerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size(double.infinity, 1.0),
|
preferredSize: const Size(double.infinity, 1.0),
|
||||||
child: LinearProgressIndicator(
|
child:
|
||||||
color: Theme.of(context).colorScheme.primary,
|
GradientProgressIndicator(progress: model.progress!)),
|
||||||
backgroundColor:
|
|
||||||
Theme.of(context).colorScheme.primaryContainer,
|
|
||||||
value: model.progress,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_background/flutter_background.dart';
|
import 'package:flutter_background/flutter_background.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
//import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
@@ -29,29 +30,31 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
bool hasErrors = false;
|
bool hasErrors = false;
|
||||||
|
|
||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
try {
|
if (true /*await Permission.ignoreBatteryOptimizations.isGranted*/) {
|
||||||
await FlutterBackground.initialize(
|
try {
|
||||||
androidConfig: FlutterBackgroundAndroidConfig(
|
await FlutterBackground.initialize(
|
||||||
notificationTitle: FlutterI18n.translate(
|
androidConfig: FlutterBackgroundAndroidConfig(
|
||||||
context,
|
notificationTitle: FlutterI18n.translate(
|
||||||
'installerView.notificationTitle',
|
context,
|
||||||
|
'installerView.notificationTitle',
|
||||||
|
),
|
||||||
|
notificationText: FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'installerView.notificationText',
|
||||||
|
),
|
||||||
|
notificationImportance: AndroidNotificationImportance.Default,
|
||||||
|
notificationIcon: const AndroidResource(
|
||||||
|
name: 'ic_notification',
|
||||||
|
defType: 'drawable',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
notificationText: FlutterI18n.translate(
|
);
|
||||||
context,
|
await FlutterBackground.enableBackgroundExecution();
|
||||||
'installerView.notificationText',
|
} on Exception {
|
||||||
),
|
// ignore
|
||||||
notificationImportance: AndroidNotificationImportance.Default,
|
}
|
||||||
notificationIcon: const AndroidResource(
|
|
||||||
name: 'ic_notification',
|
|
||||||
defType: 'drawable',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
await FlutterBackground.enableBackgroundExecution();
|
|
||||||
await Wakelock.enable();
|
|
||||||
} on Exception {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
await Wakelock.enable();
|
||||||
await handlePlatformChannelMethods();
|
await handlePlatformChannelMethods();
|
||||||
await runPatcher();
|
await runPatcher();
|
||||||
}
|
}
|
||||||
@@ -119,12 +122,14 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
hasErrors = true;
|
hasErrors = true;
|
||||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||||
}
|
}
|
||||||
try {
|
if (true /*await Permission.ignoreBatteryOptimizations.isGranted*/) {
|
||||||
await FlutterBackground.disableBackgroundExecution();
|
try {
|
||||||
await Wakelock.disable();
|
await FlutterBackground.disableBackgroundExecution();
|
||||||
} on Exception {
|
} on Exception {
|
||||||
// ignore
|
// ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
await Wakelock.disable();
|
||||||
isPatching = false;
|
isPatching = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,6 +147,13 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
update(1.0, 'Installed!', 'Installed!');
|
update(1.0, 'Installed!', 'Installed!');
|
||||||
_app.patchDate = DateTime.now();
|
_app.patchDate = DateTime.now();
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
|
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||||
|
if (hasMicroG) {
|
||||||
|
_app.packageName = _app.packageName.replaceFirst(
|
||||||
|
'com.google.',
|
||||||
|
'app.revanced.',
|
||||||
|
);
|
||||||
|
}
|
||||||
await _managerAPI.savePatchedApp(_app);
|
await _managerAPI.savePatchedApp(_app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<NavigationViewModel>.reactive(
|
return ViewModelBuilder<NavigationViewModel>.reactive(
|
||||||
|
onModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => locator<NavigationViewModel>(),
|
viewModelBuilder: () => locator<NavigationViewModel>(),
|
||||||
builder: (context, model, child) => Scaffold(
|
builder: (context, model, child) => Scaffold(
|
||||||
body: PageTransitionSwitcher(
|
body: PageTransitionSwitcher(
|
||||||
@@ -41,6 +42,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.dashboardTab',
|
'navigationView.dashboardTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
NavigationDestination(
|
NavigationDestination(
|
||||||
icon: model.isIndexSelected(1)
|
icon: model.isIndexSelected(1)
|
||||||
@@ -50,6 +52,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.patcherTab',
|
'navigationView.patcherTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
NavigationDestination(
|
NavigationDestination(
|
||||||
icon: model.isIndexSelected(2)
|
icon: model.isIndexSelected(2)
|
||||||
@@ -59,6 +62,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.settingsTab',
|
'navigationView.settingsTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,12 +1,44 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
|
//import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_view.dart';
|
import 'package:revanced_manager/ui/views/home/home_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/settings/settings_view.dart';
|
import 'package:revanced_manager/ui/views/settings/settings_view.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class NavigationViewModel extends IndexTrackingViewModel {
|
class NavigationViewModel extends IndexTrackingViewModel {
|
||||||
|
void initialize(BuildContext context) async {
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.getBool('useDarkTheme') == null) {
|
||||||
|
bool isDark =
|
||||||
|
MediaQuery.of(context).platformBrightness != Brightness.light;
|
||||||
|
await prefs.setBool('useDarkTheme', isDark);
|
||||||
|
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
|
||||||
|
}
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor:
|
||||||
|
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
DynamicTheme.of(context)!.theme.brightness == Brightness.light
|
||||||
|
? Brightness.dark
|
||||||
|
: Brightness.light,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
//if (prefs.getBool('permissionsRequested') == null) {
|
||||||
|
//await prefs.setBool('permissionsRequested', true);
|
||||||
|
RootAPI().hasRootPermissions();
|
||||||
|
//Permission.requestInstallPackages.request();
|
||||||
|
//Permission.ignoreBatteryOptimizations.request();
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
Widget getViewForIndex(int index) {
|
Widget getViewForIndex(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class PatcherView extends StatelessWidget {
|
|||||||
child: FloatingActionButton.extended(
|
child: FloatingActionButton.extended(
|
||||||
label: I18nText('patcherView.patchButton'),
|
label: I18nText('patcherView.patchButton'),
|
||||||
icon: const Icon(Icons.build),
|
icon: const Icon(Icons.build),
|
||||||
onPressed: () => model.navigateToInstaller(),
|
onPressed: () => model.showPatchConfirmationDialog(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
|
|||||||
@@ -1,14 +1,20 @@
|
|||||||
|
import 'package:device_apps/device_apps.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/app/app.router.dart';
|
import 'package:revanced_manager/app/app.router.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class PatcherViewModel extends BaseViewModel {
|
class PatcherViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
PatchedApplication? selectedApp;
|
PatchedApplication? selectedApp;
|
||||||
List<Patch> selectedPatches = [];
|
List<Patch> selectedPatches = [];
|
||||||
|
|
||||||
@@ -31,4 +37,74 @@ class PatcherViewModel extends BaseViewModel {
|
|||||||
bool dimPatchesCard() {
|
bool dimPatchesCard() {
|
||||||
return selectedApp == null;
|
return selectedApp == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> isValidPatchConfig() async {
|
||||||
|
bool needsResourcePatching =
|
||||||
|
await _patcherAPI.needsResourcePatching(selectedPatches);
|
||||||
|
if (needsResourcePatching && selectedApp != null) {
|
||||||
|
Application? app = await DeviceApps.getApp(selectedApp!.packageName);
|
||||||
|
if (app != null && app.isSplit) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> showPatchConfirmationDialog(BuildContext context) async {
|
||||||
|
bool isValid = await isValidPatchConfig();
|
||||||
|
if (isValid) {
|
||||||
|
navigateToInstaller();
|
||||||
|
} else {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText('patcherView.patchDialogTitle'),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText('patcherView.patchDialogText'),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('cancelButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
navigateToInstaller();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getAppSelectionString() {
|
||||||
|
String text = '${selectedApp!.name} (${selectedApp!.packageName})';
|
||||||
|
if (text.length > 32) {
|
||||||
|
text = '${text.substring(0, 32)}...)';
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRecommendedVersionString(BuildContext context) {
|
||||||
|
String recommendedVersion =
|
||||||
|
_patcherAPI.getRecommendedVersion(selectedApp!.packageName);
|
||||||
|
if (recommendedVersion.isEmpty) {
|
||||||
|
recommendedVersion = FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.anyVersion',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
recommendedVersion = 'v$recommendedVersion';
|
||||||
|
}
|
||||||
|
return '${FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.currentVersion',
|
||||||
|
)}: v${selectedApp!.version}\n${FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.recommendedVersion',
|
||||||
|
)}: $recommendedVersion';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,9 +55,16 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: model.patches.isEmpty
|
child: model.patches.isEmpty
|
||||||
? Center(
|
? Padding(
|
||||||
child: CircularProgressIndicator(
|
padding: const EdgeInsets.all(8.0),
|
||||||
color: Theme.of(context).colorScheme.primary,
|
child: Center(
|
||||||
|
child: I18nText(
|
||||||
|
'patchesSelectorView.noPatchesFound',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: ListView(
|
: ListView(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import 'dart:io';
|
|||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:logcat/logcat.dart';
|
import 'package:logcat/logcat.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
@@ -50,10 +51,16 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
await _managerAPI.setUseDynamicTheme(value);
|
await _managerAPI.setUseDynamicTheme(value);
|
||||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||||
if (currentTheme.isEven) {
|
if (currentTheme.isEven) {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
await DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
||||||
} else {
|
} else {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
await DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
||||||
}
|
}
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor:
|
||||||
|
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||||
|
),
|
||||||
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,10 +72,18 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
await _managerAPI.setUseDarkTheme(value);
|
await _managerAPI.setUseDarkTheme(value);
|
||||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||||
if (currentTheme < 2) {
|
if (currentTheme < 2) {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
await DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
await DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
||||||
}
|
}
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor:
|
||||||
|
DynamicTheme.of(context)!.theme.colorScheme.surface,
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
value ? Brightness.light : Brightness.dark,
|
||||||
|
),
|
||||||
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,9 @@ class AppInfoView extends StatelessWidget {
|
|||||||
CustomCard(
|
CustomCard(
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
!app.isRooted ? const Spacer() : Container(),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () => model.openApp(app),
|
onTap: () => model.openApp(app),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -92,12 +93,17 @@ class AppInfoView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
VerticalDivider(
|
VerticalDivider(
|
||||||
color: Theme.of(context).canvasColor,
|
color: Theme.of(context).canvasColor,
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () =>
|
onTap: () => model.showUninstallAlertDialog(
|
||||||
model.showUninstallAlertDialog(context, app),
|
context,
|
||||||
|
app,
|
||||||
|
false,
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -122,9 +128,11 @@ class AppInfoView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
VerticalDivider(
|
VerticalDivider(
|
||||||
color: Theme.of(context).canvasColor,
|
color: Theme.of(context).canvasColor,
|
||||||
),
|
),
|
||||||
|
const Spacer(),
|
||||||
InkWell(
|
InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.navigateToPatcher(app);
|
model.navigateToPatcher(app);
|
||||||
@@ -154,6 +162,49 @@ class AppInfoView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
app.isRooted ? const Spacer() : Container(),
|
||||||
|
app.isRooted
|
||||||
|
? VerticalDivider(
|
||||||
|
color: Theme.of(context).canvasColor,
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
app.isRooted ? const Spacer() : Container(),
|
||||||
|
app.isRooted
|
||||||
|
? InkWell(
|
||||||
|
onTap: () => model.showUninstallAlertDialog(
|
||||||
|
context,
|
||||||
|
app,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons
|
||||||
|
.settings_backup_restore_outlined,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
I18nText(
|
||||||
|
'appInfoView.unpatchButton',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Container(),
|
||||||
|
!app.isRooted ? const Spacer() : Container(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -19,16 +19,20 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
final RootAPI _rootAPI = RootAPI();
|
final RootAPI _rootAPI = RootAPI();
|
||||||
|
|
||||||
Future<void> uninstallApp(PatchedApplication app) async {
|
Future<void> uninstallApp(PatchedApplication app, bool onlyUnpatch) async {
|
||||||
if (app.isRooted) {
|
if (app.isRooted) {
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
if (hasRootPermissions) {
|
if (hasRootPermissions) {
|
||||||
_rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
_rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
||||||
_managerAPI.deletePatchedApp(app);
|
_managerAPI.deletePatchedApp(app);
|
||||||
|
if (!onlyUnpatch) {
|
||||||
|
DeviceApps.uninstallApp(app.packageName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DeviceApps.uninstallApp(app.packageName);
|
DeviceApps.uninstallApp(app.packageName).then(
|
||||||
_managerAPI.deletePatchedApp(app);
|
(value) => _managerAPI.deletePatchedApp(app),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,32 +47,39 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
Future<void> showUninstallAlertDialog(
|
Future<void> showUninstallAlertDialog(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
PatchedApplication app,
|
PatchedApplication app,
|
||||||
|
bool onlyUnpatch,
|
||||||
) async {
|
) async {
|
||||||
if (app.isRooted) {
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
if (app.isRooted && !hasRootPermissions) {
|
||||||
if (!hasRootPermissions) {
|
return showDialog(
|
||||||
return showDialog(
|
context: context,
|
||||||
context: context,
|
builder: (context) => AlertDialog(
|
||||||
builder: (context) => AlertDialog(
|
title: I18nText('appInfoView.rootDialogTitle'),
|
||||||
title: I18nText('appInfoView.rootDialogTitle'),
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
content: I18nText('appInfoView.rootDialogText'),
|
||||||
content: I18nText('appInfoView.rootDialogText'),
|
actions: <Widget>[
|
||||||
actions: <Widget>[
|
CustomMaterialButton(
|
||||||
CustomMaterialButton(
|
label: I18nText('okButton'),
|
||||||
label: I18nText('okButton'),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
)
|
||||||
)
|
],
|
||||||
],
|
),
|
||||||
),
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('appInfoView.uninstallDialogTitle'),
|
title: I18nText(
|
||||||
|
onlyUnpatch
|
||||||
|
? 'appInfoView.unpatchDialogTitle'
|
||||||
|
: 'appInfoView.uninstallDialogTitle',
|
||||||
|
),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.uninstallDialogText'),
|
content: I18nText(
|
||||||
|
onlyUnpatch
|
||||||
|
? 'appInfoView.unpatchDialogText'
|
||||||
|
: 'appInfoView.uninstallDialogText',
|
||||||
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
@@ -78,7 +89,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
uninstallApp(app);
|
uninstallApp(app, onlyUnpatch);
|
||||||
locator<HomeViewModel>().initialize(context);
|
locator<HomeViewModel>().initialize(context);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
|||||||
future: locator<HomeViewModel>().hasManagerUpdates(),
|
future: locator<HomeViewModel>().hasManagerUpdates(),
|
||||||
initialData: false,
|
initialData: false,
|
||||||
builder: (context, snapshot) => Opacity(
|
builder: (context, snapshot) => Opacity(
|
||||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.5,
|
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||||
child: CustomMaterialButton(
|
child: CustomMaterialButton(
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
label: I18nText('latestCommitCard.updateButton'),
|
label: I18nText('latestCommitCard.updateButton'),
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class GradientProgressIndicator extends StatefulWidget {
|
||||||
|
final double? progress;
|
||||||
|
const GradientProgressIndicator({required this.progress, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GradientProgressIndicator> createState() =>
|
||||||
|
_GradientProgressIndicatorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GradientProgressIndicatorState extends State<GradientProgressIndicator> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
|
Theme.of(context).colorScheme.secondary,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 5,
|
||||||
|
width: MediaQuery.of(context).size.width * widget.progress!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -39,7 +39,7 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
: Row(
|
: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 16.0,
|
height: 18.0,
|
||||||
child: ClipOval(
|
child: ClipOval(
|
||||||
child: Image.memory(
|
child: Image.memory(
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
@@ -49,8 +49,23 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 6),
|
||||||
Text(_getAppSelection()),
|
Text(locator<PatcherViewModel>().getAppSelectionString()),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
|
? Container()
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 20),
|
||||||
|
child: Text(
|
||||||
|
locator<PatcherViewModel>()
|
||||||
|
.getRecommendedVersionString(context),
|
||||||
|
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -58,10 +73,4 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getAppSelection() {
|
|
||||||
String name = locator<PatcherViewModel>().selectedApp!.name;
|
|
||||||
String version = locator<PatcherViewModel>().selectedApp!.version;
|
|
||||||
return '$name (v$version)';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,6 +61,13 @@ class _AboutWidgetState extends State<AboutWidget> {
|
|||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
'Build: ${snapshot.data!['flavor']}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
),
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
'Model: ${snapshot.data!['model']}',
|
'Model: ${snapshot.data!['model']}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
|||||||
import 'package:expandable/expandable.dart';
|
import 'package:expandable/expandable.dart';
|
||||||
import 'package:timeago/timeago.dart';
|
import 'package:timeago/timeago.dart';
|
||||||
|
|
||||||
class ApplicationItem extends StatelessWidget {
|
class ApplicationItem extends StatefulWidget {
|
||||||
final Uint8List icon;
|
final Uint8List icon;
|
||||||
final String name;
|
final String name;
|
||||||
final DateTime patchDate;
|
final DateTime patchDate;
|
||||||
@@ -24,10 +24,39 @@ class ApplicationItem extends StatelessWidget {
|
|||||||
required this.onPressed,
|
required this.onPressed,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<ApplicationItem> createState() => _ApplicationItemState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ApplicationItemState extends State<ApplicationItem>
|
||||||
|
with TickerProviderStateMixin {
|
||||||
|
late AnimationController _animationController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
initState() {
|
||||||
|
super.initState();
|
||||||
|
_animationController = AnimationController(
|
||||||
|
vsync: this,
|
||||||
|
duration: const Duration(milliseconds: 300),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
ExpandableController expController = ExpandableController();
|
||||||
return ExpandablePanel(
|
return ExpandablePanel(
|
||||||
|
controller: expController,
|
||||||
theme: const ExpandableThemeData(
|
theme: const ExpandableThemeData(
|
||||||
|
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
|
tapBodyToCollapse: false,
|
||||||
|
tapBodyToExpand: false,
|
||||||
|
tapHeaderToExpand: false,
|
||||||
hasIcon: false,
|
hasIcon: false,
|
||||||
animationDuration: Duration(milliseconds: 450),
|
animationDuration: Duration(milliseconds: 450),
|
||||||
),
|
),
|
||||||
@@ -35,33 +64,54 @@ class ApplicationItem extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 60,
|
width: 40,
|
||||||
child: Image.memory(icon, height: 39, width: 39),
|
child: Image.memory(widget.icon, height: 40, width: 40),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 4),
|
||||||
Column(
|
Padding(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
padding: const EdgeInsets.only(left: 15.0),
|
||||||
children: <Widget>[
|
child: Column(
|
||||||
Text(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
name,
|
children: <Widget>[
|
||||||
style: const TextStyle(
|
Text(
|
||||||
fontSize: 16,
|
widget.name.length > 9
|
||||||
fontWeight: FontWeight.w500,
|
? '${widget.name.substring(0, 9)}...'
|
||||||
|
: widget.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Text(format(widget.patchDate)),
|
||||||
Text(format(patchDate)),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(right: 5.0),
|
||||||
|
child: RotationTransition(
|
||||||
|
turns:
|
||||||
|
Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
expController.toggle();
|
||||||
|
_animationController.isCompleted
|
||||||
|
? _animationController.reverse()
|
||||||
|
: _animationController.forward();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.arrow_drop_down),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: isUpdatableApp
|
label: widget.isUpdatableApp
|
||||||
? I18nText('applicationItem.patchButton')
|
? I18nText('applicationItem.patchButton')
|
||||||
: I18nText('applicationItem.infoButton'),
|
: I18nText('applicationItem.infoButton'),
|
||||||
onPressed: onPressed,
|
onPressed: widget.onPressed,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -70,7 +120,7 @@ class ApplicationItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
collapsed: const Text(''),
|
collapsed: const Text(''),
|
||||||
expanded: Padding(
|
expanded: Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
|
padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
@@ -82,7 +132,7 @@ class ApplicationItem extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
Text('\u2022 ${changelog.join('\n\u2022 ')}'),
|
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class CustomCard extends StatelessWidget {
|
|||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).colorScheme.secondaryContainer
|
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.40)
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
border: isFilled
|
border: isFilled
|
||||||
? null
|
? null
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class DashboardChip extends StatelessWidget {
|
|||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.secondary,
|
: Theme.of(context).colorScheme.secondary,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
|
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ class AboutInfo {
|
|||||||
final info = await DeviceInfoPlugin().androidInfo;
|
final info = await DeviceInfoPlugin().androidInfo;
|
||||||
return {
|
return {
|
||||||
'version': packageInfo.version,
|
'version': packageInfo.version,
|
||||||
|
'flavor': kReleaseMode ? 'release' : 'debug',
|
||||||
'model': info.model,
|
'model': info.model,
|
||||||
'androidVersion': info.version.release,
|
'androidVersion': info.version.release,
|
||||||
'arch': info.supportedAbis.first
|
'arch': info.supportedAbis.first
|
||||||
|
|||||||
17
pubspec.yaml
@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.2+2
|
version: 0.0.13+13
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.5 <3.0.0"
|
sdk: ">=2.17.5 <3.0.0"
|
||||||
@@ -17,14 +17,17 @@ dependencies:
|
|||||||
device_apps:
|
device_apps:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/ponces/flutter_plugin_device_apps
|
url: https://github.com/ponces/flutter_plugin_device_apps
|
||||||
ref: appinfo-from-storage
|
ref: revanced-manager
|
||||||
device_info_plus: ^4.1.2
|
device_info_plus: ^4.1.2
|
||||||
dio: ^4.0.6
|
dio: ^4.0.6
|
||||||
dio_http_cache_lts: ^0.4.1
|
dio_http_cache_lts: ^0.4.1
|
||||||
dynamic_color: ^1.5.4
|
dynamic_color: ^1.5.4
|
||||||
dynamic_themes: ^1.1.0
|
dynamic_themes: ^1.1.0
|
||||||
expandable: ^5.0.1
|
expandable: ^5.0.1
|
||||||
file_picker: ^5.0.1
|
file_picker:
|
||||||
|
git:
|
||||||
|
url: https://github.com/alexmercerind/flutter_file_picker
|
||||||
|
ref: master
|
||||||
flex_color_scheme: ^6.0.0
|
flex_color_scheme: ^6.0.0
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
@@ -49,6 +52,7 @@ dependencies:
|
|||||||
ref: feature/nullSafe
|
ref: feature/nullSafe
|
||||||
package_info_plus: ^1.4.3+1
|
package_info_plus: ^1.4.3+1
|
||||||
path_provider: ^2.0.11
|
path_provider: ^2.0.11
|
||||||
|
#permission_handler: ^10.0.0
|
||||||
pull_to_refresh: ^2.0.0
|
pull_to_refresh: ^2.0.0
|
||||||
root: ^2.0.2
|
root: ^2.0.2
|
||||||
share_extend: ^2.0.0
|
share_extend: ^2.0.0
|
||||||
@@ -71,13 +75,6 @@ dev_dependencies:
|
|||||||
injectable_generator: ^1.5.4
|
injectable_generator: ^1.5.4
|
||||||
json_serializable: ^6.3.1
|
json_serializable: ^6.3.1
|
||||||
|
|
||||||
flutter_icons:
|
|
||||||
android: true
|
|
||||||
ios: false
|
|
||||||
image_path: "assets/images/ic_launcher_round.png"
|
|
||||||
adaptive_icon_background: "#1B1B1B"
|
|
||||||
adaptive_icon_foreground: "assets/images/ic_launcher.png"
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
|
|||||||