Compare commits

...

48 Commits

Author SHA1 Message Date
Ushie
a346f8857f build: Bump version to v0.0.26 2022-09-26 16:52:04 +03:00
oSumAtrIX
e12532ea4c chore: bump patcher dependency version to v5.1.0 2022-09-26 04:34:23 +02:00
afn
7ecf951bfb fix: tweak card appearances (#296)
* fix: tweak card appearances

* Update patch_selector_card.dart
2022-09-25 18:13:37 +05:30
Aunali321
db18874ea1 fix: now using country code for languages. 2022-09-25 14:38:25 +05:30
oSumAtrIX
18a69776cd feat: en_US.json language asset file 2022-09-25 08:26:08 +02:00
oSumAtrIX
21cadf6450 feat: remove en.json language asset 2022-09-25 08:22:21 +02:00
oSumAtrIX
5ddbe6e252 Update Crowdin configuration file 2022-09-25 08:19:47 +02:00
afn
6d1427e01e fix: move changelog into app item custom card (#294) 2022-09-25 00:19:02 +05:30
Alberto Ponces
6ac901f1d6 build: Bump version to v0.0.24 2022-09-24 13:50:44 +01:00
Alberto Ponces
587ba795bb Revert "fix: Prevent content from being overlapped by system navigation bar"
This reverts commit 4d82ff3011.
2022-09-24 13:49:46 +01:00
Alberto Ponces
6b66c7bbd0 build: Bump version to v0.0.23 2022-09-24 12:16:02 +01:00
Alberto Ponces
f398b6863a Merge branch 'flutter' of github.com:revanced/revanced-manager into flutter 2022-09-24 12:12:24 +01:00
Alberto Ponces
4d82ff3011 fix: Prevent content from being overlapped by system navigation bar 2022-09-24 12:06:36 +01:00
Alberto Ponces
2a0ea78d7f feat: Adds support for patching on x86 and x64 devices
Introduces new aapt2 binaries from revanced/aapt2
2022-09-24 12:05:36 +01:00
Aunali321
4722880647 feat: better patch version background. 2022-09-24 13:47:09 +05:30
Aunali321
32fabcfa3f fix: nav overlapping install buttons. 2022-09-24 12:53:46 +05:30
Alberto Ponces
e0c46e4268 fix: Show "Share log" menu option even if patching has errors 2022-09-23 17:22:39 +01:00
Alberto Ponces
d84230fa22 feat: Merge integrations if a patch or any of its dependencies need them 2022-09-23 17:20:19 +01:00
Alberto Ponces
9561153bfb feat: Hide "Install as Root" button if user does not have root access at all 2022-09-23 15:47:30 +01:00
Alberto Ponces
c8c35ca801 build: Bump version to v0.0.22 2022-09-23 15:34:18 +01:00
Alberto Ponces
cf99069804 fix: Handle minor lint errors 2022-09-23 15:33:27 +01:00
Alberto Ponces
6abb761724 refactor: Move some logic to ManagerAPI and PatcherAPI 2022-09-23 15:31:24 +01:00
Alberto Ponces
4609ed9eba fix: Make sure we are getting app from from storage when selection is from storage 2022-09-23 15:21:58 +01:00
Aunali321
c0f743df89 feat: HTTP2 support for api requests. (#290) 2022-09-23 19:06:06 +05:30
Aunali321
f00f910973 Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-09-23 14:58:19 +05:30
Aunali321
2bc486dcec build: Bump version to v0.0.21. 2022-09-23 14:58:07 +05:30
Aunali321
148981da18 refactor: removed dropdown for branch. 2022-09-23 14:57:05 +05:30
Aunali321
d8df377427 feat: warning dialog when selecting all patches. 2022-09-23 14:53:21 +05:30
Aunali321
efe1306aac fix: reverse versions list to have recents first. 2022-09-23 13:35:47 +05:30
Aunali321
ead308740f refactor: move custom button to shared dir. 2022-09-23 13:00:30 +05:30
oSumAtrIX
fa0f250e27 build: bump patcher dependency version to v5.0.1 2022-09-23 07:45:44 +02:00
oSumAtrIX
185d883b65 feat: acknowledgements section for template feature-issue 2022-09-23 07:33:30 +02:00
oSumAtrIX
9d8b2e1a35 feat: acknowledgements section for template feature-issue 2022-09-23 07:32:44 +02:00
Alberto Ponces
a6a7ff5040 build: Bump version to v0.0.19 2022-09-23 00:39:44 +01:00
Alberto Ponces
1028ec8e2a fix: Prevent Manager from crashing when a patcher exception occurs and print its stack trace on installer's log 2022-09-23 00:38:42 +01:00
Alberto Ponces
f9242c1958 build: Bump version to v0.0.18 2022-09-22 14:04:59 +01:00
Alberto Ponces
f9865166b0 fix: TikTok integrations and settings patches should be merged if needed 2022-09-22 14:02:07 +01:00
Alberto Ponces
f0f934f6a1 fix: Prevent printing of denied root permission exceptions for unrooted users 2022-09-22 14:01:05 +01:00
Alberto Ponces
3d25655851 fix: Uninstall button should always be shown 2022-09-22 09:46:28 +01:00
oSumAtrIX
733190e76c build: bump version to v0.0.17+17 2022-09-21 05:19:26 +02:00
oSumAtrIX
ab312dec43 build: bump patcher dependency version to v5.0.0 2022-09-21 04:16:19 +02:00
oSumAtrIX
70159b8cd8 Update Crowdin configuration file 2022-09-20 19:17:29 +02:00
oSumAtrIX
97060913a2 Update Crowdin configuration file 2022-09-20 19:07:41 +02:00
oSumAtrIX
4a0c5f9935 Update Crowdin configuration file 2022-09-20 12:06:23 +02:00
Alberto Ponces
f643a31455 Merge branch 'flutter' of github.com:revanced/revanced-manager into flutter 2022-09-20 10:05:06 +01:00
Alberto Ponces
03b87a50ea fix: Use a proper app name when MicroG is applied 2022-09-20 10:04:51 +01:00
Alberto Ponces
4631982d42 fix: Use original packageName to get compatible patches 2022-09-20 10:04:02 +01:00
Palm
4c4b694db9 chore: update English language capitalizations and format (#228)
* chore: update English language capitalizations and format

* chore: revert capitalization changes as requested
2022-09-20 12:27:20 +05:30
37 changed files with 738 additions and 504 deletions

View File

@@ -20,14 +20,6 @@ body:
- Other - Other
validations: validations:
required: true required: true
- type: dropdown
attributes:
label: Manager Branch
options:
- Flutter
- Compose
validations:
required: true
- type: textarea - type: textarea
attributes: attributes:
label: Bug description label: Bug description
@@ -112,3 +104,17 @@ body:
description: Add additional context here. description: Add additional context here.
validations: validations:
required: false required: false
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I filled out all of the requested information in this issue properly.
required: true
- label: The issue is related solely to the ReVanced Manager
required: true

View File

@@ -12,14 +12,6 @@ body:
- Other - Other
validations: validations:
required: true required: true
- type: dropdown
attributes:
label: Manager Branch
options:
- Flutter
- Compose
validations:
required: true
- type: textarea - type: textarea
attributes: attributes:
label: Issue label: Issue
@@ -43,4 +35,18 @@ body:
label: Additional context label: Additional context
description: Add additional context here. description: Add additional context here.
validations: validations:
required: false required: false
- type: checkboxes
id: acknowledgements
attributes:
label: Acknowledgements
description: Your issue will be closed if you haven't done these steps.
options:
- label: I have searched the existing issues and this is a new and no duplicate or related to another open issue.
required: true
- label: I have written a short but informative title.
required: true
- label: I filled out all of the requested information in this issue properly.
required: true
- label: The issue is related solely to the ReVanced Manager
required: true

View File

@@ -71,7 +71,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// ReVanced // ReVanced
implementation "app.revanced:revanced-patcher:4.4.2" implementation "app.revanced:revanced-patcher:5.1.0"
// Signing & aligning // Signing & aligning
implementation("org.bouncycastle:bcpkix-jdk15on:1.70") implementation("org.bouncycastle:bcpkix-jdk15on:1.70")

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -74,7 +74,6 @@ class MainActivity : FlutterActivity() {
result.notImplemented() result.notImplemented()
} }
} }
else -> result.notImplemented() else -> result.notImplemented()
} }
} }
@@ -101,161 +100,174 @@ class MainActivity : FlutterActivity() {
val integrations = File(integrationsPath) val integrations = File(integrationsPath)
val keyStoreFile = File(keyStoreFilePath) val keyStoreFile = File(keyStoreFilePath)
val patches = DexPatchBundle(
patchBundleFilePath,
DexClassLoader(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
Thread { Thread {
handler.post { try {
installerChannel.invokeMethod( val patches = DexPatchBundle(
"update", patchBundleFilePath,
mapOf( DexClassLoader(
"progress" to 0.1, patchBundleFilePath,
"header" to "",
"log" to "Copying original apk"
)
)
}
originalFile.copyTo(inputFile, true)
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.2,
"header" to "Unpacking apk...",
"log" to "Unpacking input apk"
)
)
}
val patcher =
Patcher(
PatcherOptions(
inputFile,
cacheDirPath, cacheDirPath,
resourcePatching, null,
Aapt.binary(applicationContext).absolutePath, javaClass.classLoader
cacheDirPath,
logger = ManagerLogger()
) )
) ).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.3, "header" to "", "log" to "")
)
}
if (mergeIntegrations) {
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",
mapOf( mapOf(
"progress" to 0.4, "progress" to 0.1,
"header" to "Merging integrations...", "header" to "",
"log" to "Merging integrations" "log" to "Copying original apk"
) )
) )
} }
patcher.addFiles(listOf(integrations)) {} originalFile.copyTo(inputFile, true)
}
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",
mapOf( mapOf(
"progress" to 0.5, "progress" to 0.2,
"header" to "Applying patches...", "header" to "Unpacking apk...",
"log" to "" "log" to "Unpacking input apk"
)
) )
) }
} val patcher =
patcher.addPatches(patches) Patcher(
patcher.applyPatches().forEach { (patch, res) -> PatcherOptions(
if (res.isSuccess) { inputFile,
val msg = "[success] $patch" cacheDirPath,
resourcePatching,
Aapt.binary(applicationContext).absolutePath,
cacheDirPath,
logger = ManagerLogger()
)
)
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.3, "header" to "", "log" to "")
)
}
if (mergeIntegrations) {
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",
mapOf( mapOf(
"progress" to 0.5, "progress" to 0.4,
"header" to "", "header" to "Merging integrations...",
"log" to msg "log" to "Merging integrations"
) )
) )
} }
return@forEach patcher.addFiles(listOf(integrations)) {}
} }
val msg = "[error] $patch:" + res.exceptionOrNull()!!
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",
mapOf("progress" to 0.5, "header" to "", "log" to msg) mapOf(
"progress" to 0.5,
"header" to "Applying patches...",
"log" to ""
)
) )
} }
}
handler.post { patcher.addPatches(patches)
installerChannel.invokeMethod( patcher.applyPatches().forEach { (patch, res) ->
"update", if (res.isSuccess) {
mapOf( val msg = "[success] $patch"
"progress" to 0.7, handler.post {
"header" to "Repacking apk...", installerChannel.invokeMethod(
"log" to "Repacking patched apk" "update",
) mapOf(
) "progress" to 0.5,
} "header" to "",
val res = patcher.save() "log" to msg
ZipFile(patchedFile).use { file -> )
res.dexFiles.forEach { )
file.addEntryCompressData( }
ZipEntry.createWithName(it.name), return@forEach
it.stream.readBytes() }
val msg = "[error] $patch:" + res.exceptionOrNull()!!
handler.post {
installerChannel.invokeMethod(
"update",
mapOf("progress" to 0.5, "header" to "", "log" to msg)
)
}
}
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to 0.7,
"header" to "Repacking apk...",
"log" to "Repacking patched apk"
)
) )
} }
res.resourceFile?.let { val res = patcher.save()
ZipFile(patchedFile).use { file ->
res.dexFiles.forEach {
file.addEntryCompressData(
ZipEntry.createWithName(it.name),
it.stream.readBytes()
)
}
res.resourceFile?.let {
file.copyEntriesFromFileAligned(
ZipFile(it),
ZipAligner::getEntryAlignment
)
}
file.copyEntriesFromFileAligned( file.copyEntriesFromFileAligned(
ZipFile(it), ZipFile(inputFile),
ZipAligner::getEntryAlignment ZipAligner::getEntryAlignment
) )
} }
file.copyEntriesFromFileAligned( handler.post {
ZipFile(inputFile), installerChannel.invokeMethod(
ZipAligner::getEntryAlignment "update",
) mapOf(
} "progress" to 0.9,
handler.post { "header" to "Signing apk...",
installerChannel.invokeMethod( "log" to ""
"update", )
mapOf(
"progress" to 0.9,
"header" to "Signing apk...",
"log" to ""
) )
) }
} Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
Signer("ReVanced", "s3cur3p@ssw0rd").signApk(patchedFile, outFile, keyStoreFile)
handler.post { handler.post {
installerChannel.invokeMethod( installerChannel.invokeMethod(
"update", "update",
mapOf( mapOf(
"progress" to 1.0, "progress" to 1.0,
"header" to "Finished!", "header" to "Finished!",
"log" to "Finished!" "log" to "Finished!"
)
) )
) }
} catch (ex: Throwable) {
val stack = ex.stackTraceToString()
handler.post {
installerChannel.invokeMethod(
"update",
mapOf(
"progress" to -100.0,
"header" to "Aborting...",
"log" to "An error occurred! Aborting\nError:\n$stack"
)
)
}
} }
handler.post { result.success(null) } handler.post { result.success(null) }
} }.start()
.start()
} }
inner class ManagerLogger : Logger { inner class ManagerLogger : Logger {

View File

@@ -14,18 +14,18 @@
"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",
"noInstallations": "No patched applications installed", "noInstallations": "No patched applications installed",
"installed": "Installed", "installed": "Installed",
"updateDialogTitle": "Update", "updateDialogTitle": "Update Manager",
"updateDialogText": "Are you sure you want to download and update Manager?", "updateDialogText": "Are you sure you want to download and update ReVanced Manager?",
"notificationTitle": "ReVanced Manager was updated!", "notificationTitle": "ReVanced Manager was updated",
"notificationText": "Tap to open the app", "notificationText": "Tap to open the app",
"downloadingMessage": "Downloading update!", "downloadingMessage": "Downloading update...",
"installingMessage": "Installing update... Hang on!", "installingMessage": "Installing update...",
"errorDownloadMessage": "Unable to download update!", "errorDownloadMessage": "Unable to download update",
"errorInstallMessage": "Unable to install update!", "errorInstallMessage": "Unable to install update",
"noConnection": "No internet connection" "noConnection": "No internet connection"
}, },
"applicationItem": { "applicationItem": {
@@ -34,7 +34,7 @@
"changelogLabel": "Changelog" "changelogLabel": "Changelog"
}, },
"latestCommitCard": { "latestCommitCard": {
"loadingLabel": "Loading", "loadingLabel": "Loading...",
"timeagoLabel": "{time} ago", "timeagoLabel": "{time} ago",
"patcherLabel": "Patcher: ", "patcherLabel": "Patcher: ",
"managerLabel": "Manager: ", "managerLabel": "Manager: ",
@@ -44,12 +44,12 @@
"widgetTitle": "Patcher", "widgetTitle": "Patcher",
"patchButton": "Patch", "patchButton": "Patch",
"patchDialogTitle": "Warning", "patchDialogTitle": "Warning",
"patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors can occur.\nAre you sure you want to proceed with patching a split base APK?" "patchDialogText": "You have selected a resource patch and a split APK installation was detected so patching errors may occur.\nAre you sure you want to proceed with patching a split base APK?"
}, },
"appSelectorCard": { "appSelectorCard": {
"widgetTitle": "Select application", "widgetTitle": "Select application",
"widgetTitleSelected": "Selected application", "widgetTitleSelected": "Selected application",
"widgetSubtitle": "No application selected.", "widgetSubtitle": "No application selected",
"noAppsLabel": "No applications found.", "noAppsLabel": "No applications found.",
"currentVersion": "Current", "currentVersion": "Current",
"recommendedVersion": "Recommended", "recommendedVersion": "Recommended",
@@ -58,11 +58,11 @@
"patchSelectorCard": { "patchSelectorCard": {
"widgetTitle": "Select patches", "widgetTitle": "Select patches",
"widgetTitleSelected": "Selected patches", "widgetTitleSelected": "Selected patches",
"widgetSubtitle": "Select an application first.", "widgetSubtitle": "Select an application first",
"widgetEmptySubtitle": "No patches selected." "widgetEmptySubtitle": "No patches selected"
}, },
"socialMediaCard": { "socialMediaCard": {
"widgetTitle": "Social Media", "widgetTitle": "Socials",
"widgetSubtitle": "We are online!" "widgetSubtitle": "We are online!"
}, },
"appSelectorView": { "appSelectorView": {
@@ -75,7 +75,9 @@
"viewTitle": "Select patches", "viewTitle": "Select patches",
"searchBarHint": "Search patches", "searchBarHint": "Search patches",
"doneButton": "Done", "doneButton": "Done",
"noPatchesFound": "No patches found for the selected app." "noPatchesFound": "No patches found for the selected app",
"selectAllPatchesWarningTitle": "Warning",
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
}, },
"patchItem": { "patchItem": {
"unsupportedWarningButton": "Unsupported version", "unsupportedWarningButton": "Unsupported version",
@@ -113,13 +115,13 @@
"frenchOption": "French", "frenchOption": "French",
"sourcesLabel": "Sources", "sourcesLabel": "Sources",
"sourcesLabelHint": "Configure your custom sources", "sourcesLabelHint": "Configure your custom sources",
"orgPatchesLabel" : "Patches Org", "orgPatchesLabel": "Patches Organization",
"sourcesPatchesLabel" : "Patches Source", "sourcesPatchesLabel": "Patches Source",
"orgIntegrationsLabel": "Integrations Org", "orgIntegrationsLabel": "Integrations Organization",
"sourcesIntegrationsLabel": "Integrations Source", "sourcesIntegrationsLabel": "Integrations Source",
"sourcesResetDialogTitle": "Reset", "sourcesResetDialogTitle": "Reset",
"sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?", "sourcesResetDialogText": "Are you sure you want to reset custom sources to their default values?",
"apiURLResetDialogText": "Are you sure you want to reset API URL to their default values?", "apiURLResetDialogText": "Are you sure you want to reset API URL to its default value?",
"contributorsLabel": "Contributors", "contributorsLabel": "Contributors",
"contributorsHint": "A list of contributors of ReVanced", "contributorsHint": "A list of contributors of ReVanced",
"logsLabel": "Logs", "logsLabel": "Logs",

3
crowdin.yml Normal file
View File

@@ -0,0 +1,3 @@
files:
- source: /assets/i18n/en.json
translation: /assets/i18n/%locale_with_underscore%.json

View File

@@ -35,7 +35,7 @@ class MyApp extends StatelessWidget {
localizationsDelegates: [ localizationsDelegates: [
FlutterI18nDelegate( FlutterI18nDelegate(
translationLoader: FileTranslationLoader( translationLoader: FileTranslationLoader(
fallbackFile: 'en', fallbackFile: 'en_US',
basePath: 'assets/i18n', basePath: 'assets/i18n',
), ),
), ),

View File

@@ -6,10 +6,18 @@ import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton @lazySingleton
class GithubAPI { class GithubAPI {
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com')); final Dio _dio = Dio(
BaseOptions(baseUrl: 'https://api.github.com'),
)..httpClientAdapter = Http2Adapter(
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig()); final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions( final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1), const Duration(days: 1),

View File

@@ -319,4 +319,14 @@ class ManagerAPI {
} }
return newCommits; return newCommits;
} }
Future<bool> isSplitApk(PatchedApplication patchedApp) async {
Application? app;
if (patchedApp.isFromStorage) {
app = await DeviceApps.getAppFromStorage(patchedApp.apkFilePath);
} else {
app = await DeviceApps.getApp(patchedApp.packageName);
}
return app != null && app.isSplit;
}
} }

View File

@@ -70,10 +70,14 @@ class PatcherAPI {
} }
Future<List<Patch>> getFilteredPatches(String packageName) async { Future<List<Patch>> getFilteredPatches(String packageName) async {
String newPackageName = packageName.replaceFirst(
'app.revanced.',
'com.google.',
);
return _patches return _patches
.where((patch) => .where((patch) =>
!patch.name.contains('settings') && !patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == packageName)) patch.compatiblePackages.any((pack) => pack.name == newPackageName))
.toList(); .toList();
} }
@@ -83,21 +87,38 @@ class PatcherAPI {
.toList(); .toList();
} }
bool dependencyNeedsIntegrations(String name) {
return name.contains('integrations') ||
_patches.any(
(patch) =>
patch.name == name &&
(patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
)),
);
}
Future<bool> needsIntegrations(List<Patch> selectedPatches) async { Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
return selectedPatches.any( return selectedPatches.any(
(patch) => patch.dependencies.contains('integrations'), (patch) => patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
),
); );
} }
Future<bool> needsResourcePatching(List<Patch> selectedPatches) async { Future<bool> needsResourcePatching(List<Patch> selectedPatches) async {
return selectedPatches.any( return selectedPatches.any(
(patch) => patch.dependencies.any((dep) => dep.contains('resource-')), (patch) => patch.dependencies.any(
(dep) => dep.contains('resource-'),
),
); );
} }
Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async { Future<bool> needsSettingsPatch(List<Patch> selectedPatches) async {
return selectedPatches.any( return selectedPatches.any(
(patch) => patch.dependencies.contains('settings'), (patch) => patch.dependencies.any(
(dep) => dep.contains('settings'),
),
); );
} }

