Compare commits

..

61 Commits

Author SHA1 Message Date
0b2572a730 Bump version to v0.0.31 2022-10-11 02:56:27 +05:30
6fc46d632b feat: make applied patches dialog scrollable. 2022-10-11 02:55:35 +05:30
b2a35813f6 fix: disable update functionality for now. 2022-10-11 02:32:23 +05:30
279b76ad53 fix: don't show previously patched apps after clearing data. 2022-10-11 02:17:13 +05:30
b550016681 fix: use original package name to load patches. 2022-10-10 19:02:42 +05:30
3ab5d12f3e fix: use original package name for changelog. 2022-10-10 18:57:32 +05:30
53bcb8b85f Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-10-10 18:46:02 +05:30
94397dcb4c feat: store original package name of patches apps. 2022-10-10 18:45:58 +05:30
afn
53fbee2d44 refactor: Reorder sections in readme. 2022-10-10 00:21:49 +05:30
e46ad3595d fix: permanent keystore path if available (#375) 2022-10-10 00:05:43 +05:30
f2b03b6e69 Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-10-09 23:01:18 +05:30
0df2a6bdc0 feat: brotli support. 2022-10-09 23:01:10 +05:30
df31e5ccd1 feat: add building from source instructions. 2022-10-09 02:59:50 +05:30
4dfa0dada6 build: bump version to v0.0.30 2022-10-08 22:08:03 +05:30
857a523f84 fix: changelog for youtube. 2022-10-08 22:06:45 +05:30
ceac838706 feat: use new api url. 2022-10-08 19:03:45 +05:30
e8cb6d27fc Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-10-07 18:23:49 +05:30
78428f6bd3 feat: HTTP/3 Support. 2022-10-07 18:23:43 +05:30
da94dfba70 build: Android Studio project build config 2022-10-06 12:40:25 +03:00
8275792f45 chore: bump patcher dependency version to v6.0.0 (#355) 2022-10-06 11:26:20 +02:00
a90923011a feat: allow searching for displayed patch names (#348) 2022-10-03 21:06:12 +03:00
1aa24e2871 fix: print stack trace of patch exceptions (#314) 2022-10-03 22:34:46 +05:30
68ce751745 build: bump version to v0.0.27 2022-10-01 02:15:47 +02:00
74ff64d41a chore: bump patcher dependency version to v5.1.2 2022-10-01 02:15:08 +02:00
6d45ccecc2 build: Bump version to v0.0.27 2022-09-30 21:38:15 +03:00
5418c36716 feat: use patcher for resourcePatch detection (#337)
Co-authored-by: Aunali321 <aunvakil.aa@gmail.com>
2022-09-30 21:36:39 +03:00
ca0657e8f9 feat: decrease cache duration of patches and integrations. 2022-09-28 22:26:54 +05:30
a5511c2a2c feat: update unsupported button title 2022-09-26 23:36:17 +03:00
a346f8857f build: Bump version to v0.0.26 2022-09-26 16:52:04 +03:00
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
db18874ea1 fix: now using country code for languages. 2022-09-25 14:38:25 +05:30
18a69776cd feat: en_US.json language asset file 2022-09-25 08:26:08 +02:00
21cadf6450 feat: remove en.json language asset 2022-09-25 08:22:21 +02:00
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
6ac901f1d6 build: Bump version to v0.0.24 2022-09-24 13:50:44 +01:00
587ba795bb Revert "fix: Prevent content from being overlapped by system navigation bar"
This reverts commit 4d82ff3011af43f60b0ea694aaed207c6883bd8f.
2022-09-24 13:49:46 +01:00
6b66c7bbd0 build: Bump version to v0.0.23 2022-09-24 12:16:02 +01:00
f398b6863a Merge branch 'flutter' of github.com:revanced/revanced-manager into flutter 2022-09-24 12:12:24 +01:00
4d82ff3011 fix: Prevent content from being overlapped by system navigation bar 2022-09-24 12:06:36 +01:00
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
4722880647 feat: better patch version background. 2022-09-24 13:47:09 +05:30
32fabcfa3f fix: nav overlapping install buttons. 2022-09-24 12:53:46 +05:30
e0c46e4268 fix: Show "Share log" menu option even if patching has errors 2022-09-23 17:22:39 +01:00
d84230fa22 feat: Merge integrations if a patch or any of its dependencies need them 2022-09-23 17:20:19 +01:00
9561153bfb feat: Hide "Install as Root" button if user does not have root access at all 2022-09-23 15:47:30 +01:00
c8c35ca801 build: Bump version to v0.0.22 2022-09-23 15:34:18 +01:00
cf99069804 fix: Handle minor lint errors 2022-09-23 15:33:27 +01:00
6abb761724 refactor: Move some logic to ManagerAPI and PatcherAPI 2022-09-23 15:31:24 +01:00
4609ed9eba fix: Make sure we are getting app from from storage when selection is from storage 2022-09-23 15:21:58 +01:00
c0f743df89 feat: HTTP2 support for api requests. (#290) 2022-09-23 19:06:06 +05:30
f00f910973 Merge branch 'flutter' of https://github.com/revanced/revanced-manager into flutter 2022-09-23 14:58:19 +05:30
2bc486dcec build: Bump version to v0.0.21. 2022-09-23 14:58:07 +05:30
148981da18 refactor: removed dropdown for branch. 2022-09-23 14:57:05 +05:30
d8df377427 feat: warning dialog when selecting all patches. 2022-09-23 14:53:21 +05:30
efe1306aac fix: reverse versions list to have recents first. 2022-09-23 13:35:47 +05:30
ead308740f refactor: move custom button to shared dir. 2022-09-23 13:00:30 +05:30
fa0f250e27 build: bump patcher dependency version to v5.0.1 2022-09-23 07:45:44 +02:00
185d883b65 feat: acknowledgements section for template feature-issue 2022-09-23 07:33:30 +02:00
9d8b2e1a35 feat: acknowledgements section for template feature-issue 2022-09-23 07:32:44 +02:00
42 changed files with 600 additions and 386 deletions

View File

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

View File

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

6
.run/main.dart.run.xml Normal file
View File

@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="main.dart" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/lib/main.dart" />
<method v="2" />
</configuration>
</component>

View File

@ -5,16 +5,26 @@ The official ReVanced Manager based on Flutter.
## 🔽 Download
To download the Alpha version of Manager, go [here](https://github.com/revanced/revanced-manager/releases/latest) and install the provided APK file.
## 🔴 Issues
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
## 💭 Discussion
If you wish to discuss the Manager, a thread has been made under the [#chat](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
## 📝 Prerequisites
1. Android 8 or higher
2. Does not work on some armv7 devices
3. [Vanced MicroG](https://github.com/TeamVanced/VancedMicroG/releases) required for YouTube and YouTube Music (Only for non-root)
## ⚠️ Disclaimer
*Please note that even though we're releasing the Manager, it is an ALPHA version. Meaning there's a big chance that the Manager might not work at all for you.*
*Please note that even though we're releasing the Manager, it is an ALPHA version. There's a big chance that the Manager might not work at all for you.*
## Prerequisites
1. Android 8 or higher.
2. Does not work on armv7
3. For YouTube and YouTube Music - Vanced MicroG(Only for non-root).
## 🔴 Issues
For suggestions and bug reports, open an issue [here](https://github.com/revanced/revanced-manager/issues/new/choose).
## 💭 Discussion
If you wish to discuss the Manager, a thread has been made under the [#development](https://discord.com/channels/952946952348270622/1002922226443632761) channel in the Discord server, please note that this thread may be temporary and may be removed in the future.
## 🛠️ Building Manager from source
1. Setup flutter environment for your [platform](https://docs.flutter.dev/get-started/install)
2. Clone the repository locally
3. Add your github token in gradle.properties like [this](https://github.com/revanced/revanced-documentation/wiki/Building-from-source)
4. Open the project in terminal
5. Run `flutter pub get` in terminal
6. Then `flutter packages pub run build_runner build --delete-conflicting-outputs` (Must be done on each git pull)
7. To build release apk run `flutter build apk`

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,6 @@
package app.revanced.manager.flutter
import android.os.Build
import android.os.Handler
import android.os.Looper
import androidx.annotation.NonNull
@ -12,7 +13,7 @@ import app.revanced.patcher.Patcher
import app.revanced.patcher.PatcherOptions
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.logging.Logger
import app.revanced.patcher.util.patch.impl.DexPatchBundle
import app.revanced.patcher.util.patch.PatchBundle
import dalvik.system.DexClassLoader
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
@ -42,7 +43,6 @@ class MainActivity : FlutterActivity() {
val selectedPatches = call.argument<List<String>>("selectedPatches")
val cacheDirPath = call.argument<String>("cacheDirPath")
val mergeIntegrations = call.argument<Boolean>("mergeIntegrations")
val resourcePatching = call.argument<Boolean>("resourcePatching")
val keyStoreFilePath = call.argument<String>("keyStoreFilePath")
if (patchBundleFilePath != null &&
originalFilePath != null &&
@ -53,7 +53,6 @@ class MainActivity : FlutterActivity() {
selectedPatches != null &&
cacheDirPath != null &&
mergeIntegrations != null &&
resourcePatching != null &&
keyStoreFilePath != null
) {
runPatcher(
@ -67,7 +66,6 @@ class MainActivity : FlutterActivity() {
selectedPatches,
cacheDirPath,
mergeIntegrations,
resourcePatching,
keyStoreFilePath
)
} else {
@ -90,7 +88,6 @@ class MainActivity : FlutterActivity() {
selectedPatches: List<String>,
cacheDirPath: String,
mergeIntegrations: Boolean,
resourcePatching: Boolean,
keyStoreFilePath: String
) {
val originalFile = File(originalFilePath)
@ -102,16 +99,20 @@ class MainActivity : FlutterActivity() {
Thread {
try {
val patches = DexPatchBundle(
patchBundleFilePath,
DexClassLoader(
val patches = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
PatchBundle.Dex(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
DexClassLoader(
patchBundleFilePath,
cacheDirPath,
null,
javaClass.classLoader
)
).loadPatches().filter { patch -> selectedPatches.any { it == patch.patchName } }
} else {
TODO("VERSION.SDK_INT < CUPCAKE")
}
handler.post {
installerChannel.invokeMethod(
"update",
@ -139,7 +140,6 @@ class MainActivity : FlutterActivity() {
PatcherOptions(
inputFile,
cacheDirPath,
resourcePatching,
Aapt.binary(applicationContext).absolutePath,
cacheDirPath,
logger = ManagerLogger()
@ -178,7 +178,7 @@ class MainActivity : FlutterActivity() {
}
patcher.addPatches(patches)
patcher.applyPatches().forEach { (patch, res) ->
patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) {
val msg = "[success] $patch"
handler.post {
@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
}
return@forEach
}
val msg = "[error] $patch:" + res.exceptionOrNull()!!
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
handler.post {
installerChannel.invokeMethod(
"update",

View File

@ -75,10 +75,12 @@
"viewTitle": "Select patches",
"searchBarHint": "Search patches",
"doneButton": "Done",
"noPatchesFound": "No patches found for the selected app"
"noPatchesFound": "No patches found for the selected app",
"selectAllPatchesWarningTitle": "Warning",
"selectAllPatchesWarningContent": "You are about to select all patches, that includes unrecommended patches and can cause unwanted behavior."
},
"patchItem": {
"unsupportedWarningButton": "Unsupported version",
"unsupportedWarningButton": "Warning",
"unsupportedDialogTitle": "Warning",
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
},
@ -113,8 +115,8 @@
"frenchOption": "French",
"sourcesLabel": "Sources",
"sourcesLabelHint": "Configure your custom sources",
"orgPatchesLabel" : "Patches Organization",
"sourcesPatchesLabel" : "Patches Source",
"orgPatchesLabel": "Patches Organization",
"sourcesPatchesLabel": "Patches Source",
"orgIntegrationsLabel": "Integrations Organization",
"sourcesIntegrationsLabel": "Integrations Source",
"sourcesResetDialogTitle": "Reset",
@ -140,13 +142,15 @@
"rootDialogTitle": "Error",
"rootDialogText": "App was installed with root mode enabled but currently root mode is disabled.\nPlease enable root mode first.",
"packageNameLabel": "Package Name",
"originalPackageNameLabel": "Original Package Name",
"installTypeLabel": "Installation Type",
"rootTypeLabel": "Root",
"nonRootTypeLabel": "Non-root",
"patchedDateLabel": "Patched Date",
"patchedDateHint": "{date} at {time}",
"appliedPatchesLabel": "Applied Patches",
"appliedPatchesHint": "{quantity} applied patches"
"appliedPatchesHint": "{quantity} applied patches",
"updateNotImplemented": "Update functionality not implemented yet"
},
"contributorsView": {
"widgetTitle": "Contributors",

View File

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

View File

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

View File

@ -8,6 +8,7 @@ part 'patched_application.g.dart';
class PatchedApplication {
String name;
String packageName;
String originalPackageName;
String version;
final String apkFilePath;
@JsonKey(
@ -25,6 +26,7 @@ class PatchedApplication {
PatchedApplication({
required this.name,
required this.packageName,
required this.originalPackageName,
required this.version,
required this.apkFilePath,
required this.icon,

View File

@ -2,18 +2,27 @@ import 'dart:convert';
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:dio_brotli_transformer/dio_brotli_transformer.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:revanced_manager/models/patch.dart';
@lazySingleton
class GithubAPI {
final Dio _dio = Dio(BaseOptions(baseUrl: 'https://api.github.com'));
final Dio _dio = Dio(
BaseOptions(
baseUrl: 'https://api.github.com',
headers: {
'accept-encoding': 'br',
},
),
)..httpClientAdapter = NativeAdapter();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1),
maxStale: const Duration(days: 7),
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
final Map<String, String> repoAppPath = {
'com.google.android.youtube': 'youtube',
@ -23,10 +32,12 @@ class GithubAPI {
'com.zhiliaoapp.musically': 'tiktok',
'de.dwd.warnapp': 'warnwetter',
'com.garzotto.pflotsh.ecmwf_a': 'ecmwf',
'com.spotify.music': 'spotify',
};
void initialize() {
_dio.interceptors.add(_dioCacheManager.interceptor);
_dio.transformer = DioBrotliTransformer(transformer: DefaultTransformer());
}
Future<void> clearAllCache() async {
@ -57,17 +68,20 @@ class GithubAPI {
'/repos/$repoName/commits',
queryParameters: {
'path': path,
'per_page': 3,
'since': since.toIso8601String(),
},
options: _cacheOptions,
);
List<dynamic> commits = response.data;
return commits
.map((commit) =>
(commit['commit']['message'] as String).split('\n')[0])
.map(
(commit) => (commit['commit']['message']).split('\n')[0] +
' - ' +
commit['commit']['author']['name'] +
'\n' as String,
)
.toList();
} on Exception {
} catch (e) {
return List.empty();
}
}

View File

@ -19,7 +19,7 @@ class ManagerAPI {
final String patcherRepo = 'revanced-patcher';
final String cliRepo = 'revanced-cli';
late SharedPreferences _prefs;
String defaultApiUrl = 'https://revanced-releases-api.afterst0rm.xyz';
String defaultApiUrl = 'https://releases.rvcd.win/';
String defaultPatcherRepo = 'revanced/revanced-patcher';
String defaultPatchesRepo = 'revanced/revanced-patches';
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
@ -213,6 +213,7 @@ class ManagerAPI {
PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
@ -241,6 +242,7 @@ class ManagerAPI {
PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
@ -254,33 +256,6 @@ class ManagerAPI {
return unsavedApps;
}
Future<void> reAssessSavedApps() async {
List<PatchedApplication> patchedApps = getPatchedApps();
List<PatchedApplication> unsavedApps = await getUnsavedApps(patchedApps);
patchedApps.addAll(unsavedApps);
List<PatchedApplication> toRemove = await getAppsToRemove(patchedApps);
patchedApps.removeWhere((a) => toRemove.contains(a));
for (PatchedApplication app in patchedApps) {
app.hasUpdates = await hasAppUpdates(app.packageName, app.patchDate);
app.changelog = await getAppChangelog(app.packageName, app.patchDate);
if (!app.hasUpdates) {
String? currentInstalledVersion =
(await DeviceApps.getApp(app.packageName))?.versionName;
if (currentInstalledVersion != null) {
String currentSavedVersion = app.version;
int currentInstalledVersionInt = int.parse(
currentInstalledVersion.replaceAll(RegExp('[^0-9]'), ''));
int currentSavedVersionInt =
int.parse(currentSavedVersion.replaceAll(RegExp('[^0-9]'), ''));
if (currentInstalledVersionInt > currentSavedVersionInt) {
app.hasUpdates = true;
}
}
}
}
await setPatchedApps(patchedApps);
}
Future<bool> isAppUninstalled(PatchedApplication app) async {
bool existsRoot = false;
bool existsNonRoot = await DeviceApps.isAppInstalled(app.packageName);
@ -314,9 +289,19 @@ class ManagerAPI {
newCommits = await _githubAPI.getCommits(
packageName,
getPatchesRepo(),
DateTime(2022, 3, 20, 21, 06, 01),
patchDate,
);
}
return newCommits;
}
Future<bool> isSplitApk(PatchedApplication patchedApp) async {
Application? app;
if (patchedApp.isFromStorage) {
app = await DeviceApps.getAppFromStorage(patchedApp.apkFilePath);
} else {
app = await DeviceApps.getApp(patchedApp.packageName);
}
return app != null && app.isSplit;
}
}

View File

@ -18,6 +18,7 @@ class PatcherAPI {
MethodChannel('app.revanced.manager.flutter/patcher');
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final RootAPI _rootAPI = RootAPI();
late Directory _dataDir;
late Directory _tmpDir;
late File _keyStoreFile;
List<Patch> _patches = [];
@ -26,8 +27,9 @@ class PatcherAPI {
Future<void> initialize() async {
await _loadPatches();
Directory appCache = await getTemporaryDirectory();
_dataDir = await getExternalStorageDirectory() ?? appCache;
_tmpDir = Directory('${appCache.path}/patcher');
_keyStoreFile = File('${appCache.path}/revanced-manager.keystore');
_keyStoreFile = File('${_dataDir.path}/revanced-manager.keystore');
cleanPatcher();
}
@ -70,14 +72,10 @@ class PatcherAPI {
}
Future<List<Patch>> getFilteredPatches(String packageName) async {
String newPackageName = packageName.replaceFirst(
'app.revanced.',
'com.google.',
);
return _patches
.where((patch) =>
!patch.name.contains('settings') &&
patch.compatiblePackages.any((pack) => pack.name == newPackageName))
patch.compatiblePackages.any((pack) => pack.name == packageName))
.toList();
}
@ -87,10 +85,21 @@ class PatcherAPI {
.toList();
}
bool dependencyNeedsIntegrations(String name) {
return name.contains('integrations') ||
_patches.any(
(patch) =>
patch.name == name &&
(patch.dependencies.any(
(dep) => dependencyNeedsIntegrations(dep),
)),
);
}
Future<bool> needsIntegrations(List<Patch> selectedPatches) async {
return selectedPatches.any(
(patch) => patch.dependencies.any(
(dep) => dep.contains('integrations'),
(dep) => dependencyNeedsIntegrations(dep),
),
);
}
@ -131,7 +140,6 @@ class PatcherAPI {
List<Patch> selectedPatches,
) async {
bool mergeIntegrations = await needsIntegrations(selectedPatches);
bool resourcePatching = await needsResourcePatching(selectedPatches);
bool includeSettings = await needsSettingsPatch(selectedPatches);
if (includeSettings) {
try {
@ -153,6 +161,7 @@ class PatcherAPI {
integrationsFile = await _managerAPI.downloadIntegrations();
}
if (patchBundleFile != null) {
_dataDir.createSync();
_tmpDir.createSync();
Directory workDir = _tmpDir.createTempSync('tmp-');
File inputFile = File('${workDir.path}/base.apk');
@ -175,7 +184,6 @@ class PatcherAPI {
'selectedPatches': selectedPatches.map((p) => p.name).toList(),
'cacheDirPath': cacheDir.path,
'mergeIntegrations': mergeIntegrations,
'resourcePatching': resourcePatching,
'keyStoreFilePath': _keyStoreFile.path,
},
);

View File

@ -1,5 +1,7 @@
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:dio_brotli_transformer/dio_brotli_transformer.dart';
import 'package:native_dio_client/native_dio_client.dart';
import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
@ -12,13 +14,20 @@ class RevancedAPI {
late Dio _dio = Dio();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(days: 1),
maxStale: const Duration(days: 7),
const Duration(hours: 6),
maxStale: const Duration(days: 1),
);
Future<void> initialize(String apiUrl) async {
_dio = Dio(BaseOptions(baseUrl: apiUrl));
_dio = Dio(BaseOptions(
baseUrl: apiUrl,
headers: {
'accept-encoding': 'br',
},
))
..httpClientAdapter = NativeAdapter();
_dio.interceptors.add(_dioCacheManager.interceptor);
_dio.transformer = DioBrotliTransformer(transformer: DefaultTransformer());
}
Future<void> clearAllCache() async {

View File

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

View File

@ -26,6 +26,7 @@ class AppSelectorViewModel extends BaseViewModel {
locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: application.apkFilePath,
icon: application.icon,
@ -51,6 +52,7 @@ class AppSelectorViewModel extends BaseViewModel {
locator<PatcherViewModel>().selectedApp = PatchedApplication(
name: application.appName,
packageName: application.packageName,
originalPackageName: application.packageName,
version: application.versionName!,
apkFilePath: result.files.single.path!,
icon: application.icon,

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/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
import 'package:stacked_services/stacked_services.dart';
import 'package:timezone/timezone.dart' as tz;
@ -49,7 +49,6 @@ class HomeViewModel extends BaseViewModel {
_toast.show('homeView.noConnection');
}
_getPatchedApps();
_managerAPI.reAssessSavedApps().then((_) => _getPatchedApps());
}
void navigateToAppInfo(PatchedApplication app) {

View File

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

View File

@ -1,3 +1,4 @@
// ignore_for_file: use_build_context_synchronously
import 'package:device_apps/device_apps.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@ -9,15 +10,17 @@ import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
import 'package:wakelock/wakelock.dart';
class InstallerViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final RootAPI _rootAPI = RootAPI();
final Toast _toast = locator<Toast>();
final PatchedApplication _app = locator<PatcherViewModel>().selectedApp!;
final List<Patch> _patches = locator<PatcherViewModel>().selectedPatches;
@ -28,11 +31,13 @@ class InstallerViewModel extends BaseViewModel {
double? progress = 0.0;
String logs = '';
String headerLogs = '';
bool isRooted = false;
bool isPatching = true;
bool isInstalled = false;
bool hasErrors = false;
Future<void> initialize(BuildContext context) async {
isRooted = await _rootAPI.isRooted();
if (await Permission.ignoreBatteryOptimizations.isGranted) {
try {
FlutterBackground.initialize(

View File

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

View File

@ -73,7 +73,12 @@ class _PatchesSelectorViewState extends State<PatchesSelectorView> {
_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:flutter_i18n/widgets/I18nText.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:stacked/stacked.dart';
import 'package:flutter/material.dart';
class PatchesSelectorViewModel extends BaseViewModel {
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
@ -14,7 +17,7 @@ class PatchesSelectorViewModel extends BaseViewModel {
Future<void> initialize() async {
patches.addAll(await _patcherAPI.getFilteredPatches(
locator<PatcherViewModel>().selectedApp!.packageName,
locator<PatcherViewModel>().selectedApp!.originalPackageName,
));
patches.sort((a, b) => a.name.compareTo(b.name));
notifyListeners();
@ -35,6 +38,23 @@ class PatchesSelectorViewModel extends BaseViewModel {
notifyListeners();
}
Future<void> selectAllPatcherWarning(BuildContext context) {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: I18nText('patchesSelectorView.selectAllPatchesWarningTitle'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: I18nText('patchesSelectorView.selectAllPatchesWarningContent'),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('okButton'),
onPressed: () => Navigator.of(context).pop(),
)
],
),
);
}
void selectAllPatches(bool isSelected) {
selectedPatches.clear();
if (isSelected) {
@ -53,9 +73,8 @@ class PatchesSelectorViewModel extends BaseViewModel {
.where((patch) =>
query.isEmpty ||
query.length < 2 ||
patch.name.toLowerCase().contains(
query.toLowerCase(),
))
patch.name.toLowerCase().contains(query.toLowerCase()) ||
patch.getSimpleName().toLowerCase().contains(query.toLowerCase()))
.toList();
}

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.router.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/settingsView/custom_text_field.dart';
import 'package:share_extend/share_extend.dart';
import 'package:stacked/stacked.dart';

View File

@ -160,8 +160,9 @@ class AppInfoView extends StatelessWidget {
child: InkWell(
borderRadius: BorderRadius.circular(16.0),
onTap: () {
model.navigateToPatcher(app);
Navigator.of(context).pop();
model.updateNotImplemented(context);
// model.navigateToPatcher(app);
// Navigator.of(context).pop();
},
child: Column(
mainAxisAlignment:
@ -260,6 +261,22 @@ class AppInfoView extends StatelessWidget {
subtitle: Text(app.packageName),
),
const SizedBox(height: 4),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'appInfoView.originalPackageNameLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle: Text(app.originalPackageName),
),
const SizedBox(height: 4),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),

View File

@ -8,10 +8,11 @@ import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:revanced_manager/services/toast.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_viewmodel.dart';
import 'package:revanced_manager/ui/views/patcher/patcher_viewmodel.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/utils/string.dart';
import 'package:stacked/stacked.dart';
@ -19,6 +20,7 @@ class AppInfoViewModel extends BaseViewModel {
final ManagerAPI _managerAPI = locator<ManagerAPI>();
final PatcherAPI _patcherAPI = locator<PatcherAPI>();
final RootAPI _rootAPI = RootAPI();
final Toast _toast = locator<Toast>();
Future<void> uninstallApp(
BuildContext context,
@ -51,6 +53,10 @@ class AppInfoViewModel extends BaseViewModel {
locator<NavigationViewModel>().setIndex(1);
}
void updateNotImplemented(BuildContext context) {
_toast.show('appInfoView.updateNotImplemented');
}
Future<void> showUninstallDialog(
BuildContext context,
PatchedApplication app,
@ -127,7 +133,8 @@ class AppInfoViewModel extends BaseViewModel {
builder: (context) => AlertDialog(
title: I18nText('appInfoView.appliedPatchesLabel'),
backgroundColor: Theme.of(context).colorScheme.secondaryContainer,
content: Text(getAppliedPatchesString(app.appliedPatches)),
content: SingleChildScrollView(
child: Text(getAppliedPatchesString(app.appliedPatches))),
actions: <Widget>[
CustomMaterialButton(
label: I18nText('okButton'),

View File

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

View File

@ -45,15 +45,17 @@ class AvailableUpdatesCard extends StatelessWidget {
physics: const NeverScrollableScrollPhysics(),
children: apps
.map((app) => ApplicationItem(
icon: app.icon,
name: app.name,
patchDate: app.patchDate,
changelog: app.changelog,
isUpdatableApp: true,
onPressed: () =>
locator<HomeViewModel>().navigateToPatcher(
app,
),
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(),
);

View File

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

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:revanced_manager/ui/widgets/installerView/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
import 'package:expandable/expandable.dart';
import 'package:timeago/timeago.dart';
@ -50,18 +50,8 @@ class _ApplicationItemState extends State<ApplicationItem>
@override
Widget build(BuildContext context) {
ExpandableController expController = ExpandableController();
return ExpandablePanel(
controller: expController,
theme: const ExpandableThemeData(
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
tapBodyToCollapse: false,
tapBodyToExpand: false,
tapHeaderToExpand: false,
hasIcon: false,
animationDuration: Duration(milliseconds: 450),
),
header: Padding(
padding: const EdgeInsets.only(bottom: 16.0),
return Container(
margin: const EdgeInsets.only(bottom: 16.0),
child: CustomCard(
onTap: () {
expController.toggle();
@ -69,74 +59,85 @@ class _ApplicationItemState extends State<ApplicationItem>
? _animationController.reverse()
: _animationController.forward();
},
child: 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,
child: ExpandablePanel(
controller: expController,
theme: const ExpandableThemeData(
inkWellBorderRadius: BorderRadius.all(Radius.circular(16)),
tapBodyToCollapse: false,
tapBodyToExpand: false,
tapHeaderToExpand: false,
hasIcon: false,
animationDuration: Duration(milliseconds: 450),
),
header: Row(
children: <Widget>[
SizedBox(
width: 40,
child: Image.memory(widget.icon, height: 40, width: 40),
),
const SizedBox(width: 4),
Padding(
padding: const EdgeInsets.only(left: 15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
widget.name.length > 12
? '${widget.name.substring(0, 12)}...'
: widget.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
Text(format(widget.patchDate)),
],
),
),
const Spacer(),
RotationTransition(
turns: Tween(begin: 0.0, end: 0.50)
.animate(_animationController),
child: const Padding(
padding: EdgeInsets.all(8.0),
child: Icon(Icons.arrow_drop_down),
),
),
const SizedBox(width: 8),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
CustomMaterialButton(
label: widget.isUpdatableApp
? I18nText('applicationItem.infoButton')
: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
),
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,
],
),
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>[
CustomMaterialButton(
label: widget.isUpdatableApp
? I18nText('applicationItem.patchButton')
: I18nText('applicationItem.infoButton'),
onPressed: widget.onPressed,
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'
version: 0.0.19+19
version: 0.0.31+31
environment:
sdk: ">=2.17.5 <3.0.0"
@ -20,6 +20,7 @@ dependencies:
ref: revanced-manager
device_info_plus: ^4.1.2
dio: ^4.0.6
dio_brotli_transformer: ^1.0.1
dio_http_cache_lts: ^0.4.1
dynamic_color: ^1.5.4
dynamic_themes: ^1.1.0
@ -50,6 +51,7 @@ dependencies:
git:
url: https://github.com/SuaMusica/logcat
ref: feature/nullSafe
native_dio_client: ^0.0.1-dev+1
package_info_plus: ^1.4.3+1
path_provider: ^2.0.11
permission_handler: ^10.0.0