Compare commits
216 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b999b0a0c | ||
|
|
b00d2d16d4 | ||
|
|
97d4da568b | ||
|
|
e563049f6a | ||
|
|
cc00d0dc08 | ||
|
|
2a220c3984 | ||
|
|
1d440d25be | ||
|
|
ba5234e850 | ||
|
|
293f7150f1 | ||
|
|
41b1cec8d3 | ||
|
|
c129c1eeae | ||
|
|
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 | ||
|
|
fd099fb632 | ||
|
|
e374e03355 | ||
|
|
d0293f5412 | ||
|
|
6f72c2ebec | ||
|
|
07407933d9 | ||
|
|
2f4726ea68 | ||
|
|
207e94de5a | ||
|
|
7231d44e02 | ||
|
|
bd5b38d88e | ||
|
|
530dd78752 | ||
|
|
efcf455b24 | ||
|
|
bed2cf76d5 | ||
|
|
5c8079ae95 | ||
|
|
2a2bb8212f | ||
|
|
3e6e94c098 | ||
|
|
ce100d97fd | ||
|
|
743a661c10 | ||
|
|
2b7287c04c | ||
|
|
9bdccb3c9d | ||
|
|
b8171253c7 | ||
|
|
d6dde3e23b | ||
|
|
fc5414c788 | ||
|
|
ed9038ffe8 | ||
|
|
269a71d336 | ||
|
|
9405334a7d | ||
|
|
2f14746124 | ||
|
|
6c2ceed91f | ||
|
|
c333fa3c33 | ||
|
|
79d0396630 | ||
|
|
110c3326bd | ||
|
|
9c5b0b9c14 | ||
|
|
c5ad337daa | ||
|
|
a9f64e449b | ||
|
|
48f0bc625d | ||
|
|
4c6b93320f | ||
|
|
2f3bb6cfe4 | ||
|
|
0e1fa1a5d6 | ||
|
|
38fb3444e4 | ||
|
|
f10b5aebac | ||
|
|
5a3884e159 | ||
|
|
41ac2b0df8 | ||
|
|
52e7d76c9d | ||
|
|
3aa80cacc0 | ||
|
|
dd52c379b4 | ||
|
|
5d073bddf2 | ||
|
|
7d09169c06 | ||
|
|
ce6f11f3f2 | ||
|
|
d0fb6ac3c0 | ||
|
|
ae801a2918 | ||
|
|
257fd46e27 | ||
|
|
bb96c3ed63 | ||
|
|
6bd218277d | ||
|
|
83ad7605c4 | ||
|
|
5fbc8ff7a0 | ||
|
|
bb4b59eee6 | ||
|
|
4cfb620d63 | ||
|
|
55739a9c78 | ||
|
|
482599bb4e | ||
|
|
3aaf49fee0 | ||
|
|
0424ee235c | ||
|
|
a178afce99 | ||
|
|
ef3685c817 | ||
|
|
e74fce8574 | ||
|
|
73e4ae1416 | ||
|
|
bcf3b36b13 | ||
|
|
9c3626c8ed | ||
|
|
a3dca8c142 | ||
|
|
ef0c59f693 | ||
|
|
31756884b6 | ||
|
|
0a2a495ab0 | ||
|
|
8300cc4071 | ||
|
|
9f58757caf | ||
|
|
5d296038b7 | ||
|
|
9f85450c6c | ||
|
|
cba4e175a3 | ||
|
|
cf3fa935ce | ||
|
|
6de7e2e098 | ||
|
|
30d9b5f6fe | ||
|
|
ec31667591 | ||
|
|
a82b0cd74d | ||
|
|
34e67d396f | ||
|
|
cdb492910c | ||
|
|
9f3a30d9f2 | ||
|
|
598f7571de | ||
|
|
85cd176347 | ||
|
|
2f78af7f08 | ||
|
|
a4b5fc4796 | ||
|
|
a0a0d0a939 | ||
|
|
eef9c2bf31 | ||
|
|
84813d34c6 | ||
|
|
aad7e06f2e | ||
|
|
f759af8a3f | ||
|
|
301618e467 | ||
|
|
2b5a0286ed |
67
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@@ -20,12 +20,6 @@ body:
|
|||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Branch
|
|
||||||
description: Which github branch did you use (Flutter or Compose)?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Bug description
|
label: Bug description
|
||||||
@@ -41,11 +35,56 @@ body:
|
|||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Relevant log output
|
label: Android version
|
||||||
|
description: Android version used.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Manager version
|
||||||
|
description: Manager version used.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Target package name
|
||||||
|
description: App you tried to patch.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Target package version.
|
||||||
|
description: Version of the app you tried to patch.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
attributes:
|
||||||
|
label: Installation type
|
||||||
|
options:
|
||||||
|
- Non-root
|
||||||
|
- Root
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Patches selected.
|
||||||
|
description: Patches you selected for the app.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Device logs (exported using Manager settings).
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||||
render: shell
|
render: shell
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Installer logs (exported using Installer menu option) [unneeded if issue is not during patching].
|
||||||
|
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Screenshots or videos
|
label: Screenshots or videos
|
||||||
@@ -65,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
|
||||||
|
|||||||
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
22
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
@@ -12,12 +12,6 @@ body:
|
|||||||
- Other
|
- Other
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
|
||||||
attributes:
|
|
||||||
label: Branch
|
|
||||||
description: Which github branch did you use (Flutter or Compose)?
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Issue
|
label: Issue
|
||||||
@@ -41,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
@@ -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>
|
||||||
27
README.md
@@ -5,11 +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.*
|
||||||
|
|
||||||
|
## 🔴 Issues
|
||||||
|
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
|
||||||
|
|
||||||
|
## 💭 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`
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "app.revanced.manager.flutter"
|
applicationId "app.revanced.manager.flutter"
|
||||||
minSdkVersion 21
|
minSdkVersion 26
|
||||||
targetSdkVersion 33
|
targetSdkVersion 33
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
@@ -57,6 +57,10 @@ android {
|
|||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
packagingOptions {
|
||||||
|
exclude '/prebuilt/**'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
flutter {
|
flutter {
|
||||||
@@ -67,9 +71,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.2.3"
|
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.1")
|
implementation("com.android.tools.build:apksig:7.2.2")
|
||||||
|
|
||||||
|
// MicroG cronet
|
||||||
|
implementation("org.microg:cronet-common:$cronetVersion")
|
||||||
|
implementation("org.microg:cronet-native:$cronetVersion")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,23 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="app.revanced.manager.flutter">
|
package="app.revanced.manager.flutter">
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
||||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
|
||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />
|
||||||
|
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
|
||||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||||
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="ReVanced Manager"
|
android:label="ReVanced Manager"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:largeHeap="true">
|
android:largeHeap="true"
|
||||||
|
android:extractNativeLibs="true">
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:exported="true"
|
android:exported="true"
|
||||||
|
|||||||
BIN
android/app/src/main/jniLibs/arm64-v8a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/x86_64/libaapt2.so
Normal file
@@ -1,333 +0,0 @@
|
|||||||
package app.revanced.manager.flutter
|
|
||||||
|
|
||||||
import android.os.Handler
|
|
||||||
import android.os.Looper
|
|
||||||
import androidx.annotation.NonNull
|
|
||||||
import app.revanced.manager.flutter.utils.Aapt
|
|
||||||
import app.revanced.manager.flutter.utils.aligning.ZipAligner
|
|
||||||
import app.revanced.manager.flutter.utils.signing.Signer
|
|
||||||
import app.revanced.manager.flutter.utils.zip.ZipFile
|
|
||||||
import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
|
|
||||||
import app.revanced.patcher.Patcher
|
|
||||||
import app.revanced.patcher.PatcherOptions
|
|
||||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
|
||||||
import app.revanced.patcher.util.patch.impl.DexPatchBundle
|
|
||||||
import dalvik.system.DexClassLoader
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
|
||||||
import io.flutter.embedding.engine.FlutterEngine
|
|
||||||
import io.flutter.plugin.common.MethodChannel
|
|
||||||
import io.flutter.plugin.common.MethodChannel.Result
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
class MainActivity : FlutterActivity() {
|
|
||||||
private val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher"
|
|
||||||
private val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
|
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
|
||||||
private lateinit var installerChannel: MethodChannel
|
|
||||||
|
|
||||||
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
|
||||||
super.configureFlutterEngine(flutterEngine)
|
|
||||||
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
|
|
||||||
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
|
||||||
mainChannel.setMethodCallHandler { call, result ->
|
|
||||||
when (call.method) {
|
|
||||||
"runPatcher" -> {
|
|
||||||
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
|
|
||||||
val originalFilePath = call.argument<String>("originalFilePath")
|
|
||||||
val inputFilePath = call.argument<String>("inputFilePath")
|
|
||||||
val patchedFilePath = call.argument<String>("patchedFilePath")
|
|
||||||
val outFilePath = call.argument<String>("outFilePath")
|
|
||||||
val integrationsPath = call.argument<String>("integrationsPath")
|
|
||||||
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
|
||||||
val cacheDirPath = call.argument<String>("cacheDirPath")
|
|
||||||
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
|
||||||
val resourcePatching = call.argument<Boolean>("resourcePatching")
|
|
||||||
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
|
||||||
if (patchBundleFilePath != null &&
|
|
||||||
originalFilePath != null &&
|
|
||||||
inputFilePath != null &&
|
|
||||||
patchedFilePath != null &&
|
|
||||||
outFilePath != null &&
|
|
||||||
integrationsPath != null &&
|
|
||||||
selectedPatches != null &&
|
|
||||||
cacheDirPath != null &&
|
|
||||||
mergeIntegrations != null &&
|
|
||||||
resourcePatching != null &&
|
|
||||||
keyStoreFilePath != null
|
|
||||||
) {
|
|
||||||
runPatcher(
|
|
||||||
result,
|
|
||||||
patchBundleFilePath,
|
|
||||||
originalFilePath,
|
|
||||||
inputFilePath,
|
|
||||||
patchedFilePath,
|
|
||||||
outFilePath,
|
|
||||||
integrationsPath,
|
|
||||||
selectedPatches,
|
|
||||||
cacheDirPath,
|
|
||||||
mergeIntegrations,
|
|
||||||
resourcePatching,
|
|
||||||
keyStoreFilePath
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
result.notImplemented()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else -> result.notImplemented()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun runPatcher(
|
|
||||||
result: MethodChannel.Result,
|
|
||||||
patchBundleFilePath: String,
|
|
||||||
originalFilePath: String,
|
|
||||||
inputFilePath: String,
|
|
||||||
patchedFilePath: String,
|
|
||||||
outFilePath: String,
|
|
||||||
integrationsPath: String,
|
|
||||||
selectedPatches: List<String>,
|
|
||||||
cacheDirPath: String,
|
|
||||||
mergeIntegrations: Boolean,
|
|
||||||
resourcePatching: Boolean,
|
|
||||||
keyStoreFilePath: String
|
|
||||||
) {
|
|
||||||
val originalFile = File(originalFilePath)
|
|
||||||
val inputFile = File(inputFilePath)
|
|
||||||
val patchedFile = File(patchedFilePath)
|
|
||||||
val outFile = File(outFilePath)
|
|
||||||
val integrations = File(integrationsPath)
|
|
||||||
val keyStoreFile = File(keyStoreFilePath)
|
|
||||||
|
|
||||||
val patches =
|
|
||||||
DexPatchBundle(
|
|
||||||
patchBundleFilePath,
|
|
||||||
DexClassLoader(
|
|
||||||
patchBundleFilePath,
|
|
||||||
cacheDirPath,
|
|
||||||
null,
|
|
||||||
javaClass.classLoader
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.loadPatches()
|
|
||||||
.filter { patch -> selectedPatches.any { it == patch.patchName } }
|
|
||||||
|
|
||||||
Thread(
|
|
||||||
Runnable {
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.1,
|
|
||||||
"header" to "",
|
|
||||||
"log" to "Copying original apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
originalFile.copyTo(inputFile, true)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.2,
|
|
||||||
"header" to "Unpacking apk...",
|
|
||||||
"log" to "Unpacking input apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val patcher =
|
|
||||||
Patcher(
|
|
||||||
PatcherOptions(
|
|
||||||
inputFile,
|
|
||||||
cacheDirPath,
|
|
||||||
resourcePatching,
|
|
||||||
Aapt.binary(applicationContext).absolutePath,
|
|
||||||
cacheDirPath,
|
|
||||||
logger =
|
|
||||||
object :
|
|
||||||
app.revanced.patcher.logging.Logger {
|
|
||||||
override fun error(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun warn(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun info(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun trace(msg: String) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel
|
|
||||||
.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to
|
|
||||||
-1.0,
|
|
||||||
"header" to
|
|
||||||
"",
|
|
||||||
"log" to
|
|
||||||
msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf("progress" to 0.3, "header" to "", "log" to "")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
if (mergeIntegrations) {
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.4,
|
|
||||||
"header" to "Merging integrations...",
|
|
||||||
"log" to "Merging integrations"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
patcher.addFiles(listOf(integrations)) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.5,
|
|
||||||
"header" to "Applying patches...",
|
|
||||||
"log" to ""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
patcher.addPatches(patches)
|
|
||||||
patcher.applyPatches().forEach { (patch, res) ->
|
|
||||||
if (res.isSuccess) {
|
|
||||||
val msg = "[success] $patch"
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.5,
|
|
||||||
"header" to "",
|
|
||||||
"log" to msg
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf("progress" to 0.5, "header" to "", "log" to msg)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.7,
|
|
||||||
"header" to "Repacking apk...",
|
|
||||||
"log" to "Repacking patched apk"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
val res = patcher.save()
|
|
||||||
ZipFile(patchedFile).use { file ->
|
|
||||||
res.dexFiles.forEach {
|
|
||||||
file.addEntryCompressData(
|
|
||||||
ZipEntry.createWithName(it.name),
|
|
||||||
it.stream.readBytes()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
res.resourceFile?.let {
|
|
||||||
file.copyEntriesFromFileAligned(
|
|
||||||
ZipFile(it),
|
|
||||||
ZipAligner::getEntryAlignment
|
|
||||||
)
|
|
||||||
}
|
|
||||||
file.copyEntriesFromFileAligned(
|
|
||||||
ZipFile(inputFile),
|
|
||||||
ZipAligner::getEntryAlignment
|
|
||||||
)
|
|
||||||
}
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 0.9,
|
|
||||||
"header" to "Signing apk...",
|
|
||||||
"log" to ""
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
|
||||||
|
|
||||||
handler.post {
|
|
||||||
installerChannel.invokeMethod(
|
|
||||||
"update",
|
|
||||||
mapOf(
|
|
||||||
"progress" to 1.0,
|
|
||||||
"header" to "Finished!",
|
|
||||||
"log" to "Finished!"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
handler.post { result.success(null) }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
.start()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,320 @@
|
|||||||
|
package app.revanced.manager.flutter
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import android.os.Handler
|
||||||
|
import android.os.Looper
|
||||||
|
import androidx.annotation.NonNull
|
||||||
|
import app.revanced.manager.flutter.utils.Aapt
|
||||||
|
import app.revanced.manager.flutter.utils.aligning.ZipAligner
|
||||||
|
import app.revanced.manager.flutter.utils.signing.Signer
|
||||||
|
import app.revanced.manager.flutter.utils.zip.ZipFile
|
||||||
|
import app.revanced.manager.flutter.utils.zip.structures.ZipEntry
|
||||||
|
import app.revanced.patcher.Patcher
|
||||||
|
import app.revanced.patcher.PatcherOptions
|
||||||
|
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
|
import app.revanced.patcher.logging.Logger
|
||||||
|
import app.revanced.patcher.util.patch.PatchBundle
|
||||||
|
import dalvik.system.DexClassLoader
|
||||||
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
import io.flutter.embedding.engine.FlutterEngine
|
||||||
|
import io.flutter.plugin.common.MethodChannel
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
private const val PATCHER_CHANNEL = "app.revanced.manager.flutter/patcher"
|
||||||
|
private const val INSTALLER_CHANNEL = "app.revanced.manager.flutter/installer"
|
||||||
|
|
||||||
|
class MainActivity : FlutterActivity() {
|
||||||
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
|
private lateinit var installerChannel: MethodChannel
|
||||||
|
|
||||||
|
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
|
||||||
|
super.configureFlutterEngine(flutterEngine)
|
||||||
|
val mainChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, PATCHER_CHANNEL)
|
||||||
|
installerChannel = MethodChannel(flutterEngine.dartExecutor.binaryMessenger, INSTALLER_CHANNEL)
|
||||||
|
mainChannel.setMethodCallHandler { call, result ->
|
||||||
|
when (call.method) {
|
||||||
|
"runPatcher" -> {
|
||||||
|
val patchBundleFilePath = call.argument<String>("patchBundleFilePath")
|
||||||
|
val originalFilePath = call.argument<String>("originalFilePath")
|
||||||
|
val inputFilePath = call.argument<String>("inputFilePath")
|
||||||
|
val patchedFilePath = call.argument<String>("patchedFilePath")
|
||||||
|
val outFilePath = call.argument<String>("outFilePath")
|
||||||
|
val integrationsPath = call.argument<String>("integrationsPath")
|
||||||
|
val selectedPatches = call.argument<List<String>>("selectedPatches")
|
||||||
|
val cacheDirPath = call.argument<String>("cacheDirPath")
|
||||||
|
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
|
||||||
|
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
|
||||||
|
if (patchBundleFilePath != null &&
|
||||||
|
originalFilePath != null &&
|
||||||
|
inputFilePath != null &&
|
||||||
|
patchedFilePath != null &&
|
||||||
|
outFilePath != null &&
|
||||||
|
integrationsPath != null &&
|
||||||
|
selectedPatches != null &&
|
||||||
|
cacheDirPath != null &&
|
||||||
|
mergeIntegrations != null &&
|
||||||
|
keyStoreFilePath != null
|
||||||
|
) {
|
||||||
|
runPatcher(
|
||||||
|
result,
|
||||||
|
patchBundleFilePath,
|
||||||
|
originalFilePath,
|
||||||
|
inputFilePath,
|
||||||
|
patchedFilePath,
|
||||||
|
outFilePath,
|
||||||
|
integrationsPath,
|
||||||
|
selectedPatches,
|
||||||
|
cacheDirPath,
|
||||||
|
mergeIntegrations,
|
||||||
|
keyStoreFilePath
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else -> result.notImplemented()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun runPatcher(
|
||||||
|
result: MethodChannel.Result,
|
||||||
|
patchBundleFilePath: String,
|
||||||
|
originalFilePath: String,
|
||||||
|
inputFilePath: String,
|
||||||
|
patchedFilePath: String,
|
||||||
|
outFilePath: String,
|
||||||
|
integrationsPath: String,
|
||||||
|
selectedPatches: List<String>,
|
||||||
|
cacheDirPath: String,
|
||||||
|
mergeIntegrations: Boolean,
|
||||||
|
keyStoreFilePath: String
|
||||||
|
) {
|
||||||
|
val originalFile = File(originalFilePath)
|
||||||
|
val inputFile = File(inputFilePath)
|
||||||
|
val patchedFile = File(patchedFilePath)
|
||||||
|
val outFile = File(outFilePath)
|
||||||
|
val integrations = File(integrationsPath)
|
||||||
|
val keyStoreFile = File(keyStoreFilePath)
|
||||||
|
|
||||||
|
Thread {
|
||||||
|
try {
|
||||||
|
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||||
|
PatchBundle.Dex(
|
||||||
|
patchBundleFilePath,
|
||||||
|
DexClassLoader(
|
||||||
|
patchBundleFilePath,
|
||||||
|
cacheDirPath,
|
||||||
|
null,
|
||||||
|
javaClass.classLoader
|
||||||
|
)
|
||||||
|
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
||||||
|
} else {
|
||||||
|
TODO("VERSION.SDK_INT < CUPCAKE")
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.1,
|
||||||
|
"header" to "",
|
||||||
|
"log" to "Copying original apk"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
originalFile.copyTo(inputFile, true)
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.2,
|
||||||
|
"header" to "Unpacking apk...",
|
||||||
|
"log" to "Unpacking input apk"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val patcher =
|
||||||
|
Patcher(
|
||||||
|
PatcherOptions(
|
||||||
|
inputFile,
|
||||||
|
cacheDirPath,
|
||||||
|
Aapt.binary(applicationContext).absolutePath,
|
||||||
|
cacheDirPath,
|
||||||
|
logger = ManagerLogger()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to 0.3, "header" to "", "log" to "")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (mergeIntegrations) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.4,
|
||||||
|
"header" to "Merging integrations...",
|
||||||
|
"log" to "Merging integrations"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
patcher.addFiles(listOf(integrations)) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.5,
|
||||||
|
"header" to "Applying patches...",
|
||||||
|
"log" to ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
patcher.addPatches(patches)
|
||||||
|
patcher.executePatches().forEach { (patch, res) ->
|
||||||
|
if (res.isSuccess) {
|
||||||
|
val msg = "Applied $patch"
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.5,
|
||||||
|
"header" to "",
|
||||||
|
"log" to msg
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
val msg = "$patch failed.\nError:\n" + 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"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
val res = patcher.save()
|
||||||
|
ZipFile(patchedFile).use { file ->
|
||||||
|
res.dexFiles.forEach {
|
||||||
|
file.addEntryCompressData(
|
||||||
|
ZipEntry.createWithName(it.name),
|
||||||
|
it.stream.readBytes()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
res.resourceFile?.let {
|
||||||
|
file.copyEntriesFromFileAligned(
|
||||||
|
ZipFile(it),
|
||||||
|
ZipAligner::getEntryAlignment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
file.copyEntriesFromFileAligned(
|
||||||
|
ZipFile(inputFile),
|
||||||
|
ZipAligner::getEntryAlignment
|
||||||
|
)
|
||||||
|
}
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf(
|
||||||
|
"progress" to 0.9,
|
||||||
|
"header" to "Signing apk...",
|
||||||
|
"log" to ""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
|
|
||||||
|
try {
|
||||||
|
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
//log to console
|
||||||
|
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) }
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class ManagerLogger : Logger {
|
||||||
|
override fun error(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel
|
||||||
|
.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun warn(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun info(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun trace(msg: String) {
|
||||||
|
handler.post {
|
||||||
|
installerChannel.invokeMethod(
|
||||||
|
"update",
|
||||||
|
mapOf("progress" to -1.0, "header" to "", "log" to msg)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,4 +9,4 @@ object Aapt {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun File.resolveAapt() = resolve(list { _, f -> !File(f).isDirectory && file.contains("aapt") }!!.first())
|
private fun File.resolveAapt() = resolve(list { _, f -> !File(f).isDirectory && f.contains("aapt") }!!.first())
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
package app.revanced.manager.flutter.utils.zip
|
package app.revanced.manager.flutter.utils.zip
|
||||||
|
|
||||||
import java.io.DataInput
|
import java.io.DataInput
|
||||||
@@ -17,8 +19,8 @@ fun UShort.toBigEndian() = (this.toUInt() shl 16).toBigEndian().toUShort()
|
|||||||
fun ByteBuffer.getUShort() = this.short.toUShort()
|
fun ByteBuffer.getUShort() = this.short.toUShort()
|
||||||
fun ByteBuffer.getUInt() = this.int.toUInt()
|
fun ByteBuffer.getUInt() = this.int.toUInt()
|
||||||
|
|
||||||
fun ByteBuffer.putUShort(ushort: UShort) = this.putShort(ushort.toShort())
|
fun ByteBuffer.putUShort(ushort: UShort): ByteBuffer = this.putShort(ushort.toShort())
|
||||||
fun ByteBuffer.putUInt(uint: UInt) = this.putInt(uint.toInt())
|
fun ByteBuffer.putUInt(uint: UInt): ByteBuffer = this.putInt(uint.toInt())
|
||||||
|
|
||||||
fun DataInput.readUShort() = this.readShort().toUShort()
|
fun DataInput.readUShort() = this.readShort().toUShort()
|
||||||
fun DataInput.readUInt() = this.readInt().toUInt()
|
fun DataInput.readUInt() = this.readInt().toUInt()
|
||||||
@@ -10,7 +10,7 @@ import java.nio.channels.FileChannel
|
|||||||
import java.util.zip.CRC32
|
import java.util.zip.CRC32
|
||||||
import java.util.zip.Deflater
|
import java.util.zip.Deflater
|
||||||
|
|
||||||
class ZipFile(val file: File) : Closeable {
|
class ZipFile(file: File) : Closeable {
|
||||||
var entries: MutableList<ZipEntry> = mutableListOf()
|
var entries: MutableList<ZipEntry> = mutableListOf()
|
||||||
|
|
||||||
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
|
private val filePointer: RandomAccessFile = RandomAccessFile(file, "rw")
|
||||||
@@ -134,8 +134,8 @@ class ZipFile(val file: File) : Closeable {
|
|||||||
addEntry(entry, compressedBuffer)
|
addEntry(entry, compressedBuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
|
private fun addEntryCopyData(entry: ZipEntry, data: ByteBuffer, alignment: Int? = null) {
|
||||||
alignment?.let { alignment ->
|
alignment?.let {
|
||||||
//calculate where data would end up
|
//calculate where data would end up
|
||||||
val dataOffset = filePointer.filePointer + entry.LFHSize
|
val dataOffset = filePointer.filePointer + entry.LFHSize
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ data class ZipEntry(
|
|||||||
val fileNameLength = input.readUShortLE()
|
val fileNameLength = input.readUShortLE()
|
||||||
var fileName = ""
|
var fileName = ""
|
||||||
val extraFieldLength = input.readUShortLE()
|
val extraFieldLength = input.readUShortLE()
|
||||||
var extraField = ByteArray(extraFieldLength.toInt())
|
val extraField = ByteArray(extraFieldLength.toInt())
|
||||||
val fileCommentLength = input.readUShortLE()
|
val fileCommentLength = input.readUShortLE()
|
||||||
var fileComment = ""
|
var fileComment = ""
|
||||||
val diskNumber = input.readUShortLE()
|
val diskNumber = input.readUShortLE()
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 814 B |
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 5.4 KiB |
BIN
android/app/src/main/res/drawable/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 4.4 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 11 KiB |
19
android/app/src/main/res/values-night-v31/styles.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
the Flutter engine draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
20
android/app/src/main/res/values-v31/styles.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||||
|
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<!-- Show a splash screen on the activity. Automatically removed when
|
||||||
|
the Flutter engine draws its first frame -->
|
||||||
|
<item name="android:windowBackground">@drawable/launch_background</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/ic_launcher_round</item>
|
||||||
|
</style>
|
||||||
|
<!-- Theme applied to the Android Window as soon as the process has started.
|
||||||
|
This theme determines the color of the Android Window while your
|
||||||
|
Flutter UI initializes, as well as behind your Flutter UI while its
|
||||||
|
running.
|
||||||
|
|
||||||
|
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||||
|
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||||
|
<item name="android:windowBackground">?android:colorBackground</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
|
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.6.10'
|
ext.cronetVersion = '102.5005.125'
|
||||||
|
ext.kotlin_version = '1.7.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.1.2'
|
classpath 'com.android.tools.build:gradle:7.1.3'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#Fri Jun 23 08:50:38 CEST 2017
|
#Mon May 09 12:07:41 MSK 2022
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-rc-1-bin.zip
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|||||||
@@ -1,142 +0,0 @@
|
|||||||
{
|
|
||||||
"okButton": "OK",
|
|
||||||
"cancelButton": "Cancel",
|
|
||||||
"enabledLabel": "Enabled",
|
|
||||||
"disabledLabel": "Disabled",
|
|
||||||
"yesLabel": "Yes",
|
|
||||||
"noLabel": "No",
|
|
||||||
"navigationView": {
|
|
||||||
"dashboardTab": "Dashboard",
|
|
||||||
"patcherTab": "Patcher",
|
|
||||||
"settingsTab": "Settings"
|
|
||||||
},
|
|
||||||
"homeView": {
|
|
||||||
"widgetTitle": "Dashboard",
|
|
||||||
"updatesSubtitle": "Updates",
|
|
||||||
"patchedSubtitle": "Patched Applications",
|
|
||||||
"updatesAvailable": "Updates Available",
|
|
||||||
"noUpdates": "No updates available",
|
|
||||||
"noInstallations": "No patched applications installed",
|
|
||||||
"installed": "Installed",
|
|
||||||
"updateDialogTitle": "Update",
|
|
||||||
"updateDialogText": "Are you sure you want to download and update Manager?",
|
|
||||||
"notificationTitle": "ReVanced Manager was updated!",
|
|
||||||
"notificationText": "Tap to open the app",
|
|
||||||
"downloadingMessage": "Downloading update!",
|
|
||||||
"installingMessage": "Installing update... Hang on!",
|
|
||||||
"errorDownloadMessage": "Unable to download update!",
|
|
||||||
"errorInstallMessage": "Unable to download update!",
|
|
||||||
"noConnection": "No internet connection"
|
|
||||||
},
|
|
||||||
"applicationItem": {
|
|
||||||
"patchButton": "Patch",
|
|
||||||
"infoButton": "Info",
|
|
||||||
"changelogLabel": "Changelog"
|
|
||||||
},
|
|
||||||
"latestCommitCard": {
|
|
||||||
"loadingLabel": "Loading",
|
|
||||||
"timeagoLabel": "{time} ago",
|
|
||||||
"patcherLabel": "Patcher: ",
|
|
||||||
"managerLabel": "Manager: ",
|
|
||||||
"updateButton": "Update Manager"
|
|
||||||
},
|
|
||||||
"patcherView": {
|
|
||||||
"widgetTitle": "Patcher",
|
|
||||||
"patchButton": "Patch"
|
|
||||||
},
|
|
||||||
"appSelectorCard": {
|
|
||||||
"widgetTitle": "Select application",
|
|
||||||
"widgetTitleSelected": "Selected application",
|
|
||||||
"widgetSubtitle": "No application selected.",
|
|
||||||
"noAppsLabel": "No applications found."
|
|
||||||
},
|
|
||||||
"patchSelectorCard": {
|
|
||||||
"widgetTitle": "Select patches",
|
|
||||||
"widgetTitleSelected": "Selected patches",
|
|
||||||
"widgetSubtitle": "Select an application first.",
|
|
||||||
"widgetEmptySubtitle": "No patches selected."
|
|
||||||
},
|
|
||||||
"socialMediaCard": {
|
|
||||||
"widgetTitle": "Social Media",
|
|
||||||
"widgetSubtitle": "We are online!"
|
|
||||||
},
|
|
||||||
"appSelectorView": {
|
|
||||||
"searchBarHint": "Search applications",
|
|
||||||
"storageButton": "Storage",
|
|
||||||
"errorMessage": "Unable to use selected application."
|
|
||||||
},
|
|
||||||
"patchesSelectorView": {
|
|
||||||
"searchBarHint": "Search patches",
|
|
||||||
"doneButton": "Done"
|
|
||||||
},
|
|
||||||
"patchItem": {
|
|
||||||
"unsupportedWarningButton": "Unsupported version",
|
|
||||||
"unsupportedDialogTitle": "Warning",
|
|
||||||
"unsupportedDialogText": "Selecting this patch may or may not result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
|
||||||
},
|
|
||||||
"installerView": {
|
|
||||||
"widgetTitle": "Installer",
|
|
||||||
"installButton": "Install",
|
|
||||||
"installRootButton": "Install as Root",
|
|
||||||
"openButton": "Open",
|
|
||||||
"shareButton": "Share file",
|
|
||||||
"notificationTitle": "ReVanced Manager is patching",
|
|
||||||
"notificationText": "Tap to return to the installer",
|
|
||||||
"shareApkMenuOption": "Share APK",
|
|
||||||
"shareLogMenuOption": "Share log"
|
|
||||||
},
|
|
||||||
"settingsView": {
|
|
||||||
"widgetTitle": "Settings",
|
|
||||||
"appearanceSectionTitle": "Appearance",
|
|
||||||
"patcherSectionTitle": "Patcher",
|
|
||||||
"teamSectionTitle": "Team",
|
|
||||||
"infoSectionTitle": "Info",
|
|
||||||
"darkThemeLabel": "Dark Mode",
|
|
||||||
"darkThemeHint": "Welcome to the Dark Side",
|
|
||||||
"dynamicThemeLabel": "Material You",
|
|
||||||
"dynamicThemeHint": "Enjoy an experience closer to your device",
|
|
||||||
"languageLabel": "Language",
|
|
||||||
"englishOption": "English",
|
|
||||||
"frenchOption": "French",
|
|
||||||
"sourcesLabel": "Sources",
|
|
||||||
"sourcesLabelHint": "Configure your custom sources",
|
|
||||||
"orgPatchesLabel" : "Patches Org",
|
|
||||||
"sourcesPatchesLabel" : "Patches Source",
|
|
||||||
"orgIntegrationsLabel": "Integrations Org",
|
|
||||||
"sourcesIntegrationsLabel": "Integrations Source",
|
|
||||||
"sourcesResetDialogTitle": "Reset",
|
|
||||||
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
|
||||||
"contributorsLabel": "Contributors",
|
|
||||||
"contributorsHint": "A list of contributors of ReVanced",
|
|
||||||
"logsLabel": "Logs",
|
|
||||||
"logsHint": "Share device debug logs",
|
|
||||||
"aboutLabel": "About",
|
|
||||||
"snackbarMessage": "Copied to clipboard"
|
|
||||||
},
|
|
||||||
"appInfoView": {
|
|
||||||
"widgetTitle": "App Info",
|
|
||||||
"openButton": "Open",
|
|
||||||
"uninstallButton": "Uninstall",
|
|
||||||
"patchButton": "Patch",
|
|
||||||
"uninstallDialogTitle": "Uninstall",
|
|
||||||
"uninstallDialogText": "Are you sure you want to uninstall this app?",
|
|
||||||
"rootDialogTitle": "Error",
|
|
||||||
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
|
||||||
"packageNameLabel": "Package Name",
|
|
||||||
"installTypeLabel": "Installation Type",
|
|
||||||
"rootTypeLabel": "Root",
|
|
||||||
"nonRootTypeLabel": "Non-root",
|
|
||||||
"patchedDateLabel": "Patched Date",
|
|
||||||
"patchedDateHint": "{date} at {time}",
|
|
||||||
"appliedPatchesLabel": "Applied Patches",
|
|
||||||
"appliedPatchesHint": "{quantity} applied patches"
|
|
||||||
},
|
|
||||||
"contributorsView": {
|
|
||||||
"widgetTitle": "Contributors",
|
|
||||||
"patcherContributors": "Patcher Contributors",
|
|
||||||
"patchesContributors": "Patches Contributors",
|
|
||||||
"integrationsContributors": "Integrations Contributors",
|
|
||||||
"cliContributors": "CLI Contributors",
|
|
||||||
"managerContributors": "Manager Contributors"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
182
assets/i18n/en_US.json
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
{
|
||||||
|
"okButton": "OK",
|
||||||
|
"cancelButton": "Cancel",
|
||||||
|
"enabledLabel": "Enabled",
|
||||||
|
"disabledLabel": "Disabled",
|
||||||
|
"yesButton": "Yes",
|
||||||
|
"noButton": "No",
|
||||||
|
"navigationView": {
|
||||||
|
"dashboardTab": "Dashboard",
|
||||||
|
"patcherTab": "Patcher",
|
||||||
|
"settingsTab": "Settings"
|
||||||
|
},
|
||||||
|
"homeView": {
|
||||||
|
"widgetTitle": "Dashboard",
|
||||||
|
"updatesSubtitle": "Updates",
|
||||||
|
"patchedSubtitle": "Patched Applications",
|
||||||
|
"updatesAvailable": "Updates available",
|
||||||
|
"noUpdates": "No updates available",
|
||||||
|
"WIP": "Work In Progress",
|
||||||
|
"noInstallations": "No patched applications installed",
|
||||||
|
"installed": "Installed",
|
||||||
|
"updateDialogTitle": "Update Manager",
|
||||||
|
"updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
|
||||||
|
"notificationTitle": "ReVanced Manager was updated",
|
||||||
|
"notificationText": "Tap to open the app",
|
||||||
|
"downloadingMessage": "Downloading update...",
|
||||||
|
"installingMessage": "Installing update...",
|
||||||
|
"errorDownloadMessage": "Unable to download update",
|
||||||
|
"errorInstallMessage": "Unable to install update",
|
||||||
|
"noConnection": "No internet connection",
|
||||||
|
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||||
|
},
|
||||||
|
"applicationItem": {
|
||||||
|
"patchButton": "Patch",
|
||||||
|
"infoButton": "Info",
|
||||||
|
"changelogLabel": "Changelog"
|
||||||
|
},
|
||||||
|
"latestCommitCard": {
|
||||||
|
"loadingLabel": "Loading...",
|
||||||
|
"timeagoLabel": "{time} ago",
|
||||||
|
"patcherLabel": "Patcher: ",
|
||||||
|
"managerLabel": "Manager: ",
|
||||||
|
"updateButton": "Update Manager"
|
||||||
|
},
|
||||||
|
"patcherView": {
|
||||||
|
"widgetTitle": "Patcher",
|
||||||
|
"patchButton": "Patch",
|
||||||
|
"patchDialogTitle": "Warning",
|
||||||
|
"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": {
|
||||||
|
"widgetTitle": "Select application",
|
||||||
|
"widgetTitleSelected": "Selected application",
|
||||||
|
"widgetSubtitle": "No application selected",
|
||||||
|
"noAppsLabel": "No applications found.",
|
||||||
|
"currentVersion": "Current",
|
||||||
|
"recommendedVersion": "Recommended",
|
||||||
|
"anyVersion": "any"
|
||||||
|
},
|
||||||
|
"patchSelectorCard": {
|
||||||
|
"widgetTitle": "Select patches",
|
||||||
|
"widgetTitleSelected": "Selected patches",
|
||||||
|
"widgetSubtitle": "Select an application first",
|
||||||
|
"widgetEmptySubtitle": "No patches selected"
|
||||||
|
},
|
||||||
|
"socialMediaCard": {
|
||||||
|
"widgetTitle": "Socials",
|
||||||
|
"widgetSubtitle": "We are online!"
|
||||||
|
},
|
||||||
|
"appSelectorView": {
|
||||||
|
"viewTitle": "Select application",
|
||||||
|
"searchBarHint": "Search applications",
|
||||||
|
"storageButton": "Storage",
|
||||||
|
"errorMessage": "Unable to use selected application."
|
||||||
|
},
|
||||||
|
"patchesSelectorView": {
|
||||||
|
"viewTitle": "Select patches",
|
||||||
|
"searchBarHint": "Search patches",
|
||||||
|
"doneButton": "Done",
|
||||||
|
"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": {
|
||||||
|
"unsupportedWarningButton": "Warning",
|
||||||
|
"unsupportedDialogTitle": "Warning",
|
||||||
|
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}",
|
||||||
|
"unsupportedPatchVersion": "Patch is not supported for this app version. Enable experimental toggle in settings to proceed."
|
||||||
|
},
|
||||||
|
"installerView": {
|
||||||
|
"widgetTitle": "Installer",
|
||||||
|
"installButton": "Install",
|
||||||
|
"installRootButton": "Install as Root",
|
||||||
|
"openButton": "Open",
|
||||||
|
"shareButton": "Share file",
|
||||||
|
"notificationTitle": "ReVanced Manager is patching",
|
||||||
|
"notificationText": "Tap to return to the installer",
|
||||||
|
"shareApkMenuOption": "Share APK",
|
||||||
|
"shareLogMenuOption": "Share log",
|
||||||
|
"installErrorDialogTitle": "Error",
|
||||||
|
"installErrorDialogText1": "Root install is not possible with the current patches selection.\nRepatch your app or choose non-root install.",
|
||||||
|
"installErrorDialogText2": "Non-root install is not possible with the current patches selection.\nRepatch your app or choose root install if you have your device rooted.",
|
||||||
|
"installErrorDialogText3": "Root install is not possible as the original APK was selected from storage.\nSelect an installed app or choose non-root install.",
|
||||||
|
"noExit": "Installer is still running..."
|
||||||
|
},
|
||||||
|
"settingsView": {
|
||||||
|
"widgetTitle": "Settings",
|
||||||
|
"appearanceSectionTitle": "Appearance",
|
||||||
|
"teamSectionTitle": "Team",
|
||||||
|
"infoSectionTitle": "Info",
|
||||||
|
"advancedSectionTitle": "Advanced",
|
||||||
|
"logsSectionTitle": "Logs",
|
||||||
|
"darkThemeLabel": "Dark Mode",
|
||||||
|
"darkThemeHint": "Welcome to the Dark Side",
|
||||||
|
"dynamicThemeLabel": "Material You",
|
||||||
|
"dynamicThemeHint": "Enjoy an experience closer to your device",
|
||||||
|
"languageLabel": "Language",
|
||||||
|
"englishOption": "English",
|
||||||
|
"frenchOption": "French",
|
||||||
|
"sourcesLabel": "Sources",
|
||||||
|
"sourcesLabelHint": "Configure your custom sources",
|
||||||
|
"orgPatchesLabel": "Patches Organization",
|
||||||
|
"sourcesPatchesLabel": "Patches Source",
|
||||||
|
"orgIntegrationsLabel": "Integrations Organization",
|
||||||
|
"sourcesIntegrationsLabel": "Integrations Source",
|
||||||
|
"sourcesResetDialogTitle": "Reset",
|
||||||
|
"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 its default value?",
|
||||||
|
"contributorsLabel": "Contributors",
|
||||||
|
"contributorsHint": "A list of contributors of ReVanced",
|
||||||
|
"logsLabel": "Logs",
|
||||||
|
"logsHint": "Share device debug logs",
|
||||||
|
"apiURLLabel": "API URL",
|
||||||
|
"apiURLHint": "Configure your custom API URL",
|
||||||
|
"selectApiURL": "Select URL",
|
||||||
|
"experimentalPatchesLabel": "Experimental Patch support",
|
||||||
|
"experimentalPatchesHint": "Enable to use unsupported patches in any app version",
|
||||||
|
"enabledExperimentalPatches": "Experimental patches enabled",
|
||||||
|
"aboutLabel": "About",
|
||||||
|
"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": {
|
||||||
|
"widgetTitle": "App Info",
|
||||||
|
"openButton": "Open",
|
||||||
|
"uninstallButton": "Uninstall",
|
||||||
|
"patchButton": "Patch",
|
||||||
|
"unpatchButton": "Unpatch",
|
||||||
|
"unpatchDialogText": "Are you sure you want to unpatch this app?",
|
||||||
|
"rootDialogTitle": "Error",
|
||||||
|
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
||||||
|
"packageNameLabel": "Package Name",
|
||||||
|
"originalPackageNameLabel": "Original Package Name",
|
||||||
|
"installTypeLabel": "Installation Type",
|
||||||
|
"rootTypeLabel": "Root",
|
||||||
|
"nonRootTypeLabel": "Non-root",
|
||||||
|
"patchedDateLabel": "Patched Date",
|
||||||
|
"patchedDateHint": "{date} at {time}",
|
||||||
|
"appliedPatchesLabel": "Applied Patches",
|
||||||
|
"appliedPatchesHint": "{quantity} applied patches",
|
||||||
|
"updateNotImplemented": "Update functionality not implemented yet"
|
||||||
|
},
|
||||||
|
"contributorsView": {
|
||||||
|
"widgetTitle": "Contributors",
|
||||||
|
"patcherContributors": "Patcher Contributors",
|
||||||
|
"patchesContributors": "Patches Contributors",
|
||||||
|
"integrationsContributors": "Integrations Contributors",
|
||||||
|
"cliContributors": "CLI Contributors",
|
||||||
|
"managerContributors": "Manager Contributors"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 14 KiB |
3
crowdin.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
files:
|
||||||
|
- source: /assets/i18n/en.json
|
||||||
|
translation: /assets/i18n/%locale_with_underscore%.json
|
||||||
@@ -2,6 +2,7 @@ import 'package:revanced_manager/services/github_api.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/revanced_api.dart';
|
import 'package:revanced_manager/services/revanced_api.dart';
|
||||||
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
|
import 'package:revanced_manager/ui/views/app_selector/app_selector_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
|
import 'package:revanced_manager/ui/views/contributors/contributors_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
|
||||||
@@ -36,6 +37,7 @@ import 'package:stacked_services/stacked_services.dart';
|
|||||||
LazySingleton(classType: PatcherAPI),
|
LazySingleton(classType: PatcherAPI),
|
||||||
LazySingleton(classType: RevancedAPI),
|
LazySingleton(classType: RevancedAPI),
|
||||||
LazySingleton(classType: GithubAPI),
|
LazySingleton(classType: GithubAPI),
|
||||||
|
LazySingleton(classType: Toast),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
class AppSetup {}
|
class AppSetup {}
|
||||||
|
|||||||
@@ -9,15 +9,44 @@ 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;
|
||||||
|
|
||||||
Future main() async {
|
Future main() async {
|
||||||
await ThemeManager.initialise();
|
await ThemeManager.initialise();
|
||||||
await setupLocator();
|
await setupLocator();
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await locator<ManagerAPI>().initialize();
|
await locator<ManagerAPI>().initialize();
|
||||||
await locator<PatcherAPI>().initialize();
|
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||||
locator<RevancedAPI>().initialize();
|
await locator<RevancedAPI>().initialize(apiUrl);
|
||||||
|
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||||
locator<GithubAPI>().initialize();
|
locator<GithubAPI>().initialize();
|
||||||
|
await locator<PatcherAPI>().initialize();
|
||||||
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,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',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ part 'patched_application.g.dart';
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
class PatchedApplication {
|
class PatchedApplication {
|
||||||
String name;
|
String name;
|
||||||
final String packageName;
|
String packageName;
|
||||||
|
String originalPackageName;
|
||||||
String version;
|
String version;
|
||||||
final String apkFilePath;
|
final String apkFilePath;
|
||||||
@JsonKey(
|
@JsonKey(
|
||||||
@@ -17,6 +18,7 @@ class PatchedApplication {
|
|||||||
Uint8List icon;
|
Uint8List icon;
|
||||||
DateTime patchDate;
|
DateTime patchDate;
|
||||||
bool isRooted;
|
bool isRooted;
|
||||||
|
bool isFromStorage;
|
||||||
bool hasUpdates;
|
bool hasUpdates;
|
||||||
List<String> appliedPatches;
|
List<String> appliedPatches;
|
||||||
List<String> changelog;
|
List<String> changelog;
|
||||||
@@ -24,11 +26,13 @@ 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,
|
||||||
required this.patchDate,
|
required this.patchDate,
|
||||||
this.isRooted = false,
|
this.isRooted = false,
|
||||||
|
this.isFromStorage = false,
|
||||||
this.hasUpdates = false,
|
this.hasUpdates = false,
|
||||||
this.appliedPatches = const [],
|
this.appliedPatches = const [],
|
||||||
this.changelog = const [],
|
this.changelog = const [],
|
||||||
|
|||||||
@@ -6,15 +6,16 @@ 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:sentry_flutter/sentry_flutter.dart';
|
||||||
|
import 'package:sentry_dio/sentry_dio.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class GithubAPI {
|
class GithubAPI {
|
||||||
final String apiUrl = 'https://api.github.com';
|
late Dio _dio = Dio();
|
||||||
final Dio _dio = Dio();
|
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(hours: 1),
|
const Duration(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',
|
||||||
@@ -24,24 +25,41 @@ 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 {
|
||||||
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: 'https://api.github.com',
|
||||||
|
));
|
||||||
|
|
||||||
|
_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 {
|
||||||
try {
|
try {
|
||||||
var response = await _dio.get(
|
var response = await _dio.get(
|
||||||
'$apiUrl/repos/$repoName/releases/latest',
|
'/repos/$repoName/releases/latest',
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -55,20 +73,24 @@ class GithubAPI {
|
|||||||
'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}';
|
'src/main/kotlin/app/revanced/patches/${repoAppPath[packageName]}';
|
||||||
try {
|
try {
|
||||||
var response = await _dio.get(
|
var response = await _dio.get(
|
||||||
'$apiUrl/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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +109,8 @@ class GithubAPI {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -101,7 +124,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,6 +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://releases.revanced.app/';
|
||||||
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';
|
||||||
@@ -29,6 +31,19 @@ class ManagerAPI {
|
|||||||
_prefs = await SharedPreferences.getInstance();
|
_prefs = await SharedPreferences.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getApiUrl() {
|
||||||
|
return _prefs.getString('apiUrl') ?? defaultApiUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> setApiUrl(String url) async {
|
||||||
|
if (url.isEmpty || url == ' ') {
|
||||||
|
url = defaultApiUrl;
|
||||||
|
}
|
||||||
|
await _revancedAPI.initialize(url);
|
||||||
|
await _revancedAPI.clearAllCache();
|
||||||
|
await _prefs.setString('apiUrl', url);
|
||||||
|
}
|
||||||
|
|
||||||
String getPatchesRepo() {
|
String getPatchesRepo() {
|
||||||
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
|
return _prefs.getString('patchesRepo') ?? defaultPatchesRepo;
|
||||||
}
|
}
|
||||||
@@ -67,6 +82,37 @@ 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);
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _prefs.getBool('experimentalPatchesEnabled') ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> enableExperimentalPatchesStatus(bool value) async {
|
||||||
|
await _prefs.setBool('experimentalPatchesEnabled', 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();
|
||||||
@@ -83,8 +129,10 @@ class ManagerAPI {
|
|||||||
Future<void> savePatchedApp(PatchedApplication app) async {
|
Future<void> savePatchedApp(PatchedApplication app) async {
|
||||||
List<PatchedApplication> patchedApps = getPatchedApps();
|
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
patchedApps.removeWhere((a) => a.packageName == app.packageName);
|
patchedApps.removeWhere((a) => a.packageName == app.packageName);
|
||||||
ApplicationWithIcon? installed =
|
ApplicationWithIcon? installed = await DeviceApps.getApp(
|
||||||
await DeviceApps.getApp(app.packageName, true) as ApplicationWithIcon?;
|
app.packageName,
|
||||||
|
true,
|
||||||
|
) as ApplicationWithIcon?;
|
||||||
if (installed != null) {
|
if (installed != null) {
|
||||||
app.name = installed.appName;
|
app.name = installed.appName;
|
||||||
app.version = installed.versionName!;
|
app.version = installed.versionName!;
|
||||||
@@ -100,9 +148,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 {
|
||||||
@@ -110,34 +162,50 @@ class ManagerAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Patch>> getPatches() async {
|
Future<List<Patch>> getPatches() async {
|
||||||
if (getPatchesRepo() == defaultPatchesRepo) {
|
try {
|
||||||
return await _revancedAPI.getPatches();
|
String repoName = getPatchesRepo();
|
||||||
} else {
|
if (repoName == defaultPatchesRepo) {
|
||||||
return await _githubAPI.getPatches(getPatchesRepo());
|
return await _revancedAPI.getPatches();
|
||||||
|
} 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,51 +228,132 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> reAssessSavedApps() async {
|
Future<List<PatchedApplication>> getAppsToRemove(
|
||||||
List<PatchedApplication> patchedApps = getPatchedApps();
|
List<PatchedApplication> patchedApps,
|
||||||
|
) async {
|
||||||
List<PatchedApplication> toRemove = [];
|
List<PatchedApplication> toRemove = [];
|
||||||
for (PatchedApplication app in patchedApps) {
|
for (PatchedApplication app in patchedApps) {
|
||||||
bool isRemove = await isAppUninstalled(app);
|
bool isRemove = await isAppUninstalled(app);
|
||||||
if (isRemove) {
|
if (isRemove) {
|
||||||
toRemove.add(app);
|
toRemove.add(app);
|
||||||
} else {
|
}
|
||||||
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
|
}
|
||||||
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
|
return toRemove;
|
||||||
if (!app.hasUpdates) {
|
}
|
||||||
String? currentInstalledVersion =
|
|
||||||
(await DeviceApps.getApp(app.packageName))?.versionName;
|
Future<List<PatchedApplication>> getUnsavedApps(
|
||||||
if (currentInstalledVersion != null) {
|
List<PatchedApplication> patchedApps,
|
||||||
String currentSavedVersion = app.version;
|
) async {
|
||||||
int currentInstalledVersionInt = int.parse(
|
List<PatchedApplication> unsavedApps = [];
|
||||||
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
int currentSavedVersionInt =
|
if (hasRootPermissions) {
|
||||||
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
|
List<String> installedApps = await _rootAPI.getInstalledApps();
|
||||||
if (currentInstalledVersionInt > currentSavedVersionInt) {
|
for (String packageName in installedApps) {
|
||||||
app.hasUpdates = true;
|
if (!patchedApps.any((app) => app.packageName == packageName)) {
|
||||||
}
|
ApplicationWithIcon? application = await DeviceApps.getApp(
|
||||||
|
packageName,
|
||||||
|
true,
|
||||||
|
) as ApplicationWithIcon?;
|
||||||
|
if (application != null) {
|
||||||
|
unsavedApps.add(
|
||||||
|
PatchedApplication(
|
||||||
|
name: application.appName,
|
||||||
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
|
version: application.versionName!,
|
||||||
|
apkFilePath: application.apkFilePath,
|
||||||
|
icon: application.icon,
|
||||||
|
patchDate: DateTime.now(),
|
||||||
|
isRooted: true,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
List<Application> userApps = await DeviceApps.getInstalledApplications(
|
||||||
|
includeSystemApps: false,
|
||||||
|
includeAppIcons: false,
|
||||||
|
);
|
||||||
|
for (Application app in userApps) {
|
||||||
|
if (app.packageName.startsWith('app.revanced') &&
|
||||||
|
!app.packageName.startsWith('app.revanced.manager.') &&
|
||||||
|
!patchedApps.any((uapp) => uapp.packageName == app.packageName)) {
|
||||||
|
ApplicationWithIcon? application = await DeviceApps.getApp(
|
||||||
|
app.packageName,
|
||||||
|
true,
|
||||||
|
) as ApplicationWithIcon?;
|
||||||
|
if (application != null) {
|
||||||
|
unsavedApps.add(
|
||||||
|
PatchedApplication(
|
||||||
|
name: application.appName,
|
||||||
|
packageName: application.packageName,
|
||||||
|
originalPackageName: application.packageName,
|
||||||
|
version: application.versionName!,
|
||||||
|
apkFilePath: application.apkFilePath,
|
||||||
|
icon: application.icon,
|
||||||
|
patchDate: DateTime.now(),
|
||||||
|
isRooted: false,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return unsavedApps;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> reAssessSavedApps() async {
|
||||||
|
List<PatchedApplication> patchedApps = getPatchedApps();
|
||||||
|
List<PatchedApplication> unsavedApps = await getUnsavedApps(patchedApps);
|
||||||
|
patchedApps.addAll(unsavedApps);
|
||||||
|
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
||||||
patchedApps.removeWhere((a) => toRemove.contains(a));
|
patchedApps.removeWhere((a) => toRemove.contains(a));
|
||||||
|
for (PatchedApplication app in patchedApps) {
|
||||||
|
app.hasUpdates =
|
||||||
|
await hasAppUpdates(app.originalPackageName, app.patchDate);
|
||||||
|
app.changelog =
|
||||||
|
await getAppChangelog(app.originalPackageName, app.patchDate);
|
||||||
|
if (!app.hasUpdates) {
|
||||||
|
String? currentInstalledVersion =
|
||||||
|
(await DeviceApps.getApp(app.packageName))?.versionName;
|
||||||
|
if (currentInstalledVersion != null) {
|
||||||
|
String currentSavedVersion = app.version;
|
||||||
|
int currentInstalledVersionInt = int.parse(
|
||||||
|
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
int currentSavedVersionInt =
|
||||||
|
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
|
if (currentInstalledVersionInt > currentSavedVersionInt) {
|
||||||
|
app.hasUpdates = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
await setPatchedApps(patchedApps);
|
await setPatchedApps(patchedApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
Future<bool> isAppUninstalled(PatchedApplication app) async {
|
||||||
bool existsRoot = false;
|
bool existsRoot = false;
|
||||||
|
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
||||||
if (app.isRooted) {
|
if (app.isRooted) {
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
if (hasRootPermissions) {
|
if (hasRootPermissions) {
|
||||||
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
|
existsRoot = await _rootAPI.isAppInstalled(app.packageName);
|
||||||
}
|
}
|
||||||
|
return !existsRoot || !existsNonRoot;
|
||||||
}
|
}
|
||||||
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
|
return !existsNonRoot;
|
||||||
return !existsRoot && !existsNonRoot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
|
Future<bool> hasAppUpdates(String packageName, DateTime patchDate) async {
|
||||||
@@ -227,9 +376,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,14 +57,16 @@ class PatcherAPI {
|
|||||||
for (Package package in patch.compatiblePackages) {
|
for (Package package in patch.compatiblePackages) {
|
||||||
try {
|
try {
|
||||||
if (!filteredApps.any((app) => app.packageName == package.name)) {
|
if (!filteredApps.any((app) => app.packageName == package.name)) {
|
||||||
ApplicationWithIcon? app =
|
ApplicationWithIcon? app = await DeviceApps.getApp(
|
||||||
await DeviceApps.getApp(package.name, true)
|
package.name,
|
||||||
as ApplicationWithIcon?;
|
true,
|
||||||
|
) as ApplicationWithIcon?;
|
||||||
if (app != null) {
|
if (app != null) {
|
||||||
filteredApps.add(app);
|
filteredApps.add(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,18 +88,58 @@ 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 {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dependencyNeedsIntegrations(dep),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dep.contains('resource-'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
|
||||||
|
return selectedPatches.any(
|
||||||
|
(patch) => patch.dependencies.any(
|
||||||
|
(dep) => dep.contains('settings'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getOriginalFilePath(
|
Future<String> getOriginalFilePath(
|
||||||
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(
|
||||||
@@ -101,15 +147,8 @@ class PatcherAPI {
|
|||||||
String originalFilePath,
|
String originalFilePath,
|
||||||
List<Patch> selectedPatches,
|
List<Patch> selectedPatches,
|
||||||
) async {
|
) async {
|
||||||
bool mergeIntegrations = selectedPatches.any(
|
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
||||||
(patch) => patch.dependencies.contains('integrations'),
|
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
||||||
);
|
|
||||||
bool resourcePatching = selectedPatches.any(
|
|
||||||
(patch) => patch.dependencies.any((dep) => dep.contains('resource-')),
|
|
||||||
);
|
|
||||||
bool includeSettings = selectedPatches.any(
|
|
||||||
(patch) => patch.dependencies.contains('settings'),
|
|
||||||
);
|
|
||||||
if (includeSettings) {
|
if (includeSettings) {
|
||||||
try {
|
try {
|
||||||
Patch? settingsPatch = _patches.firstWhereOrNull(
|
Patch? settingsPatch = _patches.firstWhereOrNull(
|
||||||
@@ -120,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,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');
|
||||||
@@ -137,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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -183,14 +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';
|
||||||
File share = _outFile!.renameSync(
|
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||||
_outFile!.path.substring(0, lastSeparator + 1) + newName,
|
String newPath =
|
||||||
);
|
_outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||||
ShareExtend.share(share.path, 'file');
|
File shareFile = _outFile!.copySync(newPath);
|
||||||
|
ShareExtend.share(shareFile.path, 'file');
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,4 +258,32 @@ class PatcherAPI {
|
|||||||
log.writeAsStringSync(logs);
|
log.writeAsStringSync(logs);
|
||||||
ShareExtend.share(log.path, 'file');
|
ShareExtend.share(log.path, 'file');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getRecommendedVersion(String packageName) {
|
||||||
|
Map<String, int> versions = {};
|
||||||
|
for (Patch patch in _patches) {
|
||||||
|
Package? package = patch.compatiblePackages.firstWhereOrNull(
|
||||||
|
(pack) => pack.name == packageName,
|
||||||
|
);
|
||||||
|
if (package != null) {
|
||||||
|
for (String version in package.versions) {
|
||||||
|
versions.update(
|
||||||
|
version,
|
||||||
|
(value) => versions[version]! + 1,
|
||||||
|
ifAbsent: () => 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (versions.isNotEmpty) {
|
||||||
|
var entries = versions.entries.toList()
|
||||||
|
..sort((a, b) => a.value.compareTo(b.value));
|
||||||
|
versions
|
||||||
|
..clear()
|
||||||
|
..addEntries(entries);
|
||||||
|
versions.removeWhere((key, value) => value != versions.values.last);
|
||||||
|
return (versions.keys.toList()..sort()).last;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,43 +1,69 @@
|
|||||||
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 {
|
||||||
final String apiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
|
late Dio _dio = Dio();
|
||||||
final Dio _dio = Dio();
|
|
||||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||||
final Options _cacheOptions = buildCacheOptions(
|
final Options _cacheOptions = buildCacheOptions(
|
||||||
const Duration(hours: 1),
|
const Duration(hours: 6),
|
||||||
maxStale: const Duration(days: 7),
|
maxStale: const Duration(days: 1),
|
||||||
);
|
);
|
||||||
|
|
||||||
void initialize() {
|
Future<void> initialize(String apiUrl) async {
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
try {
|
||||||
|
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 {
|
||||||
Map<String, List<dynamic>> contributors = {};
|
Map<String, List<dynamic>> contributors = {};
|
||||||
try {
|
try {
|
||||||
var response = await _dio.get(
|
var response = await _dio.get('/contributors', options: _cacheOptions);
|
||||||
'$apiUrl/contributors',
|
|
||||||
options: _cacheOptions,
|
|
||||||
);
|
|
||||||
List<dynamic> repositories = response.data['repositories'];
|
List<dynamic> repositories = response.data['repositories'];
|
||||||
for (Map<String, dynamic> repo in repositories) {
|
for (Map<String, dynamic> repo in repositories) {
|
||||||
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,10 +71,11 @@ class RevancedAPI {
|
|||||||
|
|
||||||
Future<List<Patch>> getPatches() async {
|
Future<List<Patch>> getPatches() async {
|
||||||
try {
|
try {
|
||||||
var response = await _dio.get('$apiUrl/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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,27 +85,33 @@ class RevancedAPI {
|
|||||||
String repoName,
|
String repoName,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
var response = await _dio.get('$apiUrl/tools', options: _cacheOptions);
|
var response = await _dio.get('/tools', options: _cacheOptions);
|
||||||
List<dynamic> tools = response.data['tools'];
|
List<dynamic> tools = response.data['tools'];
|
||||||
return tools.firstWhereOrNull(
|
return tools.firstWhereOrNull(
|
||||||
(t) =>
|
(t) =>
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> getLatestReleaseVersion(
|
Future<String?> getLatestReleaseVersion(
|
||||||
String extension, String repoName) async {
|
String extension,
|
||||||
|
String repoName,
|
||||||
|
) async {
|
||||||
try {
|
try {
|
||||||
Map<String, dynamic>? release =
|
Map<String, dynamic>? release = await _getLatestRelease(
|
||||||
await _getLatestRelease(extension, repoName);
|
extension,
|
||||||
|
repoName,
|
||||||
|
);
|
||||||
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;
|
||||||
@@ -94,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;
|
||||||
@@ -113,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,13 +1,33 @@
|
|||||||
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 {
|
||||||
bool? isRooted = await Root.isRooted();
|
try {
|
||||||
return isRooted != null && isRooted;
|
bool? isRooted = await Root.isRootAvailable();
|
||||||
|
if (isRooted != null && isRooted) {
|
||||||
|
isRooted = await Root.isRooted();
|
||||||
|
return isRooted != null && isRooted;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setPermissions(
|
Future<void> setPermissions(
|
||||||
@@ -55,17 +75,11 @@ class RootAPI {
|
|||||||
);
|
);
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
List<String> apps = res.split('\n');
|
List<String> apps = res.split('\n');
|
||||||
List<String> toRemove = [];
|
apps.removeWhere((pack) => pack.isEmpty);
|
||||||
for (String packageName in apps) {
|
return apps.map((pack) => pack.trim()).toList();
|
||||||
bool isInstalled = await isAppInstalled(packageName);
|
|
||||||
if (!isInstalled) {
|
|
||||||
toRemove.add(packageName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
apps.removeWhere((a) => toRemove.contains(a));
|
|
||||||
return apps;
|
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
return List.empty();
|
return List.empty();
|
||||||
@@ -111,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';
|
||||||
|
|||||||
34
lib/services/toast.dart
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
import 'package:fluttertoast/fluttertoast.dart' as t;
|
||||||
|
|
||||||
|
class Toast {
|
||||||
|
final t.FToast _fToast = t.FToast();
|
||||||
|
late BuildContext buildContext;
|
||||||
|
|
||||||
|
void initialize(BuildContext context) {
|
||||||
|
_fToast.init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show(String text) {
|
||||||
|
t.Fluttertoast.showToast(
|
||||||
|
msg: FlutterI18n.translate(
|
||||||
|
_fToast.context!,
|
||||||
|
text,
|
||||||
|
),
|
||||||
|
toastLength: t.Toast.LENGTH_LONG,
|
||||||
|
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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import 'package:google_fonts/google_fonts.dart';
|
|||||||
var lightCustomColorScheme = ColorScheme.fromSeed(
|
var lightCustomColorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: Colors.blue,
|
seedColor: Colors.blue,
|
||||||
brightness: Brightness.light,
|
brightness: Brightness.light,
|
||||||
|
primary: const Color(0xff1B73E8),
|
||||||
);
|
);
|
||||||
|
|
||||||
var lightCustomTheme = ThemeData(
|
var lightCustomTheme = ThemeData(
|
||||||
@@ -23,8 +24,8 @@ var lightCustomTheme = ThemeData(
|
|||||||
var darkCustomColorScheme = ColorScheme.fromSeed(
|
var darkCustomColorScheme = ColorScheme.fromSeed(
|
||||||
seedColor: Colors.blue,
|
seedColor: Colors.blue,
|
||||||
brightness: Brightness.dark,
|
brightness: Brightness.dark,
|
||||||
primary: const Color(0xff7792BA),
|
primary: const Color(0xffA5CAFF),
|
||||||
surface: const Color(0xff0A0D11),
|
surface: const Color(0xff1B1A1D),
|
||||||
);
|
);
|
||||||
|
|
||||||
var darkCustomTheme = ThemeData(
|
var darkCustomTheme = ThemeData(
|
||||||
@@ -38,8 +39,8 @@ var darkCustomTheme = ThemeData(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
canvasColor: const Color(0xff0A0D11),
|
canvasColor: const Color(0xff1B1A1D),
|
||||||
scaffoldBackgroundColor: const Color(0xff0A0D11),
|
scaffoldBackgroundColor: const Color(0xff1B1A1D),
|
||||||
toggleableActiveColor: const Color(0xff7792BA),
|
toggleableActiveColor: const Color(0xffA5CAFF),
|
||||||
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
|
textTheme: GoogleFonts.robotoTextTheme(ThemeData.dark().textTheme),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class DynamicThemeBuilder extends StatelessWidget {
|
|||||||
2: lightDynamicTheme,
|
2: lightDynamicTheme,
|
||||||
3: darkDynamicTheme,
|
3: darkDynamicTheme,
|
||||||
},
|
},
|
||||||
fallbackTheme: darkCustomTheme,
|
fallbackTheme: lightCustomTheme,
|
||||||
),
|
),
|
||||||
builder: (context, theme) => MaterialApp(
|
builder: (context, theme) => MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
|||||||
@@ -31,53 +31,77 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: CustomScrollView(
|
||||||
child: Padding(
|
slivers: [
|
||||||
padding:
|
SliverAppBar(
|
||||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
|
pinned: true,
|
||||||
child: Column(
|
floating: true,
|
||||||
children: <Widget>[
|
snap: false,
|
||||||
SearchBar(
|
title: I18nText(
|
||||||
showSelectIcon: false,
|
'appSelectorView.viewTitle',
|
||||||
hintText: FlutterI18n.translate(
|
child: Text(
|
||||||
context,
|
'',
|
||||||
'appSelectorView.searchBarHint',
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
),
|
),
|
||||||
onQueryChanged: (searchQuery) {
|
|
||||||
setState(() {
|
|
||||||
_query = searchQuery;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
),
|
||||||
Expanded(
|
leading: IconButton(
|
||||||
child: model.noApps
|
icon: Icon(
|
||||||
? Center(
|
Icons.arrow_back,
|
||||||
child: I18nText('appSelectorCard.noAppsLabel'),
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
)
|
|
||||||
: model.apps.isEmpty
|
|
||||||
? const AppSkeletonLoader()
|
|
||||||
: ListView(
|
|
||||||
padding: const EdgeInsets.only(bottom: 80),
|
|
||||||
children: model
|
|
||||||
.getFilteredApps(_query)
|
|
||||||
.map((app) => InkWell(
|
|
||||||
onTap: () {
|
|
||||||
model.selectApp(app);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: InstalledAppItem(
|
|
||||||
name: app.appName,
|
|
||||||
pkgName: app.packageName,
|
|
||||||
icon: app.icon,
|
|
||||||
),
|
|
||||||
))
|
|
||||||
.toList(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
bottom: PreferredSize(
|
||||||
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8.0,
|
||||||
|
horizontal: 12.0,
|
||||||
|
),
|
||||||
|
child: SearchBar(
|
||||||
|
showSelectIcon: false,
|
||||||
|
hintText: FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorView.searchBarHint',
|
||||||
|
),
|
||||||
|
onQueryChanged: (searchQuery) {
|
||||||
|
setState(() {
|
||||||
|
_query = searchQuery;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
SliverToBoxAdapter(
|
||||||
|
child: model.noApps
|
||||||
|
? Center(
|
||||||
|
child: I18nText('appSelectorCard.noAppsLabel'),
|
||||||
|
)
|
||||||
|
: model.apps.isEmpty
|
||||||
|
? const AppSkeletonLoader()
|
||||||
|
: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||||
|
.copyWith(bottom: 80),
|
||||||
|
child: Column(
|
||||||
|
children: model
|
||||||
|
.getFilteredApps(_query)
|
||||||
|
.map((app) => InstalledAppItem(
|
||||||
|
name: app.appName,
|
||||||
|
pkgName: app.packageName,
|
||||||
|
icon: app.icon,
|
||||||
|
onTap: () {
|
||||||
|
model.selectApp(app);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ import 'dart:io';
|
|||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:file_picker/file_picker.dart';
|
import 'package:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
import 'package:revanced_manager/services/patcher_api.dart';
|
import 'package:revanced_manager/services/patcher_api.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 {
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
|
final Toast _toast = locator<Toast>();
|
||||||
final List<ApplicationWithIcon> apps = [];
|
final List<ApplicationWithIcon> apps = [];
|
||||||
bool noApps = false;
|
bool noApps = false;
|
||||||
|
|
||||||
@@ -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,
|
||||||
@@ -43,31 +45,28 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
if (result != null && result.files.single.path != null) {
|
if (result != null && result.files.single.path != null) {
|
||||||
File apkFile = File(result.files.single.path!);
|
File apkFile = File(result.files.single.path!);
|
||||||
ApplicationWithIcon? application =
|
ApplicationWithIcon? application = await DeviceApps.getAppFromStorage(
|
||||||
await DeviceApps.getAppFromStorage(apkFile.path, true)
|
apkFile.path,
|
||||||
as ApplicationWithIcon?;
|
true,
|
||||||
|
) as ApplicationWithIcon?;
|
||||||
if (application != null) {
|
if (application != null) {
|
||||||
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,
|
||||||
patchDate: DateTime.now(),
|
patchDate: DateTime.now(),
|
||||||
|
isFromStorage: true,
|
||||||
);
|
);
|
||||||
locator<PatcherViewModel>().selectedPatches.clear();
|
locator<PatcherViewModel>().selectedPatches.clear();
|
||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
Fluttertoast.showToast(
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
msg: FlutterI18n.translate(
|
_toast.show('appSelectorView.errorMessage');
|
||||||
context,
|
|
||||||
'appSelectorView.errorMessage',
|
|
||||||
),
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
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:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
import 'package:animations/animations.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/homeView/available_updates_card.dart';
|
import 'package:revanced_manager/ui/widgets/homeView/available_updates_card.dart';
|
||||||
@@ -27,6 +28,7 @@ class HomeView extends StatelessWidget {
|
|||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'homeView.widgetTitle',
|
'homeView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -65,27 +67,44 @@ 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);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 14),
|
const SizedBox(height: 14),
|
||||||
model.showUpdatableApps
|
PageTransitionSwitcher(
|
||||||
? AvailableUpdatesCard()
|
transitionBuilder:
|
||||||
: InstalledAppsCard(),
|
(child, primaryAnimation, secondaryAnimation) {
|
||||||
|
return FadeThroughTransition(
|
||||||
|
animation: primaryAnimation,
|
||||||
|
secondaryAnimation: secondaryAnimation,
|
||||||
|
fillColor: Colors.transparent,
|
||||||
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
layoutBuilder: (entries) {
|
||||||
|
return Stack(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
children: entries,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: model.showUpdatableApps
|
||||||
|
? AvailableUpdatesCard()
|
||||||
|
: InstalledAppsCard(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,27 +6,30 @@ 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:flutter_local_notifications/flutter_local_notifications.dart';
|
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/app/app.router.dart';
|
import 'package:revanced_manager/app/app.router.dart';
|
||||||
import 'package:revanced_manager/models/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/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;
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class HomeViewModel extends BaseViewModel {
|
class HomeViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||||
|
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 = [];
|
||||||
|
|
||||||
@@ -38,16 +41,13 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
onSelectNotification: (p) =>
|
onSelectNotification: (p) =>
|
||||||
DeviceApps.openApp('app.revanced.manager.flutter'),
|
DeviceApps.openApp('app.revanced.manager.flutter'),
|
||||||
);
|
);
|
||||||
|
flutterLocalNotificationsPlugin
|
||||||
|
.resolvePlatformSpecificImplementation<
|
||||||
|
AndroidFlutterLocalNotificationsPlugin>()
|
||||||
|
?.requestPermission();
|
||||||
bool isConnected = await Connectivity().checkConnection();
|
bool isConnected = await Connectivity().checkConnection();
|
||||||
if (!isConnected) {
|
if (!isConnected) {
|
||||||
Fluttertoast.showToast(
|
_toast.show('homeView.noConnection');
|
||||||
msg: FlutterI18n.translate(
|
|
||||||
context,
|
|
||||||
'homeView.noConnection',
|
|
||||||
),
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
_getPatchedApps();
|
_getPatchedApps();
|
||||||
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
|
||||||
@@ -74,7 +74,10 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _getPatchedApps() {
|
void _getPatchedApps() {
|
||||||
patchedInstalledApps = _managerAPI.getPatchedApps().toList();
|
patchedInstalledApps = _managerAPI
|
||||||
|
.getPatchedApps()
|
||||||
|
.where((app) => app.hasUpdates == false)
|
||||||
|
.toList();
|
||||||
patchedUpdatableApps = _managerAPI
|
patchedUpdatableApps = _managerAPI
|
||||||
.getPatchedApps()
|
.getPatchedApps()
|
||||||
.where((app) => app.hasUpdates == true)
|
.where((app) => app.hasUpdates == true)
|
||||||
@@ -92,76 +95,61 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateManager(BuildContext context) async {
|
Future<void> updateManager(BuildContext context) async {
|
||||||
Fluttertoast.showToast(
|
try {
|
||||||
msg: FlutterI18n.translate(
|
_toast.show('homeView.downloadingMessage');
|
||||||
context,
|
File? managerApk = await _managerAPI.downloadManager();
|
||||||
'homeView.downloadingMessage',
|
if (managerApk != null) {
|
||||||
),
|
await flutterLocalNotificationsPlugin.zonedSchedule(
|
||||||
toastLength: Toast.LENGTH_LONG,
|
0,
|
||||||
gravity: ToastGravity.CENTER,
|
FlutterI18n.translate(
|
||||||
);
|
|
||||||
File? managerApk = await _managerAPI.downloadManager();
|
|
||||||
if (managerApk != null) {
|
|
||||||
flutterLocalNotificationsPlugin.show(
|
|
||||||
0,
|
|
||||||
FlutterI18n.translate(
|
|
||||||
context,
|
|
||||||
'homeView.notificationTitle',
|
|
||||||
),
|
|
||||||
FlutterI18n.translate(
|
|
||||||
context,
|
|
||||||
'homeView.notificationText',
|
|
||||||
),
|
|
||||||
const NotificationDetails(
|
|
||||||
android: AndroidNotificationDetails(
|
|
||||||
'revanced_manager_channel',
|
|
||||||
'ReVanced Manager Channel',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
Fluttertoast.showToast(
|
|
||||||
msg: FlutterI18n.translate(
|
|
||||||
context,
|
context,
|
||||||
'homeView.installingMessage',
|
'homeView.notificationTitle',
|
||||||
),
|
),
|
||||||
toastLength: Toast.LENGTH_LONG,
|
FlutterI18n.translate(
|
||||||
gravity: ToastGravity.CENTER,
|
context,
|
||||||
|
'homeView.notificationText',
|
||||||
|
),
|
||||||
|
tz.TZDateTime.now(tz.local).add(const Duration(seconds: 5)),
|
||||||
|
const NotificationDetails(
|
||||||
|
android: AndroidNotificationDetails(
|
||||||
|
'revanced_manager_channel',
|
||||||
|
'ReVanced Manager Channel',
|
||||||
|
importance: Importance.max,
|
||||||
|
priority: Priority.high,
|
||||||
|
ticker: 'ticker',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
androidAllowWhileIdle: true,
|
||||||
|
uiLocalNotificationDateInterpretation:
|
||||||
|
UILocalNotificationDateInterpretation.absoluteTime,
|
||||||
);
|
);
|
||||||
|
_toast.show('homeView.installingMessage');
|
||||||
await AppInstaller.installApk(managerApk.path);
|
await AppInstaller.installApk(managerApk.path);
|
||||||
} on Exception {
|
} else {
|
||||||
Fluttertoast.showToast(
|
_toast.show('homeView.errorDownloadMessage');
|
||||||
msg: FlutterI18n.translate(
|
|
||||||
context,
|
|
||||||
'homeView.errorInstallMessage',
|
|
||||||
),
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
} on Exception catch (e, s) {
|
||||||
Fluttertoast.showToast(
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
msg: FlutterI18n.translate(
|
_toast.show('homeView.errorInstallMessage');
|
||||||
context,
|
|
||||||
'homeView.errorDownloadMessage',
|
|
||||||
),
|
|
||||||
toastLength: Toast.LENGTH_LONG,
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showUpdateConfirmationDialog(BuildContext context) async {
|
void updatesAreDisabled() {
|
||||||
|
_toast.show('homeView.updatesDisabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: parentContext,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('homeView.updateDialogTitle'),
|
title: I18nText('homeView.updateDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
@@ -169,14 +157,14 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('noButton'),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('yesButton'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
updateManager(context);
|
updateManager(parentContext);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -195,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,8 @@ 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/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_sliver_app_bar.dart';
|
||||||
@@ -17,137 +18,137 @@ 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,
|
||||||
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: LinearProgressIndicator(
|
visible: !model.isPatching,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
child: CustomPopupMenu(
|
||||||
backgroundColor:
|
onSelected: (value) => model.onMenuSelection(value),
|
||||||
Theme.of(context).colorScheme.primaryContainer,
|
children: {
|
||||||
value: model.progress,
|
if (!model.hasErrors)
|
||||||
),
|
0: I18nText(
|
||||||
|
'installerView.shareApkMenuOption',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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(
|
||||||
SliverPadding(
|
padding: const EdgeInsets.all(20.0),
|
||||||
padding: const EdgeInsets.all(20.0),
|
sliver: SliverList(
|
||||||
sliver: SliverList(
|
delegate: SliverChildListDelegate.fixed(
|
||||||
delegate: SliverChildListDelegate.fixed(
|
<Widget>[
|
||||||
<Widget>[
|
CustomCard(
|
||||||
CustomCard(
|
child: Text(
|
||||||
child: Text(
|
model.logs,
|
||||||
model.logs,
|
style: GoogleFonts.jetBrainsMono(
|
||||||
style: GoogleFonts.jetBrainsMono(
|
fontSize: 13,
|
||||||
fontSize: 13,
|
height: 1.5,
|
||||||
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(
|
||||||
Visibility(
|
visible: !model.isInstalled && model.isRooted,
|
||||||
visible: !model.isInstalled,
|
child: CustomMaterialButton(
|
||||||
child: CustomMaterialButton(
|
isFilled: false,
|
||||||
isFilled: false,
|
label:
|
||||||
label:
|
I18nText('installerView.installRootButton'),
|
||||||
I18nText('installerView.installRootButton'),
|
isExpanded: true,
|
||||||
isExpanded: true,
|
onPressed: () => model.installResult(
|
||||||
onPressed: () => model.installResult(true),
|
context,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Visibility(
|
||||||
Visibility(
|
visible: !model.isInstalled,
|
||||||
visible: !model.isInstalled,
|
child: const SizedBox(
|
||||||
child: const SizedBox(
|
width: 16,
|
||||||
width: 16,
|
),
|
||||||
),
|
),
|
||||||
),
|
Visibility(
|
||||||
Visibility(
|
visible: !model.isInstalled,
|
||||||
visible: !model.isInstalled,
|
child: CustomMaterialButton(
|
||||||
child: CustomMaterialButton(
|
label: I18nText('installerView.installButton'),
|
||||||
label: I18nText('installerView.installButton'),
|
isExpanded: true,
|
||||||
isExpanded: true,
|
onPressed: () => model.installResult(
|
||||||
onPressed: () => model.installResult(false),
|
context,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onWillPop: () async {
|
onWillPop: () => model.onWillPop(context),
|
||||||
if (!model.isPatching) {
|
|
||||||
model.cleanPatcher();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,28 @@
|
|||||||
|
// 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';
|
||||||
import 'package:flutter_background/flutter_background.dart';
|
import 'package:flutter_background/flutter_background.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
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/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: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 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;
|
||||||
static const _installerChannel = MethodChannel(
|
static const _installerChannel = MethodChannel(
|
||||||
@@ -24,34 +32,38 @@ 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 {
|
||||||
try {
|
isRooted = await _rootAPI.isRooted();
|
||||||
await FlutterBackground.initialize(
|
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
||||||
androidConfig: FlutterBackgroundAndroidConfig(
|
try {
|
||||||
notificationTitle: FlutterI18n.translate(
|
FlutterBackground.initialize(
|
||||||
context,
|
androidConfig: FlutterBackgroundAndroidConfig(
|
||||||
'installerView.notificationTitle',
|
notificationTitle: FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'installerView.notificationTitle',
|
||||||
|
),
|
||||||
|
notificationText: FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'installerView.notificationText',
|
||||||
|
),
|
||||||
|
notificationImportance: AndroidNotificationImportance.Default,
|
||||||
|
notificationIcon: const AndroidResource(
|
||||||
|
name: 'ic_notification',
|
||||||
|
defType: 'drawable',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
notificationText: FlutterI18n.translate(
|
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||||
context,
|
} on Exception catch (e, s) {
|
||||||
'installerView.notificationText',
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
),
|
// ignore
|
||||||
notificationImportance: AndroidNotificationImportance.Default,
|
}
|
||||||
notificationIcon: const AndroidResource(
|
|
||||||
name: 'ic_notification',
|
|
||||||
defType: 'drawable',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
await FlutterBackground.enableBackgroundExecution();
|
|
||||||
await Wakelock.enable();
|
|
||||||
} on Exception {
|
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
await Wakelock.enable();
|
||||||
await handlePlatformChannelMethods();
|
await handlePlatformChannelMethods();
|
||||||
await runPatcher();
|
await runPatcher();
|
||||||
}
|
}
|
||||||
@@ -73,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;
|
||||||
@@ -90,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,
|
||||||
@@ -102,52 +123,106 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher() async {
|
Future<void> runPatcher() async {
|
||||||
update(0.0, 'Initializing...', 'Initializing installer');
|
|
||||||
if (_patches.isNotEmpty) {
|
|
||||||
try {
|
|
||||||
update(0.1, '', 'Creating working directory');
|
|
||||||
await _patcherAPI.runPatcher(
|
|
||||||
_app.packageName,
|
|
||||||
_app.apkFilePath,
|
|
||||||
_patches,
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
hasErrors = true;
|
|
||||||
update(-1.0, 'Aborting...', 'An error occurred! Aborting\nError: $e');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
hasErrors = true;
|
|
||||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
await FlutterBackground.disableBackgroundExecution();
|
update(0.0, 'Initializing...', 'Initializing installer');
|
||||||
|
if (_patches.isNotEmpty) {
|
||||||
|
try {
|
||||||
|
update(0.1, '', 'Creating working directory');
|
||||||
|
await _patcherAPI.runPatcher(
|
||||||
|
_app.packageName,
|
||||||
|
_app.apkFilePath,
|
||||||
|
_patches,
|
||||||
|
);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||||
|
try {
|
||||||
|
FlutterBackground.disableBackgroundExecution();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
await Wakelock.disable();
|
await Wakelock.disable();
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
// ignore
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
isPatching = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void installResult(bool installAsRoot) async {
|
void installResult(BuildContext context, bool installAsRoot) async {
|
||||||
_app.isRooted = installAsRoot;
|
try {
|
||||||
update(
|
_app.isRooted = installAsRoot;
|
||||||
1.0,
|
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||||
'Installing...',
|
bool rootMicroG = installAsRoot && hasMicroG;
|
||||||
_app.isRooted
|
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||||
? 'Installing patched file using root method'
|
bool ytWithoutRootMicroG =
|
||||||
: 'Installing patched file using nonroot method',
|
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
||||||
);
|
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
||||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
return showDialog(
|
||||||
if (isInstalled) {
|
context: context,
|
||||||
update(1.0, 'Installed!', 'Installed!');
|
builder: (context) => AlertDialog(
|
||||||
_app.patchDate = DateTime.now();
|
title: I18nText('installerView.installErrorDialogTitle'),
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
await _managerAPI.savePatchedApp(_app);
|
content: I18nText(
|
||||||
|
rootMicroG
|
||||||
|
? 'installerView.installErrorDialogText1'
|
||||||
|
: rootFromStorage
|
||||||
|
? 'installerView.installErrorDialogText3'
|
||||||
|
: 'installerView.installErrorDialogText2',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
update(
|
||||||
|
1.0,
|
||||||
|
'Installing...',
|
||||||
|
_app.isRooted
|
||||||
|
? 'Installing patched file using root method'
|
||||||
|
: 'Installing patched file using nonroot method',
|
||||||
|
);
|
||||||
|
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||||
|
if (isInstalled) {
|
||||||
|
update(1.0, 'Installed!', 'Installed!');
|
||||||
|
_app.isFromStorage = false;
|
||||||
|
_app.patchDate = DateTime.now();
|
||||||
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
|
if (hasMicroG) {
|
||||||
|
_app.name += ' ReVanced';
|
||||||
|
_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() {
|
||||||
@@ -155,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() {
|
||||||
@@ -175,4 +254,14 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> onWillPop(BuildContext context) async {
|
||||||
|
if (isPatching) {
|
||||||
|
_toast.show('installerView.noExit');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
cleanPatcher();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<NavigationViewModel>.reactive(
|
return ViewModelBuilder<NavigationViewModel>.reactive(
|
||||||
|
onModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => locator<NavigationViewModel>(),
|
viewModelBuilder: () => locator<NavigationViewModel>(),
|
||||||
builder: (context, model, child) => Scaffold(
|
builder: (context, model, child) => Scaffold(
|
||||||
body: PageTransitionSwitcher(
|
body: PageTransitionSwitcher(
|
||||||
@@ -41,6 +42,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.dashboardTab',
|
'navigationView.dashboardTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
NavigationDestination(
|
NavigationDestination(
|
||||||
icon: model.isIndexSelected(1)
|
icon: model.isIndexSelected(1)
|
||||||
@@ -50,6 +52,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.patcherTab',
|
'navigationView.patcherTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
NavigationDestination(
|
NavigationDestination(
|
||||||
icon: model.isIndexSelected(2)
|
icon: model.isIndexSelected(2)
|
||||||
@@ -59,6 +62,7 @@ class NavigationView extends StatelessWidget {
|
|||||||
context,
|
context,
|
||||||
'navigationView.settingsTab',
|
'navigationView.settingsTab',
|
||||||
),
|
),
|
||||||
|
tooltip: '',
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,12 +1,49 @@
|
|||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
|
import 'package:revanced_manager/services/root_api.dart';
|
||||||
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/home/home_view.dart';
|
import 'package:revanced_manager/ui/views/home/home_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_view.dart';
|
||||||
import 'package:revanced_manager/ui/views/settings/settings_view.dart';
|
import 'package:revanced_manager/ui/views/settings/settings_view.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class NavigationViewModel extends IndexTrackingViewModel {
|
class NavigationViewModel extends IndexTrackingViewModel {
|
||||||
|
void initialize(BuildContext context) async {
|
||||||
|
locator<Toast>().initialize(context);
|
||||||
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
|
if (prefs.getBool('permissionsRequested') == null) {
|
||||||
|
await prefs.setBool('permissionsRequested', true);
|
||||||
|
RootAPI().hasRootPermissions().then(
|
||||||
|
(value) => Permission.requestInstallPackages.request().then(
|
||||||
|
(value) => Permission.ignoreBatteryOptimizations.request(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (prefs.getBool('useDarkTheme') == null) {
|
||||||
|
bool isDark =
|
||||||
|
MediaQuery.of(context).platformBrightness != Brightness.light;
|
||||||
|
await prefs.setBool('useDarkTheme', isDark);
|
||||||
|
await DynamicTheme.of(context)!.setTheme(isDark ? 1 : 0);
|
||||||
|
}
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarColor: Colors.transparent,
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
DynamicTheme.of(context)!.theme.brightness == Brightness.light
|
||||||
|
? Brightness.dark
|
||||||
|
: Brightness.light,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget getViewForIndex(int index) {
|
Widget getViewForIndex(int index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -22,12 +22,13 @@ class PatcherView extends StatelessWidget {
|
|||||||
child: FloatingActionButton.extended(
|
child: FloatingActionButton.extended(
|
||||||
label: I18nText('patcherView.patchButton'),
|
label: I18nText('patcherView.patchButton'),
|
||||||
icon: const Icon(Icons.build),
|
icon: const Icon(Icons.build),
|
||||||
onPressed: () => model.navigateToInstaller(),
|
onPressed: () => model.showPatchConfirmationDialog(context),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'patcherView.widgetTitle',
|
'patcherView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -1,14 +1,21 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:revanced_manager/app/app.locator.dart';
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
import 'package:revanced_manager/app/app.router.dart';
|
import 'package:revanced_manager/app/app.router.dart';
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/models/patched_application.dart';
|
import 'package:revanced_manager/models/patched_application.dart';
|
||||||
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
|
import 'package:revanced_manager/services/patcher_api.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>();
|
||||||
PatchedApplication? selectedApp;
|
PatchedApplication? selectedApp;
|
||||||
List<Patch> selectedPatches = [];
|
List<Patch> selectedPatches = [];
|
||||||
|
|
||||||
@@ -31,4 +38,73 @@ class PatcherViewModel extends BaseViewModel {
|
|||||||
bool dimPatchesCard() {
|
bool dimPatchesCard() {
|
||||||
return selectedApp == null;
|
return selectedApp == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<bool> isValidPatchConfig() async {
|
||||||
|
bool needsResourcePatching = await _patcherAPI.needsResourcePatching(
|
||||||
|
selectedPatches,
|
||||||
|
);
|
||||||
|
if (needsResourcePatching && selectedApp != null) {
|
||||||
|
bool isSplit = await _managerAPI.isSplitApk(selectedApp!);
|
||||||
|
return !isSplit;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> showPatchConfirmationDialog(BuildContext context) async {
|
||||||
|
bool isValid = await isValidPatchConfig();
|
||||||
|
if (isValid) {
|
||||||
|
navigateToInstaller();
|
||||||
|
} else {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText('patcherView.patchDialogTitle'),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText('patcherView.patchDialogText'),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('noButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('yesButton'),
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
navigateToInstaller();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getAppSelectionString() {
|
||||||
|
String text = '${selectedApp!.name} (${selectedApp!.packageName})';
|
||||||
|
if (text.length > 32) {
|
||||||
|
text = '${text.substring(0, 32)}...)';
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRecommendedVersionString(BuildContext context) {
|
||||||
|
String recommendedVersion =
|
||||||
|
_patcherAPI.getRecommendedVersion(selectedApp!.packageName);
|
||||||
|
if (recommendedVersion.isEmpty) {
|
||||||
|
recommendedVersion = FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.anyVersion',
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
recommendedVersion = 'v$recommendedVersion';
|
||||||
|
}
|
||||||
|
return '${FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.currentVersion',
|
||||||
|
)}: v${selectedApp!.version}\n${FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'appSelectorCard.recommendedVersion',
|
||||||
|
)}: $recommendedVersion';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,137 +33,194 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: CustomScrollView(
|
||||||
child: Padding(
|
slivers: [
|
||||||
padding:
|
SliverAppBar(
|
||||||
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 12.0),
|
pinned: true,
|
||||||
child: Column(
|
floating: true,
|
||||||
children: <Widget>[
|
snap: false,
|
||||||
SearchBar(
|
title: I18nText(
|
||||||
showSelectIcon: true,
|
'patchesSelectorView.viewTitle',
|
||||||
hintText: FlutterI18n.translate(
|
child: Text(
|
||||||
context,
|
'',
|
||||||
'patchesSelectorView.searchBarHint',
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
),
|
),
|
||||||
onQueryChanged: (searchQuery) {
|
|
||||||
setState(() {
|
|
||||||
_query = searchQuery;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onSelectAll: (value) => model.selectAllPatches(value),
|
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
),
|
||||||
Expanded(
|
leading: IconButton(
|
||||||
child: model.patches.isEmpty
|
icon: Icon(
|
||||||
? Center(
|
Icons.arrow_back,
|
||||||
child: CircularProgressIndicator(
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
color: Theme.of(context).colorScheme.primary,
|
),
|
||||||
|
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(
|
||||||
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 8.0,
|
||||||
|
horizontal: 12.0,
|
||||||
|
),
|
||||||
|
child: SearchBar(
|
||||||
|
showSelectIcon: true,
|
||||||
|
hintText: FlutterI18n.translate(
|
||||||
|
context,
|
||||||
|
'patchesSelectorView.searchBarHint',
|
||||||
|
),
|
||||||
|
onQueryChanged: (searchQuery) {
|
||||||
|
setState(() {
|
||||||
|
_query = searchQuery;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSelectAll: (value) {
|
||||||
|
if (value) {
|
||||||
|
model.selectAllPatcherWarning(context);
|
||||||
|
}
|
||||||
|
model.selectAllPatches(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SliverToBoxAdapter(
|
||||||
|
child: model.patches.isEmpty
|
||||||
|
? Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: I18nText(
|
||||||
|
'patchesSelectorView.noPatchesFound',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
: ListView(
|
),
|
||||||
padding: const EdgeInsets.only(bottom: 80),
|
)
|
||||||
children: model
|
: Padding(
|
||||||
.getQueriedPatches(_query)
|
padding: const EdgeInsets.symmetric(horizontal: 12.0)
|
||||||
.map(
|
.copyWith(bottom: 80),
|
||||||
(patch) => PatchItem(
|
child: Column(
|
||||||
name: patch.name,
|
children: model
|
||||||
simpleName: patch.getSimpleName(),
|
.getQueriedPatches(_query)
|
||||||
version: patch.version,
|
.map(
|
||||||
description: patch.description,
|
(patch) => PatchItem(
|
||||||
packageVersion: model.getAppVersion(),
|
name: patch.name,
|
||||||
supportedPackageVersions:
|
simpleName: patch.getSimpleName(),
|
||||||
model.getSupportedVersions(patch),
|
version: patch.version,
|
||||||
isUnsupported: !model.isPatchSupported(patch),
|
description: patch.description,
|
||||||
isSelected: model.isSelected(patch),
|
packageVersion: model.getAppVersion(),
|
||||||
onChanged: (value) =>
|
supportedPackageVersions:
|
||||||
model.selectPatch(patch, value),
|
model.getSupportedVersions(patch),
|
||||||
),
|
isUnsupported: !model.isPatchSupported(patch),
|
||||||
/* TODO: Enable this and make use of new Patch Options implementation
|
isSelected: model.isSelected(patch),
|
||||||
patch.hasOptions ? ExpandablePanel(
|
onChanged: (value) =>
|
||||||
controller: expController,
|
model.selectPatch(patch, value),
|
||||||
theme: const ExpandableThemeData(
|
),
|
||||||
hasIcon: false,
|
/* TODO: Enable this and make use of new Patch Options implementation
|
||||||
tapBodyToExpand: true,
|
patch.hasOptions ? ExpandablePanel(
|
||||||
tapBodyToCollapse: true,
|
controller: expController,
|
||||||
tapHeaderToExpand: true,
|
theme: const ExpandableThemeData(
|
||||||
),
|
hasIcon: false,
|
||||||
header: Column(
|
tapBodyToExpand: true,
|
||||||
children: <Widget>[
|
tapBodyToCollapse: true,
|
||||||
GestureDetector(
|
tapHeaderToExpand: true,
|
||||||
onLongPress: () =>
|
),
|
||||||
expController.toggle(),
|
header: Column(
|
||||||
child: PatchItem(
|
children: <Widget>[
|
||||||
name: patch.name,
|
GestureDetector(
|
||||||
simpleName: patch.getSimpleName(),
|
onLongPress: () =>
|
||||||
description: patch.description,
|
expController.toggle(),
|
||||||
version: patch.version,
|
child: PatchItem(
|
||||||
packageVersion:
|
name: patch.name,
|
||||||
model.getAppVersion(),
|
simpleName: patch.getSimpleName(),
|
||||||
supportedPackageVersions: model
|
description: patch.description,
|
||||||
.getSupportedVersions(patch),
|
version: patch.version,
|
||||||
isUnsupported: !model
|
packageVersion:
|
||||||
.isPatchSupported(patch),
|
model.getAppVersion(),
|
||||||
isSelected:
|
supportedPackageVersions: model
|
||||||
model.isSelected(patch),
|
.getSupportedVersions(patch),
|
||||||
onChanged: (value) => model
|
isUnsupported: !model
|
||||||
.selectPatch(patch, value),
|
.isPatchSupported(patch),
|
||||||
child: const Padding(
|
isSelected:
|
||||||
padding: EdgeInsets.symmetric(
|
model.isSelected(patch),
|
||||||
vertical: 8.0,
|
onChanged: (value) => model
|
||||||
),
|
.selectPatch(patch, value),
|
||||||
child: Text(
|
child: const Padding(
|
||||||
'Long press for additional options.',
|
padding: EdgeInsets.symmetric(
|
||||||
),
|
vertical: 8.0,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'Long press for additional options.',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
expanded: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 10.0,
|
||||||
|
horizontal: 10,
|
||||||
),
|
),
|
||||||
expanded: Padding(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 10.0,
|
vertical: 8,
|
||||||
horizontal: 10,
|
horizontal: 8,
|
||||||
),
|
),
|
||||||
child: Container(
|
decoration: BoxDecoration(
|
||||||
padding: const EdgeInsets.symmetric(
|
color: Theme.of(context)
|
||||||
vertical: 8,
|
.colorScheme
|
||||||
horizontal: 8,
|
.tertiary
|
||||||
),
|
.withOpacity(0.1),
|
||||||
decoration: BoxDecoration(
|
borderRadius:
|
||||||
color: Theme.of(context)
|
BorderRadius.circular(12),
|
||||||
.colorScheme
|
),
|
||||||
.tertiary
|
child: Column(
|
||||||
.withOpacity(0.1),
|
children: <Widget>[
|
||||||
borderRadius:
|
Text(
|
||||||
BorderRadius.circular(12),
|
'Patch options',
|
||||||
),
|
style: GoogleFonts.inter(
|
||||||
child: Column(
|
fontSize: 18,
|
||||||
children: <Widget>[
|
fontWeight: FontWeight.w600,
|
||||||
Text(
|
|
||||||
'Patch options',
|
|
||||||
style: GoogleFonts.inter(
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w600,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const OptionsTextField(
|
),
|
||||||
hint: 'App name'),
|
const OptionsTextField(
|
||||||
const OptionsFilePicker(
|
hint: 'App name'),
|
||||||
optionName: 'Choose a logo',
|
const OptionsFilePicker(
|
||||||
),
|
optionName: 'Choose a logo',
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
collapsed: Container(),
|
),
|
||||||
) */
|
collapsed: Container(),
|
||||||
)
|
) */
|
||||||
.toList(),
|
)
|
||||||
),
|
.toList(),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,29 +1,29 @@
|
|||||||
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));
|
||||||
if (selectedPatches.isEmpty) {
|
|
||||||
for (Patch patch in patches) {
|
|
||||||
if (!patch.excluded && isPatchSupported(patch)) {
|
|
||||||
selectedPatches.add(patch);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,11 +42,35 @@ 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 && _managerAPI.areExperimentalPatchesEnabled() == false) {
|
||||||
|
selectedPatches
|
||||||
|
.addAll(patches.where((element) => isPatchSupported(element)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSelected && _managerAPI.areExperimentalPatchesEnabled()) {
|
||||||
selectedPatches.addAll(patches);
|
selectedPatches.addAll(patches);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,14 +79,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import 'package:stacked/stacked.dart';
|
|||||||
class SettingsView extends StatelessWidget {
|
class SettingsView extends StatelessWidget {
|
||||||
const SettingsView({Key? key}) : super(key: key);
|
const SettingsView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
static const _settingsDivider =
|
||||||
|
Divider(thickness: 1.0, indent: 20.0, endIndent: 20.0);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ViewModelBuilder<SettingsViewModel>.reactive(
|
return ViewModelBuilder<SettingsViewModel>.reactive(
|
||||||
@@ -21,6 +24,7 @@ class SettingsView extends StatelessWidget {
|
|||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: <Widget>[
|
slivers: <Widget>[
|
||||||
CustomSliverAppBar(
|
CustomSliverAppBar(
|
||||||
|
isMainView: true,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'settingsView.widgetTitle',
|
'settingsView.widgetTitle',
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -31,84 +35,111 @@ class SettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPadding(
|
SliverList(
|
||||||
padding: const EdgeInsets.all(20.0),
|
delegate: SliverChildListDelegate.fixed(
|
||||||
sliver: SliverList(
|
<Widget>[
|
||||||
delegate: SliverChildListDelegate.fixed(
|
SettingsSection(
|
||||||
<Widget>[
|
title: 'settingsView.appearanceSectionTitle',
|
||||||
SettingsSection(
|
children: <Widget>[
|
||||||
title: 'settingsView.appearanceSectionTitle',
|
CustomSwitchTile(
|
||||||
children: <Widget>[
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
CustomSwitchTile(
|
title: I18nText(
|
||||||
title: I18nText(
|
'settingsView.darkThemeLabel',
|
||||||
'settingsView.darkThemeLabel',
|
child: const Text(
|
||||||
child: const Text(
|
'',
|
||||||
'',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 20,
|
||||||
fontSize: 20,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.darkThemeHint'),
|
|
||||||
value: model.getDarkThemeStatus(),
|
|
||||||
onTap: (value) => model.setUseDarkTheme(
|
|
||||||
context,
|
|
||||||
value,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
FutureBuilder<int>(
|
subtitle: I18nText('settingsView.darkThemeHint'),
|
||||||
future: model.getSdkVersion(),
|
value: model.getDarkThemeStatus(),
|
||||||
builder: (context, snapshot) => Visibility(
|
onTap: (value) => model.setUseDarkTheme(
|
||||||
visible: snapshot.hasData &&
|
context,
|
||||||
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
value,
|
||||||
child: CustomSwitchTile(
|
),
|
||||||
title: I18nText(
|
),
|
||||||
'settingsView.dynamicThemeLabel',
|
FutureBuilder<int>(
|
||||||
child: const Text(
|
future: model.getSdkVersion(),
|
||||||
'',
|
builder: (context, snapshot) => Visibility(
|
||||||
style: TextStyle(
|
visible: snapshot.hasData &&
|
||||||
fontSize: 20,
|
snapshot.data! >= ANDROID_12_SDK_VERSION,
|
||||||
fontWeight: FontWeight.w500,
|
child: CustomSwitchTile(
|
||||||
),
|
padding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.dynamicThemeLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle:
|
),
|
||||||
I18nText('settingsView.dynamicThemeHint'),
|
subtitle: I18nText('settingsView.dynamicThemeHint'),
|
||||||
value: model.getDynamicThemeStatus(),
|
value: model.getDynamicThemeStatus(),
|
||||||
onTap: (value) => model.setUseDynamicTheme(
|
onTap: (value) => model.setUseDynamicTheme(
|
||||||
context,
|
context,
|
||||||
value,
|
value,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
SettingsTileDialog(
|
),
|
||||||
title: 'settingsView.languageLabel',
|
SettingsTileDialog(
|
||||||
subtitle: 'English',
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
onTap: () => model.showLanguagesDialog(context),
|
title: 'settingsView.languageLabel',
|
||||||
),
|
subtitle: 'English',
|
||||||
const Divider(thickness: 1.0),
|
onTap: () => model.showLanguagesDialog(context),
|
||||||
SettingsSection(
|
),
|
||||||
title: 'settingsView.patcherSectionTitle',
|
_settingsDivider,
|
||||||
children: <Widget>[
|
SettingsSection(
|
||||||
SettingsTileDialog(
|
title: 'settingsView.teamSectionTitle',
|
||||||
title: 'settingsView.sourcesLabel',
|
children: <Widget>[
|
||||||
subtitle: 'settingsView.sourcesLabelHint',
|
ListTile(
|
||||||
onTap: () => model.showSourcesDialog(context),
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.contributorsLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
subtitle: I18nText('settingsView.contributorsHint'),
|
||||||
),
|
onTap: () => model.navigateToContributors(),
|
||||||
const Divider(thickness: 1.0),
|
),
|
||||||
SettingsSection(
|
const SocialMediaWidget(
|
||||||
title: 'settingsView.teamSectionTitle',
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
children: <Widget>[
|
),
|
||||||
ListTile(
|
],
|
||||||
contentPadding: EdgeInsets.zero,
|
),
|
||||||
|
_settingsDivider,
|
||||||
|
SettingsSection(
|
||||||
|
title: 'settingsView.advancedSectionTitle',
|
||||||
|
children: <Widget>[
|
||||||
|
SettingsTileDialog(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: 'settingsView.apiURLLabel',
|
||||||
|
subtitle: 'settingsView.apiURLHint',
|
||||||
|
onTap: () => model.showApiUrlDialog(context),
|
||||||
|
),
|
||||||
|
SettingsTileDialog(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: 'settingsView.sourcesLabel',
|
||||||
|
subtitle: 'settingsView.sourcesLabelHint',
|
||||||
|
onTap: () => model.showSourcesDialog(context),
|
||||||
|
),
|
||||||
|
CustomSwitchTile(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'settingsView.contributorsLabel',
|
'settingsView.experimentalPatchesLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'',
|
'',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -117,36 +148,109 @@ class SettingsView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.contributorsHint'),
|
subtitle:
|
||||||
onTap: () => model.navigateToContributors(),
|
I18nText('settingsView.experimentalPatchesHint'),
|
||||||
),
|
value: model.areExperimentalPatchesEnabled(),
|
||||||
const SocialMediaWidget(),
|
onTap: (value) =>
|
||||||
],
|
model.useExperimentalPatches(value)),
|
||||||
),
|
ListTile(
|
||||||
const Divider(thickness: 1.0),
|
contentPadding:
|
||||||
SettingsSection(
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: 'settingsView.infoSectionTitle',
|
title: I18nText(
|
||||||
children: <Widget>[
|
'settingsView.deleteKeystoreLabel',
|
||||||
ListTile(
|
child: const Text(
|
||||||
contentPadding: EdgeInsets.zero,
|
'',
|
||||||
title: I18nText(
|
style: TextStyle(
|
||||||
'settingsView.logsLabel',
|
fontSize: 20,
|
||||||
child: const Text(
|
fontWeight: FontWeight.w500,
|
||||||
'',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
subtitle: I18nText('settingsView.logsHint'),
|
|
||||||
onTap: () => model.exportLogcatLogs(),
|
|
||||||
),
|
),
|
||||||
const AboutWidget(),
|
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,
|
||||||
|
// 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(
|
||||||
|
title: 'settingsView.infoSectionTitle',
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.logsLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.logsHint'),
|
||||||
|
onTap: () => model.exportLogcatLogs(),
|
||||||
|
),
|
||||||
|
const AboutWidget(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -3,13 +3,15 @@ import 'dart:io';
|
|||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:dynamic_themes/dynamic_themes.dart';
|
import 'package:dynamic_themes/dynamic_themes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
import 'package:logcat/logcat.dart';
|
import 'package:logcat/logcat.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
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';
|
||||||
@@ -22,10 +24,12 @@ 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();
|
||||||
final TextEditingController _intSourceController = TextEditingController();
|
final TextEditingController _intSourceController = TextEditingController();
|
||||||
|
final TextEditingController _apiUrlController = TextEditingController();
|
||||||
|
|
||||||
void setLanguage(String language) {
|
void setLanguage(String language) {
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
@@ -50,9 +54,9 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
await _managerAPI.setUseDynamicTheme(value);
|
await _managerAPI.setUseDynamicTheme(value);
|
||||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||||
if (currentTheme.isEven) {
|
if (currentTheme.isEven) {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
await DynamicTheme.of(context)!.setTheme(value ? 2 : 0);
|
||||||
} else {
|
} else {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
await DynamicTheme.of(context)!.setTheme(value ? 3 : 1);
|
||||||
}
|
}
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
@@ -65,10 +69,16 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
await _managerAPI.setUseDarkTheme(value);
|
await _managerAPI.setUseDarkTheme(value);
|
||||||
int currentTheme = DynamicTheme.of(context)!.themeId;
|
int currentTheme = DynamicTheme.of(context)!.themeId;
|
||||||
if (currentTheme < 2) {
|
if (currentTheme < 2) {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
await DynamicTheme.of(context)!.setTheme(value ? 1 : 0);
|
||||||
} else {
|
} else {
|
||||||
DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
await DynamicTheme.of(context)!.setTheme(value ? 3 : 2);
|
||||||
}
|
}
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
SystemUiOverlayStyle(
|
||||||
|
systemNavigationBarIconBrightness:
|
||||||
|
value ? Brightness.light : Brightness.dark,
|
||||||
|
),
|
||||||
|
);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,6 +203,65 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showApiUrlDialog(BuildContext context) async {
|
||||||
|
String apiUrl = _managerAPI.getApiUrl();
|
||||||
|
_apiUrlController.text = apiUrl.replaceAll('https://', '');
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
I18nText('settingsView.apiURLLabel'),
|
||||||
|
const Spacer(),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.manage_history_outlined),
|
||||||
|
onPressed: () => showApiUrlResetDialog(context),
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
CustomTextField(
|
||||||
|
leadingIcon: Icon(
|
||||||
|
Icons.api_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
inputController: _apiUrlController,
|
||||||
|
label: I18nText('settingsView.selectApiURL'),
|
||||||
|
hint: apiUrl.split('/')[0],
|
||||||
|
onChanged: (value) => notifyListeners(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('cancelButton'),
|
||||||
|
onPressed: () {
|
||||||
|
_apiUrlController.clear();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () {
|
||||||
|
String apiUrl = _apiUrlController.text;
|
||||||
|
if (!apiUrl.startsWith('https')) {
|
||||||
|
apiUrl = 'https://$apiUrl';
|
||||||
|
}
|
||||||
|
_managerAPI.setApiUrl(apiUrl);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showResetConfirmationDialog(BuildContext context) async {
|
Future<void> showResetConfirmationDialog(BuildContext context) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -203,11 +272,11 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
isFilled: false,
|
isFilled: false,
|
||||||
label: I18nText('cancelButton'),
|
label: I18nText('noButton'),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('yesButton'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_managerAPI.setPatchesRepo('');
|
_managerAPI.setPatchesRepo('');
|
||||||
_managerAPI.setIntegrationsRepo('');
|
_managerAPI.setIntegrationsRepo('');
|
||||||
@@ -220,11 +289,78 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> showApiUrlResetDialog(BuildContext context) async {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText('settingsView.sourcesResetDialogTitle'),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText('settingsView.apiURLResetDialogText'),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('noButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('yesButton'),
|
||||||
|
onPressed: () {
|
||||||
|
_managerAPI.setApiUrl('');
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// bool isSentryEnabled() {
|
||||||
|
// return _managerAPI.isSentryEnabled();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// void useSentry(bool value) {
|
||||||
|
// _managerAPI.setSentryStatus(value);
|
||||||
|
// _toast.showBottom('settingsView.restartAppForChanges');
|
||||||
|
// notifyListeners();
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _managerAPI.areExperimentalPatchesEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void useExperimentalPatches(bool value) {
|
||||||
|
_managerAPI.enableExperimentalPatchesStatus(value);
|
||||||
|
_toast.showBottom('settingsView.enabledExperimentalPatches');
|
||||||
|
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');
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class AppInfoView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
SliverPadding(
|
SliverPadding(
|
||||||
padding: const EdgeInsets.all(20.0),
|
padding: const EdgeInsets.symmetric(vertical: 20.0),
|
||||||
sliver: SliverList(
|
sliver: SliverList(
|
||||||
delegate: SliverChildListDelegate.fixed(
|
delegate: SliverChildListDelegate.fixed(
|
||||||
<Widget>[
|
<Widget>[
|
||||||
@@ -61,106 +61,193 @@ class AppInfoView extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.subtitle1,
|
style: Theme.of(context).textTheme.subtitle1,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
CustomCard(
|
Padding(
|
||||||
child: IntrinsicHeight(
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
child: Row(
|
child: CustomCard(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
padding: EdgeInsets.zero,
|
||||||
children: <Widget>[
|
child: SizedBox(
|
||||||
InkWell(
|
height: 94.0,
|
||||||
onTap: () => model.openApp(app),
|
child: Row(
|
||||||
child: Column(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Expanded(
|
||||||
Icon(
|
child: Material(
|
||||||
Icons.open_in_new_outlined,
|
type: MaterialType.transparency,
|
||||||
color:
|
child: InkWell(
|
||||||
Theme.of(context).colorScheme.primary,
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
onTap: () => model.openApp(app),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.open_in_new_outlined,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
I18nText(
|
||||||
|
'appInfoView.openButton',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
I18nText(
|
),
|
||||||
'appInfoView.openButton',
|
VerticalDivider(
|
||||||
child: Text(
|
color: Theme.of(context).canvasColor,
|
||||||
'',
|
indent: 12.0,
|
||||||
style: TextStyle(
|
endIndent: 12.0,
|
||||||
color: Theme.of(context)
|
width: 1.0,
|
||||||
.colorScheme
|
),
|
||||||
.primary,
|
Expanded(
|
||||||
fontWeight: FontWeight.bold,
|
child: Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
onTap: () => model.showUninstallDialog(
|
||||||
|
context,
|
||||||
|
app,
|
||||||
|
false,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.delete_outline,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
I18nText(
|
||||||
|
'appInfoView.uninstallButton',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
VerticalDivider(
|
||||||
|
color: Theme.of(context).canvasColor,
|
||||||
|
indent: 12.0,
|
||||||
|
endIndent: 12.0,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
onTap: () {
|
||||||
|
model.updateNotImplemented(context);
|
||||||
|
// model.navigateToPatcher(app);
|
||||||
|
// Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons.build_outlined,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
I18nText(
|
||||||
|
'appInfoView.patchButton',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (app.isRooted)
|
||||||
|
VerticalDivider(
|
||||||
|
color: Theme.of(context).canvasColor,
|
||||||
|
indent: 12.0,
|
||||||
|
endIndent: 12.0,
|
||||||
|
width: 1.0,
|
||||||
|
),
|
||||||
|
if (app.isRooted)
|
||||||
|
Expanded(
|
||||||
|
child: Material(
|
||||||
|
type: MaterialType.transparency,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(16.0),
|
||||||
|
onTap: () => model.showUninstallDialog(
|
||||||
|
context,
|
||||||
|
app,
|
||||||
|
true,
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Icon(
|
||||||
|
Icons
|
||||||
|
.settings_backup_restore_outlined,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
I18nText(
|
||||||
|
'appInfoView.unpatchButton',
|
||||||
|
child: Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.primary,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
VerticalDivider(
|
|
||||||
color: Theme.of(context).canvasColor,
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
onTap: () =>
|
|
||||||
model.showUninstallAlertDialog(context, app),
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.delete_outline,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
I18nText(
|
|
||||||
'appInfoView.uninstallButton',
|
|
||||||
child: Text(
|
|
||||||
'',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
VerticalDivider(
|
|
||||||
color: Theme.of(context).canvasColor,
|
|
||||||
),
|
|
||||||
InkWell(
|
|
||||||
onTap: () {
|
|
||||||
model.navigateToPatcher(app);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Icon(
|
|
||||||
Icons.build_outlined,
|
|
||||||
color:
|
|
||||||
Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
I18nText(
|
|
||||||
'appInfoView.patchButton',
|
|
||||||
child: Text(
|
|
||||||
'',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.colorScheme
|
|
||||||
.primary,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'appInfoView.packageNameLabel',
|
'appInfoView.packageNameLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@@ -175,7 +262,24 @@ class AppInfoView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
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(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'appInfoView.installTypeLabel',
|
'appInfoView.installTypeLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@@ -192,7 +296,8 @@ class AppInfoView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'appInfoView.patchedDateLabel',
|
'appInfoView.patchedDateLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@@ -213,7 +318,8 @@ class AppInfoView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'appInfoView.appliedPatchesLabel',
|
'appInfoView.appliedPatchesLabel',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
|||||||
@@ -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_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
@@ -7,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';
|
||||||
|
|
||||||
@@ -18,17 +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) 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) {
|
||||||
|
await DeviceApps.uninstallApp(app.packageName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DeviceApps.uninstallApp(app.packageName);
|
isUninstalled = await DeviceApps.uninstallApp(app.packageName);
|
||||||
_managerAPI.deletePatchedApp(app);
|
}
|
||||||
|
if (isUninstalled) {
|
||||||
|
await _managerAPI.deletePatchedApp(app);
|
||||||
|
locator<HomeViewModel>().initialize(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,53 +53,64 @@ class AppInfoViewModel extends BaseViewModel {
|
|||||||
locator<NavigationViewModel>().setIndex(1);
|
locator<NavigationViewModel>().setIndex(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showUninstallAlertDialog(
|
void updateNotImplemented(BuildContext context) {
|
||||||
|
_toast.show('appInfoView.updateNotImplemented');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> showUninstallDialog(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
PatchedApplication app,
|
PatchedApplication app,
|
||||||
|
bool onlyUnpatch,
|
||||||
) async {
|
) async {
|
||||||
if (app.isRooted) {
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
if (app.isRooted && !hasRootPermissions) {
|
||||||
if (!hasRootPermissions) {
|
|
||||||
return showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => AlertDialog(
|
|
||||||
title: I18nText('appInfoView.rootDialogTitle'),
|
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
content: I18nText('appInfoView.rootDialogText'),
|
|
||||||
actions: <Widget>[
|
|
||||||
CustomMaterialButton(
|
|
||||||
label: I18nText('okButton'),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: I18nText('appInfoView.uninstallDialogTitle'),
|
title: I18nText('appInfoView.rootDialogTitle'),
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
content: I18nText('appInfoView.uninstallDialogText'),
|
content: I18nText('appInfoView.rootDialogText'),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
CustomMaterialButton(
|
|
||||||
isFilled: false,
|
|
||||||
label: I18nText('cancelButton'),
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
),
|
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: I18nText('okButton'),
|
label: I18nText('okButton'),
|
||||||
onPressed: () {
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
uninstallApp(app);
|
|
||||||
locator<HomeViewModel>().initialize(context);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
if (onlyUnpatch) {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => AlertDialog(
|
||||||
|
title: I18nText(
|
||||||
|
'appInfoView.unpatchButton',
|
||||||
|
),
|
||||||
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
content: I18nText(
|
||||||
|
'appInfoView.unpatchDialogText',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
isFilled: false,
|
||||||
|
label: I18nText('noButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('yesButton'),
|
||||||
|
onPressed: () {
|
||||||
|
uninstallApp(context, app, onlyUnpatch);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
uninstallApp(context, app, onlyUnpatch);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,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'),
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class AppSkeletonLoader extends StatelessWidget {
|
|||||||
return Skeleton(
|
return Skeleton(
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
skeleton: ListView.builder(
|
skeleton: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
itemCount: 7,
|
itemCount: 7,
|
||||||
itemBuilder: (context, index) => Padding(
|
itemBuilder: (context, index) => Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8.0),
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8.0),
|
||||||
|
|||||||
@@ -6,12 +6,14 @@ class InstalledAppItem extends StatefulWidget {
|
|||||||
final String name;
|
final String name;
|
||||||
final String pkgName;
|
final String pkgName;
|
||||||
final Uint8List icon;
|
final Uint8List icon;
|
||||||
|
final Function()? onTap;
|
||||||
|
|
||||||
const InstalledAppItem({
|
const InstalledAppItem({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.pkgName,
|
required this.pkgName,
|
||||||
required this.icon,
|
required this.icon,
|
||||||
|
this.onTap,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -24,6 +26,7 @@ class _InstalledAppItemState extends State<InstalledAppItem> {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: CustomCard(
|
child: CustomCard(
|
||||||
|
onTap: widget.onTap,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -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'),
|
||||||
@@ -71,7 +71,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
|||||||
future: locator<HomeViewModel>().hasManagerUpdates(),
|
future: locator<HomeViewModel>().hasManagerUpdates(),
|
||||||
initialData: false,
|
initialData: false,
|
||||||
builder: (context, snapshot) => Opacity(
|
builder: (context, snapshot) => Opacity(
|
||||||
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.5,
|
opacity: snapshot.hasData && snapshot.data! ? 1.0 : 0.25,
|
||||||
child: CustomMaterialButton(
|
child: CustomMaterialButton(
|
||||||
isExpanded: false,
|
isExpanded: false,
|
||||||
label: I18nText('latestCommitCard.updateButton'),
|
label: I18nText('latestCommitCard.updateButton'),
|
||||||
|
|||||||
@@ -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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class GradientProgressIndicator extends StatefulWidget {
|
||||||
|
final double? progress;
|
||||||
|
const GradientProgressIndicator({required this.progress, super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GradientProgressIndicator> createState() =>
|
||||||
|
_GradientProgressIndicatorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GradientProgressIndicatorState extends State<GradientProgressIndicator> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Align(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
child: AnimatedContainer(
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
gradient: LinearGradient(
|
||||||
|
colors: [
|
||||||
|
Theme.of(context).colorScheme.primary,
|
||||||
|
Theme.of(context).colorScheme.secondary,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
height: 5,
|
||||||
|
width: MediaQuery.of(context).size.width * widget.progress!,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,53 +15,60 @@ class AppSelectorCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return CustomCard(
|
||||||
onTap: onPressed,
|
onTap: onPressed,
|
||||||
child: CustomCard(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
I18nText(
|
||||||
I18nText(
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
? 'appSelectorCard.widgetTitle'
|
||||||
? 'appSelectorCard.widgetTitle'
|
: 'appSelectorCard.widgetTitleSelected',
|
||||||
: 'appSelectorCard.widgetTitleSelected',
|
child: const Text(
|
||||||
child: const Text(
|
'',
|
||||||
'',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 18,
|
||||||
fontSize: 18,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
const SizedBox(height: 8),
|
||||||
? I18nText('appSelectorCard.widgetSubtitle')
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
: Row(
|
? I18nText('appSelectorCard.widgetSubtitle')
|
||||||
children: <Widget>[
|
: Row(
|
||||||
SizedBox(
|
children: <Widget>[
|
||||||
height: 16.0,
|
SizedBox(
|
||||||
child: ClipOval(
|
height: 18.0,
|
||||||
child: Image.memory(
|
child: ClipOval(
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
child: Image.memory(
|
||||||
? Uint8List(0)
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
: locator<PatcherViewModel>().selectedApp!.icon,
|
? Uint8List(0)
|
||||||
fit: BoxFit.cover,
|
: locator<PatcherViewModel>().selectedApp!.icon,
|
||||||
),
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
),
|
||||||
Text(_getAppSelection()),
|
const SizedBox(width: 6),
|
||||||
],
|
Text(
|
||||||
),
|
locator<PatcherViewModel>()
|
||||||
],
|
.getAppSelectionString(),
|
||||||
),
|
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
|
? Container()
|
||||||
|
: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 4),
|
||||||
|
Text(
|
||||||
|
locator<PatcherViewModel>()
|
||||||
|
.getRecommendedVersionString(context),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getAppSelection() {
|
|
||||||
String name = locator<PatcherViewModel>().selectedApp!.name;
|
|
||||||
String version = locator<PatcherViewModel>().selectedApp!.version;
|
|
||||||
return '$name (v$version)';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,32 +15,30 @@ class PatchSelectorCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return CustomCard(
|
||||||
onTap: onPressed,
|
onTap: onPressed,
|
||||||
child: CustomCard(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
I18nText(
|
||||||
I18nText(
|
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||||
locator<PatcherViewModel>().selectedPatches.isEmpty
|
? 'patchSelectorCard.widgetTitle'
|
||||||
? 'patchSelectorCard.widgetTitle'
|
: 'patchSelectorCard.widgetTitleSelected',
|
||||||
: 'patchSelectorCard.widgetTitleSelected',
|
child: const Text(
|
||||||
child: const Text(
|
'',
|
||||||
'',
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: 18,
|
||||||
fontSize: 18,
|
fontWeight: FontWeight.w500,
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
const SizedBox(height: 4),
|
||||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||||
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||||
: Text(_getPatchesSelection()),
|
? I18nText('patchSelectorCard.widgetEmptySubtitle')
|
||||||
],
|
: Text(_getPatchesSelection()),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -48,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,9 @@
|
|||||||
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/app/app.locator.dart';
|
||||||
|
import 'package:revanced_manager/services/manager_api.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/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
|
|
||||||
// ignore: must_be_immutable
|
// ignore: must_be_immutable
|
||||||
@@ -15,6 +18,8 @@ class PatchItem extends StatefulWidget {
|
|||||||
bool isSelected;
|
bool isSelected;
|
||||||
final Function(bool) onChanged;
|
final Function(bool) onChanged;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
|
final toast = locator<Toast>();
|
||||||
|
final _managerAPI = locator<ManagerAPI>();
|
||||||
|
|
||||||
PatchItem(
|
PatchItem(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
@@ -39,102 +44,136 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: InkWell(
|
child: CustomCard(
|
||||||
borderRadius: BorderRadius.circular(16),
|
backgroundColor: widget.isUnsupported &&
|
||||||
|
widget._managerAPI.areExperimentalPatchesEnabled() == false
|
||||||
|
? Theme.of(context).colorScheme.brightness == Brightness.light
|
||||||
|
? Colors.grey[400]
|
||||||
|
: Colors.grey[700]
|
||||||
|
: null,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() => widget.isSelected = !widget.isSelected);
|
setState(() {
|
||||||
|
if (widget.isUnsupported &&
|
||||||
|
!widget._managerAPI.areExperimentalPatchesEnabled()
|
||||||
|
) {
|
||||||
|
widget.isSelected = false;
|
||||||
|
widget.toast.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
|
} else {
|
||||||
|
widget.isSelected = !widget.isSelected;
|
||||||
|
}
|
||||||
|
});
|
||||||
widget.onChanged(widget.isSelected);
|
widget.onChanged(widget.isSelected);
|
||||||
},
|
},
|
||||||
child: CustomCard(
|
child: Column(
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Row(
|
||||||
Row(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Flexible(
|
||||||
Flexible(
|
child: Column(
|
||||||
child: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Row(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Text(
|
||||||
Text(
|
widget.simpleName,
|
||||||
widget.simpleName,
|
maxLines: 2,
|
||||||
style: const TextStyle(
|
overflow: TextOverflow.visible,
|
||||||
fontSize: 16,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w600,
|
fontSize: 16,
|
||||||
),
|
fontWeight: FontWeight.w600,
|
||||||
),
|
),
|
||||||
const SizedBox(width: 4),
|
),
|
||||||
Text(widget.version)
|
const SizedBox(width: 6),
|
||||||
],
|
Text(
|
||||||
),
|
widget.version,
|
||||||
const SizedBox(height: 4),
|
style: TextStyle(
|
||||||
Text(
|
fontSize: 16,
|
||||||
widget.description,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
softWrap: true,
|
),
|
||||||
maxLines: 3,
|
),
|
||||||
overflow: TextOverflow.visible,
|
],
|
||||||
style: const TextStyle(fontSize: 14),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Transform.scale(
|
|
||||||
scale: 1.2,
|
|
||||||
child: Checkbox(
|
|
||||||
value: widget.isSelected,
|
|
||||||
activeColor: Theme.of(context).colorScheme.primary,
|
|
||||||
checkColor:
|
|
||||||
Theme.of(context).colorScheme.secondaryContainer,
|
|
||||||
side: BorderSide(
|
|
||||||
width: 2.0,
|
|
||||||
color: Theme.of(context).colorScheme.primary,
|
|
||||||
),
|
),
|
||||||
onChanged: (newValue) {
|
const SizedBox(height: 4),
|
||||||
setState(() => widget.isSelected = newValue!);
|
Text(
|
||||||
widget.onChanged(widget.isSelected);
|
widget.description,
|
||||||
},
|
softWrap: true,
|
||||||
|
maxLines: 3,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 14,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Transform.scale(
|
||||||
|
scale: 1.2,
|
||||||
|
child: Checkbox(
|
||||||
|
value: widget.isSelected,
|
||||||
|
activeColor: Theme.of(context).colorScheme.primary,
|
||||||
|
checkColor:
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
side: BorderSide(
|
||||||
|
width: 2.0,
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
)
|
onChanged: (newValue) {
|
||||||
],
|
setState(() {
|
||||||
),
|
if (widget.isUnsupported &&
|
||||||
widget.isUnsupported
|
!widget._managerAPI.areExperimentalPatchesEnabled()
|
||||||
? Row(
|
) {
|
||||||
children: <Widget>[
|
widget.isSelected = false;
|
||||||
Padding(
|
widget.toast
|
||||||
padding: const EdgeInsets.only(top: 8),
|
.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
child: TextButton.icon(
|
} else {
|
||||||
label:
|
widget.isSelected = newValue!;
|
||||||
I18nText('patchItem.unsupportedWarningButton'),
|
}
|
||||||
icon: const Icon(Icons.warning),
|
});
|
||||||
onPressed: () => _showUnsupportedWarningDialog(),
|
widget.onChanged(widget.isSelected);
|
||||||
style: ButtonStyle(
|
},
|
||||||
shape: MaterialStateProperty.all(
|
),
|
||||||
RoundedRectangleBorder(
|
)
|
||||||
borderRadius: BorderRadius.circular(12),
|
],
|
||||||
side: BorderSide(
|
),
|
||||||
width: 1,
|
widget.isUnsupported
|
||||||
color:
|
? Row(
|
||||||
Theme.of(context).colorScheme.secondary,
|
children: <Widget>[
|
||||||
),
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8),
|
||||||
|
child: TextButton.icon(
|
||||||
|
label: I18nText('patchItem.unsupportedWarningButton'),
|
||||||
|
icon: const Icon(Icons.warning, size: 20.0),
|
||||||
|
onPressed: () => _showUnsupportedWarningDialog(),
|
||||||
|
style: ButtonStyle(
|
||||||
|
shape: MaterialStateProperty.all(
|
||||||
|
RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
side: BorderSide(
|
||||||
|
width: 1,
|
||||||
|
color:
|
||||||
|
Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
backgroundColor: MaterialStateProperty.all(
|
),
|
||||||
Colors.transparent,
|
backgroundColor: MaterialStateProperty.all(
|
||||||
),
|
Colors.transparent,
|
||||||
foregroundColor: MaterialStateProperty.all(
|
),
|
||||||
Theme.of(context).colorScheme.secondary,
|
foregroundColor: MaterialStateProperty.all(
|
||||||
),
|
Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
)
|
],
|
||||||
: Container(),
|
)
|
||||||
widget.child ?? const SizedBox(),
|
: Container(),
|
||||||
],
|
widget.child ?? const SizedBox(),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -151,7 +190,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>[
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ import 'package:revanced_manager/utils/about_info.dart';
|
|||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
class AboutWidget extends StatefulWidget {
|
class AboutWidget extends StatefulWidget {
|
||||||
const AboutWidget({Key? key}) : super(key: key);
|
const AboutWidget({Key? key, this.padding}) : super(key: key);
|
||||||
|
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AboutWidget> createState() => _AboutWidgetState();
|
State<AboutWidget> createState() => _AboutWidgetState();
|
||||||
@@ -13,28 +15,15 @@ class AboutWidget extends StatefulWidget {
|
|||||||
class _AboutWidgetState extends State<AboutWidget> {
|
class _AboutWidgetState extends State<AboutWidget> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Padding(
|
return FutureBuilder<Map<String, dynamic>>(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
future: AboutInfo.getInfo(),
|
||||||
child: Column(
|
builder: (context, snapshot) {
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
return Padding(
|
||||||
children: <Widget>[
|
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||||
I18nText(
|
child: ListTile(
|
||||||
'settingsView.aboutLabel',
|
contentPadding: widget.padding ?? EdgeInsets.zero,
|
||||||
child: const Text(
|
onLongPress: snapshot.hasData
|
||||||
'',
|
? () {
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 4),
|
|
||||||
FutureBuilder<Map<String, dynamic>>(
|
|
||||||
future: AboutInfo.getInfo(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
return GestureDetector(
|
|
||||||
onLongPress: () {
|
|
||||||
Clipboard.setData(
|
Clipboard.setData(
|
||||||
ClipboardData(
|
ClipboardData(
|
||||||
text: 'Version: ${snapshot.data!['version']}\n'
|
text: 'Version: ${snapshot.data!['version']}\n'
|
||||||
@@ -50,8 +39,20 @@ class _AboutWidgetState extends State<AboutWidget> {
|
|||||||
Theme.of(context).colorScheme.secondary,
|
Theme.of(context).colorScheme.secondary,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
child: Column(
|
: null,
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.aboutLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: snapshot.hasData
|
||||||
|
? Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text(
|
Text(
|
||||||
@@ -61,6 +62,13 @@ class _AboutWidgetState extends State<AboutWidget> {
|
|||||||
fontWeight: FontWeight.w300,
|
fontWeight: FontWeight.w300,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
'Build: ${snapshot.data!['flavor']}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
),
|
||||||
|
),
|
||||||
Text(
|
Text(
|
||||||
'Model: ${snapshot.data!['model']}',
|
'Model: ${snapshot.data!['model']}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
@@ -83,15 +91,11 @@ class _AboutWidgetState extends State<AboutWidget> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
)
|
||||||
);
|
: const SizedBox(),
|
||||||
} else {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class CustomSwitchTile extends StatelessWidget {
|
|||||||
final Widget subtitle;
|
final Widget subtitle;
|
||||||
final bool value;
|
final bool value;
|
||||||
final Function(bool) onTap;
|
final Function(bool) onTap;
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
|
||||||
const CustomSwitchTile({
|
const CustomSwitchTile({
|
||||||
Key? key,
|
Key? key,
|
||||||
@@ -13,14 +14,16 @@ class CustomSwitchTile extends StatelessWidget {
|
|||||||
required this.subtitle,
|
required this.subtitle,
|
||||||
required this.value,
|
required this.value,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
|
this.padding,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: padding ?? EdgeInsets.zero,
|
||||||
title: title,
|
title: title,
|
||||||
subtitle: subtitle,
|
subtitle: subtitle,
|
||||||
|
onTap: () => onTap(!value),
|
||||||
trailing: CustomSwitch(
|
trailing: CustomSwitch(
|
||||||
value: value,
|
value: value,
|
||||||
onChanged: onTap,
|
onChanged: onTap,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class SettingsSection extends StatelessWidget {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(top: 16.0, bottom: 10.0),
|
padding: const EdgeInsets.only(top: 16.0, bottom: 10.0, left: 20.0),
|
||||||
child: I18nText(
|
child: I18nText(
|
||||||
title,
|
title,
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|||||||
@@ -5,18 +5,20 @@ class SettingsTileDialog extends StatelessWidget {
|
|||||||
final String title;
|
final String title;
|
||||||
final String subtitle;
|
final String subtitle;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
|
||||||
const SettingsTileDialog({
|
const SettingsTileDialog({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.subtitle,
|
required this.subtitle,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
|
this.padding,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: padding ?? EdgeInsets.zero,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
title,
|
title,
|
||||||
child: const Text(
|
child: const Text(
|
||||||
|
|||||||
52
lib/ui/widgets/settingsView/social_media_item.dart
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
class SocialMediaItem extends StatelessWidget {
|
||||||
|
final Widget? icon;
|
||||||
|
final Widget title;
|
||||||
|
final Widget? subtitle;
|
||||||
|
final String? url;
|
||||||
|
|
||||||
|
const SocialMediaItem({
|
||||||
|
Key? key,
|
||||||
|
this.icon,
|
||||||
|
required this.title,
|
||||||
|
this.subtitle,
|
||||||
|
this.url,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
|
||||||
|
contentPadding: EdgeInsets.zero,
|
||||||
|
leading: SizedBox(
|
||||||
|
width: 48.0,
|
||||||
|
child: Center(
|
||||||
|
child: icon,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
title: DefaultTextStyle(
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
|
),
|
||||||
|
child: title,
|
||||||
|
),
|
||||||
|
subtitle: subtitle != null
|
||||||
|
? DefaultTextStyle(
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
),
|
||||||
|
child: subtitle!,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
onTap: () => url != null
|
||||||
|
? launchUrl(
|
||||||
|
Uri.parse(url!),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,16 @@ import 'package:expandable/expandable.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:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/settingsView/social_media_item.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
|
||||||
class SocialMediaWidget extends StatelessWidget {
|
class SocialMediaWidget extends StatelessWidget {
|
||||||
const SocialMediaWidget({Key? key}) : super(key: key);
|
final EdgeInsetsGeometry? padding;
|
||||||
|
|
||||||
|
const SocialMediaWidget({
|
||||||
|
Key? key,
|
||||||
|
this.padding,
|
||||||
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -14,11 +19,13 @@ class SocialMediaWidget extends StatelessWidget {
|
|||||||
theme: ExpandableThemeData(
|
theme: ExpandableThemeData(
|
||||||
hasIcon: true,
|
hasIcon: true,
|
||||||
iconColor: Theme.of(context).iconTheme.color,
|
iconColor: Theme.of(context).iconTheme.color,
|
||||||
iconPadding: const EdgeInsets.symmetric(vertical: 16.0),
|
iconPadding: const EdgeInsets.symmetric(vertical: 16.0)
|
||||||
|
.add(padding ?? EdgeInsets.zero)
|
||||||
|
.resolve(Directionality.of(context)),
|
||||||
animationDuration: const Duration(milliseconds: 400),
|
animationDuration: const Duration(milliseconds: 400),
|
||||||
),
|
),
|
||||||
header: ListTile(
|
header: ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: padding ?? EdgeInsets.zero,
|
||||||
title: I18nText(
|
title: I18nText(
|
||||||
'socialMediaCard.widgetTitle',
|
'socialMediaCard.widgetTitle',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
@@ -31,169 +38,52 @@ class SocialMediaWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
subtitle: I18nText('socialMediaCard.widgetSubtitle'),
|
subtitle: I18nText('socialMediaCard.widgetSubtitle'),
|
||||||
),
|
),
|
||||||
expanded: CustomCard(
|
expanded: Padding(
|
||||||
child: Column(
|
padding: padding ?? EdgeInsets.zero,
|
||||||
children: <Widget>[
|
child: CustomCard(
|
||||||
ListTile(
|
child: Column(
|
||||||
contentPadding: EdgeInsets.zero,
|
children: const <Widget>[
|
||||||
leading: Padding(
|
SocialMediaItem(
|
||||||
padding: const EdgeInsets.all(8.0),
|
icon: FaIcon(FontAwesomeIcons.github),
|
||||||
child: FaIcon(
|
title: Text('GitHub'),
|
||||||
FontAwesomeIcons.github,
|
subtitle: Text('github.com/revanced'),
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
url: 'https://github.com/revanced',
|
||||||
),
|
|
||||||
),
|
),
|
||||||
title: Text(
|
SocialMediaItem(
|
||||||
'GitHub',
|
icon: FaIcon(FontAwesomeIcons.discord),
|
||||||
style: TextStyle(
|
title: Text('Discord'),
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
subtitle: Text('discord.gg/revanced'),
|
||||||
),
|
url: 'https://discord.gg/rF2YcEjcrT',
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
SocialMediaItem(
|
||||||
'github.com/revanced',
|
icon: FaIcon(FontAwesomeIcons.telegram),
|
||||||
style: TextStyle(
|
title: Text('Telegram'),
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
subtitle: Text('t.me/app_revanced'),
|
||||||
),
|
url: 'https://t.me/app_revanced',
|
||||||
),
|
),
|
||||||
onTap: () => launchUrl(
|
SocialMediaItem(
|
||||||
Uri.parse('https://github.com/revanced'),
|
icon: FaIcon(FontAwesomeIcons.reddit),
|
||||||
mode: LaunchMode.externalApplication,
|
title: Text('Reddit'),
|
||||||
|
subtitle: Text('r/revancedapp'),
|
||||||
|
url: 'https://reddit.com/r/revancedapp',
|
||||||
),
|
),
|
||||||
),
|
SocialMediaItem(
|
||||||
ListTile(
|
icon: FaIcon(FontAwesomeIcons.twitter),
|
||||||
contentPadding: EdgeInsets.zero,
|
title: Text('Twitter'),
|
||||||
leading: Padding(
|
subtitle: Text('@revancedapp'),
|
||||||
padding: const EdgeInsets.all(8.0).copyWith(left: 5),
|
url: 'https://twitter.com/revancedapp',
|
||||||
child: FaIcon(
|
|
||||||
FontAwesomeIcons.discord,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
title: Text(
|
SocialMediaItem(
|
||||||
'Discord',
|
icon: FaIcon(FontAwesomeIcons.youtube),
|
||||||
style: TextStyle(
|
title: Text('YouTube'),
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
subtitle: Text('youtube.com/revanced'),
|
||||||
),
|
url: 'https://youtube.com/revanced',
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
],
|
||||||
'discord.gg/revanced',
|
),
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => launchUrl(
|
|
||||||
Uri.parse('https://discord.gg/rF2YcEjcrT'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
leading: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: FaIcon(
|
|
||||||
FontAwesomeIcons.telegram,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'Telegram',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
't.me/app_revanced',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => launchUrl(
|
|
||||||
Uri.parse('https://t.me/app_revanced'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
leading: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: FaIcon(
|
|
||||||
FontAwesomeIcons.reddit,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'Reddit',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
'r/revancedapp',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => launchUrl(
|
|
||||||
Uri.parse('https://reddit.com/r/revancedapp'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
leading: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: FaIcon(
|
|
||||||
FontAwesomeIcons.twitter,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'Twitter',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
'@revancedapp',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => launchUrl(
|
|
||||||
Uri.parse('https://twitter.com/revancedapp'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
contentPadding: EdgeInsets.zero,
|
|
||||||
leading: Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: FaIcon(
|
|
||||||
FontAwesomeIcons.youtube,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
title: Text(
|
|
||||||
'YouTube',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
subtitle: Text(
|
|
||||||
'youtube.com/revanced',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => launchUrl(
|
|
||||||
Uri.parse('https://youtube.com/revanced'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
collapsed: Container(),
|
collapsed: const SizedBox(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
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';
|
||||||
|
|
||||||
class ApplicationItem extends StatelessWidget {
|
class ApplicationItem extends StatefulWidget {
|
||||||
final Uint8List icon;
|
final Uint8List icon;
|
||||||
final String name;
|
final String name;
|
||||||
final DateTime patchDate;
|
final DateTime patchDate;
|
||||||
@@ -25,67 +25,119 @@ class ApplicationItem extends StatelessWidget {
|
|||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
State<ApplicationItem> createState() => _ApplicationItemState();
|
||||||
return ExpandablePanel(
|
}
|
||||||
theme: const ExpandableThemeData(
|
|
||||||
hasIcon: false,
|
class _ApplicationItemState extends State<ApplicationItem>
|
||||||
animationDuration: Duration(milliseconds: 450),
|
with TickerProviderStateMixin {
|
||||||
),
|
late AnimationController _animationController;
|
||||||
header: CustomCard(
|
|
||||||
child: Row(
|
@override
|
||||||
children: <Widget>[
|
initState() {
|
||||||
SizedBox(
|
super.initState();
|
||||||
width: 60,
|
_animationController = AnimationController(
|
||||||
child: Image.memory(icon, height: 39, width: 39),
|
vsync: this,
|
||||||
),
|
duration: const Duration(milliseconds: 300),
|
||||||
const SizedBox(width: 4),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
name,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(format(patchDate)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const Spacer(),
|
|
||||||
Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: <Widget>[
|
|
||||||
CustomMaterialButton(
|
|
||||||
label: isUpdatableApp
|
|
||||||
? I18nText('applicationItem.patchButton')
|
|
||||||
: I18nText('applicationItem.infoButton'),
|
|
||||||
onPressed: onPressed,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
collapsed: const Text(''),
|
|
||||||
expanded: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.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 ${changelog.join('\n\u2022 ')}'),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_animationController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ExpandableController expController = ExpandableController();
|
||||||
|
return Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 16.0),
|
||||||
|
child: CustomCard(
|
||||||
|
onTap: () {
|
||||||
|
expController.toggle();
|
||||||
|
_animationController.isCompleted
|
||||||
|
? _animationController.reverse()
|
||||||
|
: _animationController.forward();
|
||||||
|
},
|
||||||
|
child: ExpandablePanel(
|
||||||
|
controller: expController,
|
||||||
|
theme: const ExpandableThemeData(
|
||||||
|
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
|
tapBodyToCollapse: false,
|
||||||
|
tapBodyToExpand: false,
|
||||||
|
tapHeaderToExpand: false,
|
||||||
|
hasIcon: false,
|
||||||
|
animationDuration: Duration(milliseconds: 450),
|
||||||
|
),
|
||||||
|
header: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
SizedBox(
|
||||||
|
width: 40,
|
||||||
|
child: Image.memory(widget.icon, height: 40, width: 40),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
Padding(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
collapsed: const SizedBox(),
|
||||||
|
expanded: Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 16.0, left: 4.0, right: 4.0, bottom: 4.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 ')}'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,30 +3,36 @@ import 'package:flutter/material.dart';
|
|||||||
class CustomCard extends StatelessWidget {
|
class CustomCard extends StatelessWidget {
|
||||||
final bool isFilled;
|
final bool isFilled;
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
final Function()? onTap;
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
const CustomCard({
|
const CustomCard(
|
||||||
Key? key,
|
{Key? key,
|
||||||
this.isFilled = true,
|
this.isFilled = true,
|
||||||
required this.child,
|
required this.child,
|
||||||
}) : super(key: key);
|
this.onTap,
|
||||||
|
this.padding,
|
||||||
|
this.backgroundColor})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Material(
|
||||||
decoration: BoxDecoration(
|
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
||||||
|
color: isFilled
|
||||||
|
? backgroundColor?.withOpacity(0.4) ??
|
||||||
|
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
||||||
|
: backgroundColor ?? Colors.transparent,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
child: InkWell(
|
||||||
|
onTap: onTap,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
color: isFilled
|
child: Padding(
|
||||||
? Theme.of(context).colorScheme.secondaryContainer
|
padding: padding ?? const EdgeInsets.all(20.0),
|
||||||
: Colors.transparent,
|
child: child,
|
||||||
border: isFilled
|
),
|
||||||
? null
|
|
||||||
: Border.all(
|
|
||||||
width: 1,
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
padding: const EdgeInsets.all(20),
|
|
||||||
child: child,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class DashboardChip extends StatelessWidget {
|
|||||||
color: isSelected
|
color: isSelected
|
||||||
? Theme.of(context).colorScheme.primary
|
? Theme.of(context).colorScheme.primary
|
||||||
: Theme.of(context).colorScheme.secondary,
|
: Theme.of(context).colorScheme.secondary,
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
|
selectedColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
|
|||||||
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,16 @@ class CustomSliverAppBar extends StatelessWidget {
|
|||||||
final Widget title;
|
final Widget title;
|
||||||
final List<Widget>? actions;
|
final List<Widget>? actions;
|
||||||
final PreferredSizeWidget? bottom;
|
final PreferredSizeWidget? bottom;
|
||||||
|
final bool isMainView;
|
||||||
|
final Function()? onBackButtonPressed;
|
||||||
|
|
||||||
const CustomSliverAppBar({
|
const CustomSliverAppBar({
|
||||||
Key? key,
|
Key? key,
|
||||||
required this.title,
|
required this.title,
|
||||||
this.actions,
|
this.actions,
|
||||||
this.bottom,
|
this.bottom,
|
||||||
|
this.isMainView = false,
|
||||||
|
this.onBackButtonPressed,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -19,16 +23,29 @@ class CustomSliverAppBar extends StatelessWidget {
|
|||||||
snap: false,
|
snap: false,
|
||||||
floating: false,
|
floating: false,
|
||||||
expandedHeight: 100.0,
|
expandedHeight: 100.0,
|
||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: !isMainView,
|
||||||
|
flexibleSpace: FlexibleSpaceBar(
|
||||||
|
titlePadding: EdgeInsets.only(
|
||||||
|
bottom: bottom != null ? 16.0 : 14.0,
|
||||||
|
left: isMainView ? 20.0 : 55.0,
|
||||||
|
),
|
||||||
|
title: title,
|
||||||
|
),
|
||||||
|
leading: isMainView
|
||||||
|
? null
|
||||||
|
: IconButton(
|
||||||
|
icon: Icon(
|
||||||
|
Icons.arrow_back,
|
||||||
|
color: Theme.of(context).textTheme.headline6!.color,
|
||||||
|
),
|
||||||
|
onPressed:
|
||||||
|
onBackButtonPressed ?? () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
backgroundColor: MaterialStateColor.resolveWith(
|
backgroundColor: MaterialStateColor.resolveWith(
|
||||||
(states) => states.contains(MaterialState.scrolledUnder)
|
(states) => states.contains(MaterialState.scrolledUnder)
|
||||||
? Theme.of(context).colorScheme.surface
|
? Theme.of(context).colorScheme.surface
|
||||||
: Theme.of(context).canvasColor,
|
: Theme.of(context).canvasColor,
|
||||||
),
|
),
|
||||||
flexibleSpace: FlexibleSpaceBar(
|
|
||||||
titlePadding: const EdgeInsets.only(bottom: 16.0, left: 20.0),
|
|
||||||
title: title,
|
|
||||||
),
|
|
||||||
actions: actions,
|
actions: actions,
|
||||||
bottom: bottom,
|
bottom: bottom,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class SearchBar extends StatefulWidget {
|
|||||||
|
|
||||||
class _SearchBarState extends State<SearchBar> {
|
class _SearchBarState extends State<SearchBar> {
|
||||||
final TextEditingController _textController = TextEditingController();
|
final TextEditingController _textController = TextEditingController();
|
||||||
bool _toggleSelectAll = true;
|
bool _toggleSelectAll = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:device_info_plus/device_info_plus.dart';
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
|
|
||||||
@@ -7,6 +8,7 @@ class AboutInfo {
|
|||||||
final info = await DeviceInfoPlugin().androidInfo;
|
final info = await DeviceInfoPlugin().androidInfo;
|
||||||
return {
|
return {
|
||||||
'version': packageInfo.version,
|
'version': packageInfo.version,
|
||||||
|
'flavor': kReleaseMode ? 'release' : 'debug',
|
||||||
'model': info.model,
|
'model': info.model,
|
||||||
'androidVersion': info.version.release,
|
'androidVersion': info.version.release,
|
||||||
'arch': info.supportedAbis.first
|
'arch': info.supportedAbis.first
|
||||||
|
|||||||
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;
|
||||||
|
}
|
||||||
33
pubspec.yaml
@@ -4,12 +4,13 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.2+2
|
version: 0.0.39+39
|
||||||
|
|
||||||
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
|
||||||
@@ -17,14 +18,18 @@ dependencies:
|
|||||||
device_apps:
|
device_apps:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/ponces/flutter_plugin_device_apps
|
url: https://github.com/ponces/flutter_plugin_device_apps
|
||||||
ref: appinfo-from-storage
|
ref: revanced-manager
|
||||||
device_info_plus: ^4.1.2
|
device_info_plus: ^4.1.2
|
||||||
dio: ^4.0.6
|
dio: ^4.0.6
|
||||||
|
dio_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
|
||||||
expandable: ^5.0.1
|
expandable: ^5.0.1
|
||||||
file_picker: ^5.0.1
|
file_picker:
|
||||||
|
git:
|
||||||
|
url: https://github.com/alexmercerind/flutter_file_picker
|
||||||
|
ref: master
|
||||||
flex_color_scheme: ^6.0.0
|
flex_color_scheme: ^6.0.0
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
@@ -47,10 +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
|
||||||
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
|
||||||
@@ -59,26 +69,25 @@ dependencies:
|
|||||||
stacked_services: ^0.9.3
|
stacked_services: ^0.9.3
|
||||||
stacked_themes: ^0.3.9
|
stacked_themes: ^0.3.9
|
||||||
timeago: ^3.2.2
|
timeago: ^3.2.2
|
||||||
|
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_icons:
|
|
||||||
android: true
|
|
||||||
ios: false
|
|
||||||
image_path: "assets/images/ic_launcher_round.png"
|
|
||||||
adaptive_icon_background: "#1B1B1B"
|
|
||||||
adaptive_icon_foreground: "assets/images/ic_launcher.png"
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- assets/i18n/
|
- assets/i18n/
|
||||||
|
- .env
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
import 'package:revanced_manager/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
|
||||||
expect(find.text('0'), findsOneWidget);
|
|
||||||
expect(find.text('1'), findsNothing);
|
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
|
||||||
expect(find.text('0'), findsNothing);
|
|
||||||
expect(find.text('1'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||