View File

@@ -6,6 +6,7 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton @lazySingleton
class RevancedAPI { class RevancedAPI {
@@ -17,7 +18,15 @@ class RevancedAPI {
); );
Future<void> initialize(String apiUrl) async { Future<void> initialize(String apiUrl) async {
_dio = Dio(BaseOptions(baseUrl: apiUrl)); _dio = Dio(BaseOptions(
baseUrl: apiUrl,
))
..httpClientAdapter = Http2Adapter(
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
_dio.interceptors.add(_dioCacheManager.interceptor); _dio.interceptors.add(_dioCacheManager.interceptor);
} }

View File

@@ -5,10 +5,23 @@ class RootAPI {
final String _postFsDataDirPath = '/data/adb/post-fs-data.d'; final String _postFsDataDirPath = '/data/adb/post-fs-data.d';
final String _serviceDDirPath = '/data/adb/service.d'; final String _serviceDDirPath = '/data/adb/service.d';
Future<bool> isRooted() async {
try {
bool? isRooted = await Root.isRootAvailable();
return isRooted != null && isRooted;
} on Exception {
return false;
}
}
Future<bool> hasRootPermissions() async { Future<bool> hasRootPermissions() async {
try { try {
bool? isRooted = await Root.isRooted(); bool? isRooted = await Root.isRootAvailable();
return isRooted != null && isRooted; if (isRooted != null && isRooted) {
isRooted = await Root.isRooted();
return isRooted != null && isRooted;
}
return false;
} on Exception { } on Exception {
return false; return false;
} }

View File

@@ -15,7 +15,7 @@ import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/toast.dart'; import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package: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;

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart'; import 'package:revanced_manager/ui/views/installer/installer_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart'; import 'package:revanced_manager/ui/widgets/installerView/gradient_progress_indicator.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_popup_menu.dart';
@@ -18,130 +18,134 @@ class InstallerView extends StatelessWidget {
onModelReady: (model) => model.initialize(context), onModelReady: (model) => model.initialize(context),
viewModelBuilder: () => InstallerViewModel(), viewModelBuilder: () => InstallerViewModel(),
builder: (context, model, child) => WillPopScope( builder: (context, model, child) => WillPopScope(
child: Scaffold( child: SafeArea(
body: CustomScrollView( top: false,
controller: model.scrollController, child: Scaffold(
slivers: <Widget>[ body: CustomScrollView(
CustomSliverAppBar( controller: model.scrollController,
title: Text( slivers: <Widget>[
model.headerLogs, CustomSliverAppBar(
style: GoogleFonts.inter( title: Text(
color: Theme.of(context).textTheme.headline6!.color, model.headerLogs,
), style: GoogleFonts.inter(
), color: Theme.of(context).textTheme.headline6!.color,
onBackButtonPressed: () => model.onWillPop(context),
actions: <Widget>[
Visibility(
visible: !model.isPatching && !model.hasErrors,
child: CustomPopupMenu(
onSelected: (value) => model.onMenuSelection(value),
children: {
0: I18nText(
'installerView.shareApkMenuOption',
child: const Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
1: I18nText(
'installerView.shareLogMenuOption',
child: const Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
},
), ),
), ),
], onBackButtonPressed: () => model.onWillPop(context),
bottom: PreferredSize( actions: <Widget>[
preferredSize: const Size(double.infinity, 1.0), Visibility(
child: visible: !model.isPatching,
GradientProgressIndicator(progress: model.progress!)), child: CustomPopupMenu(
), onSelected: (value) => model.onMenuSelection(value),
SliverPadding( children: {
padding: const EdgeInsets.all(20.0), if (!model.hasErrors)
sliver: SliverList( 0: I18nText(
delegate: SliverChildListDelegate.fixed( 'installerView.shareApkMenuOption',
<Widget>[ child: const Text(
CustomCard( '',
child: Text( style: TextStyle(
model.logs, fontWeight: FontWeight.bold,
style: GoogleFonts.jetBrainsMono( ),
fontSize: 13, ),
height: 1.5, ),
1: I18nText(
'installerView.shareLogMenuOption',
child: const Text(
'',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
},
),
),
],
bottom: PreferredSize(
preferredSize: const Size(double.infinity, 1.0),
child:
GradientProgressIndicator(progress: model.progress!)),
),
SliverPadding(
padding: const EdgeInsets.all(20.0),
sliver: SliverList(
delegate: SliverChildListDelegate.fixed(
<Widget>[
CustomCard(
child: Text(
model.logs,
style: GoogleFonts.jetBrainsMono(
fontSize: 13,
height: 1.5,
),
), ),
), ),
), ],
], ),
), ),
), ),
), SliverFillRemaining(
SliverFillRemaining( hasScrollBody: false,
hasScrollBody: false, child: Align(
child: Align( alignment: Alignment.bottomCenter,
alignment: Alignment.bottomCenter, child: Visibility(
child: Visibility( visible: !model.isPatching && !model.hasErrors,
visible: !model.isPatching && !model.hasErrors, child: Padding(
child: Padding( padding: const EdgeInsets.all(20.0).copyWith(top: 0.0),
padding: const EdgeInsets.all(20.0).copyWith(top: 0.0), child: Row(
child: Row( mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[
children: <Widget>[ Visibility(
Visibility( visible: model.isInstalled,
visible: model.isInstalled, child: CustomMaterialButton(
child: CustomMaterialButton( label: I18nText('installerView.openButton'),
label: I18nText('installerView.openButton'), isExpanded: true,
isExpanded: true, onPressed: () {
onPressed: () { model.openApp();
model.openApp(); model.cleanPatcher();
model.cleanPatcher(); Navigator.of(context).pop();
Navigator.of(context).pop(); },
},
),
),
Visibility(
visible: !model.isInstalled,
child: CustomMaterialButton(
isFilled: false,
label:
I18nText('installerView.installRootButton'),
isExpanded: true,
onPressed: () => model.installResult(
context,
true,
), ),
), ),
), Visibility(
Visibility( visible: !model.isInstalled && model.isRooted,
visible: !model.isInstalled, child: CustomMaterialButton(
child: const SizedBox( isFilled: false,
width: 16, label:
), I18nText('installerView.installRootButton'),
), isExpanded: true,
Visibility( onPressed: () => model.installResult(
visible: !model.isInstalled, context,
child: CustomMaterialButton( true,
label: I18nText('installerView.installButton'), ),
isExpanded: true,
onPressed: () => model.installResult(
context,
false,
), ),
), ),
), Visibility(
], visible: !model.isInstalled,
child: const SizedBox(
width: 16,
),
),
Visibility(
visible: !model.isInstalled,
child: CustomMaterialButton(
label: I18nText('installerView.installButton'),
isExpanded: true,
onPressed: () => model.installResult(
context,
false,
),
),
),
],
),
), ),
), ),
), ),
), ),
), ],
], ),
), ),
), ),
onWillPop: () => model.onWillPop(context), onWillPop: () => model.onWillPop(context),

View File

@@ -1,3 +1,4 @@
// ignore_for_file: use_build_context_synchronously
import 'package:device_apps/device_apps.dart'; import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -9,15 +10,17 @@ import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart'; import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/services/toast.dart'; import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:wakelock/wakelock.dart'; import 'package:wakelock/wakelock.dart';
class InstallerViewModel extends BaseViewModel { class InstallerViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>(); final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>(); final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final RootAPI _rootAPI = RootAPI();
final Toast _toast = locator<Toast>(); final Toast _toast = locator<Toast>();
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!; final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches; final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
@@ -28,11 +31,13 @@ class InstallerViewModel extends BaseViewModel {
double? progress = 0.0; double? progress = 0.0;
String logs = ''; String logs = '';
String headerLogs = ''; String headerLogs = '';
bool isRooted = false;
bool isPatching = true; bool isPatching = true;
bool isInstalled = false; bool isInstalled = false;
bool hasErrors = false; bool hasErrors = false;
Future<void> initialize(BuildContext context) async { Future<void> initialize(BuildContext context) async {
isRooted = await _rootAPI.isRooted();
if (await Permission.ignoreBatteryOptimizations.isGranted) { if (await Permission.ignoreBatteryOptimizations.isGranted) {
try { try {
FlutterBackground.initialize( FlutterBackground.initialize(
@@ -78,14 +83,20 @@ class InstallerViewModel extends BaseViewModel {
} }
void update(double value, String header, String log) { void update(double value, String header, String log) {
if (value > 0) { if (value >= 0.0) {
progress = value; progress = value;
} }
isPatching = progress == 1.0 ? false : true; if (value == 0.0) {
if (progress == 0.0) {
logs = ''; logs = '';
isPatching = true;
isInstalled = false; isInstalled = false;
hasErrors = false; hasErrors = false;
} else if (value == 1.0) {
isPatching = false;
hasErrors = false;
} else if (value == -100.0) {
isPatching = false;
hasErrors = true;
} }
if (header.isNotEmpty) { if (header.isNotEmpty) {
headerLogs = header; headerLogs = header;
@@ -95,6 +106,9 @@ class InstallerViewModel extends BaseViewModel {
logs += '\n'; logs += '\n';
} }
logs += log; logs += log;
if (logs[logs.length - 1] == '\n') {
logs = logs.substring(0, logs.length - 1);
}
Future.delayed(const Duration(milliseconds: 500)).then((value) { Future.delayed(const Duration(milliseconds: 500)).then((value) {
scrollController.animateTo( scrollController.animateTo(
scrollController.position.maxScrollExtent, scrollController.position.maxScrollExtent,
@@ -117,12 +131,14 @@ class InstallerViewModel extends BaseViewModel {
_patches, _patches,
); );
} catch (e) { } catch (e) {
hasErrors = true; update(
update(-1.0, 'Aborting...', 'An error occurred! Aborting\nError: $e'); -100.0,
'Aborting...',
'An error occurred! Aborting\nError:\n$e',
);
} }
} else { } else {
hasErrors = true; update(-100.0, 'Aborting...', 'No app or patches selected! Aborting');
update(-1.0, 'Aborting...', 'No app or patches selected! Aborting');
} }
if (FlutterBackground.isBackgroundExecutionEnabled) { if (FlutterBackground.isBackgroundExecutionEnabled) {
try { try {
@@ -132,7 +148,6 @@ class InstallerViewModel extends BaseViewModel {
} }
} }
await Wakelock.disable(); await Wakelock.disable();
isPatching = false;
} }
void installResult(BuildContext context, bool installAsRoot) async { void installResult(BuildContext context, bool installAsRoot) async {
@@ -178,6 +193,7 @@ class InstallerViewModel extends BaseViewModel {
_app.patchDate = DateTime.now(); _app.patchDate = DateTime.now();
_app.appliedPatches = _patches.map((p) => p.name).toList(); _app.appliedPatches = _patches.map((p) => p.name).toList();
if (hasMicroG) { if (hasMicroG) {
_app.name += ' ReVanced';
_app.packageName = _app.packageName.replaceFirst( _app.packageName = _app.packageName.replaceFirst(
'com.google.', 'com.google.',
'app.revanced.', 'app.revanced.',

View File

@@ -1,4 +1,3 @@
import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:injectable/injectable.dart'; import 'package:injectable/injectable.dart';
@@ -6,14 +5,16 @@ import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart'; import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart'; import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart'; import 'package:stacked_services/stacked_services.dart';
@lazySingleton @lazySingleton
class PatcherViewModel extends BaseViewModel { class PatcherViewModel extends BaseViewModel {
final NavigationService _navigationService = locator<NavigationService>(); final NavigationService _navigationService = locator<NavigationService>();
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>(); final PatcherAPI _patcherAPI = locator<PatcherAPI>();
PatchedApplication? selectedApp; PatchedApplication? selectedApp;
List<Patch> selectedPatches = []; List<Patch> selectedPatches = [];
@@ -39,13 +40,12 @@ class PatcherViewModel extends BaseViewModel {
} }
Future<bool> isValidPatchConfig() async { Future<bool> isValidPatchConfig() async {
bool needsResourcePatching = bool needsResourcePatching = await _patcherAPI.needsResourcePatching(
await _patcherAPI.needsResourcePatching(selectedPatches); selectedPatches,
);
if (needsResourcePatching && selectedApp != null) { if (needsResourcePatching && selectedApp != null) {
Application? app = await DeviceApps.getApp(selectedApp!.packageName); bool isSplit = await _managerAPI.isSplitApk(selectedApp!);
if (app != null && app.isSplit) { return !isSplit;
return false;
}
} }
return true; return true;
} }

View File

@@ -73,7 +73,12 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
_query = searchQuery; _query = searchQuery;
}); });
}, },
onSelectAll: (value) => model.selectAllPatches(value), onSelectAll: (value) {
if (value) {
model.selectAllPatcherWarning(context);
}
model.selectAllPatches(value);
},
), ),
), ),
), ),

View File

@@ -1,10 +1,13 @@
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart'; import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart'; import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/patcher_api.dart'; import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
import 'package:flutter/material.dart';
class PatchesSelectorViewModel extends BaseViewModel { class PatchesSelectorViewModel extends BaseViewModel {
final PatcherAPI _patcherAPI = locator<PatcherAPI>(); final PatcherAPI _patcherAPI = locator<PatcherAPI>();
@@ -35,6 +38,23 @@ class PatchesSelectorViewModel extends BaseViewModel {
notifyListeners(); notifyListeners();
} }
Future<void> selectAllPatcherWarning(BuildContext context) {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('patchesSelectorView.selectAllPatchesWarningTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patchesSelectorView.selectAllPatchesWarningContent'),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
)
],
),
);
}
void selectAllPatches(bool isSelected) { void selectAllPatches(bool isSelected) {
selectedPatches.clear(); selectedPatches.clear();
if (isSelected) { if (isSelected) {

View File

@@ -10,7 +10,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/app/app.router.dart'; import 'package:revanced_manager/app/app.router.dart';
import 'package:revanced_manager/services/manager_api.dart'; import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart'; import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:share_extend/share_extend.dart'; import 'package:share_extend/share_extend.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';

View File

@@ -104,52 +104,50 @@ class AppInfoView extends StatelessWidget {
), ),
), ),
), ),
if (app.isRooted) VerticalDivider(
VerticalDivider( color: Theme.of(context).canvasColor,
color: Theme.of(context).canvasColor, indent: 12.0,
indent: 12.0, endIndent: 12.0,
endIndent: 12.0, width: 1.0,
width: 1.0, ),
), Expanded(
if (app.isRooted) child: Material(
Expanded( type: MaterialType.transparency,
child: Material( child: InkWell(
type: MaterialType.transparency, borderRadius: BorderRadius.circular(16.0),
child: InkWell( onTap: () => model.showUninstallDialog(
borderRadius: BorderRadius.circular(16.0), context,
onTap: () => model.showUninstallDialog( app,
context, false,
app, ),
false, child: Column(
), mainAxisAlignment:
child: Column( MainAxisAlignment.center,
mainAxisAlignment: children: <Widget>[
MainAxisAlignment.center, Icon(
children: <Widget>[ Icons.delete_outline,
Icon( color: Theme.of(context)
Icons.delete_outline, .colorScheme
color: Theme.of(context) .primary,
.colorScheme ),
.primary, const SizedBox(height: 10),
), I18nText(
const SizedBox(height: 10), 'appInfoView.uninstallButton',
I18nText( child: Text(
'appInfoView.uninstallButton', '',
child: Text( style: TextStyle(
'', color: Theme.of(context)
style: TextStyle( .colorScheme
color: Theme.of(context) .primary,
.colorScheme fontWeight: FontWeight.bold,
.primary,
fontWeight: FontWeight.bold,
),
), ),
), ),
], ),
), ],
), ),
), ),
), ),
),
VerticalDivider( VerticalDivider(
color: Theme.of(context).canvasColor, color: Theme.of(context).canvasColor,
indent: 12.0, indent: 12.0,

View File

@@ -11,7 +11,7 @@ import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart'; import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart'; import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/string.dart'; import 'package:revanced_manager/utils/string.dart';
import 'package:stacked/stacked.dart'; import 'package:stacked/stacked.dart';
@@ -20,20 +20,26 @@ class AppInfoViewModel extends BaseViewModel {
final PatcherAPI _patcherAPI = locator<PatcherAPI>(); final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final RootAPI _rootAPI = RootAPI(); final RootAPI _rootAPI = RootAPI();
Future<void> uninstallApp(PatchedApplication app, bool onlyUnpatch) async { Future<void> uninstallApp(
BuildContext context,
PatchedApplication app,
bool onlyUnpatch,
) async {
bool isUninstalled = true;
if (app.isRooted) { if (app.isRooted) {
bool hasRootPermissions = await _rootAPI.hasRootPermissions(); bool hasRootPermissions = await _rootAPI.hasRootPermissions();
if (hasRootPermissions) { if (hasRootPermissions) {
_rootAPI.deleteApp(app.packageName, app.apkFilePath); await _rootAPI.deleteApp(app.packageName, app.apkFilePath);
_managerAPI.deletePatchedApp(app);
if (!onlyUnpatch) { if (!onlyUnpatch) {
DeviceApps.uninstallApp(app.packageName); await DeviceApps.uninstallApp(app.packageName);
} }
} }
} else { } else {
DeviceApps.uninstallApp(app.packageName).then( isUninstalled = await DeviceApps.uninstallApp(app.packageName);
(value) => _managerAPI.deletePatchedApp(app), }
); if (isUninstalled) {
await _managerAPI.deletePatchedApp(app);
locator<HomeViewModel>().initialize(context);
} }
} }
@@ -87,8 +93,7 @@ class AppInfoViewModel extends BaseViewModel {
CustomMaterialButton( CustomMaterialButton(
label: I18nText('yesButton'), label: I18nText('yesButton'),
onPressed: () { onPressed: () {
uninstallApp(app, onlyUnpatch); uninstallApp(context, app, onlyUnpatch);
locator<HomeViewModel>().initialize(context);
Navigator.of(context).pop(); Navigator.of(context).pop();
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@@ -97,8 +102,7 @@ class AppInfoViewModel extends BaseViewModel {
), ),
); );
} else { } else {
uninstallApp(app, onlyUnpatch); uninstallApp(context, app, onlyUnpatch);
locator<HomeViewModel>().initialize(context);
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
} }

View File

@@ -33,7 +33,7 @@ class _ContributorsCardState extends State<ContributorsCard> {
'', '',
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w500,
), ),
), ),
), ),

View File

@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
class LatestCommitCard extends StatefulWidget { class LatestCommitCard extends StatefulWidget {
@@ -49,7 +49,7 @@ class _LatestCommitCardState extends State<LatestCommitCard> {
), ),
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 4),
Row( Row(
children: <Widget>[ children: <Widget>[
I18nText('latestCommitCard.managerLabel'), I18nText('latestCommitCard.managerLabel'),

View File

@@ -1,49 +0,0 @@
import 'package:flutter/material.dart';
class CustomMaterialButton extends StatelessWidget {
final Widget label;
final bool isFilled;
final bool isExpanded;
final Function()? onPressed;
const CustomMaterialButton({
Key? key,
required this.label,
this.isFilled = true,
this.isExpanded = false,
required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
isExpanded
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
shape: MaterialStateProperty.all(
StadiumBorder(
side: isFilled
? BorderSide.none
: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.primary,
),
),
),
backgroundColor: MaterialStateProperty.all(
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
isFilled
? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.primary,
),
),
onPressed: onPressed,
child: label,
);
}
}

View File

@@ -32,7 +32,7 @@ class AppSelectorCard extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 8),
locator<PatcherViewModel>().selectedApp == null locator<PatcherViewModel>().selectedApp == null
? I18nText('appSelectorCard.widgetSubtitle') ? I18nText('appSelectorCard.widgetSubtitle')
: Row( : Row(
@@ -49,21 +49,21 @@ class AppSelectorCard extends StatelessWidget {
), ),
), ),
const SizedBox(width: 6), const SizedBox(width: 6),
Text(locator<PatcherViewModel>().getAppSelectionString()), Text(
locator<PatcherViewModel>()
.getAppSelectionString(),
style: const TextStyle(fontWeight: FontWeight.w600),
),
], ],
), ),
locator<PatcherViewModel>().selectedApp == null locator<PatcherViewModel>().selectedApp == null
? Container() ? Container()
: Column( : Column(
children: [ children: [
const SizedBox(height: 10), const SizedBox(height: 4),
Padding( Text(
padding: const EdgeInsets.only(left: 20), locator<PatcherViewModel>()
child: Text( .getRecommendedVersionString(context),
locator<PatcherViewModel>()
.getRecommendedVersionString(context),
style: const TextStyle(fontStyle: FontStyle.italic),
),
), ),
], ],
), ),

View File

@@ -32,7 +32,7 @@ class PatchSelectorCard extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(height: 10), const SizedBox(height: 4),
locator<PatcherViewModel>().selectedApp == null locator<PatcherViewModel>().selectedApp == null
? I18nText('patchSelectorCard.widgetSubtitle') ? I18nText('patchSelectorCard.widgetSubtitle')
: locator<PatcherViewModel>().selectedPatches.isEmpty : locator<PatcherViewModel>().selectedPatches.isEmpty
@@ -46,7 +46,7 @@ class PatchSelectorCard extends StatelessWidget {
String _getPatchesSelection() { String _getPatchesSelection() {
String text = ''; String text = '';
for (Patch p in locator<PatcherViewModel>().selectedPatches) { for (Patch p in locator<PatcherViewModel>().selectedPatches) {
text += '${p.getSimpleName()} (v${p.version})\n'; text += '\u2022 ${p.getSimpleName()} (v${p.version})\n';
} }
return text.substring(0, text.length - 1); return text.substring(0, text.length - 1);
} }

View File

@@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
// ignore: must_be_immutable // ignore: must_be_immutable
@@ -58,13 +58,21 @@ class _PatchItemState extends State<PatchItem> {
children: <Widget>[ children: <Widget>[
Text( Text(
widget.simpleName, widget.simpleName,
maxLines: 2,
overflow: TextOverflow.visible,
style: const TextStyle( style: const TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
const SizedBox(width: 4), const SizedBox(width: 6),
Text(widget.version) Text(
widget.version,
style: TextStyle(
fontSize: 16,
color: Theme.of(context).colorScheme.secondary,
),
),
], ],
), ),
const SizedBox(height: 4), const SizedBox(height: 4),
@@ -73,7 +81,10 @@ class _PatchItemState extends State<PatchItem> {
softWrap: true, softWrap: true,
maxLines: 3, maxLines: 3,
overflow: TextOverflow.visible, overflow: TextOverflow.visible,
style: const TextStyle(fontSize: 14), style: TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.onSecondaryContainer,
),
), ),
], ],
), ),
@@ -104,12 +115,12 @@ class _PatchItemState extends State<PatchItem> {
padding: const EdgeInsets.only(top: 8), padding: const EdgeInsets.only(top: 8),
child: TextButton.icon( child: TextButton.icon(
label: I18nText('patchItem.unsupportedWarningButton'), label: I18nText('patchItem.unsupportedWarningButton'),
icon: const Icon(Icons.warning), icon: const Icon(Icons.warning, size: 20.0),
onPressed: () => _showUnsupportedWarningDialog(), onPressed: () => _showUnsupportedWarningDialog(),
style: ButtonStyle( style: ButtonStyle(
shape: MaterialStateProperty.all( shape: MaterialStateProperty.all(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(8),
side: BorderSide( side: BorderSide(
width: 1, width: 1,
color: color:
@@ -147,7 +158,7 @@ class _PatchItemState extends State<PatchItem> {
translationParams: { translationParams: {
'packageVersion': widget.packageVersion, 'packageVersion': widget.packageVersion,
'supportedVersions': 'supportedVersions':
'\u2022 ${widget.supportedPackageVersions.join('\n\u2022 ')}', '\u2022 ${widget.supportedPackageVersions.reversed.join('\n\u2022 ')}',
}, },
), ),
actions: <Widget>[ actions: <Widget>[

View File

@@ -1,7 +1,7 @@
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart'; import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart'; import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:expandable/expandable.dart'; import 'package:expandable/expandable.dart';
import 'package:timeago/timeago.dart'; import 'package:timeago/timeago.dart';
@@ -50,93 +50,94 @@ class _ApplicationItemState extends State<ApplicationItem>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ExpandableController expController = ExpandableController(); ExpandableController expController = ExpandableController();
return ExpandablePanel( return Container(
controller: expController, margin: const EdgeInsets.only(bottom: 16.0),
theme: const ExpandableThemeData( child: CustomCard(
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)), onTap: () {
tapBodyToCollapse: false, expController.toggle();
tapBodyToExpand: false, _animationController.isCompleted
tapHeaderToExpand: false, ? _animationController.reverse()
hasIcon: false, : _animationController.forward();
animationDuration: Duration(milliseconds: 450), },
), child: ExpandablePanel(
header: Padding( controller: expController,
padding: const EdgeInsets.only(bottom: 16.0), theme: const ExpandableThemeData(
child: CustomCard( inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
onTap: () { tapBodyToCollapse: false,
expController.toggle(); tapBodyToExpand: false,
_animationController.isCompleted tapHeaderToExpand: false,
? _animationController.reverse() hasIcon: false,
: _animationController.forward(); animationDuration: Duration(milliseconds: 450),
}, ),
child: Row( header: Row(
children: <Widget>[
SizedBox(
width: 40,
child: Image.memory(widget.icon, height: 40, width: 40),
),
const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.name.length > 9
? '${widget.name.substring(0, 9)}...'
: widget.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(format(widget.patchDate)),
],
),
),
const Spacer(),
RotationTransition(
turns:
Tween(begin: 0.0, end: 0.50).animate(_animationController),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.arrow_drop_down),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
CustomMaterialButton( SizedBox(
label: widget.isUpdatableApp width: 40,
? I18nText('applicationItem.patchButton') child: Image.memory(widget.icon, height: 40, width: 40),
: I18nText('applicationItem.infoButton'), ),
onPressed: widget.onPressed, const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.name.length > 12
? '${widget.name.substring(0, 12)}...'
: widget.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(format(widget.patchDate)),
],
),
),
const Spacer(),
RotationTransition(
turns: Tween(begin: 0.0, end: 0.50)
.animate(_animationController),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.arrow_drop_down),
),
),
const SizedBox(width: 8),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
CustomMaterialButton(
label: widget.isUpdatableApp
? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
),
],
), ),
], ],
), ),
], collapsed: const SizedBox(),
expanded: Padding(
padding: const EdgeInsets.only(top: 16.0, left: 4.0, right: 4.0, bottom: 4.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
I18nText(
'applicationItem.changelogLabel',
child: const Text(
'',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
const SizedBox(height: 4),
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
],
),
), ),
), ),
), )
collapsed: const SizedBox(),
expanded: Padding(
padding: const EdgeInsets.all(16.0).copyWith(top: 0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
I18nText(
'applicationItem.changelogLabel',
child: const Text(
'',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
const SizedBox(height: 4),
Text('\u2022 ${widget.changelog.join('\n\u2022 ')}'),
],
),
),
); );
} }
} }

