mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-23 19:21:03 +00:00
Compare commits
51 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30376c960f | ||
|
|
405147b1c5 | ||
|
|
d545dfe49b | ||
|
|
c571cf2c53 | ||
|
|
fd5d71e24d | ||
|
|
2c3809d2bc | ||
|
|
0fc8e7cbc8 | ||
|
|
787e47f634 | ||
|
|
dc47da75f2 | ||
|
|
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 |
45
.github/workflows/crowdin.yml
vendored
Normal file
45
.github/workflows/crowdin.yml
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
name: Sync Crowdin translations
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "flutter"
|
||||||
|
paths:
|
||||||
|
- "assets/i18n/en_US.json"
|
||||||
|
- ".github/workflows/crowdin.yml"
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 * * *" # daily
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
sync-crowdin:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Crowdin
|
||||||
|
uses: crowdin/github-action@1.0.4
|
||||||
|
with:
|
||||||
|
config: crowdin.yml
|
||||||
|
upload_translations: true
|
||||||
|
download_translations: true
|
||||||
|
push_translations: true
|
||||||
|
create_pull_request: false
|
||||||
|
localization_branch_name: i18n_flutter
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||||
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
|
|
||||||
|
# commented due to Manager not being ready for the translated files to be in the main branch
|
||||||
|
# - name: GitHub is so dumb i just cant
|
||||||
|
# run: |
|
||||||
|
# sudo chmod -R ugo+rwX .
|
||||||
|
|
||||||
|
# - name: Merge
|
||||||
|
# run: |
|
||||||
|
# git checkout flutter
|
||||||
|
# git add *
|
||||||
|
# git merge i18n_flutter
|
||||||
|
# git push
|
||||||
@@ -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`
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
patcher.addPatches(patches)
|
patcher.addPatches(patches)
|
||||||
patcher.executePatches().forEach { (patch, res) ->
|
patcher.executePatches().forEach { (patch, res) ->
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
val msg = "[success] $patch"
|
val msg = "Applied $patch"
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
@@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
}
|
}
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
|
val msg = "$patch failed.\nError:\n" + res.exceptionOrNull()!!.printStackTrace()
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
@@ -241,7 +241,16 @@ class MainActivity : FlutterActivity() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
|
|
||||||
|
// 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 {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.cronetVersion = '102.5005.125'
|
ext.cronetVersion = '102.5005.125'
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.7.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -13,20 +13,22 @@
|
|||||||
"homeView": {
|
"homeView": {
|
||||||
"widgetTitle": "Dashboard",
|
"widgetTitle": "Dashboard",
|
||||||
"updatesSubtitle": "Updates",
|
"updatesSubtitle": "Updates",
|
||||||
"patchedSubtitle": "Patched Applications",
|
"patchedSubtitle": "Patched applications",
|
||||||
"updatesAvailable": "Updates available",
|
"updatesAvailable": "Updates available",
|
||||||
"noUpdates": "No updates available",
|
"noUpdates": "No updates available",
|
||||||
|
"WIP": "Work in progress...",
|
||||||
"noInstallations": "No patched applications installed",
|
"noInstallations": "No patched applications installed",
|
||||||
"installed": "Installed",
|
"installed": "Installed",
|
||||||
"updateDialogTitle": "Update Manager",
|
"updateDialogTitle": "Update Manager",
|
||||||
"updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
|
"updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
|
||||||
"notificationTitle": "ReVanced Manager was updated",
|
"notificationTitle": "Update downloaded",
|
||||||
"notificationText": "Tap to open the app",
|
"notificationText": "Tap to install the update",
|
||||||
"downloadingMessage": "Downloading update...",
|
"downloadingMessage": "Downloading update...",
|
||||||
"installingMessage": "Installing update...",
|
"installingMessage": "Installing update...",
|
||||||
"errorDownloadMessage": "Unable to download update",
|
"errorDownloadMessage": "Unable to download update",
|
||||||
"errorInstallMessage": "Unable to install update",
|
"errorInstallMessage": "Unable to install update",
|
||||||
"noConnection": "No internet connection"
|
"noConnection": "No internet connection",
|
||||||
|
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||||
},
|
},
|
||||||
"applicationItem": {
|
"applicationItem": {
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
@@ -44,13 +46,13 @@
|
|||||||
"widgetTitle": "Patcher",
|
"widgetTitle": "Patcher",
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
"patchDialogTitle": "Warning",
|
"patchDialogTitle": "Warning",
|
||||||
"patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors may occur.\nAre you sure you want to proceed with patching a split base APK?"
|
"patchDialogText": "You have selected a resource patch and a split APK installation has been detected, so patching errors may occur.\nAre you sure you want to proceed?"
|
||||||
},
|
},
|
||||||
"appSelectorCard": {
|
"appSelectorCard": {
|
||||||
"widgetTitle": "Select application",
|
"widgetTitle": "Select an application",
|
||||||
"widgetTitleSelected": "Selected application",
|
"widgetTitleSelected": "Selected application",
|
||||||
"widgetSubtitle": "No application selected",
|
"widgetSubtitle": "No application selected",
|
||||||
"noAppsLabel": "No applications found.",
|
"noAppsLabel": "No applications found",
|
||||||
"currentVersion": "Current",
|
"currentVersion": "Current",
|
||||||
"recommendedVersion": "Recommended",
|
"recommendedVersion": "Recommended",
|
||||||
"anyVersion": "any"
|
"anyVersion": "any"
|
||||||
@@ -66,15 +68,17 @@
|
|||||||
"widgetSubtitle": "We are online!"
|
"widgetSubtitle": "We are online!"
|
||||||
},
|
},
|
||||||
"appSelectorView": {
|
"appSelectorView": {
|
||||||
"viewTitle": "Select application",
|
"viewTitle": "Select an application",
|
||||||
"searchBarHint": "Search applications",
|
"searchBarHint": "Search applications",
|
||||||
"storageButton": "Storage",
|
"storageButton": "Storage",
|
||||||
"errorMessage": "Unable to use selected application."
|
"errorMessage": "Unable to use selected application"
|
||||||
},
|
},
|
||||||
"patchesSelectorView": {
|
"patchesSelectorView": {
|
||||||
"viewTitle": "Select patches",
|
"viewTitle": "Select patches",
|
||||||
"searchBarHint": "Search patches",
|
"searchBarHint": "Search patches",
|
||||||
"doneButton": "Done",
|
"doneButton": "Done",
|
||||||
|
"loadPatchesSelection": "Load patches selection",
|
||||||
|
"noSavedPatches": "No saved patches for the selected app\nPress Done to save current selection",
|
||||||
"noPatchesFound": "No patches found for the selected app",
|
"noPatchesFound": "No patches found for the selected app",
|
||||||
"selectAllPatchesWarningTitle": "Warning",
|
"selectAllPatchesWarningTitle": "Warning",
|
||||||
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
|
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
|
||||||
@@ -82,7 +86,8 @@
|
|||||||
"patchItem": {
|
"patchItem": {
|
||||||
"unsupportedWarningButton": "Warning",
|
"unsupportedWarningButton": "Warning",
|
||||||
"unsupportedDialogTitle": "Warning",
|
"unsupportedDialogTitle": "Warning",
|
||||||
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nSupported versions:\n{supportedVersions}",
|
||||||
|
"unsupportedPatchVersion": "Patch is not supported for this app version. Enable experimental toggle in settings to proceed."
|
||||||
},
|
},
|
||||||
"installerView": {
|
"installerView": {
|
||||||
"widgetTitle": "Installer",
|
"widgetTitle": "Installer",
|
||||||
@@ -93,12 +98,13 @@
|
|||||||
"notificationTitle": "ReVanced Manager is patching",
|
"notificationTitle": "ReVanced Manager is patching",
|
||||||
"notificationText": "Tap to return to the installer",
|
"notificationText": "Tap to return to the installer",
|
||||||
"shareApkMenuOption": "Share APK",
|
"shareApkMenuOption": "Share APK",
|
||||||
|
"exportApkMenuOption": "Export APK",
|
||||||
"shareLogMenuOption": "Share log",
|
"shareLogMenuOption": "Share log",
|
||||||
"installErrorDialogTitle": "Error",
|
"installErrorDialogTitle": "Error",
|
||||||
"installErrorDialogText1": "Root install is not possible with the current patches selection.\nRepatch your app or choose non-root install.",
|
"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.",
|
"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.",
|
"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..."
|
"noExit": "Installer is still running, cannot exit..."
|
||||||
},
|
},
|
||||||
"settingsView": {
|
"settingsView": {
|
||||||
"widgetTitle": "Settings",
|
"widgetTitle": "Settings",
|
||||||
@@ -106,8 +112,9 @@
|
|||||||
"teamSectionTitle": "Team",
|
"teamSectionTitle": "Team",
|
||||||
"infoSectionTitle": "Info",
|
"infoSectionTitle": "Info",
|
||||||
"advancedSectionTitle": "Advanced",
|
"advancedSectionTitle": "Advanced",
|
||||||
"darkThemeLabel": "Dark Mode",
|
"logsSectionTitle": "Logs",
|
||||||
"darkThemeHint": "Welcome to the Dark Side",
|
"darkThemeLabel": "Dark mode",
|
||||||
|
"darkThemeHint": "Welcome to the dark side",
|
||||||
"dynamicThemeLabel": "Material You",
|
"dynamicThemeLabel": "Material You",
|
||||||
"dynamicThemeHint": "Enjoy an experience closer to your device",
|
"dynamicThemeHint": "Enjoy an experience closer to your device",
|
||||||
"languageLabel": "Language",
|
"languageLabel": "Language",
|
||||||
@@ -115,49 +122,76 @@
|
|||||||
"frenchOption": "French",
|
"frenchOption": "French",
|
||||||
"sourcesLabel": "Sources",
|
"sourcesLabel": "Sources",
|
||||||
"sourcesLabelHint": "Configure your custom sources",
|
"sourcesLabelHint": "Configure your custom sources",
|
||||||
"orgPatchesLabel": "Patches Organization",
|
"orgPatchesLabel": "Patches organization",
|
||||||
"sourcesPatchesLabel": "Patches Source",
|
"sourcesPatchesLabel": "Patches source",
|
||||||
"orgIntegrationsLabel": "Integrations Organization",
|
"orgIntegrationsLabel": "Integrations organization",
|
||||||
"sourcesIntegrationsLabel": "Integrations Source",
|
"sourcesIntegrationsLabel": "Integrations source",
|
||||||
"sourcesResetDialogTitle": "Reset",
|
"sourcesResetDialogTitle": "Reset",
|
||||||
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
|
||||||
"apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?",
|
"apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?",
|
||||||
"contributorsLabel": "Contributors",
|
"contributorsLabel": "Contributors",
|
||||||
"contributorsHint": "A list of contributors of ReVanced",
|
"contributorsHint": "A list of contributors of ReVanced",
|
||||||
"logsLabel": "Logs",
|
"logsLabel": "Logs",
|
||||||
"logsHint": "Share device debug logs",
|
"logsHint": "Share Manager's logs",
|
||||||
"apiURLLabel": "API URL",
|
"apiURLLabel": "API URL",
|
||||||
"apiURLHint": "Configure your custom API URL",
|
"apiURLHint": "Configure your custom API URL",
|
||||||
"selectApiURL": "Select URL",
|
"selectApiURL": "API URL",
|
||||||
|
"experimentalPatchesLabel": "Experimental patches support",
|
||||||
|
"experimentalPatchesHint": "Enable usage of unsupported patches in any app version",
|
||||||
|
"enabledExperimentalPatches": "Experimental patches support enabled",
|
||||||
|
"exportSectionTitle": "Import & export",
|
||||||
"aboutLabel": "About",
|
"aboutLabel": "About",
|
||||||
"snackbarMessage": "Copied to clipboard"
|
"snackbarMessage": "Copied to clipboard",
|
||||||
|
"sentryLabel": "Sentry logging",
|
||||||
|
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
|
||||||
|
"restartAppForChanges": "Restart the app to apply changes",
|
||||||
|
"deleteKeystoreLabel": "Delete keystore",
|
||||||
|
"deleteKeystoreHint": "Delete the keystore used to sign the app",
|
||||||
|
"deletedKeystore": "Keystore deleted",
|
||||||
|
"deleteTempDirLabel": "Delete temporary files",
|
||||||
|
"deleteTempDirHint": "Delete the unused temporary files",
|
||||||
|
"deletedTempDir": "Temporary files deleted",
|
||||||
|
"exportPatchesLabel": "Export patches selection",
|
||||||
|
"exportPatchesHint": "Export patches selection to a JSON file",
|
||||||
|
"exportedPatches": "Patches selection exported",
|
||||||
|
"noExportFileFound": "No patches selection to export",
|
||||||
|
"importPatchesLabel": "Import patches selection",
|
||||||
|
"importPatchesHint": "Import patches selection from a JSON file",
|
||||||
|
"importedPatches": "Patches selection imported",
|
||||||
|
"resetStoredPatchesLabel": "Reset patches",
|
||||||
|
"resetStoredPatchesHint": "Reset the stored patches selection",
|
||||||
|
"resetStoredPatches": "Patches selection has been reset",
|
||||||
|
"jsonSelectorErrorMessage": "Unable to use selected JSON file",
|
||||||
|
"deleteLogsLabel": "Delete logs",
|
||||||
|
"deleteLogsHint": "Delete collected manager logs",
|
||||||
|
"deletedLogs": "Logs deleted"
|
||||||
},
|
},
|
||||||
"appInfoView": {
|
"appInfoView": {
|
||||||
"widgetTitle": "App Info",
|
"widgetTitle": "App info",
|
||||||
"openButton": "Open",
|
"openButton": "Open",
|
||||||
"uninstallButton": "Uninstall",
|
"uninstallButton": "Uninstall",
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
"unpatchButton": "Unpatch",
|
"unpatchButton": "Unpatch",
|
||||||
"unpatchDialogText": "Are you sure you want to unpatch this app?",
|
"unpatchDialogText": "Are you sure you want to unpatch this app?",
|
||||||
"rootDialogTitle": "Error",
|
"rootDialogTitle": "Error",
|
||||||
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
|
"rootDialogText": "App was installed with superuser permissions, but currently ReVanced Manager has no permissions.\nPlease grant superuser permissions first.",
|
||||||
"packageNameLabel": "Package Name",
|
"packageNameLabel": "Package name",
|
||||||
"originalPackageNameLabel": "Original Package Name",
|
"originalPackageNameLabel": "Original package name",
|
||||||
"installTypeLabel": "Installation Type",
|
"installTypeLabel": "Installation type",
|
||||||
"rootTypeLabel": "Root",
|
"rootTypeLabel": "Root",
|
||||||
"nonRootTypeLabel": "Non-root",
|
"nonRootTypeLabel": "Non-root",
|
||||||
"patchedDateLabel": "Patched Date",
|
"patchedDateLabel": "Patched date",
|
||||||
"patchedDateHint": "{date} at {time}",
|
"patchedDateHint": "{date} at {time}",
|
||||||
"appliedPatchesLabel": "Applied Patches",
|
"appliedPatchesLabel": "Applied patches",
|
||||||
"appliedPatchesHint": "{quantity} applied patches",
|
"appliedPatchesHint": "{quantity} applied patches",
|
||||||
"updateNotImplemented": "Update functionality not implemented yet"
|
"updateNotImplemented": "This feature has not been implemented yet"
|
||||||
},
|
},
|
||||||
"contributorsView": {
|
"contributorsView": {
|
||||||
"widgetTitle": "Contributors",
|
"widgetTitle": "Contributors",
|
||||||
"patcherContributors": "Patcher Contributors",
|
"patcherContributors": "Patcher contributors",
|
||||||
"patchesContributors": "Patches Contributors",
|
"patchesContributors": "Patches contributors",
|
||||||
"integrationsContributors": "Integrations Contributors",
|
"integrationsContributors": "Integrations contributors",
|
||||||
"cliContributors": "CLI Contributors",
|
"cliContributors": "CLI contributors",
|
||||||
"managerContributors": "Manager Contributors"
|
"managerContributors": "Manager contributors"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
crowdin.yml
10
crowdin.yml
@@ -1,3 +1,9 @@
|
|||||||
|
project_id_env: CROWDIN_PROJECT_ID
|
||||||
|
api_token_env: CROWDIN_PERSONAL_TOKEN
|
||||||
|
|
||||||
|
commit_message: 'chore(i18n): sync translations'
|
||||||
|
|
||||||
|
preserve_hierarchy: true
|
||||||
files:
|
files:
|
||||||
- source: /assets/i18n/en.json
|
- source: assets/i18n/en_US.json
|
||||||
translation: /assets/i18n/%locale_with_underscore%.json
|
translation: assets/i18n/%locale_with_underscore%.json
|
||||||
@@ -9,6 +9,7 @@ import 'package:revanced_manager/services/revanced_api.dart';
|
|||||||
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
|
||||||
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
|
||||||
import 'package:stacked_themes/stacked_themes.dart';
|
import 'package:stacked_themes/stacked_themes.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:timezone/data/latest.dart' as tz;
|
import 'package:timezone/data/latest.dart' as tz;
|
||||||
|
|
||||||
Future main() async {
|
Future main() async {
|
||||||
@@ -18,9 +19,34 @@ Future main() async {
|
|||||||
await locator<ManagerAPI>().initialize();
|
await locator<ManagerAPI>().initialize();
|
||||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||||
await locator<RevancedAPI>().initialize(apiUrl);
|
await locator<RevancedAPI>().initialize(apiUrl);
|
||||||
|
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||||
locator<GithubAPI>().initialize();
|
locator<GithubAPI>().initialize();
|
||||||
await locator<PatcherAPI>().initialize();
|
await locator<PatcherAPI>().initialize();
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
|
|
||||||
|
// Remove this section if you are building from source and don't have sentry configured
|
||||||
|
// await SentryFlutter.init(
|
||||||
|
// (options) {
|
||||||
|
// options
|
||||||
|
// ..dsn = isSentryEnabled ? '' : ''
|
||||||
|
// ..environment = 'alpha'
|
||||||
|
// ..release = '0.1'
|
||||||
|
// ..tracesSampleRate = 1.0
|
||||||
|
// ..anrEnabled = true
|
||||||
|
// ..enableOutOfMemoryTracking = true
|
||||||
|
// ..sampleRate = isSentryEnabled ? 1.0 : 0.0
|
||||||
|
// ..beforeSend = (event, hint) {
|
||||||
|
// if (isSentryEnabled) {
|
||||||
|
// return event;
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
|
// } as BeforeSendCallback?;
|
||||||
|
// },
|
||||||
|
// appRunner: () {
|
||||||
|
// runApp(const MyApp());
|
||||||
|
// },
|
||||||
|
// );
|
||||||
runApp(const MyApp());
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:native_dio_client/native_dio_client.dart';
|
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/utils/check_for_gms.dart';
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
|
import 'package:sentry_dio/sentry_dio.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class GithubAPI {
|
class GithubAPI {
|
||||||
@@ -29,25 +29,26 @@ class GithubAPI {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void initialize() async {
|
void initialize() async {
|
||||||
bool isGMSInstalled = await checkForGMS();
|
try {
|
||||||
|
|
||||||
if (!isGMSInstalled) {
|
|
||||||
_dio = Dio(BaseOptions(
|
_dio = Dio(BaseOptions(
|
||||||
baseUrl: 'https://api.github.com',
|
baseUrl: 'https://api.github.com',
|
||||||
));
|
));
|
||||||
print('GitHub API: Using default engine + $isGMSInstalled');
|
|
||||||
} else {
|
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||||
_dio = Dio(BaseOptions(
|
_dio.addSentry(
|
||||||
baseUrl: 'https://api.github.com',
|
captureFailedRequests: true,
|
||||||
))
|
);
|
||||||
..httpClientAdapter = NativeAdapter();
|
} on Exception catch (e, s) {
|
||||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
@@ -57,7 +58,8 @@ class GithubAPI {
|
|||||||
options: _cacheOptions,
|
options: _cacheOptions,
|
||||||
);
|
);
|
||||||
return response.data;
|
return response.data;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +89,8 @@ class GithubAPI {
|
|||||||
'\n' as String,
|
'\n' as String,
|
||||||
)
|
)
|
||||||
.toList();
|
.toList();
|
||||||
} catch (e) {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,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;
|
||||||
@@ -120,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;
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ import 'dart:io';
|
|||||||
import 'package:device_apps/device_apps.dart';
|
import 'package:device_apps/device_apps.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
import 'package:package_info_plus/package_info_plus.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/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/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
|
||||||
@@ -18,8 +20,9 @@ class ManagerAPI {
|
|||||||
final RootAPI _rootAPI = RootAPI();
|
final RootAPI _rootAPI = RootAPI();
|
||||||
final String patcherRepo = 'revanced-patcher';
|
final String patcherRepo = 'revanced-patcher';
|
||||||
final String cliRepo = 'revanced-cli';
|
final String cliRepo = 'revanced-cli';
|
||||||
|
late String storedPatchesFile = '/selected-patches.json';
|
||||||
late SharedPreferences _prefs;
|
late SharedPreferences _prefs;
|
||||||
String defaultApiUrl = 'https://releases.rvcd.win/';
|
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';
|
||||||
@@ -28,6 +31,8 @@ class ManagerAPI {
|
|||||||
|
|
||||||
Future<void> initialize() async {
|
Future<void> initialize() async {
|
||||||
_prefs = await SharedPreferences.getInstance();
|
_prefs = await SharedPreferences.getInstance();
|
||||||
|
storedPatchesFile =
|
||||||
|
(await getApplicationDocumentsDirectory()).path + storedPatchesFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getApiUrl() {
|
String getApiUrl() {
|
||||||
@@ -81,6 +86,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();
|
||||||
@@ -116,9 +152,13 @@ class ManagerAPI {
|
|||||||
await setPatchedApps(patchedApps);
|
await setPatchedApps(patchedApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void clearAllData() {
|
void clearAllData() async {
|
||||||
_revancedAPI.clearAllCache();
|
try {
|
||||||
_githubAPI.clearAllCache();
|
_revancedAPI.clearAllCache();
|
||||||
|
_githubAPI.clearAllCache();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, List<dynamic>>> getContributors() async {
|
Future<Map<String, List<dynamic>>> getContributors() async {
|
||||||
@@ -126,35 +166,50 @@ class ManagerAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Patch>> getPatches() async {
|
Future<List<Patch>> getPatches() async {
|
||||||
String repoName = getPatchesRepo();
|
try {
|
||||||
if (repoName == defaultPatchesRepo) {
|
String repoName = getPatchesRepo();
|
||||||
return await _revancedAPI.getPatches();
|
if (repoName == defaultPatchesRepo) {
|
||||||
} else {
|
return await _revancedAPI.getPatches();
|
||||||
return await _githubAPI.getPatches(repoName);
|
} else {
|
||||||
|
return await _githubAPI.getPatches(repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> downloadPatches() async {
|
Future<File?> downloadPatches() async {
|
||||||
String repoName = getPatchesRepo();
|
try {
|
||||||
if (repoName == defaultPatchesRepo) {
|
String repoName = getPatchesRepo();
|
||||||
return await _revancedAPI.getLatestReleaseFile(
|
if (repoName == defaultPatchesRepo) {
|
||||||
'.jar',
|
return await _revancedAPI.getLatestReleaseFile(
|
||||||
defaultPatchesRepo,
|
'.jar',
|
||||||
);
|
defaultPatchesRepo,
|
||||||
} else {
|
);
|
||||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
} else {
|
||||||
|
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File?> downloadIntegrations() async {
|
Future<File?> downloadIntegrations() async {
|
||||||
String repoName = getIntegrationsRepo();
|
try {
|
||||||
if (repoName == defaultIntegrationsRepo) {
|
String repoName = getIntegrationsRepo();
|
||||||
return await _revancedAPI.getLatestReleaseFile(
|
if (repoName == defaultIntegrationsRepo) {
|
||||||
'.apk',
|
return await _revancedAPI.getLatestReleaseFile(
|
||||||
defaultIntegrationsRepo,
|
'.apk',
|
||||||
);
|
defaultIntegrationsRepo,
|
||||||
} else {
|
);
|
||||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
} else {
|
||||||
|
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,6 +232,13 @@ class ManagerAPI {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<String?> getLatestPatchesVersion() async {
|
||||||
|
return await _revancedAPI.getLatestReleaseVersion(
|
||||||
|
'.json',
|
||||||
|
defaultPatchesRepo,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<String> getCurrentManagerVersion() async {
|
Future<String> getCurrentManagerVersion() async {
|
||||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
return packageInfo.version;
|
return packageInfo.version;
|
||||||
@@ -333,4 +395,43 @@ class ManagerAPI {
|
|||||||
}
|
}
|
||||||
return app != null && app.isSplit;
|
return app != null && app.isSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> setSelectedPatches(String app, List<String> patches) async {
|
||||||
|
final File selectedPatchesFile = File(storedPatchesFile);
|
||||||
|
Map<String, dynamic> patchesMap = await readSelectedPatchesFile();
|
||||||
|
if (patches.isEmpty) {
|
||||||
|
patchesMap.remove(app);
|
||||||
|
} else {
|
||||||
|
patchesMap[app] = patches;
|
||||||
|
}
|
||||||
|
if (selectedPatchesFile.existsSync()) {
|
||||||
|
selectedPatchesFile.createSync(recursive: true);
|
||||||
|
}
|
||||||
|
selectedPatchesFile.writeAsString(jsonEncode(patchesMap));
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<String>> getSelectedPatches(String app) async {
|
||||||
|
Map<String, dynamic> patchesMap = await readSelectedPatchesFile();
|
||||||
|
if (patchesMap.isNotEmpty) {
|
||||||
|
final List<String> patches =
|
||||||
|
List.from(patchesMap.putIfAbsent(app, () => List.empty()));
|
||||||
|
return patches;
|
||||||
|
}
|
||||||
|
return List.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, dynamic>> readSelectedPatchesFile() async {
|
||||||
|
final File selectedPatchesFile = File(storedPatchesFile);
|
||||||
|
if (selectedPatchesFile.existsSync()) {
|
||||||
|
String string = selectedPatchesFile.readAsStringSync();
|
||||||
|
if (string.trim().isEmpty) return {};
|
||||||
|
return json.decode(string);
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> resetLastSelectedPatches() async {
|
||||||
|
final File selectedPatchesFile = File(storedPatchesFile);
|
||||||
|
selectedPatchesFile.deleteSync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ 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';
|
||||||
|
import 'package:cr_file_saver/file_saver.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class PatcherAPI {
|
class PatcherAPI {
|
||||||
@@ -44,7 +46,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,7 +66,8 @@ class PatcherAPI {
|
|||||||
filteredApps.add(app);
|
filteredApps.add(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,14 +128,19 @@ class PatcherAPI {
|
|||||||
String packageName,
|
String packageName,
|
||||||
String originalFilePath,
|
String originalFilePath,
|
||||||
) async {
|
) async {
|
||||||
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
try {
|
||||||
if (hasRootPermissions) {
|
bool hasRootPermissions = await _rootAPI.hasRootPermissions();
|
||||||
originalFilePath = await _rootAPI.getOriginalFilePath(
|
if (hasRootPermissions) {
|
||||||
packageName,
|
originalFilePath = await _rootAPI.getOriginalFilePath(
|
||||||
originalFilePath,
|
packageName,
|
||||||
);
|
originalFilePath,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return originalFilePath;
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
return originalFilePath;
|
||||||
}
|
}
|
||||||
return originalFilePath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher(
|
Future<void> runPatcher(
|
||||||
@@ -151,7 +160,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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,24 +179,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,
|
||||||
'keyStoreFilePath': _keyStoreFile.path,
|
'mergeIntegrations': mergeIntegrations,
|
||||||
},
|
'keyStoreFilePath': _keyStoreFile.path,
|
||||||
);
|
},
|
||||||
|
);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
print(e);
|
||||||
|
throw await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,22 +221,56 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void exportPatchedFile(String appName, String version) {
|
||||||
|
try {
|
||||||
|
if (_outFile != null) {
|
||||||
|
String newName = _getFileName(appName, version);
|
||||||
|
|
||||||
|
// This is temporary workaround to populate initial file name
|
||||||
|
// ref: https://github.com/Cleveroad/cr_file_saver/issues/7
|
||||||
|
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||||
|
String newSourcePath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
||||||
|
_outFile!.copySync(newSourcePath);
|
||||||
|
|
||||||
|
CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
|
||||||
|
sourceFilePath: newSourcePath,
|
||||||
|
destinationFileName: newName
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void sharePatchedFile(String appName, String version) {
|
void sharePatchedFile(String appName, String version) {
|
||||||
if (_outFile != null) {
|
try {
|
||||||
|
if (_outFile != null) {
|
||||||
|
String newName = _getFileName(appName, version);
|
||||||
|
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String _getFileName(String appName, String version) {
|
||||||
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
String prefix = appName.toLowerCase().replaceAll(' ', '-');
|
||||||
String newName = '$prefix-revanced_v$version.apk';
|
String newName = '$prefix-revanced_v$version.apk';
|
||||||
int lastSeparator = _outFile!.path.lastIndexOf('/');
|
return newName;
|
||||||
String newPath = _outFile!.path.substring(0, lastSeparator + 1) + newName;
|
|
||||||
File shareFile = _outFile!.copySync(newPath);
|
|
||||||
ShareExtend.share(shareFile.path, 'file');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> sharePatcherLog(String logs) async {
|
Future<void> sharePatcherLog(String logs) async {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ 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: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 {
|
||||||
@@ -19,25 +21,36 @@ class RevancedAPI {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Future<void> initialize(String apiUrl) async {
|
Future<void> initialize(String apiUrl) async {
|
||||||
bool isGMSInstalled = await checkForGMS();
|
try {
|
||||||
|
bool isGMSInstalled = await checkForGMS();
|
||||||
|
|
||||||
if (!isGMSInstalled) {
|
if (!isGMSInstalled) {
|
||||||
_dio = Dio(BaseOptions(
|
_dio = Dio(BaseOptions(
|
||||||
baseUrl: apiUrl,
|
baseUrl: apiUrl,
|
||||||
));
|
));
|
||||||
print('ReVanced API: Using default engine + $isGMSInstalled');
|
print('ReVanced API: Using default engine + $isGMSInstalled');
|
||||||
} else {
|
} else {
|
||||||
_dio = Dio(BaseOptions(
|
_dio = Dio(BaseOptions(
|
||||||
baseUrl: apiUrl,
|
baseUrl: apiUrl,
|
||||||
))
|
))
|
||||||
..httpClientAdapter = NativeAdapter();
|
..httpClientAdapter = NativeAdapter();
|
||||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
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);
|
||||||
}
|
}
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
@@ -49,7 +62,8 @@ class RevancedAPI {
|
|||||||
String name = repo['name'];
|
String name = repo['name'];
|
||||||
contributors[name] = repo['contributors'];
|
contributors[name] = repo['contributors'];
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
return contributors;
|
return contributors;
|
||||||
@@ -60,7 +74,8 @@ class RevancedAPI {
|
|||||||
var response = await _dio.get('/patches', options: _cacheOptions);
|
var response = await _dio.get('/patches', options: _cacheOptions);
|
||||||
List<dynamic> patches = response.data;
|
List<dynamic> patches = response.data;
|
||||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +92,8 @@ class RevancedAPI {
|
|||||||
t['repository'] == repoName &&
|
t['repository'] == repoName &&
|
||||||
(t['name'] as String).endsWith(extension),
|
(t['name'] as String).endsWith(extension),
|
||||||
);
|
);
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,7 +110,8 @@ class RevancedAPI {
|
|||||||
if (release != null) {
|
if (release != null) {
|
||||||
return release['version'];
|
return release['version'];
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -110,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;
|
||||||
@@ -129,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,4 +1,5 @@
|
|||||||
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';
|
||||||
@@ -9,7 +10,8 @@ class RootAPI {
|
|||||||
try {
|
try {
|
||||||
bool? isRooted = await Root.isRootAvailable();
|
bool? isRooted = await Root.isRootAvailable();
|
||||||
return isRooted != null && isRooted;
|
return isRooted != null && isRooted;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +24,8 @@ class RootAPI {
|
|||||||
return isRooted != null && isRooted;
|
return isRooted != null && isRooted;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +78,8 @@ class RootAPI {
|
|||||||
apps.removeWhere((pack) => pack.isEmpty);
|
apps.removeWhere((pack) => pack.isEmpty);
|
||||||
return apps.map((pack) => pack.trim()).toList();
|
return apps.map((pack) => pack.trim()).toList();
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return List.empty();
|
return List.empty();
|
||||||
}
|
}
|
||||||
return List.empty();
|
return List.empty();
|
||||||
@@ -121,14 +125,15 @@ class RootAPI {
|
|||||||
await installApk(packageName, patchedFilePath);
|
await installApk(packageName, patchedFilePath);
|
||||||
await mountApk(packageName, originalFilePath);
|
await mountApk(packageName, originalFilePath);
|
||||||
return true;
|
return true;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> installServiceDScript(String packageName) async {
|
Future<void> installServiceDScript(String packageName) async {
|
||||||
String content = '#!/system/bin/sh\n'
|
String content = '#!/system/bin/sh\n'
|
||||||
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 1; done\n'
|
'while [ "\$(getprop sys.boot_completed | tr -d \'"\'"\'\\\\r\'"\'"\')" != "1" ]; do sleep 3; done\n'
|
||||||
'base_path=$_managerDirPath/$packageName/base.apk\n'
|
'base_path=$_managerDirPath/$packageName/base.apk\n'
|
||||||
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
'stock_path=\$(pm path $packageName | grep base | sed \'"\'"\'s/package://g\'"\'"\')\n'
|
||||||
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
'[ ! -z \$stock_path ] && mount -o bind \$base_path \$stock_path';
|
||||||
|
|||||||
@@ -20,4 +20,15 @@ class Toast {
|
|||||||
gravity: t.ToastGravity.CENTER,
|
gravity: t.ToastGravity.CENTER,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void showBottom(String text) {
|
||||||
|
t.Fluttertoast.showToast(
|
||||||
|
msg: FlutterI18n.translate(
|
||||||
|
_fToast.context!,
|
||||||
|
text,
|
||||||
|
),
|
||||||
|
toastLength: t.Toast.LENGTH_LONG,
|
||||||
|
gravity: t.ToastGravity.BOTTOM,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ 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/services.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/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 {
|
||||||
@@ -32,7 +34,7 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
icon: application.icon,
|
icon: application.icon,
|
||||||
patchDate: DateTime.now(),
|
patchDate: DateTime.now(),
|
||||||
);
|
);
|
||||||
locator<PatcherViewModel>().selectedPatches.clear();
|
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +46,11 @@ 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!);
|
||||||
|
List<String> pathSplit = result.files.single.path!.split("/");
|
||||||
|
pathSplit.removeLast();
|
||||||
|
Directory filePickerCacheDir = Directory(pathSplit.join("/"));
|
||||||
|
Iterable<File> deletableFiles = (await filePickerCacheDir.list().toList()).whereType<File>();
|
||||||
|
for (var file in deletableFiles) { if (file.path != apkFile.path && file.path.endsWith(".apk")) file.delete(); }
|
||||||
ApplicationWithIcon? application = await DeviceApps.getAppFromStorage(
|
ApplicationWithIcon? application = await DeviceApps.getAppFromStorage(
|
||||||
apkFile.path,
|
apkFile.path,
|
||||||
true,
|
true,
|
||||||
@@ -59,11 +66,12 @@ class AppSelectorViewModel extends BaseViewModel {
|
|||||||
patchDate: DateTime.now(),
|
patchDate: DateTime.now(),
|
||||||
isFromStorage: true,
|
isFromStorage: true,
|
||||||
);
|
);
|
||||||
locator<PatcherViewModel>().selectedPatches.clear();
|
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||||
locator<PatcherViewModel>().notifyListeners();
|
locator<PatcherViewModel>().notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
_toast.show('appSelectorView.errorMessage');
|
_toast.show('appSelectorView.errorMessage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DashboardChip(
|
|
||||||
label: I18nText('homeView.updatesAvailable'),
|
|
||||||
isSelected: model.showUpdatableApps,
|
|
||||||
onSelected: (value) {
|
|
||||||
model.toggleUpdatableApps(true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
DashboardChip(
|
DashboardChip(
|
||||||
label: I18nText('homeView.installed'),
|
label: I18nText('homeView.installed'),
|
||||||
isSelected: !model.showUpdatableApps,
|
isSelected: !model.showUpdatableApps,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
model.toggleUpdatableApps(false);
|
model.toggleUpdatableApps(false);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
DashboardChip(
|
||||||
|
label: I18nText('homeView.updatesAvailable'),
|
||||||
|
isSelected: model.showUpdatableApps,
|
||||||
|
onSelected: (value) {
|
||||||
|
model.toggleUpdatableApps(true);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ 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/shared/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
import 'package:timezone/timezone.dart' as tz;
|
import 'package:timezone/timezone.dart' as tz;
|
||||||
@@ -28,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||||
DateTime? _lastUpdate;
|
DateTime? _lastUpdate;
|
||||||
bool showUpdatableApps = true;
|
bool showUpdatableApps = false;
|
||||||
List<PatchedApplication> patchedInstalledApps = [];
|
List<PatchedApplication> patchedInstalledApps = [];
|
||||||
List<PatchedApplication> patchedUpdatableApps = [];
|
List<PatchedApplication> patchedUpdatableApps = [];
|
||||||
|
|
||||||
@@ -94,7 +95,8 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
int currentVersionInt =
|
int currentVersionInt =
|
||||||
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
int.parse(currentVersion.replaceAll(RegExp('[^0-9]'), ''));
|
||||||
return latestVersionInt > currentVersionInt;
|
return latestVersionInt > currentVersionInt;
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,11 +137,16 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
} else {
|
} else {
|
||||||
_toast.show('homeView.errorDownloadMessage');
|
_toast.show('homeView.errorDownloadMessage');
|
||||||
}
|
}
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
_toast.show('homeView.errorInstallMessage');
|
_toast.show('homeView.errorInstallMessage');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatesAreDisabled() {
|
||||||
|
_toast.show('homeView.updatesDisabled');
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: parentContext,
|
context: parentContext,
|
||||||
@@ -176,7 +183,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
Future<void> forceRefresh(BuildContext context) async {
|
Future<void> forceRefresh(BuildContext context) async {
|
||||||
await Future.delayed(const Duration(seconds: 1));
|
await Future.delayed(const Duration(seconds: 1));
|
||||||
if (_lastUpdate == null ||
|
if (_lastUpdate == null ||
|
||||||
_lastUpdate!.difference(DateTime.now()).inSeconds > 60) {
|
_lastUpdate!.difference(DateTime.now()).inSeconds > 2) {
|
||||||
_managerAPI.clearAllData();
|
_managerAPI.clearAllData();
|
||||||
}
|
}
|
||||||
initialize(context);
|
initialize(context);
|
||||||
|
|||||||
@@ -48,7 +48,16 @@ class InstallerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
1: I18nText(
|
1: I18nText(
|
||||||
|
'installerView.exportApkMenuOption',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
2: I18nText(
|
||||||
'installerView.shareLogMenuOption',
|
'installerView.shareLogMenuOption',
|
||||||
child: const Text(
|
child: const Text(
|
||||||
'',
|
'',
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import 'package:revanced_manager/services/root_api.dart';
|
|||||||
import 'package:revanced_manager/services/toast.dart';
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
import 'package:wakelock/wakelock.dart';
|
import 'package:wakelock/wakelock.dart';
|
||||||
|
|
||||||
@@ -57,7 +58,8 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
).then((value) => FlutterBackground.enableBackgroundExecution());
|
).then((value) => FlutterBackground.enableBackgroundExecution());
|
||||||
} on Exception {
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,91 +123,114 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> runPatcher() async {
|
Future<void> runPatcher() async {
|
||||||
update(0.0, 'Initializing...', 'Initializing installer');
|
try {
|
||||||
if (_patches.isNotEmpty) {
|
update(0.0, 'Initializing...', 'Initializing installer');
|
||||||
try {
|
if (_patches.isNotEmpty) {
|
||||||
update(0.1, '', 'Creating working directory');
|
try {
|
||||||
await _patcherAPI.runPatcher(
|
update(0.1, '', 'Creating working directory');
|
||||||
_app.packageName,
|
await _patcherAPI.runPatcher(
|
||||||
_app.apkFilePath,
|
_app.packageName,
|
||||||
_patches,
|
_app.apkFilePath,
|
||||||
);
|
_patches,
|
||||||
} catch (e) {
|
);
|
||||||
update(
|
} on Exception catch (e, s) {
|
||||||
-100.0,
|
update(
|
||||||
'Aborting...',
|
-100.0,
|
||||||
'An error occurred! Aborting\nError:\n$e',
|
'Aborting...',
|
||||||
);
|
'An error occurred! Aborting\nError:\n$e',
|
||||||
|
);
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
throw await Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
||||||
}
|
}
|
||||||
} else {
|
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
||||||
update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
|
try {
|
||||||
}
|
FlutterBackground.disableBackgroundExecution();
|
||||||
if (FlutterBackground.isBackgroundExecutionEnabled) {
|
} on Exception catch (e, s) {
|
||||||
try {
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
FlutterBackground.disableBackgroundExecution();
|
// ignore
|
||||||
} on Exception {
|
}
|
||||||
// ignore
|
|
||||||
}
|
}
|
||||||
|
await Wakelock.disable();
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
await Wakelock.disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void installResult(BuildContext context, bool installAsRoot) async {
|
void installResult(BuildContext context, bool installAsRoot) async {
|
||||||
_app.isRooted = installAsRoot;
|
try {
|
||||||
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
_app.isRooted = installAsRoot;
|
||||||
bool rootMicroG = installAsRoot && hasMicroG;
|
bool hasMicroG = _patches.any((p) => p.name.endsWith('microg-support'));
|
||||||
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
bool rootMicroG = installAsRoot && hasMicroG;
|
||||||
bool ytWithoutRootMicroG =
|
bool rootFromStorage = installAsRoot && _app.isFromStorage;
|
||||||
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
bool ytWithoutRootMicroG =
|
||||||
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
!installAsRoot && !hasMicroG && _app.packageName.contains('youtube');
|
||||||
return showDialog(
|
if (rootMicroG || rootFromStorage || ytWithoutRootMicroG) {
|
||||||
context: context,
|
return showDialog(
|
||||||
builder: (context) => AlertDialog(
|
context: context,
|
||||||
title: I18nText('installerView.installErrorDialogTitle'),
|
builder: (context) => AlertDialog(
|
||||||
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
title: I18nText('installerView.installErrorDialogTitle'),
|
||||||
content: I18nText(
|
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
rootMicroG
|
content: I18nText(
|
||||||
? 'installerView.installErrorDialogText1'
|
rootMicroG
|
||||||
: rootFromStorage
|
? 'installerView.installErrorDialogText1'
|
||||||
? 'installerView.installErrorDialogText3'
|
: rootFromStorage
|
||||||
: 'installerView.installErrorDialogText2',
|
? 'installerView.installErrorDialogText3'
|
||||||
|
: 'installerView.installErrorDialogText2',
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
CustomMaterialButton(
|
||||||
|
label: I18nText('okButton'),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
);
|
||||||
CustomMaterialButton(
|
} else {
|
||||||
label: I18nText('okButton'),
|
update(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
1.0,
|
||||||
)
|
'Installing...',
|
||||||
],
|
_app.isRooted
|
||||||
),
|
? 'Installing patched file using root method'
|
||||||
);
|
: 'Installing patched file using nonroot method',
|
||||||
} else {
|
);
|
||||||
update(
|
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
||||||
1.0,
|
if (isInstalled) {
|
||||||
'Installing...',
|
update(1.0, 'Installed!', 'Installed!');
|
||||||
_app.isRooted
|
_app.isFromStorage = false;
|
||||||
? 'Installing patched file using root method'
|
_app.patchDate = DateTime.now();
|
||||||
: 'Installing patched file using nonroot method',
|
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
||||||
);
|
if (hasMicroG) {
|
||||||
isInstalled = await _patcherAPI.installPatchedFile(_app);
|
_app.name += ' ReVanced';
|
||||||
if (isInstalled) {
|
_app.packageName = _app.packageName.replaceFirst(
|
||||||
update(1.0, 'Installed!', 'Installed!');
|
'com.google.',
|
||||||
_app.isFromStorage = false;
|
'app.revanced.',
|
||||||
_app.patchDate = DateTime.now();
|
);
|
||||||
_app.appliedPatches = _patches.map((p) => p.name).toList();
|
}
|
||||||
if (hasMicroG) {
|
await _managerAPI.savePatchedApp(_app);
|
||||||
_app.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 exportResult() {
|
||||||
|
try {
|
||||||
|
_patcherAPI.exportPatchedFile(_app.name, _app.version);
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
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() {
|
||||||
@@ -213,10 +238,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() {
|
||||||
@@ -229,6 +258,9 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
shareResult();
|
shareResult();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
exportResult();
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
shareLog();
|
shareLog();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,4 +107,15 @@ class PatcherViewModel extends BaseViewModel {
|
|||||||
'appSelectorCard.recommendedVersion',
|
'appSelectorCard.recommendedVersion',
|
||||||
)}: $recommendedVersion';
|
)}: $recommendedVersion';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> loadLastSelectedPatches() async {
|
||||||
|
this.selectedPatches.clear();
|
||||||
|
List<String> selectedPatches =
|
||||||
|
await _managerAPI.getSelectedPatches(selectedApp!.originalPackageName);
|
||||||
|
List<Patch> patches =
|
||||||
|
await _patcherAPI.getFilteredPatches(selectedApp!.originalPackageName);
|
||||||
|
this.selectedPatches
|
||||||
|
.addAll(patches.where((patch) => selectedPatches.contains(patch.name)));
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +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/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
import 'package:revanced_manager/ui/views/patches_selector/patches_selector_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
|
import 'package:revanced_manager/ui/widgets/patchesSelectorView/patch_item.dart';
|
||||||
|
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
|
import 'package:revanced_manager/ui/widgets/shared/search_bar.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
|
|
||||||
@@ -25,7 +26,12 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
floatingActionButton: Visibility(
|
floatingActionButton: Visibility(
|
||||||
visible: model.patches.isNotEmpty,
|
visible: model.patches.isNotEmpty,
|
||||||
child: FloatingActionButton.extended(
|
child: FloatingActionButton.extended(
|
||||||
label: I18nText('patchesSelectorView.doneButton'),
|
label: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
I18nText('patchesSelectorView.doneButton'),
|
||||||
|
Text(' (${model.selectedPatches.length})')
|
||||||
|
],
|
||||||
|
),
|
||||||
icon: const Icon(Icons.check),
|
icon: const Icon(Icons.check),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
model.selectPatches();
|
model.selectPatches();
|
||||||
@@ -55,6 +61,41 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
|
|||||||
),
|
),
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
),
|
),
|
||||||
|
actions: [
|
||||||
|
Container(
|
||||||
|
height: 2,
|
||||||
|
margin: const EdgeInsets.only(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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
CustomPopupMenu(
|
||||||
|
onSelected: (value) => {
|
||||||
|
model.onMenuSelection(value)
|
||||||
|
},
|
||||||
|
children: {
|
||||||
|
0: I18nText(
|
||||||
|
'patchesSelectorView.loadPatchesSelection',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
bottom: PreferredSize(
|
bottom: PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(64.0),
|
preferredSize: const Size.fromHeight(64.0),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ 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/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:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:stacked/stacked.dart';
|
import 'package:stacked/stacked.dart';
|
||||||
@@ -11,11 +13,14 @@ 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!.originalPackageName,
|
locator<PatcherViewModel>().selectedApp!.originalPackageName,
|
||||||
));
|
));
|
||||||
@@ -57,17 +62,31 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
void selectPatches() {
|
void selectPatches() {
|
||||||
locator<PatcherViewModel>().selectedPatches = selectedPatches;
|
locator<PatcherViewModel>().selectedPatches = selectedPatches;
|
||||||
|
saveSelectedPatches();
|
||||||
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) =>
|
||||||
@@ -100,4 +119,33 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
pack.name == app.packageName &&
|
pack.name == app.packageName &&
|
||||||
(pack.versions.isEmpty || pack.versions.contains(app.version)));
|
(pack.versions.isEmpty || pack.versions.contains(app.version)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onMenuSelection(value) {
|
||||||
|
switch (value) {
|
||||||
|
case 0:
|
||||||
|
loadSelectedPatches();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> saveSelectedPatches() async {
|
||||||
|
List<String> selectedPatches =
|
||||||
|
this.selectedPatches.map((patch) => patch.name).toList();
|
||||||
|
await _managerAPI.setSelectedPatches(
|
||||||
|
locator<PatcherViewModel>().selectedApp!.originalPackageName,
|
||||||
|
selectedPatches);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> loadSelectedPatches() async {
|
||||||
|
List<String> selectedPatches = await _managerAPI.getSelectedPatches(
|
||||||
|
locator<PatcherViewModel>().selectedApp!.originalPackageName);
|
||||||
|
if (selectedPatches.isNotEmpty) {
|
||||||
|
this.selectedPatches.clear();
|
||||||
|
this.selectedPatches.addAll(
|
||||||
|
patches.where((patch) => selectedPatches.contains(patch.name)));
|
||||||
|
} else {
|
||||||
|
locator<Toast>().showBottom('patchesSelectorView.noSavedPatches');
|
||||||
|
}
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,9 +136,151 @@ class SettingsView extends StatelessWidget {
|
|||||||
subtitle: 'settingsView.sourcesLabelHint',
|
subtitle: 'settingsView.sourcesLabelHint',
|
||||||
onTap: () => model.showSourcesDialog(context),
|
onTap: () => model.showSourcesDialog(context),
|
||||||
),
|
),
|
||||||
|
CustomSwitchTile(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.experimentalPatchesLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle:
|
||||||
|
I18nText('settingsView.experimentalPatchesHint'),
|
||||||
|
value: model.areExperimentalPatchesEnabled(),
|
||||||
|
onTap: (value) => model.useExperimentalPatches(value),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteKeystoreLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteKeystoreHint'),
|
||||||
|
onTap: () => model.deleteKeystore,
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteTempDirLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteTempDirHint'),
|
||||||
|
onTap: () => model.deleteTempDir(),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.deleteLogsLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.deleteLogsHint'),
|
||||||
|
onTap: () => model.deleteLogs(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_settingsDivider,
|
_settingsDivider,
|
||||||
|
SettingsSection(
|
||||||
|
title: 'settingsView.exportSectionTitle',
|
||||||
|
children: <Widget>[
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.exportPatchesLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.exportPatchesHint'),
|
||||||
|
onTap: () => model.exportPatches(),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.importPatchesLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle: I18nText('settingsView.importPatchesHint'),
|
||||||
|
onTap: () => model.importPatches(),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
contentPadding:
|
||||||
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.resetStoredPatchesLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle:
|
||||||
|
I18nText('settingsView.resetStoredPatchesHint'),
|
||||||
|
onTap: () => model.resetSelectedPatches(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
_settingsDivider,
|
||||||
|
// SettingsSection(
|
||||||
|
// title: 'settingsView.logsSectionTitle',
|
||||||
|
// children: <Widget>[
|
||||||
|
// CustomSwitchTile(
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
// title: I18nText(
|
||||||
|
// 'settingsView.sentryLabel',
|
||||||
|
// child: const Text(
|
||||||
|
// '',
|
||||||
|
// style: TextStyle(
|
||||||
|
// fontSize: 20,
|
||||||
|
// fontWeight: FontWeight.w500,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// subtitle: I18nText('settingsView.sentryHint'),
|
||||||
|
// value: model.isSentryEnabled(),
|
||||||
|
// onTap: (value) => model.useSentry(value),
|
||||||
|
// ),
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// _settingsDivider,
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: 'settingsView.infoSectionTitle',
|
title: 'settingsView.infoSectionTitle',
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// ignore_for_file: use_build_context_synchronously
|
// ignore_for_file: use_build_context_synchronously
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:cr_file_saver/file_saver.dart';
|
||||||
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:file_picker/file_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
@@ -10,8 +12,11 @@ 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/services/toast.dart';
|
||||||
|
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.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:sentry_flutter/sentry_flutter.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';
|
||||||
import 'package:stacked_services/stacked_services.dart';
|
import 'package:stacked_services/stacked_services.dart';
|
||||||
@@ -23,6 +28,7 @@ const int ANDROID_12_SDK_VERSION = 31;
|
|||||||
class SettingsViewModel extends BaseViewModel {
|
class SettingsViewModel extends BaseViewModel {
|
||||||
final NavigationService _navigationService = locator<NavigationService>();
|
final NavigationService _navigationService = locator<NavigationService>();
|
||||||
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
final ManagerAPI _managerAPI = locator<ManagerAPI>();
|
||||||
|
final Toast _toast = locator<Toast>();
|
||||||
final TextEditingController _orgPatSourceController = TextEditingController();
|
final TextEditingController _orgPatSourceController = TextEditingController();
|
||||||
final TextEditingController _patSourceController = TextEditingController();
|
final TextEditingController _patSourceController = TextEditingController();
|
||||||
final TextEditingController _orgIntSourceController = TextEditingController();
|
final TextEditingController _orgIntSourceController = TextEditingController();
|
||||||
@@ -313,11 +319,106 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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<void> exportPatches() async {
|
||||||
|
try {
|
||||||
|
File outFile = File(_managerAPI.storedPatchesFile);
|
||||||
|
if (outFile.existsSync()) {
|
||||||
|
String dateTime = DateTime.now()
|
||||||
|
.toString()
|
||||||
|
.replaceAll(' ', '_')
|
||||||
|
.split('.').first;
|
||||||
|
String tempFilePath = '${outFile.path.substring(0, outFile.path.lastIndexOf('/') + 1)}selected_patches_$dateTime.json';
|
||||||
|
outFile.copySync(tempFilePath);
|
||||||
|
await CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
|
||||||
|
sourceFilePath: tempFilePath,
|
||||||
|
destinationFileName: ''
|
||||||
|
));
|
||||||
|
File(tempFilePath).delete();
|
||||||
|
locator<Toast>().showBottom('settingsView.exportedPatches');
|
||||||
|
} else {
|
||||||
|
locator<Toast>().showBottom('settingsView.noExportFileFound');
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
Sentry.captureException(e, stackTrace: s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> importPatches() async {
|
||||||
|
try {
|
||||||
|
FilePickerResult? result = await FilePicker.platform.pickFiles(
|
||||||
|
type: FileType.custom,
|
||||||
|
allowedExtensions: ['json'],
|
||||||
|
);
|
||||||
|
if (result != null && result.files.single.path != null) {
|
||||||
|
File inFile = File(result.files.single.path!);
|
||||||
|
final File storedPatchesFile = File(_managerAPI.storedPatchesFile);
|
||||||
|
if (!storedPatchesFile.existsSync()) {
|
||||||
|
storedPatchesFile.createSync(recursive: true);
|
||||||
|
}
|
||||||
|
inFile.copySync(storedPatchesFile.path);
|
||||||
|
inFile.delete();
|
||||||
|
if (locator<PatcherViewModel>().selectedApp != null) {
|
||||||
|
locator<PatcherViewModel>().loadLastSelectedPatches();
|
||||||
|
}
|
||||||
|
locator<Toast>().showBottom('settingsView.importedPatches');
|
||||||
|
}
|
||||||
|
} on Exception catch (e, s) {
|
||||||
|
await Sentry.captureException(e, stackTrace: s);
|
||||||
|
locator<Toast>().showBottom('settingsView.jsonSelectorErrorMessage');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetSelectedPatches() {
|
||||||
|
_managerAPI.resetLastSelectedPatches();
|
||||||
|
_toast.showBottom('settingsView.resetStoredPatches');
|
||||||
|
}
|
||||||
|
|
||||||
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');
|
||||||
|
|||||||
@@ -14,50 +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,
|
],
|
||||||
//TODO: Find a better way to do update functionality
|
),
|
||||||
onPressed: () {}
|
),
|
||||||
// () =>
|
);
|
||||||
// locator<HomeViewModel>().navigateToPatcher(
|
// return apps.isEmpty
|
||||||
// app,
|
// ? CustomCard(
|
||||||
// ),
|
// child: Center(
|
||||||
))
|
// child: Column(
|
||||||
.toList(),
|
// 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(),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,17 +20,30 @@ class PatchSelectorCard extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
I18nText(
|
Row(
|
||||||
locator<PatcherViewModel>().selectedPatches.isEmpty
|
children: <Widget>[
|
||||||
? 'patchSelectorCard.widgetTitle'
|
I18nText(
|
||||||
: 'patchSelectorCard.widgetTitleSelected',
|
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||||
child: const Text(
|
? 'patchSelectorCard.widgetTitle'
|
||||||
'',
|
: 'patchSelectorCard.widgetTitleSelected',
|
||||||
style: TextStyle(
|
child: const Text(
|
||||||
fontSize: 18,
|
'',
|
||||||
fontWeight: FontWeight.w500,
|
style: TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
Text(
|
||||||
|
locator<PatcherViewModel>().selectedPatches.isEmpty
|
||||||
|
? ''
|
||||||
|
: ' (${locator<PatcherViewModel>().selectedPatches.length})',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 18,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 4),
|
const SizedBox(height: 4),
|
||||||
locator<PatcherViewModel>().selectedApp == null
|
locator<PatcherViewModel>().selectedApp == null
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
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/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_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
|
|
||||||
@@ -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,
|
||||||
@@ -40,8 +45,23 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: CustomCard(
|
child: CustomCard(
|
||||||
|
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: Column(
|
child: Column(
|
||||||
@@ -83,7 +103,9 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -101,7 +123,17 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
onChanged: (newValue) {
|
onChanged: (newValue) {
|
||||||
setState(() => widget.isSelected = newValue!);
|
setState(() {
|
||||||
|
if (widget.isUnsupported &&
|
||||||
|
!widget._managerAPI.areExperimentalPatchesEnabled()
|
||||||
|
) {
|
||||||
|
widget.isSelected = false;
|
||||||
|
widget.toast
|
||||||
|
.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
|
} else {
|
||||||
|
widget.isSelected = newValue!;
|
||||||
|
}
|
||||||
|
});
|
||||||
widget.onChanged(widget.isSelected);
|
widget.onChanged(widget.isSelected);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: widget.isUpdatableApp
|
label: widget.isUpdatableApp
|
||||||
? I18nText('applicationItem.infoButton')
|
? I18nText('applicationItem.patchButton')
|
||||||
: I18nText('applicationItem.infoButton'),
|
: I18nText('applicationItem.infoButton'),
|
||||||
onPressed: widget.onPressed,
|
onPressed: widget.onPressed,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,22 +5,25 @@ class CustomCard extends StatelessWidget {
|
|||||||
final Widget child;
|
final Widget child;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
final EdgeInsetsGeometry? padding;
|
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,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.padding,
|
this.padding,
|
||||||
}) : super(key: key);
|
this.backgroundColor})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
? backgroundColor?.withOpacity(0.4) ??
|
||||||
: Colors.transparent,
|
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
||||||
|
: backgroundColor ?? Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
|
|||||||
13
pubspec.yaml
13
pubspec.yaml
@@ -4,16 +4,18 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.32+32
|
version: 0.0.40+40
|
||||||
|
|
||||||
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
|
||||||
cross_connectivity: ^3.0.5
|
cross_connectivity: ^3.0.5
|
||||||
|
cr_file_saver: ^0.0.1+2
|
||||||
device_apps:
|
device_apps:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/ponces/flutter_plugin_device_apps
|
url: https://github.com/ponces/flutter_plugin_device_apps
|
||||||
@@ -71,17 +73,22 @@ dependencies:
|
|||||||
timezone: ^0.8.0
|
timezone: ^0.8.0
|
||||||
url_launcher: ^6.1.5
|
url_launcher: ^6.1.5
|
||||||
wakelock: ^0.6.2
|
wakelock: ^0.6.2
|
||||||
|
sentry_dio: ^6.12.2
|
||||||
|
flutter_dotenv: ^5.0.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
json_serializable: ^6.3.1
|
||||||
build_runner: any
|
build_runner: any
|
||||||
flutter_launcher_icons: ^0.10.0
|
flutter_launcher_icons: ^0.10.0
|
||||||
flutter_lints: ^2.0.1
|
flutter_lints: ^2.0.1
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
injectable_generator: ^1.5.4
|
injectable_generator: ^1.5.4
|
||||||
json_serializable: ^6.3.1
|
|
||||||
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
assets:
|
assets:
|
||||||
- assets/i18n/
|
- assets/i18n/
|
||||||
|
- .env
|
||||||
|
|||||||
Reference in New Issue
Block a user