mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-18 23:16:50 +08:00
Compare commits
99 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 |
22
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
22
.github/ISSUE_TEMPLATE/bug-issue.yml
vendored
@ -20,14 +20,6 @@ body:
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Manager Branch
|
||||
options:
|
||||
- Flutter
|
||||
- Compose
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Bug description
|
||||
@ -112,3 +104,17 @@ body:
|
||||
description: Add additional context here.
|
||||
validations:
|
||||
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
|
||||
|
22
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
22
.github/ISSUE_TEMPLATE/feature-issue.yml
vendored
@ -12,14 +12,6 @@ body:
|
||||
- Other
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Manager Branch
|
||||
options:
|
||||
- Flutter
|
||||
- Compose
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Issue
|
||||
@ -44,3 +36,17 @@ body:
|
||||
description: Add additional context here.
|
||||
validations:
|
||||
required: false
|
||||
- type: checkboxes
|
||||
id: acknowledgements
|
||||
attributes:
|
||||
label: Acknowledgements
|
||||
description: Your issue will be closed if you haven't done these steps.
|
||||
options:
|
||||
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
|
||||
required: true
|
||||
- label: I have written a short but informative title.
|
||||
required: true
|
||||
- label: I filled out all of the requested information in this issue properly.
|
||||
required: true
|
||||
- label: The issue is related solely to the ReVanced Manager
|
||||
required: true
|
||||
|
6
.run/main.dart.run.xml
Normal file
6
.run/main.dart.run.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
|
||||
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
24
README.md
24
README.md
@ -5,16 +5,26 @@ The official ReVanced Manager based on Flutter.
|
||||
## 🔽 Download
|
||||
To download the Alpha version of Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file.
|
||||
|
||||
## 📝 Prerequisites
|
||||
1. Android 8 or higher
|
||||
2. Does not work on some armv7 devices
|
||||
3. [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases) required for YouTube and YouTube Music (Only for non-root)
|
||||
|
||||
## ⚠️ Disclaimer
|
||||
*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 [#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.
|
||||
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.
|
||||
|
||||
## ⚠️ 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.*
|
||||
|
||||
## Prerequisites
|
||||
1. Android 8 or higher.
|
||||
2. Does not work on armv7
|
||||
3. For YouTube and YouTube Music - Vanced MicroG(Only for non-root).
|
||||
## 🛠️ 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.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- lib/utils/env_class.g.dart
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
|
@ -71,9 +71,14 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
// ReVanced
|
||||
implementation "app.revanced:revanced-patcher:5.0.0"
|
||||
implementation "app.revanced:revanced-patcher:6.0.0"
|
||||
|
||||
// Signing & aligning
|
||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||
implementation("com.android.tools.build:apksig:7.2.2")
|
||||
|
||||
// MicroG cronet
|
||||
implementation("org.microg:cronet-common:$cronetVersion")
|
||||
implementation("org.microg:cronet-native:$cronetVersion")
|
||||
|
||||
}
|
||||
|
Binary file not shown.
BIN
android/app/src/main/jniLibs/arm64-v8a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/arm64-v8a/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/armeabi-v7a/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
android/app/src/main/jniLibs/x86_64/libaapt2.so
Normal file
BIN
android/app/src/main/jniLibs/x86_64/libaapt2.so
Normal file
Binary file not shown.
Binary file not shown.
@ -1,5 +1,6 @@
|
||||
package app.revanced.manager.flutter
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import androidx.annotation.NonNull
|
||||
@ -12,7 +13,7 @@ import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||
import app.revanced.patcher.logging.Logger
|
||||
import app.revanced.patcher.util.patch.impl.DexPatchBundle
|
||||
import app.revanced.patcher.util.patch.PatchBundle
|
||||
import dalvik.system.DexClassLoader
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.engine.FlutterEngine
|
||||
@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
|
||||
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 &&
|
||||
@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
|
||||
selectedPatches != null &&
|
||||
cacheDirPath != null &&
|
||||
mergeIntegrations != null &&
|
||||
resourcePatching != null &&
|
||||
keyStoreFilePath != null
|
||||
) {
|
||||
runPatcher(
|
||||
@ -67,14 +66,12 @@ class MainActivity : FlutterActivity() {
|
||||
selectedPatches,
|
||||
cacheDirPath,
|
||||
mergeIntegrations,
|
||||
resourcePatching,
|
||||
keyStoreFilePath
|
||||
)
|
||||
} else {
|
||||
result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
@ -91,7 +88,6 @@ class MainActivity : FlutterActivity() {
|
||||
selectedPatches: List<String>,
|
||||
cacheDirPath: String,
|
||||
mergeIntegrations: Boolean,
|
||||
resourcePatching: Boolean,
|
||||
keyStoreFilePath: String
|
||||
) {
|
||||
val originalFile = File(originalFilePath)
|
||||
@ -101,7 +97,10 @@ class MainActivity : FlutterActivity() {
|
||||
val integrations = File(integrationsPath)
|
||||
val keyStoreFile = File(keyStoreFilePath)
|
||||
|
||||
val patches = DexPatchBundle(
|
||||
Thread {
|
||||
try {
|
||||
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
|
||||
PatchBundle.Dex(
|
||||
patchBundleFilePath,
|
||||
DexClassLoader(
|
||||
patchBundleFilePath,
|
||||
@ -110,8 +109,10 @@ class MainActivity : FlutterActivity() {
|
||||
javaClass.classLoader
|
||||
)
|
||||
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
|
||||
} else {
|
||||
TODO("VERSION.SDK_INT < CUPCAKE")
|
||||
}
|
||||
|
||||
Thread {
|
||||
handler.post {
|
||||
installerChannel.invokeMethod(
|
||||
"update",
|
||||
@ -139,7 +140,6 @@ class MainActivity : FlutterActivity() {
|
||||
PatcherOptions(
|
||||
inputFile,
|
||||
cacheDirPath,
|
||||
resourcePatching,
|
||||
Aapt.binary(applicationContext).absolutePath,
|
||||
cacheDirPath,
|
||||
logger = ManagerLogger()
|
||||
@ -176,8 +176,9 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
patcher.addPatches(patches)
|
||||
patcher.applyPatches().forEach { (patch, res) ->
|
||||
patcher.executePatches().forEach { (patch, res) ->
|
||||
if (res.isSuccess) {
|
||||
val msg = "[success] $patch"
|
||||
handler.post {
|
||||
@ -192,7 +193,7 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
return@forEach
|
||||
}
|
||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!
|
||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
|
||||
handler.post {
|
||||
installerChannel.invokeMethod(
|
||||
"update",
|
||||
@ -240,7 +241,16 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
// 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(
|
||||
@ -252,10 +262,21 @@ class MainActivity : FlutterActivity() {
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
handler.post { result.success(null) }
|
||||
} 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"
|
||||
)
|
||||
)
|
||||
}
|
||||
.start()
|
||||
}
|
||||
handler.post { result.success(null) }
|
||||
}.start()
|
||||
}
|
||||
|
||||
inner class ManagerLogger : Logger {
|
||||
|
@ -1,4 +1,5 @@
|
||||
buildscript {
|
||||
ext.cronetVersion = '102.5005.125'
|
||||
ext.kotlin_version = '1.7.10'
|
||||
repositories {
|
||||
google()
|
||||
|
@ -16,6 +16,7 @@
|
||||
"patchedSubtitle": "Patched Applications",
|
||||
"updatesAvailable": "Updates available",
|
||||
"noUpdates": "No updates available",
|
||||
"WIP": "Work In Progress",
|
||||
"noInstallations": "No patched applications installed",
|
||||
"installed": "Installed",
|
||||
"updateDialogTitle": "Update Manager",
|
||||
@ -26,7 +27,8 @@
|
||||
"installingMessage": "Installing update...",
|
||||
"errorDownloadMessage": "Unable to download update",
|
||||
"errorInstallMessage": "Unable to install update",
|
||||
"noConnection": "No internet connection"
|
||||
"noConnection": "No internet connection",
|
||||
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||
},
|
||||
"applicationItem": {
|
||||
"patchButton": "Patch",
|
||||
@ -75,10 +77,12 @@
|
||||
"viewTitle": "Select patches",
|
||||
"searchBarHint": "Search patches",
|
||||
"doneButton": "Done",
|
||||
"noPatchesFound": "No patches found for the selected app"
|
||||
"noPatchesFound": "No patches found for the selected app",
|
||||
"selectAllPatchesWarningTitle": "Warning",
|
||||
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
|
||||
},
|
||||
"patchItem": {
|
||||
"unsupportedWarningButton": "Unsupported version",
|
||||
"unsupportedWarningButton": "Warning",
|
||||
"unsupportedDialogTitle": "Warning",
|
||||
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
||||
},
|
||||
@ -104,6 +108,7 @@
|
||||
"teamSectionTitle": "Team",
|
||||
"infoSectionTitle": "Info",
|
||||
"advancedSectionTitle": "Advanced",
|
||||
"logsSectionTitle": "Logs",
|
||||
"darkThemeLabel": "Dark Mode",
|
||||
"darkThemeHint": "Welcome to the Dark Side",
|
||||
"dynamicThemeLabel": "Material You",
|
||||
@ -128,7 +133,19 @@
|
||||
"apiURLHint": "Configure your custom API URL",
|
||||
"selectApiURL": "Select URL",
|
||||
"aboutLabel": "About",
|
||||
"snackbarMessage": "Copied to clipboard"
|
||||
"snackbarMessage": "Copied to clipboard",
|
||||
"sentryLabel": "Sentry Logging",
|
||||
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
|
||||
"restartAppForChanges": "Restart the app to apply changes",
|
||||
"deleteKeystoreLabel": "Delete keystore",
|
||||
"deleteKeystoreHint": "Delete the keystore used to sign the app",
|
||||
"deletedKeystore": "Keystore deleted",
|
||||
"deleteTempDirLabel": "Delete temp directory",
|
||||
"deleteTempDirHint": "Delete the temporary directory used to store temporary files",
|
||||
"deletedTempDir": "Temp directory deleted",
|
||||
"deleteLogsLabel": "Delete logs",
|
||||
"deleteLogsHint": "Delete collected manager logs",
|
||||
"deletedLogs": "Logs deleted"
|
||||
},
|
||||
"appInfoView": {
|
||||
"widgetTitle": "App Info",
|
||||
@ -140,13 +157,15 @@
|
||||
"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"
|
||||
"appliedPatchesHint": "{quantity} applied patches",
|
||||
"updateNotImplemented": "Update functionality not implemented yet"
|
||||
},
|
||||
"contributorsView": {
|
||||
"widgetTitle": "Contributors",
|
@ -1,3 +1,3 @@
|
||||
files:
|
||||
- source: /assets/i18n/en.json
|
||||
translation: /assets/i18n/%two_letters_code%.json
|
||||
translation: /assets/i18n/%locale_with_underscore%.json
|
||||
|
@ -9,6 +9,7 @@ import 'package:revanced_manager/services/revanced_api.dart';
|
||||
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_view.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 {
|
||||
@ -18,9 +19,34 @@ Future main() async {
|
||||
await locator<ManagerAPI>().initialize();
|
||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||
await locator<RevancedAPI>().initialize(apiUrl);
|
||||
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||
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());
|
||||
}
|
||||
|
||||
@ -35,7 +61,7 @@ class MyApp extends StatelessWidget {
|
||||
localizationsDelegates: [
|
||||
FlutterI18nDelegate(
|
||||
translationLoader: FileTranslationLoader(
|
||||
fallbackFile: 'en',
|
||||
fallbackFile: 'en_US',
|
||||
basePath: 'assets/i18n',
|
||||
),
|
||||
),
|
||||
|
@ -8,6 +8,7 @@ part 'patched_application.g.dart';
|
||||
class PatchedApplication {
|
||||
String name;
|
||||
String packageName;
|
||||
String originalPackageName;
|
||||
String version;
|
||||
final String apkFilePath;
|
||||
@JsonKey(
|
||||
@ -25,6 +26,7 @@ class PatchedApplication {
|
||||
PatchedApplication({
|
||||
required this.name,
|
||||
required this.packageName,
|
||||
required this.originalPackageName,
|
||||
required this.version,
|
||||
required this.apkFilePath,
|
||||
required this.icon,
|
||||
|
@ -5,15 +5,19 @@ import 'package:dio/dio.dart';
|
||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:native_dio_client/native_dio_client.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/utils/check_for_gms.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sentry_dio/sentry_dio.dart';
|
||||
|
||||
@lazySingleton
|
||||
class GithubAPI {
|
||||
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com'));
|
||||
late Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(days: 1),
|
||||
maxStale: const Duration(days: 7),
|
||||
const Duration(hours: 6),
|
||||
maxStale: const Duration(days: 1),
|
||||
);
|
||||
final Map<String, String> repoAppPath = {
|
||||
'com.google.android.youtube': 'youtube',
|
||||
@ -23,14 +27,40 @@ class GithubAPI {
|
||||
'com.zhiliaoapp.musically': 'tiktok',
|
||||
'de.dwd.warnapp': 'warnwetter',
|
||||
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
|
||||
'com.spotify.music': 'spotify',
|
||||
};
|
||||
|
||||
void initialize() {
|
||||
void initialize() async {
|
||||
try {
|
||||
bool isGMSInstalled = await checkForGMS();
|
||||
|
||||
if (!isGMSInstalled) {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
));
|
||||
print('GitHub API: Using default engine + $isGMSInstalled');
|
||||
} else {
|
||||
_dio = Dio(BaseOptions(
|
||||
baseUrl: 'https://api.github.com',
|
||||
))
|
||||
..httpClientAdapter = NativeAdapter();
|
||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
||||
}
|
||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||
_dio.addSentry(
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> clearAllCache() async {
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>?> _getLatestRelease(String repoName) async {
|
||||
@ -40,7 +70,8 @@ class GithubAPI {
|
||||
options: _cacheOptions,
|
||||
);
|
||||
return response.data;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -57,17 +88,21 @@ class GithubAPI {
|
||||
'/repos/$repoName/commits',
|
||||
queryParameters: {
|
||||
'path': path,
|
||||
'per_page': 3,
|
||||
'since': since.toIso8601String(),
|
||||
},
|
||||
options: _cacheOptions,
|
||||
);
|
||||
List<dynamic> commits = response.data;
|
||||
return commits
|
||||
.map((commit) =>
|
||||
(commit['commit']['message'] as String).split('\n')[0])
|
||||
.map(
|
||||
(commit) => (commit['commit']['message']).split('\n')[0] +
|
||||
' - ' +
|
||||
commit['commit']['author']['name'] +
|
||||
'\n' as String,
|
||||
)
|
||||
.toList();
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -86,7 +121,8 @@ class GithubAPI {
|
||||
);
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -100,7 +136,8 @@ class GithubAPI {
|
||||
List<dynamic> list = jsonDecode(f.readAsStringSync());
|
||||
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 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/revanced_api.dart';
|
||||
import 'package:revanced_manager/services/root_api.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@lazySingleton
|
||||
@ -19,7 +20,7 @@ class ManagerAPI {
|
||||
final String patcherRepo = 'revanced-patcher';
|
||||
final String cliRepo = 'revanced-cli';
|
||||
late SharedPreferences _prefs;
|
||||
String defaultApiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
|
||||
String defaultApiUrl = 'https://releases.rvcd.win/';
|
||||
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
||||
String defaultPatchesRepo = 'revanced/revanced-patches';
|
||||
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
||||
@ -81,6 +82,29 @@ class ManagerAPI {
|
||||
await _prefs.setBool('useDarkTheme', value);
|
||||
}
|
||||
|
||||
// bool isSentryEnabled() {
|
||||
// return _prefs.getBool('sentryEnabled') ?? true;
|
||||
// }
|
||||
|
||||
// Future<void> setSentryStatus(bool value) async {
|
||||
// await _prefs.setBool('sentryEnabled', value);
|
||||
// }
|
||||
|
||||
Future<void> deleteTempFolder() async {
|
||||
final Directory dir = Directory('/data/local/tmp/revanced-manager');
|
||||
if (await dir.exists()) {
|
||||
await dir.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deleteKeystore() async {
|
||||
final File keystore = File(
|
||||
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore');
|
||||
if (await keystore.exists()) {
|
||||
await keystore.delete();
|
||||
}
|
||||
}
|
||||
|
||||
List<PatchedApplication> getPatchedApps() {
|
||||
List<String> apps = _prefs.getStringList('patchedApps') ?? [];
|
||||
return apps.map((a) => PatchedApplication.fromJson(jsonDecode(a))).toList();
|
||||
@ -116,9 +140,13 @@ class ManagerAPI {
|
||||
await setPatchedApps(patchedApps);
|
||||
}
|
||||
|
||||
void clearAllData() {
|
||||
void clearAllData() async {
|
||||
try {
|
||||
_revancedAPI.clearAllCache();
|
||||
_githubAPI.clearAllCache();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||
@ -126,15 +154,21 @@ class ManagerAPI {
|
||||
}
|
||||
|
||||
Future<List<Patch>> getPatches() async {
|
||||
try {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
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 {
|
||||
try {
|
||||
String repoName = getPatchesRepo();
|
||||
if (repoName == defaultPatchesRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
@ -144,9 +178,14 @@ class ManagerAPI {
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> downloadIntegrations() async {
|
||||
try {
|
||||
String repoName = getIntegrationsRepo();
|
||||
if (repoName == defaultIntegrationsRepo) {
|
||||
return await _revancedAPI.getLatestReleaseFile(
|
||||
@ -156,6 +195,10 @@ class ManagerAPI {
|
||||
} else {
|
||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<File?> downloadManager() async {
|
||||
@ -177,6 +220,13 @@ class ManagerAPI {
|
||||
);
|
||||
}
|
||||
|
||||
Future<String?> getLatestPatchesVersion() async {
|
||||
return await _revancedAPI.getLatestReleaseVersion(
|
||||
'.json',
|
||||
defaultPatchesRepo,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getCurrentManagerVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
return packageInfo.version;
|
||||
@ -213,6 +263,7 @@ class ManagerAPI {
|
||||
PatchedApplication(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
originalPackageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: application.apkFilePath,
|
||||
icon: application.icon,
|
||||
@ -241,6 +292,7 @@ class ManagerAPI {
|
||||
PatchedApplication(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
originalPackageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: application.apkFilePath,
|
||||
icon: application.icon,
|
||||
@ -261,8 +313,10 @@ class ManagerAPI {
|
||||
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
|
||||
patchedApps.removeWhere((a) => toRemove.contains(a));
|
||||
for (PatchedApplication app in patchedApps) {
|
||||
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
|
||||
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
|
||||
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;
|
||||
@ -314,9 +368,19 @@ class ManagerAPI {
|
||||
newCommits = await _githubAPI.getCommits(
|
||||
packageName,
|
||||
getPatchesRepo(),
|
||||
DateTime(2022, 3, 20, 21, 06, 01),
|
||||
patchDate,
|
||||
);
|
||||
}
|
||||
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/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/root_api.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:share_extend/share_extend.dart';
|
||||
|
||||
@lazySingleton
|
||||
@ -18,6 +19,7 @@ class PatcherAPI {
|
||||
MethodChannel('app.revanced.manager.flutter/patcher');
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final RootAPI _rootAPI = RootAPI();
|
||||
late Directory _dataDir;
|
||||
late Directory _tmpDir;
|
||||
late File _keyStoreFile;
|
||||
List<Patch> _patches = [];
|
||||
@ -26,8 +28,9 @@ class PatcherAPI {
|
||||
Future<void> initialize() async {
|
||||
await _loadPatches();
|
||||
Directory appCache = await getTemporaryDirectory();
|
||||
_dataDir = await getExternalStorageDirectory() ?? appCache;
|
||||
_tmpDir = Directory('${appCache.path}/patcher');
|
||||
_keyStoreFile = File('${appCache.path}/revanced-manager.keystore');
|
||||
_keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
|
||||
cleanPatcher();
|
||||
}
|
||||
|
||||
@ -42,7 +45,8 @@ class PatcherAPI {
|
||||
if (_patches.isEmpty) {
|
||||
_patches = await _managerAPI.getPatches();
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_patches = List.empty();
|
||||
}
|
||||
}
|
||||
@ -61,7 +65,8 @@ class PatcherAPI {
|
||||
filteredApps.add(app);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -70,14 +75,10 @@ class PatcherAPI {
|
||||
}
|
||||
|
||||
Future<List<Patch>> getFilteredPatches(String packageName) async {
|
||||
String newPackageName = packageName.replaceFirst(
|
||||
'app.revanced.',
|
||||
'com.google.',
|
||||
);
|
||||
return _patches
|
||||
.where((patch) =>
|
||||
!patch.name.contains('settings') &&
|
||||
patch.compatiblePackages.any((pack) => pack.name == newPackageName))
|
||||
patch.compatiblePackages.any((pack) => pack.name == packageName))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@ -87,10 +88,21 @@ class PatcherAPI {
|
||||
.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) => dep.contains('integrations'),
|
||||
(dep) => dependencyNeedsIntegrations(dep),
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -115,6 +127,7 @@ class PatcherAPI {
|
||||
String packageName,
|
||||
String originalFilePath,
|
||||
) async {
|
||||
try {
|
||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||
if (hasRootPermissions) {
|
||||
originalFilePath = await _rootAPI.getOriginalFilePath(
|
||||
@ -123,6 +136,10 @@ class PatcherAPI {
|
||||
);
|
||||
}
|
||||
return originalFilePath;
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return originalFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> runPatcher(
|
||||
@ -131,7 +148,6 @@ class PatcherAPI {
|
||||
List<Patch> selectedPatches,
|
||||
) async {
|
||||
bool mergeIntegrations = await needsIntegrations(selectedPatches);
|
||||
bool resourcePatching = await needsResourcePatching(selectedPatches);
|
||||
bool includeSettings = await needsSettingsPatch(selectedPatches);
|
||||
if (includeSettings) {
|
||||
try {
|
||||
@ -143,7 +159,8 @@ class PatcherAPI {
|
||||
if (settingsPatch != null) {
|
||||
selectedPatches.add(settingsPatch);
|
||||
}
|
||||
} catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@ -153,6 +170,7 @@ class PatcherAPI {
|
||||
integrationsFile = await _managerAPI.downloadIntegrations();
|
||||
}
|
||||
if (patchBundleFile != null) {
|
||||
_dataDir.createSync();
|
||||
_tmpDir.createSync();
|
||||
Directory workDir = _tmpDir.createTempSync('tmp-');
|
||||
File inputFile = File('${workDir.path}/base.apk');
|
||||
@ -160,6 +178,7 @@ class PatcherAPI {
|
||||
_outFile = File('${workDir.path}/out.apk');
|
||||
Directory cacheDir = Directory('${workDir.path}/cache');
|
||||
cacheDir.createSync();
|
||||
try {
|
||||
await patcherChannel.invokeMethod(
|
||||
'runPatcher',
|
||||
{
|
||||
@ -175,10 +194,13 @@ class PatcherAPI {
|
||||
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
|
||||
'cacheDirPath': cacheDir.path,
|
||||
'mergeIntegrations': mergeIntegrations,
|
||||
'resourcePatching': resourcePatching,
|
||||
'keyStoreFilePath': _keyStoreFile.path,
|
||||
},
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
print(e);
|
||||
throw await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,7 +220,8 @@ class PatcherAPI {
|
||||
await AppInstaller.installApk(_outFile!.path);
|
||||
return await DeviceApps.isAppInstalled(patchedApp.packageName);
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -206,14 +229,19 @@ class PatcherAPI {
|
||||
}
|
||||
|
||||
void sharePatchedFile(String appName, String version) {
|
||||
try {
|
||||
if (_outFile != null) {
|
||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||
String newName = '$prefix-revanced_v$version.apk';
|
||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||
String newPath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||
String newPath =
|
||||
_outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||
File shareFile = _outFile!.copySync(newPath);
|
||||
ShareExtend.share(shareFile.path, 'file');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> sharePatcherLog(String logs) async {
|
||||
|
@ -1,28 +1,56 @@
|
||||
import 'dart:io';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:native_dio_client/native_dio_client.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/utils/check_for_gms.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:sentry_dio/sentry_dio.dart';
|
||||
|
||||
@lazySingleton
|
||||
class RevancedAPI {
|
||||
late Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final Options _cacheOptions = buildCacheOptions(
|
||||
const Duration(days: 1),
|
||||
maxStale: const Duration(days: 7),
|
||||
const Duration(hours: 6),
|
||||
maxStale: const Duration(days: 1),
|
||||
);
|
||||
|
||||
Future<void> initialize(String apiUrl) async {
|
||||
_dio = Dio(BaseOptions(baseUrl: apiUrl));
|
||||
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 {
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||
@ -34,7 +62,8 @@ class RevancedAPI {
|
||||
String name = repo['name'];
|
||||
contributors[name] = repo['contributors'];
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return {};
|
||||
}
|
||||
return contributors;
|
||||
@ -45,7 +74,8 @@ class RevancedAPI {
|
||||
var response = await _dio.get('/patches', options: _cacheOptions);
|
||||
List<dynamic> patches = response.data;
|
||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -62,7 +92,8 @@ class RevancedAPI {
|
||||
t['repository'] == repoName &&
|
||||
(t['name'] as String).endsWith(extension),
|
||||
);
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -79,7 +110,8 @@ class RevancedAPI {
|
||||
if (release != null) {
|
||||
return release['version'];
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -95,7 +127,8 @@ class RevancedAPI {
|
||||
String url = release['browser_download_url'];
|
||||
return await DefaultCacheManager().getSingleFile(url);
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -114,7 +147,8 @@ class RevancedAPI {
|
||||
DateTime timestamp = DateTime.parse(release['timestamp'] as String);
|
||||
return format(timestamp, locale: 'en_short');
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
@ -1,10 +1,21 @@
|
||||
import 'package:root/root.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
class RootAPI {
|
||||
final String _managerDirPath = '/data/local/tmp/revanced-manager';
|
||||
final String _postFsDataDirPath = '/data/adb/post-fs-data.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 {
|
||||
try {
|
||||
bool? isRooted = await Root.isRootAvailable();
|
||||
@ -13,7 +24,8 @@ class RootAPI {
|
||||
return isRooted != null && isRooted;
|
||||
}
|
||||
return false;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -66,7 +78,8 @@ class RootAPI {
|
||||
apps.removeWhere((pack) => pack.isEmpty);
|
||||
return apps.map((pack) => pack.trim()).toList();
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
return List.empty();
|
||||
@ -112,14 +125,15 @@ class RootAPI {
|
||||
await installApk(packageName, patchedFilePath);
|
||||
await mountApk(packageName, originalFilePath);
|
||||
return true;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> installServiceDScript(String packageName) async {
|
||||
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'
|
||||
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
||||
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
||||
|
@ -20,4 +20,15 @@ class Toast {
|
||||
gravity: t.ToastGravity.CENTER,
|
||||
);
|
||||
}
|
||||
|
||||
void showBottom(String text) {
|
||||
t.Fluttertoast.showToast(
|
||||
msg: FlutterI18n.translate(
|
||||
_fToast.context!,
|
||||
text,
|
||||
),
|
||||
toastLength: t.Toast.LENGTH_LONG,
|
||||
gravity: t.ToastGravity.BOTTOM,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
class AppSelectorViewModel extends BaseViewModel {
|
||||
@ -26,6 +27,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
originalPackageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: application.apkFilePath,
|
||||
icon: application.icon,
|
||||
@ -51,6 +53,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().selectedApp = PatchedApplication(
|
||||
name: application.appName,
|
||||
packageName: application.packageName,
|
||||
originalPackageName: application.packageName,
|
||||
version: application.versionName!,
|
||||
apkFilePath: result.files.single.path!,
|
||||
icon: application.icon,
|
||||
@ -61,7 +64,8 @@ class AppSelectorViewModel extends BaseViewModel {
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
}
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_toast.show('appSelectorView.errorMessage');
|
||||
}
|
||||
}
|
||||
|
@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.updatesAvailable'),
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(true);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.installed'),
|
||||
isSelected: !model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(false);
|
||||
},
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
DashboardChip(
|
||||
label: I18nText('homeView.updatesAvailable'),
|
||||
isSelected: model.showUpdatableApps,
|
||||
onSelected: (value) {
|
||||
model.toggleUpdatableApps(true);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
|
@ -15,7 +15,8 @@ import 'package:revanced_manager/services/patcher_api.dart';
|
||||
import 'package:revanced_manager/services/toast.dart';
|
||||
import 'package:revanced_manager/ui/views/navigation/navigation_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_services/stacked_services.dart';
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
@ -28,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
|
||||
final Toast _toast = locator<Toast>();
|
||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||
DateTime? _lastUpdate;
|
||||
bool showUpdatableApps = true;
|
||||
bool showUpdatableApps = false;
|
||||
List<PatchedApplication> patchedInstalledApps = [];
|
||||
List<PatchedApplication> patchedUpdatableApps = [];
|
||||
|
||||
@ -94,7 +95,8 @@ class HomeViewModel extends BaseViewModel {
|
||||
int currentVersionInt =
|
||||
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||
return latestVersionInt > currentVersionInt;
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -135,11 +137,16 @@ class HomeViewModel extends BaseViewModel {
|
||||
} else {
|
||||
_toast.show('homeView.errorDownloadMessage');
|
||||
}
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_toast.show('homeView.errorInstallMessage');
|
||||
}
|
||||
}
|
||||
|
||||
void updatesAreDisabled() {
|
||||
_toast.show('homeView.updatesDisabled');
|
||||
}
|
||||
|
||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||
return showDialog(
|
||||
context: parentContext,
|
||||
@ -176,7 +183,7 @@ class HomeViewModel extends BaseViewModel {
|
||||
Future<void> forceRefresh(BuildContext context) async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
if (_lastUpdate == null ||
|
||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 60) {
|
||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 2) {
|
||||
_managerAPI.clearAllData();
|
||||
}
|
||||
initialize(context);
|
||||
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:google_fonts/google_fonts.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_popup_menu.dart';
|
||||
@ -18,6 +18,8 @@ class InstallerView extends StatelessWidget {
|
||||
onModelReady: (model) => model.initialize(context),
|
||||
viewModelBuilder: () => InstallerViewModel(),
|
||||
builder: (context, model, child) => WillPopScope(
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Scaffold(
|
||||
body: CustomScrollView(
|
||||
controller: model.scrollController,
|
||||
@ -32,10 +34,11 @@ class InstallerView extends StatelessWidget {
|
||||
onBackButtonPressed: () => model.onWillPop(context),
|
||||
actions: <Widget>[
|
||||
Visibility(
|
||||
visible: !model.isPatching && !model.hasErrors,
|
||||
visible: !model.isPatching,
|
||||
child: CustomPopupMenu(
|
||||
onSelected: (value) => model.onMenuSelection(value),
|
||||
children: {
|
||||
if (!model.hasErrors)
|
||||
0: I18nText(
|
||||
'installerView.shareApkMenuOption',
|
||||
child: const Text(
|
||||
@ -106,7 +109,7 @@ class InstallerView extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: !model.isInstalled,
|
||||
visible: !model.isInstalled && model.isRooted,
|
||||
child: CustomMaterialButton(
|
||||
isFilled: false,
|
||||
label:
|
||||
@ -144,6 +147,7 @@ class InstallerView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
onWillPop: () => model.onWillPop(context),
|
||||
),
|
||||
);
|
||||
|
@ -1,3 +1,4 @@
|
||||
// ignore_for_file: use_build_context_synchronously
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -9,15 +10,18 @@ import 'package:revanced_manager/models/patch.dart';
|
||||
import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_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/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:wakelock/wakelock.dart';
|
||||
|
||||
class InstallerViewModel extends BaseViewModel {
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final RootAPI _rootAPI = RootAPI();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
|
||||
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
|
||||
@ -28,11 +32,13 @@ class InstallerViewModel extends BaseViewModel {
|
||||
double? progress = 0.0;
|
||||
String logs = '';
|
||||
String headerLogs = '';
|
||||
bool isRooted = false;
|
||||
bool isPatching = true;
|
||||
bool isInstalled = false;
|
||||
bool hasErrors = false;
|
||||
|
||||
Future<void> initialize(BuildContext context) async {
|
||||
isRooted = await _rootAPI.isRooted();
|
||||
if (await Permission.ignoreBatteryOptimizations.isGranted) {
|
||||
try {
|
||||
FlutterBackground.initialize(
|
||||
@ -52,7 +58,8 @@ class InstallerViewModel extends BaseViewModel {
|
||||
),
|
||||
),
|
||||
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@ -78,14 +85,20 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
void update(double value, String header, String log) {
|
||||
if (value > 0) {
|
||||
if (value >= 0.0) {
|
||||
progress = value;
|
||||
}
|
||||
isPatching = progress == 1.0 ? false : true;
|
||||
if (progress == 0.0) {
|
||||
if (value == 0.0) {
|
||||
logs = '';
|
||||
isPatching = true;
|
||||
isInstalled = false;
|
||||
hasErrors = false;
|
||||
} else if (value == 1.0) {
|
||||
isPatching = false;
|
||||
hasErrors = false;
|
||||
} else if (value == -100.0) {
|
||||
isPatching = false;
|
||||
hasErrors = true;
|
||||
}
|
||||
if (header.isNotEmpty) {
|
||||
headerLogs = header;
|
||||
@ -95,6 +108,9 @@ class InstallerViewModel extends BaseViewModel {
|
||||
logs += '\n';
|
||||
}
|
||||
logs += log;
|
||||
if (logs[logs.length - 1] == '\n') {
|
||||
logs = logs.substring(0, logs.length - 1);
|
||||
}
|
||||
Future.delayed(const Duration(milliseconds: 500)).then((value) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.maxScrollExtent,
|
||||
@ -107,6 +123,7 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<void> runPatcher() async {
|
||||
try {
|
||||
update(0.0, 'Initializing...', 'Initializing installer');
|
||||
if (_patches.isNotEmpty) {
|
||||
try {
|
||||
@ -116,26 +133,34 @@ class InstallerViewModel extends BaseViewModel {
|
||||
_app.apkFilePath,
|
||||
_patches,
|
||||
);
|
||||
} catch (e) {
|
||||
hasErrors = true;
|
||||
update(-1.0, 'Aborting...', 'An error occurred! Aborting\nError: $e');
|
||||
} 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 {
|
||||
hasErrors = true;
|
||||
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||
}
|
||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||
try {
|
||||
FlutterBackground.disableBackgroundExecution();
|
||||
} on Exception {
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
await Wakelock.disable();
|
||||
isPatching = false;
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void installResult(BuildContext context, bool installAsRoot) async {
|
||||
try {
|
||||
_app.isRooted = installAsRoot;
|
||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||
bool rootMicroG = installAsRoot && hasMicroG;
|
||||
@ -187,10 +212,17 @@ class InstallerViewModel extends BaseViewModel {
|
||||
await _managerAPI.savePatchedApp(_app);
|
||||
}
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void shareResult() {
|
||||
try {
|
||||
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void shareLog() {
|
||||
@ -198,10 +230,14 @@ class InstallerViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<void> cleanPatcher() async {
|
||||
try {
|
||||
_patcherAPI.cleanPatcher();
|
||||
locator<PatcherViewModel>().selectedApp = null;
|
||||
locator<PatcherViewModel>().selectedPatches.clear();
|
||||
locator<PatcherViewModel>().notifyListeners();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
void openApp() {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
@ -6,14 +5,16 @@ import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/app/app.router.dart';
|
||||
import 'package:revanced_manager/models/patch.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/installerView/custom_material_button.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:stacked_services/stacked_services.dart';
|
||||
|
||||
@lazySingleton
|
||||
class PatcherViewModel extends BaseViewModel {
|
||||
final NavigationService _navigationService = locator<NavigationService>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
PatchedApplication? selectedApp;
|
||||
List<Patch> selectedPatches = [];
|
||||
@ -39,13 +40,12 @@ class PatcherViewModel extends BaseViewModel {
|
||||
}
|
||||
|
||||
Future<bool> isValidPatchConfig() async {
|
||||
bool needsResourcePatching =
|
||||
await _patcherAPI.needsResourcePatching(selectedPatches);
|
||||
bool needsResourcePatching = await _patcherAPI.needsResourcePatching(
|
||||
selectedPatches,
|
||||
);
|
||||
if (needsResourcePatching && selectedApp != null) {
|
||||
Application? app = await DeviceApps.getApp(selectedApp!.packageName);
|
||||
if (app != null && app.isSplit) {
|
||||
return false;
|
||||
}
|
||||
bool isSplit = await _managerAPI.isSplitApk(selectedApp!);
|
||||
return !isSplit;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -55,6 +55,25 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
),
|
||||
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(
|
||||
@ -73,7 +92,12 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
||||
_query = searchQuery;
|
||||
});
|
||||
},
|
||||
onSelectAll: (value) => model.selectAllPatches(value),
|
||||
onSelectAll: (value) {
|
||||
if (value) {
|
||||
model.selectAllPatcherWarning(context);
|
||||
}
|
||||
model.selectAllPatches(value);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -1,20 +1,27 @@
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter_i18n/widgets/I18nText.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/models/patch.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/views/patcher/patcher_viewmodel.dart';
|
||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PatchesSelectorViewModel extends BaseViewModel {
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final List<Patch> patches = [];
|
||||
final List<Patch> selectedPatches =
|
||||
locator<PatcherViewModel>().selectedPatches;
|
||||
String? patchesVersion = '';
|
||||
|
||||
Future<void> initialize() async {
|
||||
getPatchesVersion();
|
||||
patches.addAll(await _patcherAPI.getFilteredPatches(
|
||||
locator<PatcherViewModel>().selectedApp!.packageName,
|
||||
locator<PatcherViewModel>().selectedApp!.originalPackageName,
|
||||
));
|
||||
patches.sort((a, b) => a.name.compareTo(b.name));
|
||||
notifyListeners();
|
||||
@ -35,6 +42,23 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
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) {
|
||||
selectedPatches.clear();
|
||||
if (isSelected) {
|
||||
@ -48,14 +72,19 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
||||
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) {
|
||||
return patches
|
||||
.where((patch) =>
|
||||
query.isEmpty ||
|
||||
query.length < 2 ||
|
||||
patch.name.toLowerCase().contains(
|
||||
query.toLowerCase(),
|
||||
))
|
||||
patch.name.toLowerCase().contains(query.toLowerCase()) ||
|
||||
patch.getSimpleName().toLowerCase().contains(query.toLowerCase()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
|
@ -136,9 +136,79 @@ class SettingsView extends StatelessWidget {
|
||||
subtitle: 'settingsView.sourcesLabelHint',
|
||||
onTap: () => model.showSourcesDialog(context),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.deleteKeystoreLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.deleteKeystoreHint'),
|
||||
onTap: () => model.deleteKeystore,
|
||||
),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.deleteTempDirLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.deleteTempDirHint'),
|
||||
onTap: () => model.deleteTempDir(),
|
||||
),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'settingsView.deleteLogsLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: I18nText('settingsView.deleteLogsHint'),
|
||||
onTap: () => model.deleteLogs(),
|
||||
),
|
||||
],
|
||||
),
|
||||
_settingsDivider,
|
||||
// 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>[
|
||||
|
@ -10,7 +10,8 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:revanced_manager/app/app.locator.dart';
|
||||
import 'package:revanced_manager/app/app.router.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:share_extend/share_extend.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
@ -23,6 +24,7 @@ const int ANDROID_12_SDK_VERSION = 31;
|
||||
class SettingsViewModel extends BaseViewModel {
|
||||
final NavigationService _navigationService = locator<NavigationService>();
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final Toast _toast = locator<Toast>();
|
||||
final TextEditingController _orgPatSourceController = TextEditingController();
|
||||
final TextEditingController _patSourceController = TextEditingController();
|
||||
final TextEditingController _orgIntSourceController = TextEditingController();
|
||||
@ -313,11 +315,42 @@ class SettingsViewModel extends BaseViewModel {
|
||||
);
|
||||
}
|
||||
|
||||
// bool isSentryEnabled() {
|
||||
// return _managerAPI.isSentryEnabled();
|
||||
// }
|
||||
|
||||
// void useSentry(bool value) {
|
||||
// _managerAPI.setSentryStatus(value);
|
||||
// _toast.showBottom('settingsView.restartAppForChanges');
|
||||
// notifyListeners();
|
||||
// }
|
||||
|
||||
void deleteKeystore() {
|
||||
_managerAPI.deleteKeystore();
|
||||
_toast.showBottom('settingsView.deletedKeystore');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
void deleteTempDir() {
|
||||
_managerAPI.deleteTempFolder();
|
||||
_toast.showBottom('settingsView.deletedTempDir');
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<int> getSdkVersion() async {
|
||||
AndroidDeviceInfo info = await DeviceInfoPlugin().androidInfo;
|
||||
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 {
|
||||
Directory appCache = await getTemporaryDirectory();
|
||||
Directory logDir = Directory('${appCache.path}/logs');
|
||||
|
@ -160,8 +160,9 @@ class AppInfoView extends StatelessWidget {
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
onTap: () {
|
||||
model.navigateToPatcher(app);
|
||||
Navigator.of(context).pop();
|
||||
model.updateNotImplemented(context);
|
||||
// model.navigateToPatcher(app);
|
||||
// Navigator.of(context).pop();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
@ -260,6 +261,22 @@ class AppInfoView extends StatelessWidget {
|
||||
subtitle: Text(app.packageName),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
title: I18nText(
|
||||
'appInfoView.originalPackageNameLabel',
|
||||
child: const Text(
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
subtitle: Text(app.originalPackageName),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ListTile(
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
|
@ -8,10 +8,11 @@ import 'package:revanced_manager/models/patched_application.dart';
|
||||
import 'package:revanced_manager/services/manager_api.dart';
|
||||
import 'package:revanced_manager/services/patcher_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/navigation/navigation_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:stacked/stacked.dart';
|
||||
|
||||
@ -19,6 +20,7 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
|
||||
final RootAPI _rootAPI = RootAPI();
|
||||
final Toast _toast = locator<Toast>();
|
||||
|
||||
Future<void> uninstallApp(
|
||||
BuildContext context,
|
||||
@ -51,6 +53,10 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
locator<NavigationViewModel>().setIndex(1);
|
||||
}
|
||||
|
||||
void updateNotImplemented(BuildContext context) {
|
||||
_toast.show('appInfoView.updateNotImplemented');
|
||||
}
|
||||
|
||||
Future<void> showUninstallDialog(
|
||||
BuildContext context,
|
||||
PatchedApplication app,
|
||||
@ -127,7 +133,8 @@ class AppInfoViewModel extends BaseViewModel {
|
||||
builder: (context) => AlertDialog(
|
||||
title: I18nText('appInfoView.appliedPatchesLabel'),
|
||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||
content: Text(getAppliedPatchesString(app.appliedPatches)),
|
||||
content: SingleChildScrollView(
|
||||
child: Text(getAppliedPatchesString(app.appliedPatches))),
|
||||
actions: <Widget>[
|
||||
CustomMaterialButton(
|
||||
label: I18nText('okButton'),
|
||||
|
@ -33,7 +33,7 @@ class _ContributorsCardState extends State<ContributorsCard> {
|
||||
'',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -14,8 +14,7 @@ class AvailableUpdatesCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return apps.isEmpty
|
||||
? CustomCard(
|
||||
return CustomCard(
|
||||
child: Center(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
@ -26,7 +25,7 @@ class AvailableUpdatesCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
I18nText(
|
||||
'homeView.noUpdates',
|
||||
'homeView.WIP',
|
||||
child: Text(
|
||||
'',
|
||||
textAlign: TextAlign.center,
|
||||
@ -38,24 +37,51 @@ class AvailableUpdatesCard extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: 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,
|
||||
onPressed: () =>
|
||||
locator<HomeViewModel>().navigateToPatcher(
|
||||
app,
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
);
|
||||
// return apps.isEmpty
|
||||
// ? CustomCard(
|
||||
// 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:revanced_manager/app/app.locator.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';
|
||||
|
||||
class LatestCommitCard extends StatefulWidget {
|
||||
@ -49,7 +49,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
I18nText('latestCommitCard.managerLabel'),
|
||||
|
@ -1,49 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMaterialButton extends StatelessWidget {
|
||||
final Widget label;
|
||||
final bool isFilled;
|
||||
final bool isExpanded;
|
||||
final Function()? onPressed;
|
||||
|
||||
const CustomMaterialButton({
|
||||
Key? key,
|
||||
required this.label,
|
||||
this.isFilled = true,
|
||||
this.isExpanded = false,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
isExpanded
|
||||
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
||||
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
),
|
||||
shape: MaterialStateProperty.all(
|
||||
StadiumBorder(
|
||||
side: isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
isFilled
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: label,
|
||||
);
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ class AppSelectorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 8),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('appSelectorCard.widgetSubtitle')
|
||||
: Row(
|
||||
@ -49,21 +49,21 @@ class AppSelectorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(locator<PatcherViewModel>().getAppSelectionString()),
|
||||
Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getAppSelectionString(),
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? Container()
|
||||
: Column(
|
||||
children: [
|
||||
const SizedBox(height: 10),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20),
|
||||
child: Text(
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
locator<PatcherViewModel>()
|
||||
.getRecommendedVersionString(context),
|
||||
style: const TextStyle(fontStyle: FontStyle.italic),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -32,7 +32,7 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
const SizedBox(height: 4),
|
||||
locator<PatcherViewModel>().selectedApp == null
|
||||
? I18nText('patchSelectorCard.widgetSubtitle')
|
||||
: locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||
@ -46,7 +46,7 @@ class PatchSelectorCard extends StatelessWidget {
|
||||
String _getPatchesSelection() {
|
||||
String text = '';
|
||||
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);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.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';
|
||||
|
||||
// ignore: must_be_immutable
|
||||
@ -58,13 +58,21 @@ class _PatchItemState extends State<PatchItem> {
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.simpleName,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(widget.version)
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
widget.version,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
@ -73,7 +81,10 @@ class _PatchItemState extends State<PatchItem> {
|
||||
softWrap: true,
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.visible,
|
||||
style: const TextStyle(fontSize: 14),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@ -104,12 +115,12 @@ class _PatchItemState extends State<PatchItem> {
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: TextButton.icon(
|
||||
label: I18nText('patchItem.unsupportedWarningButton'),
|
||||
icon: const Icon(Icons.warning),
|
||||
icon: const Icon(Icons.warning, size: 20.0),
|
||||
onPressed: () => _showUnsupportedWarningDialog(),
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(
|
||||
width: 1,
|
||||
color:
|
||||
@ -147,7 +158,7 @@ class _PatchItemState extends State<PatchItem> {
|
||||
translationParams: {
|
||||
'packageVersion': widget.packageVersion,
|
||||
'supportedVersions':
|
||||
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}',
|
||||
'\u2022 ${widget.supportedPackageVersions.reversed.join('\n\u2022 ')}',
|
||||
},
|
||||
),
|
||||
actions: <Widget>[
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'dart:typed_data';
|
||||
import 'package:flutter/material.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:expandable/expandable.dart';
|
||||
import 'package:timeago/timeago.dart';
|
||||
@ -50,7 +50,16 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
ExpandableController expController = ExpandableController();
|
||||
return ExpandablePanel(
|
||||
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)),
|
||||
@ -60,16 +69,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
hasIcon: false,
|
||||
animationDuration: Duration(milliseconds: 450),
|
||||
),
|
||||
header: Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16.0),
|
||||
child: CustomCard(
|
||||
onTap: () {
|
||||
expController.toggle();
|
||||
_animationController.isCompleted
|
||||
? _animationController.reverse()
|
||||
: _animationController.forward();
|
||||
},
|
||||
child: Row(
|
||||
header: Row(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 40,
|
||||
@ -82,8 +82,8 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
widget.name.length > 9
|
||||
? '${widget.name.substring(0, 9)}...'
|
||||
widget.name.length > 12
|
||||
? '${widget.name.substring(0, 12)}...'
|
||||
: widget.name,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
@ -96,13 +96,14 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
),
|
||||
const Spacer(),
|
||||
RotationTransition(
|
||||
turns:
|
||||
Tween(begin: 0.0, end: 0.50).animate(_animationController),
|
||||
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,
|
||||
@ -117,11 +118,10 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
collapsed: const SizedBox(),
|
||||
expanded: Padding(
|
||||
padding: const EdgeInsets.all(16.0).copyWith(top: 0.0),
|
||||
padding: const EdgeInsets.only(
|
||||
top: 16.0, left: 4.0, right: 4.0, bottom: 4.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
@ -137,6 +137,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
130
lib/ui/widgets/shared/custom_material_button.dart
Normal file
130
lib/ui/widgets/shared/custom_material_button.dart
Normal file
@ -0,0 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomMaterialButton extends StatelessWidget {
|
||||
final Widget label;
|
||||
final bool isFilled;
|
||||
final bool isExpanded;
|
||||
final Function()? onPressed;
|
||||
|
||||
const CustomMaterialButton({
|
||||
Key? key,
|
||||
required this.label,
|
||||
this.isFilled = true,
|
||||
this.isExpanded = false,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(
|
||||
isExpanded
|
||||
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
||||
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
||||
),
|
||||
shape: MaterialStateProperty.all(
|
||||
StadiumBorder(
|
||||
side: isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
isFilled
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: label,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ignore: must_be_immutable
|
||||
class TimerButton extends StatefulWidget {
|
||||
Widget label;
|
||||
bool isFilled;
|
||||
int seconds;
|
||||
final bool isRunning;
|
||||
final Function()? onTimerEnd;
|
||||
|
||||
TimerButton({
|
||||
Key? key,
|
||||
required this.seconds,
|
||||
required this.isRunning,
|
||||
required this.onTimerEnd,
|
||||
this.label = const Text(''),
|
||||
this.isFilled = true,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<TimerButton> createState() => _TimerButtonState();
|
||||
}
|
||||
|
||||
class _TimerButtonState extends State<TimerButton> {
|
||||
void timer(int seconds) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
if (seconds > 0) {
|
||||
setState(() {
|
||||
seconds--;
|
||||
});
|
||||
timer(seconds);
|
||||
} else {
|
||||
widget.onTimerEnd!();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//decrement seconds
|
||||
if (widget.isRunning) {
|
||||
timer(widget.seconds);
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext build) {
|
||||
return TextButton(
|
||||
style: ButtonStyle(
|
||||
shape: MaterialStateProperty.all(
|
||||
StadiumBorder(
|
||||
side: widget.isFilled
|
||||
? BorderSide.none
|
||||
: BorderSide(
|
||||
width: 1,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
),
|
||||
backgroundColor: MaterialStateProperty.all(
|
||||
widget.isFilled
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.transparent,
|
||||
),
|
||||
foregroundColor: MaterialStateProperty.all(
|
||||
widget.isFilled
|
||||
? Theme.of(context).colorScheme.surface
|
||||
: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
onPressed: widget.isRunning ? null : widget.onTimerEnd,
|
||||
child: Text(
|
||||
widget.isRunning ? '${widget.seconds}' : 'Install',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
10
lib/utils/check_for_gms.dart
Normal file
10
lib/utils/check_for_gms.dart
Normal file
@ -0,0 +1,10 @@
|
||||
// Check for google mobile services on device
|
||||
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
|
||||
Future<bool> checkForGMS() async {
|
||||
bool isGMSInstalled = true;
|
||||
isGMSInstalled = await DeviceApps.isAppInstalled('com.google.android.gms') ||
|
||||
await DeviceApps.isAppInstalled('com.android.vending');
|
||||
return isGMSInstalled;
|
||||
}
|
12
pubspec.yaml
12
pubspec.yaml
@ -4,12 +4,13 @@ homepage: https://github.com/revanced/revanced-manager
|
||||
|
||||
publish_to: 'none'
|
||||
|
||||
version: 0.0.18+18
|
||||
version: 0.0.36+36
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.5 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
sentry_flutter: ^6.12.2
|
||||
animations: ^2.0.4
|
||||
app_installer: ^1.1.0
|
||||
collection: ^1.16.0
|
||||
@ -20,6 +21,7 @@ dependencies:
|
||||
ref: revanced-manager
|
||||
device_info_plus: ^4.1.2
|
||||
dio: ^4.0.6
|
||||
dio_brotli_transformer: ^1.0.1
|
||||
dio_http_cache_lts: ^0.4.1
|
||||
dynamic_color: ^1.5.4
|
||||
dynamic_themes: ^1.1.0
|
||||
@ -50,6 +52,7 @@ dependencies:
|
||||
git:
|
||||
url: https://github.com/SuaMusica/logcat
|
||||
ref: feature/nullSafe
|
||||
native_dio_client: ^0.0.1-dev+1
|
||||
package_info_plus: ^1.4.3+1
|
||||
path_provider: ^2.0.11
|
||||
permission_handler: ^10.0.0
|
||||
@ -69,17 +72,22 @@ dependencies:
|
||||
timezone: ^0.8.0
|
||||
url_launcher: ^6.1.5
|
||||
wakelock: ^0.6.2
|
||||
sentry_dio: ^6.12.2
|
||||
flutter_dotenv: ^5.0.2
|
||||
|
||||
dev_dependencies:
|
||||
json_serializable: ^6.3.1
|
||||
build_runner: any
|
||||
flutter_launcher_icons: ^0.10.0
|
||||
flutter_lints: ^2.0.1
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
injectable_generator: ^1.5.4
|
||||
json_serializable: ^6.3.1
|
||||
|
||||
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- assets/i18n/
|
||||
- .env
|
||||
|
Reference in New Issue
Block a user