View File

@@ -0,0 +1,130 @@
import 'package:flutter/material.dart';
class CustomMaterialButton extends StatelessWidget {
final Widget label;
final bool isFilled;
final bool isExpanded;
final Function()? onPressed;
const CustomMaterialButton({
Key? key,
required this.label,
this.isFilled = true,
this.isExpanded = false,
required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextButton(
style: ButtonStyle(
padding: MaterialStateProperty.all(
isExpanded
? const EdgeInsets.symmetric(horizontal: 24, vertical: 12)
: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
),
shape: MaterialStateProperty.all(
StadiumBorder(
side: isFilled
? BorderSide.none
: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.primary,
),
),
),
backgroundColor: MaterialStateProperty.all(
isFilled ? Theme.of(context).colorScheme.primary : Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
isFilled
? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.primary,
),
),
onPressed: onPressed,
child: label,
);
}
}
// ignore: must_be_immutable
class TimerButton extends StatefulWidget {
Widget label;
bool isFilled;
int seconds;
final bool isRunning;
final Function()? onTimerEnd;
TimerButton({
Key? key,
required this.seconds,
required this.isRunning,
required this.onTimerEnd,
this.label = const Text(''),
this.isFilled = true,
}) : super(key: key);
@override
State<TimerButton> createState() => _TimerButtonState();
}
class _TimerButtonState extends State<TimerButton> {
void timer(int seconds) {
Future.delayed(const Duration(seconds: 1), () {
if (seconds > 0) {
setState(() {
seconds--;
});
timer(seconds);
} else {
widget.onTimerEnd!();
}
});
}
@override
void initState() {
//decrement seconds
if (widget.isRunning) {
timer(widget.seconds);
}
super.initState();
}
@override
Widget build(BuildContext build) {
return TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(
StadiumBorder(
side: widget.isFilled
? BorderSide.none
: BorderSide(
width: 1,
color: Theme.of(context).colorScheme.primary,
),
),
),
backgroundColor: MaterialStateProperty.all(
widget.isFilled
? Theme.of(context).colorScheme.primary
: Colors.transparent,
),
foregroundColor: MaterialStateProperty.all(
widget.isFilled
? Theme.of(context).colorScheme.surface
: Theme.of(context).colorScheme.primary,
),
),
onPressed: widget.isRunning ? null : widget.onTimerEnd,
child: Text(
widget.isRunning ? '${widget.seconds}' : 'Install',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
);
}
}

