mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-23 19:21:03 +00:00
Compare commits
111 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caa9694543 | ||
|
|
ac79765372 | ||
|
|
39500f054d | ||
|
|
f2d5cc91db | ||
|
|
84a788fd9e | ||
|
|
3778bfe1b5 | ||
|
|
63b2d8e0bd | ||
|
|
e7490b8d75 | ||
|
|
2e050d06e8 | ||
|
|
5fd1154039 | ||
|
|
39401a78ec | ||
|
|
273aa42b17 | ||
|
|
603917d21e | ||
|
|
e55cd6a938 | ||
|
|
2aaed14a3a | ||
|
|
511c25163d | ||
|
|
c24e50f3a0 | ||
|
|
2d732288a7 | ||
|
|
56e715cd3c | ||
|
|
074d8005bc | ||
|
|
5b38c9442a | ||
|
|
3b8dc66da6 | ||
|
|
f5ebfc92fc | ||
|
|
9de063aced | ||
|
|
331691cc9d | ||
|
|
1a97cdf91d | ||
|
|
fbd4359d61 | ||
|
|
f31a60d9bb | ||
|
|
79aca0e579 | ||
|
|
6d35c47b6b | ||
|
|
f1261398e9 | ||
|
|
007b518503 | ||
|
|
c6edc620c8 | ||
|
|
3f9d7c9cc0 | ||
|
|
6c1845e246 | ||
|
|
0b2572a730 | ||
|
|
6fc46d632b | ||
|
|
b2a35813f6 | ||
|
|
279b76ad53 | ||
|
|
b550016681 | ||
|
|
3ab5d12f3e | ||
|
|
53bcb8b85f | ||
|
|
94397dcb4c | ||
|
|
53fbee2d44 | ||
|
|
e46ad3595d | ||
|
|
f2b03b6e69 | ||
|
|
0df2a6bdc0 | ||
|
|
df31e5ccd1 | ||
|
|
4dfa0dada6 | ||
|
|
857a523f84 | ||
|
|
ceac838706 | ||
|
|
e8cb6d27fc | ||
|
|
78428f6bd3 | ||
|
|
da94dfba70 | ||
|
|
8275792f45 | ||
|
|
a90923011a | ||
|
|
1aa24e2871 | ||
|
|
68ce751745 | ||
|
|
74ff64d41a | ||
|
|
6d45ccecc2 | ||
|
|
5418c36716 | ||
|
|
ca0657e8f9 | ||
|
|
a5511c2a2c | ||
|
|
a346f8857f | ||
|
|
e12532ea4c | ||
|
|
7ecf951bfb | ||
|
|
db18874ea1 | ||
|
|
18a69776cd | ||
|
|
21cadf6450 | ||
|
|
5ddbe6e252 | ||
|
|
6d1427e01e | ||
|
|
6ac901f1d6 | ||
|
|
587ba795bb | ||
|
|
6b66c7bbd0 | ||
|
|
f398b6863a | ||
|
|
4d82ff3011 | ||
|
|
2a0ea78d7f | ||
|
|
4722880647 | ||
|
|
32fabcfa3f | ||
|
|
e0c46e4268 | ||
|
|
d84230fa22 | ||
|
|
9561153bfb | ||
|
|
c8c35ca801 | ||
|
|
cf99069804 | ||
|
|
6abb761724 | ||
|
|
4609ed9eba | ||
|
|
c0f743df89 | ||
|
|
f00f910973 | ||
|
|
2bc486dcec | ||
|
|
148981da18 | ||
|
|
d8df377427 | ||
|
|
efe1306aac | ||
|
|
ead308740f | ||
|
|
fa0f250e27 | ||
|
|
185d883b65 | ||
|
|
9d8b2e1a35 | ||
|
|
a6a7ff5040 | ||
|
|
1028ec8e2a | ||
|
|
f9242c1958 | ||
|
|
f9865166b0 | ||
|
|
f0f934f6a1 | ||
|
|
3d25655851 | ||
|
|
733190e76c | ||
|
|
ab312dec43 | ||
|
|
70159b8cd8 | ||
|
|
97060913a2 | ||
|
|
4a0c5f9935 | ||
|
|
f643a31455 | ||
|
|
03b87a50ea | ||
|
|
4631982d42 | ||
|
|
4c4b694db9 |
22
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
22
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@@ -20,14 +20,6 @@ body:
|
|||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Manager Branch
|
|
||||||
options:
|
|
||||||
- Flutter
|
|
||||||
- Compose
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Bug description
|
label: Bug description
|
||||||
@@ -112,3 +104,17 @@ body:
|
|||||||
description: Add additional context here.
|
description: Add additional context here.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
- type: checkboxes
|
||||||
|
id: acknowledgements
|
||||||
|
attributes:
|
||||||
|
label: Acknowledgements
|
||||||
|
description: Your issue will be closed if you haven't done these steps.
|
||||||
|
options:
|
||||||
|
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
||||||
|
required: true
|
||||||
|
- label: I have written a short but informative title.
|
||||||
|
required: true
|
||||||
|
- label: I filled out all of the requested information in this issue properly.
|
||||||
|
required: true
|
||||||
|
- label: The issue is related solely to the ReVanced Manager
|
||||||
|
required: true
|
||||||
|
|||||||
24
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
24
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
@@ -12,14 +12,6 @@ body:
|
|||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
|
||||||
attributes:
|
|
||||||
label: Manager Branch
|
|
||||||
options:
|
|
||||||
- Flutter
|
|
||||||
- Compose
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Issue
|
label: Issue
|
||||||
@@ -43,4 +35,18 @@ body:
|
|||||||
label: Additional context
|
label: Additional context
|
||||||
description: Add additional context here.
|
description: Add additional context here.
|
||||||
validations:
|
validations:
|
||||||
required: false
|
required: false
|
||||||
|
- type: checkboxes
|
||||||
|
id: acknowledgements
|
||||||
|
attributes:
|
||||||
|
label: Acknowledgements
|
||||||
|
description: Your issue will be closed if you haven't done these steps.
|
||||||
|
options:
|
||||||
|
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
||||||
|
required: true
|
||||||
|
- label: I have written a short but informative title.
|
||||||
|
required: true
|
||||||
|
- label: I filled out all of the requested information in this issue properly.
|
||||||
|
required: true
|
||||||
|
- label: The issue is related solely to the ReVanced Manager
|
||||||
|
required: true
|
||||||
|
|||||||
6
.run/main.dart.run.xml
Normal file
6
.run/main.dart.run.xml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="ProjectRunConfigurationManager">
|
||||||
|
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||||
|
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
|
||||||
|
<method v="2" />
|
||||||
|
</configuration>
|
||||||
|
</component>
|
||||||
30
README.md
30
README.md
@@ -5,16 +5,26 @@ The official ReVanced Manager based on Flutter.
|
|||||||
## 🔽 Download
|
## 🔽 Download
|
||||||
To download the Alpha version of Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file.
|
To download the Alpha version of Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file.
|
||||||
|
|
||||||
## 🔴 Issues
|
## 📝 Prerequisites
|
||||||
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
|
1. Android 8 or higher
|
||||||
|
2. Does not work on some armv7 devices
|
||||||
## 💭 Discussion
|
3. [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases) required for YouTube and YouTube Music (Only for non-root)
|
||||||
If you wish to discuss the Manager, a thread has been made under the [#chat](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
|
|
||||||
|
|
||||||
## ⚠️ Disclaimer
|
## ⚠️ Disclaimer
|
||||||
*Please note that even though we're releasing the Manager, it is an ALPHA version. Meaning there's a big chance that the Manager might not work at all for you.*
|
*Please note that even though we're releasing the Manager, it is an ALPHA version. There's a big chance that the Manager might not work at all for you.*
|
||||||
|
|
||||||
## Prerequisites
|
## 🔴 Issues
|
||||||
1. Android 8 or higher.
|
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
|
||||||
2. Does not work on armv7
|
|
||||||
3. For YouTube and YouTube Music - Vanced MicroG(Only for non-root).
|
## 💭 Discussion
|
||||||
|
If you wish to discuss the Manager, a thread has been made under the [#development](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
|
||||||
|
|
||||||
|
|
||||||
|
## 🛠️ Building Manager from source
|
||||||
|
1. Setup flutter environment for your [platform](https://docs.flutter.dev/get-started/install)
|
||||||
|
2. Clone the repository locally
|
||||||
|
3. Add your github token in gradle.properties like [this](https://github.com/revanced/revanced-documentation/wiki/Building-from-source)
|
||||||
|
4. Open the project in terminal
|
||||||
|
5. Run `flutter pub get` in terminal
|
||||||
|
6. Then `flutter packages pub run build_runner build --delete-conflicting-outputs` (Must be done on each git pull)
|
||||||
|
7. To build release apk run `flutter build apk`
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
# packages, and plugins designed to encourage good coding practices.
|
# packages, and plugins designed to encourage good coding practices.
|
||||||
include: package:flutter_lints/flutter.yaml
|
include: package:flutter_lints/flutter.yaml
|
||||||
|
|
||||||
|
analyzer:
|
||||||
|
exclude:
|
||||||
|
- lib/utils/env_class.g.dart
|
||||||
|
|
||||||
linter:
|
linter:
|
||||||
# The lint rules applied to this project can be customized in the
|
# The lint rules applied to this project can be customized in the
|
||||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||||
|
|||||||
@@ -71,9 +71,14 @@ 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.4.2"
|
implementation "app.revanced:revanced-patcher:6.0.0"
|
||||||
|
|
||||||
// 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.2")
|
implementation("com.android.tools.build:apksig:7.2.2")
|
||||||
|
|
||||||
|
// MicroG cronet
|
||||||
|
implementation("org.microg:cronet-common:$cronetVersion")
|
||||||
|
implementation("org.microg:cronet-native:$cronetVersion")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
android/app/src/main/jniLibs/arm64-v8a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/arm64-v8a/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
android/app/src/main/jniLibs/x86_64/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/x86_64/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,6 @@
|
|||||||
package app.revanced.manager.flutter
|
package app.revanced.manager.flutter
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.os.Looper
|
import android.os.Looper
|
||||||
import androidx.annotation.NonNull
|
import androidx.annotation.NonNull
|
||||||
@@ -12,7 +13,7 @@ import app.revanced.patcher.Patcher
|
|||||||
import app.revanced.patcher.PatcherOptions
|
import app.revanced.patcher.PatcherOptions
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import app.revanced.patcher.logging.Logger
|
import app.revanced.patcher.logging.Logger
|
||||||
import app.revanced.patcher.util.patch.impl.DexPatchBundle
|
import app.revanced.patcher.util.patch.PatchBundle
|
||||||
import dalvik.system.DexClassLoader
|
import dalvik.system.DexClassLoader
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
import io.flutter.embedding.engine.FlutterEngine
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
@@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
||||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||||
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
||||||
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
|
||||||
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
||||||
if (patchBundleFilePath != null &&
|
if (patchBundleFilePath != null &&
|
||||||
originalFilePath != null &&
|
originalFilePath != null &&
|
||||||
@@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches != null &&
|
selectedPatches != null &&
|
||||||
cacheDirPath != null &&
|
cacheDirPath != null &&
|
||||||
mergeIntegrations != null &&
|
mergeIntegrations != null &&
|
||||||
resourcePatching != null &&
|
|
||||||
keyStoreFilePath != null
|
keyStoreFilePath != null
|
||||||
) {
|
) {
|
||||||
runPatcher(
|
runPatcher(
|
||||||
@@ -67,14 +66,12 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches,
|
selectedPatches,
|
||||||
cacheDirPath,
|
cacheDirPath,
|
||||||
mergeIntegrations,
|
mergeIntegrations,
|
||||||
resourcePatching,
|
|
||||||
keyStoreFilePath
|
keyStoreFilePath
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
result.notImplemented()
|
result.notImplemented()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> result.notImplemented()
|
else -> result.notImplemented()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -91,7 +88,6 @@ class MainActivity : FlutterActivity() {
|
|||||||
selectedPatches: List<String>,
|
selectedPatches: List<String>,
|
||||||
cacheDirPath: String,
|
cacheDirPath: String,
|
||||||
mergeIntegrations: Boolean,
|
mergeIntegrations: Boolean,
|
||||||
resourcePatching: Boolean,
|
|
||||||
keyStoreFilePath: String
|
keyStoreFilePath: String
|
||||||
) {
|
) {
|
||||||
val originalFile = File(originalFilePath)
|
val originalFile = File(originalFilePath)
|
||||||
@@ -101,161 +97,186 @@ class MainActivity : FlutterActivity() {
|
|||||||
val integrations = File(integrationsPath)
|
val integrations = File(integrationsPath)
|
||||||
val keyStoreFile = File(keyStoreFilePath)
|
val keyStoreFile = File(keyStoreFilePath)
|
||||||
|
|
||||||
val patches = DexPatchBundle(
|
|
||||||
patchBundleFilePath,
|
|
||||||
DexClassLoader(
|
|
||||||
patchBundleFilePath,
|
|
||||||
cacheDirPath,
|
|
||||||
null,
|
|
||||||
javaClass.classLoader
|
|
||||||
)
|
|
||||||
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
|
||||||
|
|
||||||
Thread {
|
Thread {
|
||||||
handler.post {
|
try {
|
||||||
installerChannel.invokeMethod(
|
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
"update",
|
PatchBundle.Dex(
|
||||||
mapOf(
|
patchBundleFilePath,
|
||||||
"progress" to 0.1,
|
DexClassLoader(
|
||||||
"header" to "",
|
patchBundleFilePath,
|
||||||
"log" to "Copying original apk"
|
cacheDirPath,
|
||||||
)
|
null,
|
||||||
)
|
javaClass.classLoader
|
||||||
}
|
)
|
||||||
originalFile.copyTo(inputFile, true)
|
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
||||||
|
} else {
|
||||||
|
TODO("VERSION.SDK_INT < CUPCAKE")
|
||||||
|
}
|
||||||
|
|
||||||
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 {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
mapOf(
|
mapOf(
|
||||||
"progress" to 0.4,
|
"progress" to 0.1,
|
||||||
"header" to "Merging integrations...",
|
"header" to "",
|
||||||
"log" to "Merging integrations"
|
"log" to "Copying original apk"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
patcher.addFiles(listOf(integrations)) {}
|
originalFile.copyTo(inputFile, true)
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
mapOf(
|
mapOf(
|
||||||
"progress" to 0.5,
|
"progress" to 0.2,
|
||||||
"header" to "Applying patches...",
|
"header" to "Unpacking apk...",
|
||||||
"log" to ""
|
"log" to "Unpacking input apk"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
val patcher =
|
||||||
patcher.addPatches(patches)
|
Patcher(
|
||||||
patcher.applyPatches().forEach { (patch, res) ->
|
PatcherOptions(
|
||||||
if (res.isSuccess) {
|
inputFile,
|
||||||
val msg = "[success] $patch"
|
cacheDirPath,
|
||||||
|
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 {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
mapOf(
|
mapOf(
|
||||||
"progress" to 0.5,
|
"progress" to 0.4,
|
||||||
"header" to "",
|
"header" to "Merging integrations...",
|
||||||
"log" to msg
|
"log" to "Merging integrations"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return@forEach
|
patcher.addFiles(listOf(integrations)) {}
|
||||||
}
|
}
|
||||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!
|
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
mapOf("progress" to 0.5, "header" to "", "log" to msg)
|
mapOf(
|
||||||
|
"progress" to 0.5,
|
||||||
|
"header" to "Applying patches...",
|
||||||
|
"log" to ""
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
patcher.addPatches(patches)
|
||||||
installerChannel.invokeMethod(
|
patcher.executePatches().forEach { (patch, res) ->
|
||||||
"update",
|
if (res.isSuccess) {
|
||||||
mapOf(
|
val msg = "[success] $patch"
|
||||||
"progress" to 0.7,
|
handler.post {
|
||||||
"header" to "Repacking apk...",
|
installerChannel.invokeMethod(
|
||||||
"log" to "Repacking patched apk"
|
"update",
|
||||||
)
|
mapOf(
|
||||||
)
|
"progress" to 0.5,
|
||||||
}
|
"header" to "",
|
||||||
val res = patcher.save()
|
"log" to msg
|
||||||
ZipFile(patchedFile).use { file ->
|
)
|
||||||
res.dexFiles.forEach {
|
)
|
||||||
file.addEntryCompressData(
|
}
|
||||||
ZipEntry.createWithName(it.name),
|
return@forEach
|
||||||
it.stream.readBytes()
|
}
|
||||||
|
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
|
||||||
|
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"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
res.resourceFile?.let {
|
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(
|
file.copyEntriesFromFileAligned(
|
||||||
ZipFile(it),
|
ZipFile(inputFile),
|
||||||
ZipAligner::getEntryAlignment
|
ZipAligner::getEntryAlignment
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
file.copyEntriesFromFileAligned(
|
handler.post {
|
||||||
ZipFile(inputFile),
|
installerChannel.invokeMethod(
|
||||||
ZipAligner::getEntryAlignment
|
"update",
|
||||||
)
|
mapOf(
|
||||||
}
|
"progress" to 0.9,
|
||||||
handler.post {
|
"header" to "Signing apk...",
|
||||||
installerChannel.invokeMethod(
|
"log" to ""
|
||||||
"update",
|
)
|
||||||
mapOf(
|
|
||||||
"progress" to 0.9,
|
|
||||||
"header" to "Signing apk...",
|
|
||||||
"log" to ""
|
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
|
||||||
|
|
||||||
handler.post {
|
// Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
try {
|
||||||
mapOf(
|
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
"progress" to 1.0,
|
} catch (e: Exception) {
|
||||||
"header" to "Finished!",
|
//log to console
|
||||||
"log" to "Finished!"
|
print("Error signing apk: ${e.message}")
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 1.0,
|
||||||
|
"header" to "Finished!",
|
||||||
|
"log" to "Finished!"
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
|
} catch (ex: Throwable) {
|
||||||
|
val stack = ex.stackTraceToString()
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to -100.0,
|
||||||
|
"header" to "Aborting...",
|
||||||
|
"log" to "An error occurred! Aborting\nError:\n$stack"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handler.post { result.success(null) }
|
handler.post { result.success(null) }
|
||||||
}
|
}.start()
|
||||||
.start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class ManagerLogger : Logger {
|
inner class ManagerLogger : Logger {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
|
ext.cronetVersion = '102.5005.125'
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
|||||||
@@ -14,19 +14,21 @@
|
|||||||
"widgetTitle": "Dashboard",
|
"widgetTitle": "Dashboard",
|
||||||
"updatesSubtitle": "Updates",
|
"updatesSubtitle": "Updates",
|
||||||
"patchedSubtitle": "Patched Applications",
|
"patchedSubtitle": "Patched Applications",
|
||||||
"updatesAvailable": "Updates Available",
|
"updatesAvailable": "Updates available",
|
||||||
"noUpdates": "No updates available",
|
"noUpdates": "No updates available",
|
||||||
|
"WIP": "Work In Progress",
|
||||||
"noInstallations": "No patched applications installed",
|
"noInstallations": "No patched applications installed",
|
||||||
"installed": "Installed",
|
"installed": "Installed",
|
||||||
"updateDialogTitle": "Update",
|
"updateDialogTitle": "Update Manager",
|
||||||
"updateDialogText": "Are you sure you want to download and update Manager?",
|
"updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
|
||||||
"notificationTitle": "ReVanced Manager was updated!",
|
"notificationTitle": "ReVanced Manager was updated",
|
||||||
"notificationText": "Tap to open the app",
|
"notificationText": "Tap to open the app",
|
||||||
"downloadingMessage": "Downloading update!",
|
"downloadingMessage": "Downloading update...",
|
||||||
"installingMessage": "Installing update... Hang on!",
|
"installingMessage": "Installing update...",
|
||||||
"errorDownloadMessage": "Unable to download update!",
|
"errorDownloadMessage": "Unable to download update",
|
||||||
"errorInstallMessage": "Unable to install update!",
|
"errorInstallMessage": "Unable to install update",
|
||||||
"noConnection": "No internet connection"
|
"noConnection": "No internet connection",
|
||||||
|
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||||
},
|
},
|
||||||
"applicationItem": {
|
"applicationItem": {
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
@@ -34,7 +36,7 @@
|
|||||||
"changelogLabel": "Changelog"
|
"changelogLabel": "Changelog"
|
||||||
},
|
},
|
||||||
"latestCommitCard": {
|
"latestCommitCard": {
|
||||||
"loadingLabel": "Loading",
|
"loadingLabel": "Loading...",
|
||||||
"timeagoLabel": "{time} ago",
|
"timeagoLabel": "{time} ago",
|
||||||
"patcherLabel": "Patcher: ",
|
"patcherLabel": "Patcher: ",
|
||||||
"managerLabel": "Manager: ",
|
"managerLabel": "Manager: ",
|
||||||
@@ -44,12 +46,12 @@
|
|||||||
"widgetTitle": "Patcher",
|
"widgetTitle": "Patcher",
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
"patchDialogTitle": "Warning",
|
"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?"
|
"patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors may 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",
|
"currentVersion": "Current",
|
||||||
"recommendedVersion": "Recommended",
|
"recommendedVersion": "Recommended",
|
||||||
@@ -58,11 +60,11 @@
|
|||||||
"patchSelectorCard": {
|
"patchSelectorCard": {
|
||||||
"widgetTitle": "Select patches",
|
"widgetTitle": "Select patches",
|
||||||
"widgetTitleSelected": "Selected patches",
|
"widgetTitleSelected": "Selected patches",
|
||||||
"widgetSubtitle": "Select an application first.",
|
"widgetSubtitle": "Select an application first",
|
||||||
"widgetEmptySubtitle": "No patches selected."
|
"widgetEmptySubtitle": "No patches selected"
|
||||||
},
|
},
|
||||||
"socialMediaCard": {
|
"socialMediaCard": {
|
||||||
"widgetTitle": "Social Media",
|
"widgetTitle": "Socials",
|
||||||
"widgetSubtitle": "We are online!"
|
"widgetSubtitle": "We are online!"
|
||||||
},
|
},
|
||||||
"appSelectorView": {
|
"appSelectorView": {
|
||||||
@@ -75,10 +77,12 @@
|
|||||||
"viewTitle": "Select patches",
|
"viewTitle": "Select patches",
|
||||||
"searchBarHint": "Search patches",
|
"searchBarHint": "Search patches",
|
||||||
"doneButton": "Done",
|
"doneButton": "Done",
|
||||||
"noPatchesFound": "No patches found for the selected app."
|
"noPatchesFound": "No patches found for the selected app",
|
||||||
|
"selectAllPatchesWarningTitle": "Warning",
|
||||||
|
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
|
||||||
},
|
},
|
||||||
"patchItem": {
|
"patchItem": {
|
||||||
"unsupportedWarningButton": "Unsupported version",
|
"unsupportedWarningButton": "Warning",
|
||||||
"unsupportedDialogTitle": "Warning",
|
"unsupportedDialogTitle": "Warning",
|
||||||
"unsupportedDialogText": "Selecting this patch may 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}"
|
||||||
},
|
},
|
||||||
@@ -104,6 +108,7 @@
|
|||||||
"teamSectionTitle": "Team",
|
"teamSectionTitle": "Team",
|
||||||
"infoSectionTitle": "Info",
|
"infoSectionTitle": "Info",
|
||||||
"advancedSectionTitle": "Advanced",
|
"advancedSectionTitle": "Advanced",
|
||||||
|
"logsSectionTitle": "Logs",
|
||||||
"darkThemeLabel": "Dark Mode",
|
"darkThemeLabel": "Dark Mode",
|
||||||
"darkThemeHint": "Welcome to the Dark Side",
|
"darkThemeHint": "Welcome to the Dark Side",
|
||||||
"dynamicThemeLabel": "Material You",
|
"dynamicThemeLabel": "Material You",
|
||||||
@@ -113,13 +118,13 @@
|
|||||||
"frenchOption": "French",
|
"frenchOption": "French",
|
||||||
"sourcesLabel": "Sources",
|
"sourcesLabel": "Sources",
|
||||||
"sourcesLabelHint": "Configure your custom sources",
|
"sourcesLabelHint": "Configure your custom sources",
|
||||||
"orgPatchesLabel" : "Patches Org",
|
"orgPatchesLabel": "Patches Organization",
|
||||||
"sourcesPatchesLabel" : "Patches Source",
|
"sourcesPatchesLabel": "Patches Source",
|
||||||
"orgIntegrationsLabel": "Integrations Org",
|
"orgIntegrationsLabel": "Integrations Organization",
|
||||||
"sourcesIntegrationsLabel": "Integrations Source",
|
"sourcesIntegrationsLabel": "Integrations Source",
|
||||||
"sourcesResetDialogTitle": "Reset",
|
"sourcesResetDialogTitle": "Reset",
|
||||||
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
||||||
"apiURLResetDialogText": "Are you sure you want to reset API URL to their default values?",
|
"apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?",
|
||||||
"contributorsLabel": "Contributors",
|
"contributorsLabel": "Contributors",
|
||||||
"contributorsHint": "A list of contributors of ReVanced",
|
"contributorsHint": "A list of contributors of ReVanced",
|
||||||
"logsLabel": "Logs",
|
"logsLabel": "Logs",
|
||||||
@@ -128,7 +133,19 @@
|
|||||||
"apiURLHint": "Configure your custom API URL",
|
"apiURLHint": "Configure your custom API URL",
|
||||||
"selectApiURL": "Select URL",
|
"selectApiURL": "Select URL",
|
||||||
"aboutLabel": "About",
|
"aboutLabel": "About",
|
||||||
"snackbarMessage": "Copied to clipboard"
|
"snackbarMessage": "Copied to clipboard",
|
||||||
|
"sentryLabel": "Sentry Logging",
|
||||||
|
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
|
||||||
|
"restartAppForChanges": "Restart the app to apply changes",
|
||||||
|
"deleteKeystoreLabel": "Delete keystore",
|
||||||
|
"deleteKeystoreHint": "Delete the keystore used to sign the app",
|
||||||
|
"deletedKeystore": "Keystore deleted",
|
||||||
|
"deleteTempDirLabel": "Delete temp directory",
|
||||||
|
"deleteTempDirHint": "Delete the temporary directory used to store temporary files",
|
||||||
|
"deletedTempDir": "Temp directory deleted",
|
||||||
|
"deleteLogsLabel": "Delete logs",
|
||||||
|
"deleteLogsHint": "Delete collected manager logs",
|
||||||
|
"deletedLogs": "Logs deleted"
|
||||||
},
|
},
|
||||||
"appInfoView": {
|
"appInfoView": {
|
||||||
"widgetTitle": "App Info",
|
"widgetTitle": "App Info",
|
||||||
@@ -140,13 +157,15 @@
|
|||||||
"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",
|
||||||
|
"originalPackageNameLabel": "Original Package Name",
|
||||||
"installTypeLabel": "Installation Type",
|
"installTypeLabel": "Installation Type",
|
||||||
"rootTypeLabel": "Root",
|
"rootTypeLabel": "Root",
|
||||||
"nonRootTypeLabel": "Non-root",
|
"nonRootTypeLabel": "Non-root",
|
||||||
"patchedDateLabel": "Patched Date",
|
"patchedDateLabel": "Patched Date",
|
||||||
"patchedDateHint": "{date} at {time}",
|
"patchedDateHint": "{date} at {time}",
|
||||||
"appliedPatchesLabel": "Applied Patches",
|
"appliedPatchesLabel": "Applied Patches",
|
||||||
"appliedPatchesHint": "{quantity} applied patches"
|
"appliedPatchesHint": "{quantity} applied patches",
|
||||||
|
"updateNotImplemented": "Update functionality not implemented yet"
|
||||||
},
|
},
|
||||||
"contributorsView": {
|
"contributorsView": {
|
||||||
"widgetTitle": "Contributors",
|
"widgetTitle": "Contributors",
|
||||||
3
crowdin.yml
Normal file
3
crowdin.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
files:
|
||||||
|
- source: /assets/i18n/en.json
|
||||||
|
translation: /assets/i18n/%locale_with_underscore%.json
|
||||||
@@ -9,6 +9,7 @@ import 'package:revanced_manager/services/revanced_api.dart';
|
|||||||
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
||||||
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
||||||
import 'package:stacked_themes/stacked_themes.dart';
|
import 'package:stacked_themes/stacked_themes.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:timezone/data/latest.dart' as tz;
|
import 'package:timezone/data/latest.dart' as tz;
|
||||||
|
|
||||||
Future main() async {
|
Future main() async {
|
||||||
@@ -18,9 +19,34 @@ Future main() async {
|
|||||||
await locator<ManagerAPI>().initialize();
|
await locator<ManagerAPI>().initialize();
|
||||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||||
await locator<RevancedAPI>().initialize(apiUrl);
|
await locator<RevancedAPI>().initialize(apiUrl);
|
||||||
|
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||||
locator<GithubAPI>().initialize();
|
locator<GithubAPI>().initialize();
|
||||||
await locator<PatcherAPI>().initialize();
|
await locator<PatcherAPI>().initialize();
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
|
|
||||||
|
// Remove this section if you are building from source and don't have sentry configured
|
||||||
|
// await SentryFlutter.init(
|
||||||
|
// (options) {
|
||||||
|
// options
|
||||||
|
// ..dsn = isSentryEnabled ? '' : ''
|
||||||
|
// ..environment = 'alpha'
|
||||||
|
// ..release = '0.1'
|
||||||
|
// ..tracesSampleRate = 1.0
|
||||||
|
// ..anrEnabled = true
|
||||||
|
// ..enableOutOfMemoryTracking = true
|
||||||
|
// ..sampleRate = isSentryEnabled ? 1.0 : 0.0
|
||||||
|
// ..beforeSend = (event, hint) {
|
||||||
|
// if (isSentryEnabled) {
|
||||||
|
// return event;
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// } as BeforeSendCallback?;
|
||||||
|
// },
|
||||||
|
// appRunner: () {
|
||||||
|
// runApp(const MyApp());
|
||||||
|
// },
|
||||||
|
// );
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +61,7 @@ class MyApp extends StatelessWidget {
|
|||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
FlutterI18nDelegate(
|
FlutterI18nDelegate(
|
||||||
translationLoader: FileTranslationLoader(
|
translationLoader: FileTranslationLoader(
|
||||||
fallbackFile: 'en',
|
fallbackFile: 'en_US',
|
||||||
basePath: 'assets/i18n',
|
basePath: 'assets/i18n',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ part 'patched_application.g.dart';
|
|||||||
class PatchedApplication {
|
class PatchedApplication {
|
||||||
String name;
|
String name;
|
||||||
String packageName;
|
String packageName;
|
||||||
|
String originalPackageName;
|
||||||
String version;
|
String version;
|
||||||
final String apkFilePath;
|
final String apkFilePath;
|
||||||
@JsonKey(
|
@JsonKey(
|
||||||
@@ -25,6 +26,7 @@ class PatchedApplication {
|
|||||||
PatchedApplication({
|
PatchedApplication({
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.packageName,
|
required this.packageName,
|
||||||
|
required this.originalPackageName,
|
||||||
required this.version,
|
required this.version,
|
||||||
required this.apkFilePath,
|
required this.apkFilePath,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
|
|||||||
@@ -5,15 +5,19 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
|
import 'package:native_dio_client/native_dio_client.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
|
import 'package:revanced_manager/utils/check_for_gms.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
import 'package:sentry_dio/sentry_dio.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class GithubAPI {
|
class GithubAPI {
|
||||||
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com'));
|
late Dio _dio = Dio();
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(days: 1),
|
const Duration(hours: 6),
|
||||||
maxStale: const Duration(days: 7),
|
maxStale: const Duration(days: 1),
|
||||||
);
|
);
|
||||||
final Map<String, String> repoAppPath = {
|
final Map<String, String> repoAppPath = {
|
||||||
'com.google.android.youtube': 'youtube',
|
'com.google.android.youtube': 'youtube',
|
||||||
@@ -23,14 +27,40 @@ class GithubAPI {
|
|||||||
'com.zhiliaoapp.musically': 'tiktok',
|
'com.zhiliaoapp.musically': 'tiktok',
|
||||||
'de.dwd.warnapp': 'warnwetter',
|
'de.dwd.warnapp': 'warnwetter',
|
||||||
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
|
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
|
||||||
|
'com.spotify.music': 'spotify',
|
||||||
};
|
};
|
||||||
|
|
||||||
void initialize() {
|
void initialize() async {
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
try {
|
||||||
|
bool isGMSInstalled = await checkForGMS();
|
||||||
|
|
||||||
|
if (!isGMSInstalled) {
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: 'https://api.github.com',
|
||||||
|
));
|
||||||
|
print('GitHub API: Using default engine + $isGMSInstalled');
|
||||||
|
} else {
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: 'https://api.github.com',
|
||||||
|
))
|
||||||
|
..httpClientAdapter = NativeAdapter();
|
||||||
|
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||||
|
}
|
||||||
|
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||||
|
_dio.addSentry(
|
||||||
|
captureFailedRequests: true,
|
||||||
|
);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> clearAllCache() async {
|
Future<void> clearAllCache() async {
|
||||||
await _dioCacheManager.clearAll();
|
try {
|
||||||
|
await _dioCacheManager.clearAll();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
||||||
@@ -40,7 +70,8 @@ class GithubAPI {
|
|||||||
options: _cacheOptions,
|
options: _cacheOptions,
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,17 +88,21 @@ class GithubAPI {
|
|||||||
'/repos/$repoName/commits',
|
'/repos/$repoName/commits',
|
||||||
queryParameters: {
|
queryParameters: {
|
||||||
'path': path,
|
'path': path,
|
||||||
'per_page': 3,
|
|
||||||
'since': since.toIso8601String(),
|
'since': since.toIso8601String(),
|
||||||
},
|
},
|
||||||
options: _cacheOptions,
|
options: _cacheOptions,
|
||||||
);
|
);
|
||||||
List<dynamic> commits = response.data;
|
List<dynamic> commits = response.data;
|
||||||
return commits
|
return commits
|
||||||
.map((commit) =>
|
.map(
|
||||||
(commit['commit']['message'] as String).split('\n')[0])
|
(commit) => (commit['commit']['message']).split('\n')[0] +
|
||||||
|
' - ' +
|
||||||
|
commit['commit']['author']['name'] +
|
||||||
|
'\n' as String,
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +121,8 @@ class GithubAPI {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -100,7 +136,8 @@ class GithubAPI {
|
|||||||
List<dynamic> list = jsonDecode(f.readAsStringSync());
|
List<dynamic> list = jsonDecode(f.readAsStringSync());
|
||||||
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
return patches;
|
return patches;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import 'package:revanced_manager/models/patched_application.dart';
|
|||||||
import 'package:revanced_manager/services/github_api.dart';
|
import 'package:revanced_manager/services/github_api.dart';
|
||||||
import 'package:revanced_manager/services/revanced_api.dart';
|
import 'package:revanced_manager/services/revanced_api.dart';
|
||||||
import 'package:revanced_manager/services/root_api.dart';
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
@@ -19,7 +20,7 @@ class ManagerAPI {
|
|||||||
final String patcherRepo = 'revanced-patcher';
|
final String patcherRepo = 'revanced-patcher';
|
||||||
final String cliRepo = 'revanced-cli';
|
final String cliRepo = 'revanced-cli';
|
||||||
late SharedPreferences _prefs;
|
late SharedPreferences _prefs;
|
||||||
String defaultApiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
|
String defaultApiUrl = 'https://releases.rvcd.win/';
|
||||||
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
||||||
String defaultPatchesRepo = 'revanced/revanced-patches';
|
String defaultPatchesRepo = 'revanced/revanced-patches';
|
||||||
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
||||||
@@ -81,6 +82,29 @@ class ManagerAPI {
|
|||||||
await _prefs.setBool('useDarkTheme', value);
|
await _prefs.setBool('useDarkTheme', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bool isSentryEnabled() {
|
||||||
|
// return _prefs.getBool('sentryEnabled') ?? true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setSentryStatus(bool value) async {
|
||||||
|
// await _prefs.setBool('sentryEnabled', value);
|
||||||
|
// }
|
||||||
|
|
||||||
|
Future<void> deleteTempFolder() async {
|
||||||
|
final Directory dir = Directory('/data/local/tmp/revanced-manager');
|
||||||
|
if (await dir.exists()) {
|
||||||
|
await dir.delete(recursive: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteKeystore() async {
|
||||||
|
final File keystore = File(
|
||||||
|
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore');
|
||||||
|
if (await keystore.exists()) {
|
||||||
|
await keystore.delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<PatchedApplication> getPatchedApps() {
|
List<PatchedApplication> getPatchedApps() {
|
||||||
List<String> apps = _prefs.getStringList('patchedApps') ?? [];
|
List<String> apps = _prefs.getStringList('patchedApps') ?? [];
|
||||||
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
|
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
|
||||||
@@ -116,9 +140,13 @@ class ManagerAPI {
|
|||||||
await setPatchedApps(patchedApps);
|
await setPatchedApps(patchedApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAllData() {
|
void clearAllData() async {
|
||||||
_revancedAPI.clearAllCache();
|
try {
|
||||||
_githubAPI.clearAllCache();
|
_revancedAPI.clearAllCache();
|
||||||
|
_githubAPI.clearAllCache();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||||
@@ -126,35 +154,50 @@ class ManagerAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Patch>> getPatches() async {
|
Future<List<Patch>> getPatches() async {
|
||||||
String repoName = getPatchesRepo();
|
try {
|
||||||
if (repoName == defaultPatchesRepo) {
|
String repoName = getPatchesRepo();
|
||||||
return await _revancedAPI.getPatches();
|
if (repoName == defaultPatchesRepo) {
|
||||||
} else {
|
return await _revancedAPI.getPatches();
|
||||||
return await _githubAPI.getPatches(repoName);
|
} else {
|
||||||
|
return await _githubAPI.getPatches(repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> downloadPatches() async {
|
Future<File?> downloadPatches() async {
|
||||||
String repoName = getPatchesRepo();
|
try {
|
||||||
if (repoName == defaultPatchesRepo) {
|
String repoName = getPatchesRepo();
|
||||||
return await _revancedAPI.getLatestReleaseFile(
|
if (repoName == defaultPatchesRepo) {
|
||||||
'.jar',
|
return await _revancedAPI.getLatestReleaseFile(
|
||||||
defaultPatchesRepo,
|
'.jar',
|
||||||
);
|
defaultPatchesRepo,
|
||||||
} else {
|
);
|
||||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
} else {
|
||||||
|
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> downloadIntegrations() async {
|
Future<File?> downloadIntegrations() async {
|
||||||
String repoName = getIntegrationsRepo();
|
try {
|
||||||
if (repoName == defaultIntegrationsRepo) {
|
String repoName = getIntegrationsRepo();
|
||||||
return await _revancedAPI.getLatestReleaseFile(
|
if (repoName == defaultIntegrationsRepo) {
|
||||||
'.apk',
|
return await _revancedAPI.getLatestReleaseFile(
|
||||||
defaultIntegrationsRepo,
|
'.apk',
|
||||||
);
|
defaultIntegrationsRepo,
|
||||||
} else {
|
);
|
||||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
} else {
|
||||||
|
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +220,13 @@ class ManagerAPI {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> getLatestPatchesVersion() async {
|
||||||
|
return await _revancedAPI.getLatestReleaseVersion(
|
||||||
|
'.json',
|
||||||
|
defaultPatchesRepo,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getCurrentManagerVersion() async {
|
Future<String> getCurrentManagerVersion() async {
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
return packageInfo.version;
|
return packageInfo.version;
|
||||||
@@ -213,6 +263,7 @@ class ManagerAPI {
|
|||||||
PatchedApplication(
|
PatchedApplication(
|
||||||
name: application.appName,
|
name: application.appName,
|
||||||
packageName: application.packageName,
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
version: application.versionName!,
|
version: application.versionName!,
|
||||||
apkFilePath: application.apkFilePath,
|
apkFilePath: application.apkFilePath,
|
||||||
icon: application.icon,
|
icon: application.icon,
|
||||||
@@ -241,6 +292,7 @@ class ManagerAPI {
|
|||||||
PatchedApplication(
|
PatchedApplication(
|
||||||
name: application.appName,
|
name: application.appName,
|
||||||
packageName: application.packageName,
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
version: application.versionName!,
|
version: application.versionName!,
|
||||||
apkFilePath: application.apkFilePath,
|
apkFilePath: application.apkFilePath,
|
||||||
icon: application.icon,
|
icon: application.icon,
|
||||||
@@ -261,8 +313,10 @@ class ManagerAPI {
|
|||||||
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
||||||
patchedApps.removeWhere((a) => toRemove.contains(a));
|
patchedApps.removeWhere((a) => toRemove.contains(a));
|
||||||
for (PatchedApplication app in patchedApps) {
|
for (PatchedApplication app in patchedApps) {
|
||||||
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
|
app.hasUpdates =
|
||||||
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
|
await hasAppUpdates(app.originalPackageName, app.patchDate);
|
||||||
|
app.changelog =
|
||||||
|
await getAppChangelog(app.originalPackageName, app.patchDate);
|
||||||
if (!app.hasUpdates) {
|
if (!app.hasUpdates) {
|
||||||
String? currentInstalledVersion =
|
String? currentInstalledVersion =
|
||||||
(await DeviceApps.getApp(app.packageName))?.versionName;
|
(await DeviceApps.getApp(app.packageName))?.versionName;
|
||||||
@@ -314,9 +368,19 @@ class ManagerAPI {
|
|||||||
newCommits = await _githubAPI.getCommits(
|
newCommits = await _githubAPI.getCommits(
|
||||||
packageName,
|
packageName,
|
||||||
getPatchesRepo(),
|
getPatchesRepo(),
|
||||||
DateTime(2022, 3, 20, 21, 06, 01),
|
patchDate,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return newCommits;
|
return newCommits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> isSplitApk(PatchedApplication patchedApp) async {
|
||||||
|
Application? app;
|
||||||
|
if (patchedApp.isFromStorage) {
|
||||||
|
app = await DeviceApps.getAppFromStorage(patchedApp.apkFilePath);
|
||||||
|
} else {
|
||||||
|
app = await DeviceApps.getApp(patchedApp.packageName);
|
||||||
|
}
|
||||||
|
return app != null && app.isSplit;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ 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/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/root_api.dart';
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:share_extend/share_extend.dart';
|
import 'package:share_extend/share_extend.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
@@ -18,6 +19,7 @@ class PatcherAPI {
|
|||||||
MethodChannel('app.revanced.manager.flutter/patcher');
|
MethodChannel('app.revanced.manager.flutter/patcher');
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final RootAPI _rootAPI = RootAPI();
|
final RootAPI _rootAPI = RootAPI();
|
||||||
|
late Directory _dataDir;
|
||||||
late Directory _tmpDir;
|
late Directory _tmpDir;
|
||||||
late File _keyStoreFile;
|
late File _keyStoreFile;
|
||||||
List<Patch> _patches = [];
|
List<Patch> _patches = [];
|
||||||
@@ -26,8 +28,9 @@ class PatcherAPI {
|
|||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
await _loadPatches();
|
await _loadPatches();
|
||||||
Directory appCache = await getTemporaryDirectory();
|
Directory appCache = await getTemporaryDirectory();
|
||||||
|
_dataDir = await getExternalStorageDirectory() ?? appCache;
|
||||||
_tmpDir = Directory('${appCache.path}/patcher');
|
_tmpDir = Directory('${appCache.path}/patcher');
|
||||||
_keyStoreFile = File('${appCache.path}/revanced-manager.keystore');
|
_keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
|
||||||
cleanPatcher();
|
cleanPatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +45,8 @@ class PatcherAPI {
|
|||||||
if (_patches.isEmpty) {
|
if (_patches.isEmpty) {
|
||||||
_patches = await _managerAPI.getPatches();
|
_patches = await _managerAPI.getPatches();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
_patches = List.empty();
|
_patches = List.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -61,7 +65,8 @@ class PatcherAPI {
|
|||||||
filteredApps.add(app);
|
filteredApps.add(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,21 +88,38 @@ class PatcherAPI {
|
|||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool dependencyNeedsIntegrations(String name) {
|
||||||
|
return name.contains('integrations') ||
|
||||||
|
_patches.any(
|
||||||
|
(patch) =>
|
||||||
|
patch.name == name &&
|
||||||
|
(patch.dependencies.any(
|
||||||
|
(dep) => dependencyNeedsIntegrations(dep),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
|
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
|
||||||
return selectedPatches.any(
|
return selectedPatches.any(
|
||||||
(patch) => patch.dependencies.contains('integrations'),
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dependencyNeedsIntegrations(dep),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
|
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
|
||||||
return selectedPatches.any(
|
return selectedPatches.any(
|
||||||
(patch) => patch.dependencies.any((dep) => dep.contains('resource-')),
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dep.contains('resource-'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
|
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
|
||||||
return selectedPatches.any(
|
return selectedPatches.any(
|
||||||
(patch) => patch.dependencies.contains('settings'),
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dep.contains('settings'),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,14 +127,19 @@ class PatcherAPI {
|
|||||||
String packageName,
|
String packageName,
|
||||||
String originalFilePath,
|
String originalFilePath,
|
||||||
) async {
|
) async {
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
try {
|
||||||
if (hasRootPermissions) {
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
originalFilePath = await _rootAPI.getOriginalFilePath(
|
if (hasRootPermissions) {
|
||||||
packageName,
|
originalFilePath = await _rootAPI.getOriginalFilePath(
|
||||||
originalFilePath,
|
packageName,
|
||||||
);
|
originalFilePath,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return originalFilePath;
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return originalFilePath;
|
||||||
}
|
}
|
||||||
return originalFilePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher(
|
Future<void> runPatcher(
|
||||||
@@ -121,7 +148,6 @@ class PatcherAPI {
|
|||||||
List<Patch> selectedPatches,
|
List<Patch> selectedPatches,
|
||||||
) async {
|
) async {
|
||||||
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
||||||
bool resourcePatching = await needsResourcePatching(selectedPatches);
|
|
||||||
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
||||||
if (includeSettings) {
|
if (includeSettings) {
|
||||||
try {
|
try {
|
||||||
@@ -133,7 +159,8 @@ class PatcherAPI {
|
|||||||
if (settingsPatch != null) {
|
if (settingsPatch != null) {
|
||||||
selectedPatches.add(settingsPatch);
|
selectedPatches.add(settingsPatch);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,6 +170,7 @@ class PatcherAPI {
|
|||||||
integrationsFile = await _managerAPI.downloadIntegrations();
|
integrationsFile = await _managerAPI.downloadIntegrations();
|
||||||
}
|
}
|
||||||
if (patchBundleFile != null) {
|
if (patchBundleFile != null) {
|
||||||
|
_dataDir.createSync();
|
||||||
_tmpDir.createSync();
|
_tmpDir.createSync();
|
||||||
Directory workDir = _tmpDir.createTempSync('tmp-');
|
Directory workDir = _tmpDir.createTempSync('tmp-');
|
||||||
File inputFile = File('${workDir.path}/base.apk');
|
File inputFile = File('${workDir.path}/base.apk');
|
||||||
@@ -150,25 +178,29 @@ class PatcherAPI {
|
|||||||
_outFile = File('${workDir.path}/out.apk');
|
_outFile = File('${workDir.path}/out.apk');
|
||||||
Directory cacheDir = Directory('${workDir.path}/cache');
|
Directory cacheDir = Directory('${workDir.path}/cache');
|
||||||
cacheDir.createSync();
|
cacheDir.createSync();
|
||||||
await patcherChannel.invokeMethod(
|
try {
|
||||||
'runPatcher',
|
await patcherChannel.invokeMethod(
|
||||||
{
|
'runPatcher',
|
||||||
'patchBundleFilePath': patchBundleFile.path,
|
{
|
||||||
'originalFilePath': await getOriginalFilePath(
|
'patchBundleFilePath': patchBundleFile.path,
|
||||||
packageName,
|
'originalFilePath': await getOriginalFilePath(
|
||||||
originalFilePath,
|
packageName,
|
||||||
),
|
originalFilePath,
|
||||||
'inputFilePath': inputFile.path,
|
),
|
||||||
'patchedFilePath': patchedFile.path,
|
'inputFilePath': inputFile.path,
|
||||||
'outFilePath': _outFile!.path,
|
'patchedFilePath': patchedFile.path,
|
||||||
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
|
'outFilePath': _outFile!.path,
|
||||||
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
'integrationsPath': mergeIntegrations ? integrationsFile!.path : '',
|
||||||
'cacheDirPath': cacheDir.path,
|
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
||||||
'mergeIntegrations': mergeIntegrations,
|
'cacheDirPath': cacheDir.path,
|
||||||
'resourcePatching': resourcePatching,
|
'mergeIntegrations': mergeIntegrations,
|
||||||
'keyStoreFilePath': _keyStoreFile.path,
|
'keyStoreFilePath': _keyStoreFile.path,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
print(e);
|
||||||
|
throw await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +220,8 @@ class PatcherAPI {
|
|||||||
await AppInstaller.installApk(_outFile!.path);
|
await AppInstaller.installApk(_outFile!.path);
|
||||||
return await DeviceApps.isAppInstalled(patchedApp.packageName);
|
return await DeviceApps.isAppInstalled(patchedApp.packageName);
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -196,13 +229,18 @@ class PatcherAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sharePatchedFile(String appName, String version) {
|
void sharePatchedFile(String appName, String version) {
|
||||||
if (_outFile != null) {
|
try {
|
||||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
if (_outFile != null) {
|
||||||
String newName = '$prefix-revanced_v$version.apk';
|
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
String newName = '$prefix-revanced_v$version.apk';
|
||||||
String newPath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||||
File shareFile = _outFile!.copySync(newPath);
|
String newPath =
|
||||||
ShareExtend.share(shareFile.path, 'file');
|
_outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||||
|
File shareFile = _outFile!.copySync(newPath);
|
||||||
|
ShareExtend.share(shareFile.path, 'file');
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,56 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:native_dio_client/native_dio_client.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
|
import 'package:revanced_manager/utils/check_for_gms.dart';
|
||||||
import 'package:timeago/timeago.dart';
|
import 'package:timeago/timeago.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
import 'package:sentry_dio/sentry_dio.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class RevancedAPI {
|
class RevancedAPI {
|
||||||
late Dio _dio = Dio();
|
late Dio _dio = Dio();
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(days: 1),
|
const Duration(hours: 6),
|
||||||
maxStale: const Duration(days: 7),
|
maxStale: const Duration(days: 1),
|
||||||
);
|
);
|
||||||
|
|
||||||
Future<void> initialize(String apiUrl) async {
|
Future<void> initialize(String apiUrl) async {
|
||||||
_dio = Dio(BaseOptions(baseUrl: apiUrl));
|
try {
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
bool isGMSInstalled = await checkForGMS();
|
||||||
|
|
||||||
|
if (!isGMSInstalled) {
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: apiUrl,
|
||||||
|
));
|
||||||
|
print('ReVanced API: Using default engine + $isGMSInstalled');
|
||||||
|
} else {
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: apiUrl,
|
||||||
|
))
|
||||||
|
..httpClientAdapter = NativeAdapter();
|
||||||
|
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||||
|
}
|
||||||
|
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||||
|
_dio.addSentry(
|
||||||
|
captureFailedRequests: true,
|
||||||
|
);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> clearAllCache() async {
|
Future<void> clearAllCache() async {
|
||||||
await _dioCacheManager.clearAll();
|
try {
|
||||||
|
await _dioCacheManager.clearAll();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||||
@@ -34,7 +62,8 @@ class RevancedAPI {
|
|||||||
String name = repo['name'];
|
String name = repo['name'];
|
||||||
contributors[name] = repo['contributors'];
|
contributors[name] = repo['contributors'];
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return contributors;
|
return contributors;
|
||||||
@@ -45,7 +74,8 @@ class RevancedAPI {
|
|||||||
var response = await _dio.get('/patches', options: _cacheOptions);
|
var response = await _dio.get('/patches', options: _cacheOptions);
|
||||||
List<dynamic> patches = response.data;
|
List<dynamic> patches = response.data;
|
||||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +92,8 @@ class RevancedAPI {
|
|||||||
t['repository'] == repoName &&
|
t['repository'] == repoName &&
|
||||||
(t['name'] as String).endsWith(extension),
|
(t['name'] as String).endsWith(extension),
|
||||||
);
|
);
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,7 +110,8 @@ class RevancedAPI {
|
|||||||
if (release != null) {
|
if (release != null) {
|
||||||
return release['version'];
|
return release['version'];
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -95,7 +127,8 @@ class RevancedAPI {
|
|||||||
String url = release['browser_download_url'];
|
String url = release['browser_download_url'];
|
||||||
return await DefaultCacheManager().getSingleFile(url);
|
return await DefaultCacheManager().getSingleFile(url);
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -114,7 +147,8 @@ class RevancedAPI {
|
|||||||
DateTime timestamp = DateTime.parse(release['timestamp'] as String);
|
DateTime timestamp = DateTime.parse(release['timestamp'] as String);
|
||||||
return format(timestamp, locale: 'en_short');
|
return format(timestamp, locale: 'en_short');
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -1,15 +1,31 @@
|
|||||||
import 'package:root/root.dart';
|
import 'package:root/root.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
|
||||||
class RootAPI {
|
class RootAPI {
|
||||||
final String _managerDirPath = '/data/local/tmp/revanced-manager';
|
final String _managerDirPath = '/data/local/tmp/revanced-manager';
|
||||||
final String _postFsDataDirPath = '/data/adb/post-fs-data.d';
|
final String _postFsDataDirPath = '/data/adb/post-fs-data.d';
|
||||||
final String _serviceDDirPath = '/data/adb/service.d';
|
final String _serviceDDirPath = '/data/adb/service.d';
|
||||||
|
|
||||||
|
Future<bool> isRooted() async {
|
||||||
|
try {
|
||||||
|
bool? isRooted = await Root.isRootAvailable();
|
||||||
|
return isRooted != null && isRooted;
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<bool> hasRootPermissions() async {
|
Future<bool> hasRootPermissions() async {
|
||||||
try {
|
try {
|
||||||
bool? isRooted = await Root.isRooted();
|
bool? isRooted = await Root.isRootAvailable();
|
||||||
return isRooted != null && isRooted;
|
if (isRooted != null && isRooted) {
|
||||||
} on Exception {
|
isRooted = await Root.isRooted();
|
||||||
|
return isRooted != null && isRooted;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,7 +78,8 @@ class RootAPI {
|
|||||||
apps.removeWhere((pack) => pack.isEmpty);
|
apps.removeWhere((pack) => pack.isEmpty);
|
||||||
return apps.map((pack) => pack.trim()).toList();
|
return apps.map((pack) => pack.trim()).toList();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
return List.empty();
|
return List.empty();
|
||||||
@@ -108,14 +125,15 @@ class RootAPI {
|
|||||||
await installApk(packageName, patchedFilePath);
|
await installApk(packageName, patchedFilePath);
|
||||||
await mountApk(packageName, originalFilePath);
|
await mountApk(packageName, originalFilePath);
|
||||||
return true;
|
return true;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> installServiceDScript(String packageName) async {
|
Future<void> installServiceDScript(String packageName) async {
|
||||||
String content = '#!/system/bin/sh\n'
|
String content = '#!/system/bin/sh\n'
|
||||||
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 1; done\n'
|
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n'
|
||||||
'base_path=$_managerDirPath/$packageName/base.apk\n'
|
'base_path=$_managerDirPath/$packageName/base.apk\n'
|
||||||
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
||||||
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
||||||
|
|||||||
@@ -20,4 +20,15 @@ class Toast {
|
|||||||
gravity: t.ToastGravity.CENTER,
|
gravity: t.ToastGravity.CENTER,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showBottom(String text) {
|
||||||
|
t.Fluttertoast.showToast(
|
||||||
|
msg: FlutterI18n.translate(
|
||||||
|
_fToast.context!,
|
||||||
|
text,
|
||||||
|
),
|
||||||
|
toastLength: t.Toast.LENGTH_LONG,
|
||||||
|
gravity: t.ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import 'package:revanced_manager/models/patched_application.dart';
|
|||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
import 'package:revanced_manager/services/toast.dart';
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
class AppSelectorViewModel extends BaseViewModel {
|
class AppSelectorViewModel extends BaseViewModel {
|
||||||
@@ -26,6 +27,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||||
name: application.appName,
|
name: application.appName,
|
||||||
packageName: application.packageName,
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
version: application.versionName!,
|
version: application.versionName!,
|
||||||
apkFilePath: application.apkFilePath,
|
apkFilePath: application.apkFilePath,
|
||||||
icon: application.icon,
|
icon: application.icon,
|
||||||
@@ -51,6 +53,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||||
name: application.appName,
|
name: application.appName,
|
||||||
packageName: application.packageName,
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
version: application.versionName!,
|
version: application.versionName!,
|
||||||
apkFilePath: result.files.single.path!,
|
apkFilePath: result.files.single.path!,
|
||||||
icon: application.icon,
|
icon: application.icon,
|
||||||
@@ -61,7 +64,8 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
_toast.show('appSelectorView.errorMessage');
|
_toast.show('appSelectorView.errorMessage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DashboardChip(
|
|
||||||
label: I18nText('homeView.updatesAvailable'),
|
|
||||||
isSelected: model.showUpdatableApps,
|
|
||||||
onSelected: (value) {
|
|
||||||
model.toggleUpdatableApps(true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
DashboardChip(
|
DashboardChip(
|
||||||
label: I18nText('homeView.installed'),
|
label: I18nText('homeView.installed'),
|
||||||
isSelected: !model.showUpdatableApps,
|
isSelected: !model.showUpdatableApps,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
model.toggleUpdatableApps(false);
|
model.toggleUpdatableApps(false);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
DashboardChip(
|
||||||
|
label: I18nText('homeView.updatesAvailable'),
|
||||||
|
isSelected: model.showUpdatableApps,
|
||||||
|
onSelected: (value) {
|
||||||
|
model.toggleUpdatableApps(true);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ import 'package:revanced_manager/services/patcher_api.dart';
|
|||||||
import 'package:revanced_manager/services/toast.dart';
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.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';
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
@@ -28,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||||
DateTime? _lastUpdate;
|
DateTime? _lastUpdate;
|
||||||
bool showUpdatableApps = true;
|
bool showUpdatableApps = false;
|
||||||
List<PatchedApplication> patchedInstalledApps = [];
|
List<PatchedApplication> patchedInstalledApps = [];
|
||||||
List<PatchedApplication> patchedUpdatableApps = [];
|
List<PatchedApplication> patchedUpdatableApps = [];
|
||||||
|
|
||||||
@@ -94,7 +95,8 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
int currentVersionInt =
|
int currentVersionInt =
|
||||||
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
return latestVersionInt > currentVersionInt;
|
return latestVersionInt > currentVersionInt;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,11 +137,16 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
} else {
|
} else {
|
||||||
_toast.show('homeView.errorDownloadMessage');
|
_toast.show('homeView.errorDownloadMessage');
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
_toast.show('homeView.errorInstallMessage');
|
_toast.show('homeView.errorInstallMessage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatesAreDisabled() {
|
||||||
|
_toast.show('homeView.updatesDisabled');
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: parentContext,
|
context: parentContext,
|
||||||
@@ -176,7 +183,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
Future<void> forceRefresh(BuildContext context) async {
|
Future<void> forceRefresh(BuildContext context) async {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
if (_lastUpdate == null ||
|
if (_lastUpdate == null ||
|
||||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 60) {
|
_lastUpdate!.difference(DateTime.now()).inSeconds > 2) {
|
||||||
_managerAPI.clearAllData();
|
_managerAPI.clearAllData();
|
||||||
}
|
}
|
||||||
initialize(context);
|
initialize(context);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
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/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.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';
|
||||||
@@ -18,130 +18,134 @@ class InstallerView extends StatelessWidget {
|
|||||||
onModelReady: (model) => model.initialize(context),
|
onModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => InstallerViewModel(),
|
viewModelBuilder: () => InstallerViewModel(),
|
||||||
builder: (context, model, child) => WillPopScope(
|
builder: (context, model, child) => WillPopScope(
|
||||||
child: Scaffold(
|
child: SafeArea(
|
||||||
body: CustomScrollView(
|
top: false,
|
||||||
controller: model.scrollController,
|
child: Scaffold(
|
||||||
slivers: <Widget>[
|
body: CustomScrollView(
|
||||||
CustomSliverAppBar(
|
controller: model.scrollController,
|
||||||
title: Text(
|
slivers: <Widget>[
|
||||||
model.headerLogs,
|
CustomSliverAppBar(
|
||||||
style: GoogleFonts.inter(
|
title: Text(
|
||||||
color: Theme.of(context).textTheme.headline6!.color,
|
model.headerLogs,
|
||||||
),
|
style: GoogleFonts.inter(
|
||||||
),
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
onBackButtonPressed: () => model.onWillPop(context),
|
|
||||||
actions: <Widget>[
|
|
||||||
Visibility(
|
|
||||||
visible: !model.isPatching && !model.hasErrors,
|
|
||||||
child: CustomPopupMenu(
|
|
||||||
onSelected: (value) => model.onMenuSelection(value),
|
|
||||||
children: {
|
|
||||||
0: I18nText(
|
|
||||||
'installerView.shareApkMenuOption',
|
|
||||||
child: const Text(
|
|
||||||
'',
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
1: I18nText(
|
|
||||||
'installerView.shareLogMenuOption',
|
|
||||||
child: const Text(
|
|
||||||
'',
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
onBackButtonPressed: () => model.onWillPop(context),
|
||||||
bottom: PreferredSize(
|
actions: <Widget>[
|
||||||
preferredSize: const Size(double.infinity, 1.0),
|
Visibility(
|
||||||
child:
|
visible: !model.isPatching,
|
||||||
GradientProgressIndicator(progress: model.progress!)),
|
child: CustomPopupMenu(
|
||||||
),
|
onSelected: (value) => model.onMenuSelection(value),
|
||||||
SliverPadding(
|
children: {
|
||||||
padding: const EdgeInsets.all(20.0),
|
if (!model.hasErrors)
|
||||||
sliver: SliverList(
|
0: I18nText(
|
||||||
delegate: SliverChildListDelegate.fixed(
|
'installerView.shareApkMenuOption',
|
||||||
<Widget>[
|
child: const Text(
|
||||||
CustomCard(
|
'',
|
||||||
child: Text(
|
style: TextStyle(
|
||||||
model.logs,
|
fontWeight: FontWeight.bold,
|
||||||
style: GoogleFonts.jetBrainsMono(
|
),
|
||||||
fontSize: 13,
|
),
|
||||||
height: 1.5,
|
),
|
||||||
|
1: I18nText(
|
||||||
|
'installerView.shareLogMenuOption',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: const Size(double.infinity, 1.0),
|
||||||
|
child:
|
||||||
|
GradientProgressIndicator(progress: model.progress!)),
|
||||||
|
),
|
||||||
|
SliverPadding(
|
||||||
|
padding: const EdgeInsets.all(20.0),
|
||||||
|
sliver: SliverList(
|
||||||
|
delegate: SliverChildListDelegate.fixed(
|
||||||
|
<Widget>[
|
||||||
|
CustomCard(
|
||||||
|
child: Text(
|
||||||
|
model.logs,
|
||||||
|
style: GoogleFonts.jetBrainsMono(
|
||||||
|
fontSize: 13,
|
||||||
|
height: 1.5,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SliverFillRemaining(
|
||||||
SliverFillRemaining(
|
hasScrollBody: false,
|
||||||
hasScrollBody: false,
|
child: Align(
|
||||||
child: Align(
|
alignment: Alignment.bottomCenter,
|
||||||
alignment: Alignment.bottomCenter,
|
child: Visibility(
|
||||||
child: Visibility(
|
visible: !model.isPatching && !model.hasErrors,
|
||||||
visible: !model.isPatching && !model.hasErrors,
|
child: Padding(
|
||||||
child: Padding(
|
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
|
||||||
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
|
child: Row(
|
||||||
child: Row(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Visibility(
|
||||||
Visibility(
|
visible: model.isInstalled,
|
||||||
visible: model.isInstalled,
|
child: CustomMaterialButton(
|
||||||
child: CustomMaterialButton(
|
label: I18nText('installerView.openButton'),
|
||||||
label: I18nText('installerView.openButton'),
|
isExpanded: true,
|
||||||
isExpanded: true,
|
onPressed: () {
|
||||||
onPressed: () {
|
model.openApp();
|
||||||
model.openApp();
|
model.cleanPatcher();
|
||||||
model.cleanPatcher();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Visibility(
|
|
||||||
visible: !model.isInstalled,
|
|
||||||
child: CustomMaterialButton(
|
|
||||||
isFilled: false,
|
|
||||||
label:
|
|
||||||
I18nText('installerView.installRootButton'),
|
|
||||||
isExpanded: true,
|
|
||||||
onPressed: () => model.installResult(
|
|
||||||
context,
|
|
||||||
true,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Visibility(
|
||||||
Visibility(
|
visible: !model.isInstalled && model.isRooted,
|
||||||
visible: !model.isInstalled,
|
child: CustomMaterialButton(
|
||||||
child: const SizedBox(
|
isFilled: false,
|
||||||
width: 16,
|
label:
|
||||||
),
|
I18nText('installerView.installRootButton'),
|
||||||
),
|
isExpanded: true,
|
||||||
Visibility(
|
onPressed: () => model.installResult(
|
||||||
visible: !model.isInstalled,
|
context,
|
||||||
child: CustomMaterialButton(
|
true,
|
||||||
label: I18nText('installerView.installButton'),
|
),
|
||||||
isExpanded: true,
|
|
||||||
onPressed: () => model.installResult(
|
|
||||||
context,
|
|
||||||
false,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
Visibility(
|
||||||
],
|
visible: !model.isInstalled,
|
||||||
|
child: const SizedBox(
|
||||||
|
width: 16,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !model.isInstalled,
|
||||||
|
child: CustomMaterialButton(
|
||||||
|
label: I18nText('installerView.installButton'),
|
||||||
|
isExpanded: true,
|
||||||
|
onPressed: () => model.installResult(
|
||||||
|
context,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onWillPop: () => model.onWillPop(context),
|
onWillPop: () => model.onWillPop(context),
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
@@ -9,15 +10,18 @@ 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/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
import 'package:revanced_manager/services/toast.dart';
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:wakelock/wakelock.dart';
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
|
||||||
class InstallerViewModel extends BaseViewModel {
|
class InstallerViewModel extends BaseViewModel {
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
|
final RootAPI _rootAPI = RootAPI();
|
||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
|
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
|
||||||
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
||||||
@@ -28,11 +32,13 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
double? progress = 0.0;
|
double? progress = 0.0;
|
||||||
String logs = '';
|
String logs = '';
|
||||||
String headerLogs = '';
|
String headerLogs = '';
|
||||||
|
bool isRooted = false;
|
||||||
bool isPatching = true;
|
bool isPatching = true;
|
||||||
bool isInstalled = false;
|
bool isInstalled = false;
|
||||||
bool hasErrors = false;
|
bool hasErrors = false;
|
||||||
|
|
||||||
Future<void> initialize(BuildContext context) async {
|
Future<void> initialize(BuildContext context) async {
|
||||||
|
isRooted = await _rootAPI.isRooted();
|
||||||
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
||||||
try {
|
try {
|
||||||
FlutterBackground.initialize(
|
FlutterBackground.initialize(
|
||||||
@@ -52,7 +58,8 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
).then((value) => FlutterBackground.enableBackgroundExecution());
|
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,14 +85,20 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void update(double value, String header, String log) {
|
void update(double value, String header, String log) {
|
||||||
if (value > 0) {
|
if (value >= 0.0) {
|
||||||
progress = value;
|
progress = value;
|
||||||
}
|
}
|
||||||
isPatching = progress == 1.0 ? false : true;
|
if (value == 0.0) {
|
||||||
if (progress == 0.0) {
|
|
||||||
logs = '';
|
logs = '';
|
||||||
|
isPatching = true;
|
||||||
isInstalled = false;
|
isInstalled = false;
|
||||||
hasErrors = false;
|
hasErrors = false;
|
||||||
|
} else if (value == 1.0) {
|
||||||
|
isPatching = false;
|
||||||
|
hasErrors = false;
|
||||||
|
} else if (value == -100.0) {
|
||||||
|
isPatching = false;
|
||||||
|
hasErrors = true;
|
||||||
}
|
}
|
||||||
if (header.isNotEmpty) {
|
if (header.isNotEmpty) {
|
||||||
headerLogs = header;
|
headerLogs = header;
|
||||||
@@ -95,6 +108,9 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
logs += '\n';
|
logs += '\n';
|
||||||
}
|
}
|
||||||
logs += log;
|
logs += log;
|
||||||
|
if (logs[logs.length - 1] == '\n') {
|
||||||
|
logs = logs.substring(0, logs.length - 1);
|
||||||
|
}
|
||||||
Future.delayed(const Duration(milliseconds: 500)).then((value) {
|
Future.delayed(const Duration(milliseconds: 500)).then((value) {
|
||||||
scrollController.animateTo(
|
scrollController.animateTo(
|
||||||
scrollController.position.maxScrollExtent,
|
scrollController.position.maxScrollExtent,
|
||||||
@@ -107,89 +123,106 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher() async {
|
Future<void> runPatcher() async {
|
||||||
update(0.0, 'Initializing...', 'Initializing installer');
|
try {
|
||||||
if (_patches.isNotEmpty) {
|
update(0.0, 'Initializing...', 'Initializing installer');
|
||||||
try {
|
if (_patches.isNotEmpty) {
|
||||||
update(0.1, '', 'Creating working directory');
|
try {
|
||||||
await _patcherAPI.runPatcher(
|
update(0.1, '', 'Creating working directory');
|
||||||
_app.packageName,
|
await _patcherAPI.runPatcher(
|
||||||
_app.apkFilePath,
|
_app.packageName,
|
||||||
_patches,
|
_app.apkFilePath,
|
||||||
);
|
_patches,
|
||||||
} catch (e) {
|
);
|
||||||
hasErrors = true;
|
} on Exception catch (e, s) {
|
||||||
update(-1.0, 'Aborting...', 'An error occurred! Aborting\nError: $e');
|
update(
|
||||||
|
-100.0,
|
||||||
|
'Aborting...',
|
||||||
|
'An error occurred! Aborting\nError:\n$e',
|
||||||
|
);
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
throw await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||||
}
|
}
|
||||||
} else {
|
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||||
hasErrors = true;
|
try {
|
||||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
FlutterBackground.disableBackgroundExecution();
|
||||||
}
|
} on Exception catch (e, s) {
|
||||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
try {
|
// ignore
|
||||||
FlutterBackground.disableBackgroundExecution();
|
}
|
||||||
} on Exception {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
await Wakelock.disable();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
await Wakelock.disable();
|
|
||||||
isPatching = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void installResult(BuildContext context, bool installAsRoot) async {
|
void installResult(BuildContext context, bool installAsRoot) async {
|
||||||
_app.isRooted = installAsRoot;
|
try {
|
||||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
_app.isRooted = installAsRoot;
|
||||||
bool rootMicroG = installAsRoot && hasMicroG;
|
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||||
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
bool rootMicroG = installAsRoot && hasMicroG;
|
||||||
bool ytWithoutRootMicroG =
|
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||||
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
bool ytWithoutRootMicroG =
|
||||||
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
||||||
return showDialog(
|
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
||||||
context: context,
|
return showDialog(
|
||||||
builder: (context) => AlertDialog(
|
context: context,
|
||||||
title: I18nText('installerView.installErrorDialogTitle'),
|
builder: (context) => AlertDialog(
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
title: I18nText('installerView.installErrorDialogTitle'),
|
||||||
content: I18nText(
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
rootMicroG
|
content: I18nText(
|
||||||
? 'installerView.installErrorDialogText1'
|
rootMicroG
|
||||||
: rootFromStorage
|
? 'installerView.installErrorDialogText1'
|
||||||
? 'installerView.installErrorDialogText3'
|
: rootFromStorage
|
||||||
: 'installerView.installErrorDialogText2',
|
? 'installerView.installErrorDialogText3'
|
||||||
|
: 'installerView.installErrorDialogText2',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
);
|
||||||
CustomMaterialButton(
|
} else {
|
||||||
label: I18nText('okButton'),
|
update(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
1.0,
|
||||||
)
|
'Installing...',
|
||||||
],
|
_app.isRooted
|
||||||
),
|
? 'Installing patched file using root method'
|
||||||
);
|
: 'Installing patched file using nonroot method',
|
||||||
} else {
|
);
|
||||||
update(
|
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||||
1.0,
|
if (isInstalled) {
|
||||||
'Installing...',
|
update(1.0, 'Installed!', 'Installed!');
|
||||||
_app.isRooted
|
_app.isFromStorage = false;
|
||||||
? 'Installing patched file using root method'
|
_app.patchDate = DateTime.now();
|
||||||
: 'Installing patched file using nonroot method',
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
);
|
if (hasMicroG) {
|
||||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
_app.name += ' ReVanced';
|
||||||
if (isInstalled) {
|
_app.packageName = _app.packageName.replaceFirst(
|
||||||
update(1.0, 'Installed!', 'Installed!');
|
'com.google.',
|
||||||
_app.isFromStorage = false;
|
'app.revanced.',
|
||||||
_app.patchDate = DateTime.now();
|
);
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
}
|
||||||
if (hasMicroG) {
|
await _managerAPI.savePatchedApp(_app);
|
||||||
_app.packageName = _app.packageName.replaceFirst(
|
|
||||||
'com.google.',
|
|
||||||
'app.revanced.',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
await _managerAPI.savePatchedApp(_app);
|
|
||||||
}
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareResult() {
|
void shareResult() {
|
||||||
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
try {
|
||||||
|
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareLog() {
|
void shareLog() {
|
||||||
@@ -197,10 +230,14 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> cleanPatcher() async {
|
Future<void> cleanPatcher() async {
|
||||||
_patcherAPI.cleanPatcher();
|
try {
|
||||||
locator<PatcherViewModel>().selectedApp = null;
|
_patcherAPI.cleanPatcher();
|
||||||
locator<PatcherViewModel>().selectedPatches.clear();
|
locator<PatcherViewModel>().selectedApp = null;
|
||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().selectedPatches.clear();
|
||||||
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void openApp() {
|
void openApp() {
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:device_apps/device_apps.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
@@ -6,14 +5,16 @@ 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/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/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 ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
PatchedApplication? selectedApp;
|
PatchedApplication? selectedApp;
|
||||||
List<Patch> selectedPatches = [];
|
List<Patch> selectedPatches = [];
|
||||||
@@ -39,13 +40,12 @@ class PatcherViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isValidPatchConfig() async {
|
Future<bool> isValidPatchConfig() async {
|
||||||
bool needsResourcePatching =
|
bool needsResourcePatching = await _patcherAPI.needsResourcePatching(
|
||||||
await _patcherAPI.needsResourcePatching(selectedPatches);
|
selectedPatches,
|
||||||
|
);
|
||||||
if (needsResourcePatching && selectedApp != null) {
|
if (needsResourcePatching && selectedApp != null) {
|
||||||
Application? app = await DeviceApps.getApp(selectedApp!.packageName);
|
bool isSplit = await _managerAPI.isSplitApk(selectedApp!);
|
||||||
if (app != null && app.isSplit) {
|
return !isSplit;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,25 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
Container(
|
||||||
|
height: 2,
|
||||||
|
margin: const EdgeInsets.only(right: 16, top: 12, bottom: 12),
|
||||||
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.tertiary.withOpacity(0.5),
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
model.patchesVersion!,
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(64.0),
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
@@ -73,7 +92,12 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
_query = searchQuery;
|
_query = searchQuery;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onSelectAll: (value) => model.selectAllPatches(value),
|
onSelectAll: (value) {
|
||||||
|
if (value) {
|
||||||
|
model.selectAllPatcherWarning(context);
|
||||||
|
}
|
||||||
|
model.selectAllPatches(value);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,20 +1,27 @@
|
|||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
|
import 'package:flutter_i18n/widgets/I18nText.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';
|
||||||
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class PatchesSelectorViewModel extends BaseViewModel {
|
class PatchesSelectorViewModel extends BaseViewModel {
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final List<Patch> patches = [];
|
final List<Patch> patches = [];
|
||||||
final List<Patch> selectedPatches =
|
final List<Patch> selectedPatches =
|
||||||
locator<PatcherViewModel>().selectedPatches;
|
locator<PatcherViewModel>().selectedPatches;
|
||||||
|
String? patchesVersion = '';
|
||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
|
getPatchesVersion();
|
||||||
patches.addAll(await _patcherAPI.getFilteredPatches(
|
patches.addAll(await _patcherAPI.getFilteredPatches(
|
||||||
locator<PatcherViewModel>().selectedApp!.packageName,
|
locator<PatcherViewModel>().selectedApp!.originalPackageName,
|
||||||
));
|
));
|
||||||
patches.sort((a, b) => a.name.compareTo(b.name));
|
patches.sort((a, b) => a.name.compareTo(b.name));
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -35,6 +42,23 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> selectAllPatcherWarning(BuildContext context) {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText('patchesSelectorView.selectAllPatchesWarningTitle'),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText('patchesSelectorView.selectAllPatchesWarningContent'),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void selectAllPatches(bool isSelected) {
|
void selectAllPatches(bool isSelected) {
|
||||||
selectedPatches.clear();
|
selectedPatches.clear();
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
@@ -48,14 +72,19 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> getPatchesVersion() async {
|
||||||
|
patchesVersion = await _managerAPI.getLatestPatchesVersion();
|
||||||
|
// print('Patches version: $patchesVersion');
|
||||||
|
return patchesVersion ?? '0.0.0';
|
||||||
|
}
|
||||||
|
|
||||||
List<Patch> getQueriedPatches(String query) {
|
List<Patch> getQueriedPatches(String query) {
|
||||||
return patches
|
return patches
|
||||||
.where((patch) =>
|
.where((patch) =>
|
||||||
query.isEmpty ||
|
query.isEmpty ||
|
||||||
query.length < 2 ||
|
query.length < 2 ||
|
||||||
patch.name.toLowerCase().contains(
|
patch.name.toLowerCase().contains(query.toLowerCase()) ||
|
||||||
query.toLowerCase(),
|
patch.getSimpleName().toLowerCase().contains(query.toLowerCase()))
|
||||||
))
|
|
||||||
.toList();
|
.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,79 @@ class SettingsView extends StatelessWidget {
|
|||||||
subtitle: 'settingsView.sourcesLabelHint',
|
subtitle: 'settingsView.sourcesLabelHint',
|
||||||
onTap: () => model.showSourcesDialog(context),
|
onTap: () => model.showSourcesDialog(context),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteKeystoreLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteKeystoreHint'),
|
||||||
|
onTap: () => model.deleteKeystore,
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteTempDirLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteTempDirHint'),
|
||||||
|
onTap: () => model.deleteTempDir(),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteLogsLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteLogsHint'),
|
||||||
|
onTap: () => model.deleteLogs(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_settingsDivider,
|
_settingsDivider,
|
||||||
|
// SettingsSection(
|
||||||
|
// title: 'settingsView.logsSectionTitle',
|
||||||
|
// children: <Widget>[
|
||||||
|
// CustomSwitchTile(
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
// title: I18nText(
|
||||||
|
// 'settingsView.sentryLabel',
|
||||||
|
// child: const Text(
|
||||||
|
// '',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 20,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// subtitle: I18nText('settingsView.sentryHint'),
|
||||||
|
// value: model.isSentryEnabled(),
|
||||||
|
// onTap: (value) => model.useSentry(value),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// _settingsDivider,
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: 'settingsView.infoSectionTitle',
|
title: 'settingsView.infoSectionTitle',
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import 'package:path_provider/path_provider.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/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
|
||||||
import 'package:share_extend/share_extend.dart';
|
import 'package:share_extend/share_extend.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
@@ -23,6 +24,7 @@ const int ANDROID_12_SDK_VERSION = 31;
|
|||||||
class SettingsViewModel extends BaseViewModel {
|
class SettingsViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
|
final Toast _toast = locator<Toast>();
|
||||||
final TextEditingController _orgPatSourceController = TextEditingController();
|
final TextEditingController _orgPatSourceController = TextEditingController();
|
||||||
final TextEditingController _patSourceController = TextEditingController();
|
final TextEditingController _patSourceController = TextEditingController();
|
||||||
final TextEditingController _orgIntSourceController = TextEditingController();
|
final TextEditingController _orgIntSourceController = TextEditingController();
|
||||||
@@ -313,11 +315,42 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// bool isSentryEnabled() {
|
||||||
|
// return _managerAPI.isSentryEnabled();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// void useSentry(bool value) {
|
||||||
|
// _managerAPI.setSentryStatus(value);
|
||||||
|
// _toast.showBottom('settingsView.restartAppForChanges');
|
||||||
|
// notifyListeners();
|
||||||
|
// }
|
||||||
|
|
||||||
|
void deleteKeystore() {
|
||||||
|
_managerAPI.deleteKeystore();
|
||||||
|
_toast.showBottom('settingsView.deletedKeystore');
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void deleteTempDir() {
|
||||||
|
_managerAPI.deleteTempFolder();
|
||||||
|
_toast.showBottom('settingsView.deletedTempDir');
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
Future<int> getSdkVersion() async {
|
Future<int> getSdkVersion() async {
|
||||||
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
||||||
return info.version.sdkInt ?? -1;
|
return info.version.sdkInt ?? -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> deleteLogs() async {
|
||||||
|
Directory appCacheDir = await getTemporaryDirectory();
|
||||||
|
Directory logsDir = Directory('${appCacheDir.path}/logs');
|
||||||
|
if (logsDir.existsSync()) {
|
||||||
|
logsDir.deleteSync(recursive: true);
|
||||||
|
}
|
||||||
|
_toast.showBottom('settingsView.deletedLogs');
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> exportLogcatLogs() async {
|
Future<void> exportLogcatLogs() async {
|
||||||
Directory appCache = await getTemporaryDirectory();
|
Directory appCache = await getTemporaryDirectory();
|
||||||
Directory logDir = Directory('${appCache.path}/logs');
|
Directory logDir = Directory('${appCache.path}/logs');
|
||||||
|
|||||||
@@ -104,52 +104,50 @@ class AppInfoView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (app.isRooted)
|
VerticalDivider(
|
||||||
VerticalDivider(
|
color: Theme.of(context).canvasColor,
|
||||||
color: Theme.of(context).canvasColor,
|
indent: 12.0,
|
||||||
indent: 12.0,
|
endIndent: 12.0,
|
||||||
endIndent: 12.0,
|
width: 1.0,
|
||||||
width: 1.0,
|
),
|
||||||
),
|
Expanded(
|
||||||
if (app.isRooted)
|
child: Material(
|
||||||
Expanded(
|
type: MaterialType.transparency,
|
||||||
child: Material(
|
child: InkWell(
|
||||||
type: MaterialType.transparency,
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
child: InkWell(
|
onTap: () => model.showUninstallDialog(
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
context,
|
||||||
onTap: () => model.showUninstallDialog(
|
app,
|
||||||
context,
|
false,
|
||||||
app,
|
),
|
||||||
false,
|
child: Column(
|
||||||
),
|
mainAxisAlignment:
|
||||||
child: Column(
|
MainAxisAlignment.center,
|
||||||
mainAxisAlignment:
|
children: <Widget>[
|
||||||
MainAxisAlignment.center,
|
Icon(
|
||||||
children: <Widget>[
|
Icons.delete_outline,
|
||||||
Icon(
|
color: Theme.of(context)
|
||||||
Icons.delete_outline,
|
.colorScheme
|
||||||
color: Theme.of(context)
|
.primary,
|
||||||
.colorScheme
|
),
|
||||||
.primary,
|
const SizedBox(height: 10),
|
||||||
),
|
I18nText(
|
||||||
const SizedBox(height: 10),
|
'appInfoView.uninstallButton',
|
||||||
I18nText(
|
child: Text(
|
||||||
'appInfoView.uninstallButton',
|
'',
|
||||||
child: Text(
|
style: TextStyle(
|
||||||
'',
|
color: Theme.of(context)
|
||||||
style: TextStyle(
|
.colorScheme
|
||||||
color: Theme.of(context)
|
.primary,
|
||||||
.colorScheme
|
fontWeight: FontWeight.bold,
|
||||||
.primary,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
VerticalDivider(
|
VerticalDivider(
|
||||||
color: Theme.of(context).canvasColor,
|
color: Theme.of(context).canvasColor,
|
||||||
indent: 12.0,
|
indent: 12.0,
|
||||||
@@ -162,8 +160,9 @@ class AppInfoView extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius: BorderRadius.circular(16.0),
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
model.navigateToPatcher(app);
|
model.updateNotImplemented(context);
|
||||||
Navigator.of(context).pop();
|
// model.navigateToPatcher(app);
|
||||||
|
// Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
@@ -262,6 +261,22 @@ class AppInfoView extends StatelessWidget {
|
|||||||
subtitle: Text(app.packageName),
|
subtitle: Text(app.packageName),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'appInfoView.originalPackageNameLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: Text(app.originalPackageName),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import 'package:revanced_manager/models/patched_application.dart';
|
|||||||
import 'package:revanced_manager/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.dart';
|
||||||
import 'package:revanced_manager/services/root_api.dart';
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/utils/string.dart';
|
import 'package:revanced_manager/utils/string.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
@@ -19,21 +20,28 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
final RootAPI _rootAPI = RootAPI();
|
final RootAPI _rootAPI = RootAPI();
|
||||||
|
final Toast _toast = locator<Toast>();
|
||||||
|
|
||||||
Future<void> uninstallApp(PatchedApplication app, bool onlyUnpatch) async {
|
Future<void> uninstallApp(
|
||||||
|
BuildContext context,
|
||||||
|
PatchedApplication app,
|
||||||
|
bool onlyUnpatch,
|
||||||
|
) async {
|
||||||
|
bool isUninstalled = true;
|
||||||
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);
|
await _rootAPI.deleteApp(app.packageName, app.apkFilePath);
|
||||||
_managerAPI.deletePatchedApp(app);
|
|
||||||
if (!onlyUnpatch) {
|
if (!onlyUnpatch) {
|
||||||
DeviceApps.uninstallApp(app.packageName);
|
await DeviceApps.uninstallApp(app.packageName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DeviceApps.uninstallApp(app.packageName).then(
|
isUninstalled = await DeviceApps.uninstallApp(app.packageName);
|
||||||
(value) => _managerAPI.deletePatchedApp(app),
|
}
|
||||||
);
|
if (isUninstalled) {
|
||||||
|
await _managerAPI.deletePatchedApp(app);
|
||||||
|
locator<HomeViewModel>().initialize(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,6 +53,10 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
locator<NavigationViewModel>().setIndex(1);
|
locator<NavigationViewModel>().setIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updateNotImplemented(BuildContext context) {
|
||||||
|
_toast.show('appInfoView.updateNotImplemented');
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showUninstallDialog(
|
Future<void> showUninstallDialog(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
PatchedApplication app,
|
PatchedApplication app,
|
||||||
@@ -87,8 +99,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('yesButton'),
|
label: I18nText('yesButton'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
uninstallApp(app, onlyUnpatch);
|
uninstallApp(context, app, onlyUnpatch);
|
||||||
locator<HomeViewModel>().initialize(context);
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
@@ -97,8 +108,7 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
uninstallApp(app, onlyUnpatch);
|
uninstallApp(context, app, onlyUnpatch);
|
||||||
locator<HomeViewModel>().initialize(context);
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +133,8 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: Text(getAppliedPatchesString(app.appliedPatches)),
|
content: SingleChildScrollView(
|
||||||
|
child: Text(getAppliedPatchesString(app.appliedPatches))),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class _ContributorsCardState extends State<ContributorsCard> {
|
|||||||
'',
|
'',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 20,
|
fontSize: 20,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -14,48 +14,74 @@ class AvailableUpdatesCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return apps.isEmpty
|
return CustomCard(
|
||||||
? CustomCard(
|
child: Center(
|
||||||
child: Center(
|
child: Column(
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Icon(
|
||||||
Icon(
|
size: 40,
|
||||||
size: 40,
|
Icons.update_disabled,
|
||||||
Icons.update_disabled,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
I18nText(
|
|
||||||
'homeView.noUpdates',
|
|
||||||
child: Text(
|
|
||||||
'',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
const SizedBox(height: 16),
|
||||||
: ListView(
|
I18nText(
|
||||||
shrinkWrap: true,
|
'homeView.WIP',
|
||||||
padding: EdgeInsets.zero,
|
child: Text(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
'',
|
||||||
children: apps
|
textAlign: TextAlign.center,
|
||||||
.map((app) => ApplicationItem(
|
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||||
icon: app.icon,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
name: app.name,
|
),
|
||||||
patchDate: app.patchDate,
|
),
|
||||||
changelog: app.changelog,
|
)
|
||||||
isUpdatableApp: true,
|
],
|
||||||
onPressed: () =>
|
),
|
||||||
locator<HomeViewModel>().navigateToPatcher(
|
),
|
||||||
app,
|
);
|
||||||
),
|
// return apps.isEmpty
|
||||||
))
|
// ? CustomCard(
|
||||||
.toList(),
|
// child: Center(
|
||||||
);
|
// child: Column(
|
||||||
|
// children: <Widget>[
|
||||||
|
// Icon(
|
||||||
|
// size: 40,
|
||||||
|
// Icons.update_disabled,
|
||||||
|
// color: Theme.of(context).colorScheme.secondary,
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 16),
|
||||||
|
// I18nText(
|
||||||
|
// 'homeView.noUpdates',
|
||||||
|
// child: Text(
|
||||||
|
// '',
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||||
|
// color: Theme.of(context).colorScheme.secondary,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// : ListView(
|
||||||
|
// shrinkWrap: true,
|
||||||
|
// padding: EdgeInsets.zero,
|
||||||
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
|
// children: apps
|
||||||
|
// .map((app) => ApplicationItem(
|
||||||
|
// icon: app.icon,
|
||||||
|
// name: app.name,
|
||||||
|
// patchDate: app.patchDate,
|
||||||
|
// changelog: app.changelog,
|
||||||
|
// isUpdatableApp: true,
|
||||||
|
// //TODO: Find a better way to do update functionality
|
||||||
|
// onPressed: () {}
|
||||||
|
// // () =>
|
||||||
|
// // locator<HomeViewModel>().navigateToPatcher(
|
||||||
|
// // app,
|
||||||
|
// // ),
|
||||||
|
// ))
|
||||||
|
// .toList(),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
|
|
||||||
class LatestCommitCard extends StatefulWidget {
|
class LatestCommitCard extends StatefulWidget {
|
||||||
@@ -49,7 +49,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 4),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
I18nText('latestCommitCard.managerLabel'),
|
I18nText('latestCommitCard.managerLabel'),
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class CustomMaterialButton extends StatelessWidget {
|
|
||||||
final Widget label;
|
|
||||||
final bool isFilled;
|
|
||||||
final bool isExpanded;
|
|
||||||
final Function()? onPressed;
|
|
||||||
|
|
||||||
const CustomMaterialButton({
|
|
||||||
Key? key,
|
|
||||||
required this.label,
|
|
||||||
this.isFilled = true,
|
|
||||||
this.isExpanded = false,
|
|
||||||
required this.onPressed,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return TextButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
padding: MaterialStateProperty.all(
|
|
||||||
isExpanded
|
|
||||||
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
|
||||||
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
|
||||||
),
|
|
||||||
shape: MaterialStateProperty.all(
|
|
||||||
StadiumBorder(
|
|
||||||
side: isFilled
|
|
||||||
? BorderSide.none
|
|
||||||
: BorderSide(
|
|
||||||
width: 1,
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
backgroundColor: MaterialStateProperty.all(
|
|
||||||
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
|
|
||||||
),
|
|
||||||
foregroundColor: MaterialStateProperty.all(
|
|
||||||
isFilled
|
|
||||||
? Theme.of(context).colorScheme.surface
|
|
||||||
: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: onPressed,
|
|
||||||
child: label,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -32,7 +32,7 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 8),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
? I18nText('appSelectorCard.widgetSubtitle')
|
? I18nText('appSelectorCard.widgetSubtitle')
|
||||||
: Row(
|
: Row(
|
||||||
@@ -49,21 +49,21 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 6),
|
const SizedBox(width: 6),
|
||||||
Text(locator<PatcherViewModel>().getAppSelectionString()),
|
Text(
|
||||||
|
locator<PatcherViewModel>()
|
||||||
|
.getAppSelectionString(),
|
||||||
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
? Container()
|
? Container()
|
||||||
: Column(
|
: Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 4),
|
||||||
Padding(
|
Text(
|
||||||
padding: const EdgeInsets.only(left: 20),
|
locator<PatcherViewModel>()
|
||||||
child: Text(
|
.getRecommendedVersionString(context),
|
||||||
locator<PatcherViewModel>()
|
|
||||||
.getRecommendedVersionString(context),
|
|
||||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class PatchSelectorCard extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 4),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||||
@@ -46,7 +46,7 @@ class PatchSelectorCard extends StatelessWidget {
|
|||||||
String _getPatchesSelection() {
|
String _getPatchesSelection() {
|
||||||
String text = '';
|
String text = '';
|
||||||
for (Patch p in locator<PatcherViewModel>().selectedPatches) {
|
for (Patch p in locator<PatcherViewModel>().selectedPatches) {
|
||||||
text += '${p.getSimpleName()} (v${p.version})\n';
|
text += '\u2022 ${p.getSimpleName()} (v${p.version})\n';
|
||||||
}
|
}
|
||||||
return text.substring(0, text.length - 1);
|
return text.substring(0, text.length - 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
@@ -58,13 +58,21 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
widget.simpleName,
|
widget.simpleName,
|
||||||
|
maxLines: 2,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
const SizedBox(width: 6),
|
||||||
Text(widget.version)
|
Text(
|
||||||
|
widget.version,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
@@ -73,7 +81,10 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
softWrap: true,
|
softWrap: true,
|
||||||
maxLines: 3,
|
maxLines: 3,
|
||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: const TextStyle(fontSize: 14),
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -104,12 +115,12 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
padding: const EdgeInsets.only(top: 8),
|
padding: const EdgeInsets.only(top: 8),
|
||||||
child: TextButton.icon(
|
child: TextButton.icon(
|
||||||
label: I18nText('patchItem.unsupportedWarningButton'),
|
label: I18nText('patchItem.unsupportedWarningButton'),
|
||||||
icon: const Icon(Icons.warning),
|
icon: const Icon(Icons.warning, size: 20.0),
|
||||||
onPressed: () => _showUnsupportedWarningDialog(),
|
onPressed: () => _showUnsupportedWarningDialog(),
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
shape: MaterialStateProperty.all(
|
shape: MaterialStateProperty.all(
|
||||||
RoundedRectangleBorder(
|
RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(8),
|
||||||
side: BorderSide(
|
side: BorderSide(
|
||||||
width: 1,
|
width: 1,
|
||||||
color:
|
color:
|
||||||
@@ -147,7 +158,7 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
translationParams: {
|
translationParams: {
|
||||||
'packageVersion': widget.packageVersion,
|
'packageVersion': widget.packageVersion,
|
||||||
'supportedVersions':
|
'supportedVersions':
|
||||||
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}',
|
'\u2022 ${widget.supportedPackageVersions.reversed.join('\n\u2022 ')}',
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:typed_data';
|
import 'dart:typed_data';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
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';
|
||||||
@@ -50,18 +50,8 @@ class _ApplicationItemState extends State<ApplicationItem>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
ExpandableController expController = ExpandableController();
|
ExpandableController expController = ExpandableController();
|
||||||
return ExpandablePanel(
|
return Container(
|
||||||
controller: expController,
|
margin: const EdgeInsets.only(bottom: 16.0),
|
||||||
theme: const ExpandableThemeData(
|
|
||||||
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
|
||||||
tapBodyToCollapse: false,
|
|
||||||
tapBodyToExpand: false,
|
|
||||||
tapHeaderToExpand: false,
|
|
||||||
hasIcon: false,
|
|
||||||
animationDuration: Duration(milliseconds: 450),
|
|
||||||
),
|
|
||||||
header: Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 16.0),
|
|
||||||
child: CustomCard(
|
child: CustomCard(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
expController.toggle();
|
expController.toggle();
|
||||||
@@ -69,74 +59,85 @@ class _ApplicationItemState extends State<ApplicationItem>
|
|||||||
? _animationController.reverse()
|
? _animationController.reverse()
|
||||||
: _animationController.forward();
|
: _animationController.forward();
|
||||||
},
|
},
|
||||||
child: Row(
|
child: ExpandablePanel(
|
||||||
children: <Widget>[
|
controller: expController,
|
||||||
SizedBox(
|
theme: const ExpandableThemeData(
|
||||||
width: 40,
|
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
child: Image.memory(widget.icon, height: 40, width: 40),
|
tapBodyToCollapse: false,
|
||||||
),
|
tapBodyToExpand: false,
|
||||||
const SizedBox(width: 4),
|
tapHeaderToExpand: false,
|
||||||
Padding(
|
hasIcon: false,
|
||||||
padding: const EdgeInsets.only(left: 15.0),
|
animationDuration: Duration(milliseconds: 450),
|
||||||
child: Column(
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
header: Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
SizedBox(
|
||||||
widget.name.length > 9
|
width: 40,
|
||||||
? '${widget.name.substring(0, 9)}...'
|
child: Image.memory(widget.icon, height: 40, width: 40),
|
||||||
: widget.name,
|
),
|
||||||
style: const TextStyle(
|
const SizedBox(width: 4),
|
||||||
fontSize: 16,
|
Padding(
|
||||||
fontWeight: FontWeight.w500,
|
padding: const EdgeInsets.only(left: 15.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(
|
||||||
|
widget.name.length > 12
|
||||||
|
? '${widget.name.substring(0, 12)}...'
|
||||||
|
: widget.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
Text(format(widget.patchDate)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const Spacer(),
|
||||||
|
RotationTransition(
|
||||||
|
turns: Tween(begin: 0.0, end: 0.50)
|
||||||
|
.animate(_animationController),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.all(8.0),
|
||||||
|
child: Icon(Icons.arrow_drop_down),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: widget.isUpdatableApp
|
||||||
|
? I18nText('applicationItem.patchButton')
|
||||||
|
: I18nText('applicationItem.infoButton'),
|
||||||
|
onPressed: widget.onPressed,
|
||||||
),
|
),
|
||||||
Text(format(widget.patchDate)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
const Spacer(),
|
),
|
||||||
RotationTransition(
|
collapsed: const SizedBox(),
|
||||||
turns:
|
expanded: Padding(
|
||||||
Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
padding: const EdgeInsets.only(
|
||||||
child: const Padding(
|
top: 16.0, left: 4.0, right: 4.0, bottom: 4.0),
|
||||||
padding: EdgeInsets.all(8.0),
|
child: Column(
|
||||||
child: Icon(Icons.arrow_drop_down),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
|
||||||
),
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CustomMaterialButton(
|
I18nText(
|
||||||
label: widget.isUpdatableApp
|
'applicationItem.changelogLabel',
|
||||||
? I18nText('applicationItem.patchButton')
|
child: const Text(
|
||||||
: I18nText('applicationItem.infoButton'),
|
'',
|
||||||
onPressed: widget.onPressed,
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
collapsed: const SizedBox(),
|
|
||||||
expanded: Padding(
|
|
||||||
padding: const EdgeInsets.all(16.0).copyWith(top: 0.0),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
I18nText(
|
|
||||||
'applicationItem.changelogLabel',
|
|
||||||
child: const Text(
|
|
||||||
'',
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
),
|
||||||
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
|
));
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
130
lib/ui/widgets/shared/custom_material_button.dart
Normal file
130
lib/ui/widgets/shared/custom_material_button.dart
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class CustomMaterialButton extends StatelessWidget {
|
||||||
|
final Widget label;
|
||||||
|
final bool isFilled;
|
||||||
|
final bool isExpanded;
|
||||||
|
final Function()? onPressed;
|
||||||
|
|
||||||
|
const CustomMaterialButton({
|
||||||
|
Key? key,
|
||||||
|
required this.label,
|
||||||
|
this.isFilled = true,
|
||||||
|
this.isExpanded = false,
|
||||||
|
required this.onPressed,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
padding: MaterialStateProperty.all(
|
||||||
|
isExpanded
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
||||||
|
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||||
|
),
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
StadiumBorder(
|
||||||
|
side: isFilled
|
||||||
|
? BorderSide.none
|
||||||
|
: BorderSide(
|
||||||
|
width: 1,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: MaterialStateProperty.all(
|
||||||
|
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
|
||||||
|
),
|
||||||
|
foregroundColor: MaterialStateProperty.all(
|
||||||
|
isFilled
|
||||||
|
? Theme.of(context).colorScheme.surface
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: onPressed,
|
||||||
|
child: label,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class TimerButton extends StatefulWidget {
|
||||||
|
Widget label;
|
||||||
|
bool isFilled;
|
||||||
|
int seconds;
|
||||||
|
final bool isRunning;
|
||||||
|
final Function()? onTimerEnd;
|
||||||
|
|
||||||
|
TimerButton({
|
||||||
|
Key? key,
|
||||||
|
required this.seconds,
|
||||||
|
required this.isRunning,
|
||||||
|
required this.onTimerEnd,
|
||||||
|
this.label = const Text(''),
|
||||||
|
this.isFilled = true,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<TimerButton> createState() => _TimerButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TimerButtonState extends State<TimerButton> {
|
||||||
|
void timer(int seconds) {
|
||||||
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
|
if (seconds > 0) {
|
||||||
|
setState(() {
|
||||||
|
seconds--;
|
||||||
|
});
|
||||||
|
timer(seconds);
|
||||||
|
} else {
|
||||||
|
widget.onTimerEnd!();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
//decrement seconds
|
||||||
|
if (widget.isRunning) {
|
||||||
|
timer(widget.seconds);
|
||||||
|
}
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext build) {
|
||||||
|
return TextButton(
|
||||||
|
style: ButtonStyle(
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
StadiumBorder(
|
||||||
|
side: widget.isFilled
|
||||||
|
? BorderSide.none
|
||||||
|
: BorderSide(
|
||||||
|
width: 1,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
backgroundColor: MaterialStateProperty.all(
|
||||||
|
widget.isFilled
|
||||||
|
? Theme.of(context).colorScheme.primary
|
||||||
|
: Colors.transparent,
|
||||||
|
),
|
||||||
|
foregroundColor: MaterialStateProperty.all(
|
||||||
|
widget.isFilled
|
||||||
|
? Theme.of(context).colorScheme.surface
|
||||||
|
: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onPressed: widget.isRunning ? null : widget.onTimerEnd,
|
||||||
|
child: Text(
|
||||||
|
widget.isRunning ? '${widget.seconds}' : 'Install',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
lib/utils/check_for_gms.dart
Normal file
10
lib/utils/check_for_gms.dart
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// Check for google mobile services on device
|
||||||
|
|
||||||
|
import 'package:device_apps/device_apps.dart';
|
||||||
|
|
||||||
|
Future<bool> checkForGMS() async {
|
||||||
|
bool isGMSInstalled = true;
|
||||||
|
isGMSInstalled = await DeviceApps.isAppInstalled('com.google.android.gms') ||
|
||||||
|
await DeviceApps.isAppInstalled('com.android.vending');
|
||||||
|
return isGMSInstalled;
|
||||||
|
}
|
||||||
19
pubspec.yaml
19
pubspec.yaml
@@ -4,12 +4,13 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.16+16
|
version: 0.0.34+34
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.5 <3.0.0"
|
sdk: ">=2.17.5 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
sentry_flutter: ^6.12.2
|
||||||
animations: ^2.0.4
|
animations: ^2.0.4
|
||||||
app_installer: ^1.1.0
|
app_installer: ^1.1.0
|
||||||
collection: ^1.16.0
|
collection: ^1.16.0
|
||||||
@@ -20,6 +21,7 @@ dependencies:
|
|||||||
ref: revanced-manager
|
ref: revanced-manager
|
||||||
device_info_plus: ^4.1.2
|
device_info_plus: ^4.1.2
|
||||||
dio: ^4.0.6
|
dio: ^4.0.6
|
||||||
|
dio_brotli_transformer: ^1.0.1
|
||||||
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
|
||||||
@@ -50,11 +52,15 @@ dependencies:
|
|||||||
git:
|
git:
|
||||||
url: https://github.com/SuaMusica/logcat
|
url: https://github.com/SuaMusica/logcat
|
||||||
ref: feature/nullSafe
|
ref: feature/nullSafe
|
||||||
|
native_dio_client: ^0.0.1-dev+1
|
||||||
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
|
permission_handler: ^10.0.0
|
||||||
pull_to_refresh: ^2.0.0
|
pull_to_refresh: ^2.0.0
|
||||||
root: ^2.0.2
|
root:
|
||||||
|
git:
|
||||||
|
url: https://github.com/gokul1630/root
|
||||||
|
ref: main
|
||||||
share_extend: ^2.0.0
|
share_extend: ^2.0.0
|
||||||
shared_preferences: ^2.0.15
|
shared_preferences: ^2.0.15
|
||||||
skeletons: ^0.0.3
|
skeletons: ^0.0.3
|
||||||
@@ -66,17 +72,22 @@ dependencies:
|
|||||||
timezone: ^0.8.0
|
timezone: ^0.8.0
|
||||||
url_launcher: ^6.1.5
|
url_launcher: ^6.1.5
|
||||||
wakelock: ^0.6.2
|
wakelock: ^0.6.2
|
||||||
|
sentry_dio: ^6.12.2
|
||||||
|
flutter_dotenv: ^5.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
json_serializable: ^6.3.1
|
||||||
build_runner: any
|
build_runner: any
|
||||||
flutter_launcher_icons: ^0.10.0
|
flutter_launcher_icons: ^0.10.0
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^2.0.1
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
injectable_generator: ^1.5.4
|
injectable_generator: ^1.5.4
|
||||||
json_serializable: ^6.3.1
|
|
||||||
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- assets/i18n/
|
- assets/i18n/
|
||||||
|
- .env
|
||||||
|
|||||||
Reference in New Issue
Block a user