View File

@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
publish_to: 'none' publish_to: 'none'
version: 0.0.16+16 version: 0.0.26+26
environment: environment:
sdk: ">=2.17.5 <3.0.0" sdk: ">=2.17.5 <3.0.0"
@@ -20,6 +20,7 @@ dependencies:
ref: revanced-manager ref: revanced-manager
device_info_plus: ^4.1.2 device_info_plus: ^4.1.2
dio: ^4.0.6 dio: ^4.0.6
dio_http2_adapter: ^2.0.0
dio_http_cache_lts: ^0.4.1 dio_http_cache_lts: ^0.4.1
dynamic_color: ^1.5.4 dynamic_color: ^1.5.4
dynamic_themes: ^1.1.0 dynamic_themes: ^1.1.0
@@ -54,7 +55,10 @@ dependencies:
path_provider: ^2.0.11 path_provider: ^2.0.11
permission_handler: ^10.0.0 permission_handler: ^10.0.0
pull_to_refresh: ^2.0.0 pull_to_refresh: ^2.0.0
root: ^2.0.2 root:
git:
url: https://github.com/gokul1630/root
ref: main
share_extend: ^2.0.0 share_extend: ^2.0.0
shared_preferences: ^2.0.15 shared_preferences: ^2.0.15
skeletons: ^0.0.3 skeletons: ^0.0.3