mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-24 11:41:01 +00:00
Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b999b0a0c | ||
|
|
b00d2d16d4 | ||
|
|
97d4da568b | ||
|
|
e563049f6a | ||
|
|
cc00d0dc08 | ||
|
|
2a220c3984 | ||
|
|
1d440d25be | ||
|
|
ba5234e850 | ||
|
|
293f7150f1 | ||
|
|
41b1cec8d3 | ||
|
|
c129c1eeae | ||
|
|
caa9694543 | ||
|
|
ac79765372 | ||
|
|
39500f054d | ||
|
|
f2d5cc91db | ||
|
|
84a788fd9e | ||
|
|
3778bfe1b5 |
@@ -180,7 +180,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
patcher.addPatches(patches)
|
patcher.addPatches(patches)
|
||||||
patcher.executePatches().forEach { (patch, res) ->
|
patcher.executePatches().forEach { (patch, res) ->
|
||||||
if (res.isSuccess) {
|
if (res.isSuccess) {
|
||||||
val msg = "[success] $patch"
|
val msg = "Applied $patch"
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
@@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
|
|||||||
}
|
}
|
||||||
return@forEach
|
return@forEach
|
||||||
}
|
}
|
||||||
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
|
val msg = "$patch failed.\nError:\n" + res.exceptionOrNull()!!.printStackTrace()
|
||||||
handler.post {
|
handler.post {
|
||||||
installerChannel.invokeMethod(
|
installerChannel.invokeMethod(
|
||||||
"update",
|
"update",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.cronetVersion = '102.5005.125'
|
ext.cronetVersion = '102.5005.125'
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.7.20'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
"patchedSubtitle": "Patched Applications",
|
"patchedSubtitle": "Patched Applications",
|
||||||
"updatesAvailable": "Updates available",
|
"updatesAvailable": "Updates available",
|
||||||
"noUpdates": "No updates available",
|
"noUpdates": "No updates available",
|
||||||
|
"WIP": "Work In Progress",
|
||||||
"noInstallations": "No patched applications installed",
|
"noInstallations": "No patched applications installed",
|
||||||
"installed": "Installed",
|
"installed": "Installed",
|
||||||
"updateDialogTitle": "Update Manager",
|
"updateDialogTitle": "Update Manager",
|
||||||
@@ -26,7 +27,8 @@
|
|||||||
"installingMessage": "Installing update...",
|
"installingMessage": "Installing update...",
|
||||||
"errorDownloadMessage": "Unable to download update",
|
"errorDownloadMessage": "Unable to download update",
|
||||||
"errorInstallMessage": "Unable to install update",
|
"errorInstallMessage": "Unable to install update",
|
||||||
"noConnection": "No internet connection"
|
"noConnection": "No internet connection",
|
||||||
|
"updatesDisabled": "Updating a patched app is currently disabled. Repatch the app again."
|
||||||
},
|
},
|
||||||
"applicationItem": {
|
"applicationItem": {
|
||||||
"patchButton": "Patch",
|
"patchButton": "Patch",
|
||||||
@@ -82,7 +84,8 @@
|
|||||||
"patchItem": {
|
"patchItem": {
|
||||||
"unsupportedWarningButton": "Warning",
|
"unsupportedWarningButton": "Warning",
|
||||||
"unsupportedDialogTitle": "Warning",
|
"unsupportedDialogTitle": "Warning",
|
||||||
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}"
|
"unsupportedDialogText": "Selecting this patch may result in patching errors.\n\nApp version: {packageVersion}\nCurrent supported versions:\n{supportedVersions}",
|
||||||
|
"unsupportedPatchVersion": "Patch is not supported for this app version. Enable experimental toggle in settings to proceed."
|
||||||
},
|
},
|
||||||
"installerView": {
|
"installerView": {
|
||||||
"widgetTitle": "Installer",
|
"widgetTitle": "Installer",
|
||||||
@@ -130,6 +133,9 @@
|
|||||||
"apiURLLabel": "API URL",
|
"apiURLLabel": "API URL",
|
||||||
"apiURLHint": "Configure your custom API URL",
|
"apiURLHint": "Configure your custom API URL",
|
||||||
"selectApiURL": "Select URL",
|
"selectApiURL": "Select URL",
|
||||||
|
"experimentalPatchesLabel": "Experimental Patch support",
|
||||||
|
"experimentalPatchesHint": "Enable to use unsupported patches in any app version",
|
||||||
|
"enabledExperimentalPatches": "Experimental patches enabled",
|
||||||
"aboutLabel": "About",
|
"aboutLabel": "About",
|
||||||
"snackbarMessage": "Copied to clipboard",
|
"snackbarMessage": "Copied to clipboard",
|
||||||
"sentryLabel": "Sentry Logging",
|
"sentryLabel": "Sentry Logging",
|
||||||
|
|||||||
@@ -19,34 +19,35 @@ Future main() async {
|
|||||||
await locator<ManagerAPI>().initialize();
|
await locator<ManagerAPI>().initialize();
|
||||||
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
String apiUrl = locator<ManagerAPI>().getApiUrl();
|
||||||
await locator<RevancedAPI>().initialize(apiUrl);
|
await locator<RevancedAPI>().initialize(apiUrl);
|
||||||
bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
// bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
|
||||||
locator<GithubAPI>().initialize();
|
locator<GithubAPI>().initialize();
|
||||||
await locator<PatcherAPI>().initialize();
|
await locator<PatcherAPI>().initialize();
|
||||||
tz.initializeTimeZones();
|
tz.initializeTimeZones();
|
||||||
|
|
||||||
// Remove this section if you are building from source and don't have sentry configured
|
// Remove this section if you are building from source and don't have sentry configured
|
||||||
await SentryFlutter.init(
|
// await SentryFlutter.init(
|
||||||
(options) {
|
// (options) {
|
||||||
options
|
// options
|
||||||
..dsn = isSentryEnabled ? '' : ''
|
// ..dsn = isSentryEnabled ? '' : ''
|
||||||
..environment = 'alpha'
|
// ..environment = 'alpha'
|
||||||
..release = '0.1'
|
// ..release = '0.1'
|
||||||
..tracesSampleRate = 1.0
|
// ..tracesSampleRate = 1.0
|
||||||
..anrEnabled = true
|
// ..anrEnabled = true
|
||||||
..enableOutOfMemoryTracking = true
|
// ..enableOutOfMemoryTracking = true
|
||||||
..sampleRate = isSentryEnabled ? 1.0 : 0.0
|
// ..sampleRate = isSentryEnabled ? 1.0 : 0.0
|
||||||
..beforeSend = (event, hint) {
|
// ..beforeSend = (event, hint) {
|
||||||
if (isSentryEnabled) {
|
// if (isSentryEnabled) {
|
||||||
return event;
|
// return event;
|
||||||
} else {
|
// } else {
|
||||||
return null;
|
// return null;
|
||||||
}
|
// }
|
||||||
} as BeforeSendCallback?;
|
// } as BeforeSendCallback?;
|
||||||
},
|
// },
|
||||||
appRunner: () {
|
// appRunner: () {
|
||||||
runApp(const MyApp());
|
// runApp(const MyApp());
|
||||||
},
|
// },
|
||||||
);
|
// );
|
||||||
|
runApp(const MyApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
|
|||||||
@@ -5,9 +5,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
|
||||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||||
import 'package:injectable/injectable.dart';
|
import 'package:injectable/injectable.dart';
|
||||||
import 'package:native_dio_client/native_dio_client.dart';
|
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/utils/check_for_gms.dart';
|
|
||||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||||
import 'package:sentry_dio/sentry_dio.dart';
|
import 'package:sentry_dio/sentry_dio.dart';
|
||||||
|
|
||||||
@@ -32,20 +30,10 @@ class GithubAPI {
|
|||||||
|
|
||||||
void initialize() async {
|
void initialize() async {
|
||||||
try {
|
try {
|
||||||
bool isGMSInstalled = await checkForGMS();
|
_dio = Dio(BaseOptions(
|
||||||
|
baseUrl: 'https://api.github.com',
|
||||||
|
));
|
||||||
|
|
||||||
if (!isGMSInstalled) {
|
|
||||||
_dio = Dio(BaseOptions(
|
|
||||||
baseUrl: 'https://api.github.com',
|
|
||||||
));
|
|
||||||
print('GitHub API: Using default engine + $isGMSInstalled');
|
|
||||||
} else {
|
|
||||||
_dio = Dio(BaseOptions(
|
|
||||||
baseUrl: 'https://api.github.com',
|
|
||||||
))
|
|
||||||
..httpClientAdapter = NativeAdapter();
|
|
||||||
print('ReVanced API: Using CronetEngine + $isGMSInstalled');
|
|
||||||
}
|
|
||||||
_dio.interceptors.add(_dioCacheManager.interceptor);
|
_dio.interceptors.add(_dioCacheManager.interceptor);
|
||||||
_dio.addSentry(
|
_dio.addSentry(
|
||||||
captureFailedRequests: true,
|
captureFailedRequests: true,
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class ManagerAPI {
|
|||||||
final String patcherRepo = 'revanced-patcher';
|
final String patcherRepo = 'revanced-patcher';
|
||||||
final String cliRepo = 'revanced-cli';
|
final String cliRepo = 'revanced-cli';
|
||||||
late SharedPreferences _prefs;
|
late SharedPreferences _prefs;
|
||||||
String defaultApiUrl = 'https://releases.rvcd.win/';
|
String defaultApiUrl = 'https://releases.revanced.app/';
|
||||||
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
String defaultPatcherRepo = 'revanced/revanced-patcher';
|
||||||
String defaultPatchesRepo = 'revanced/revanced-patches';
|
String defaultPatchesRepo = 'revanced/revanced-patches';
|
||||||
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
|
||||||
@@ -82,12 +82,20 @@ class ManagerAPI {
|
|||||||
await _prefs.setBool('useDarkTheme', value);
|
await _prefs.setBool('useDarkTheme', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSentryEnabled() {
|
// bool isSentryEnabled() {
|
||||||
return _prefs.getBool('sentryEnabled') ?? true;
|
// return _prefs.getBool('sentryEnabled') ?? true;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Future<void> setSentryStatus(bool value) async {
|
||||||
|
// await _prefs.setBool('sentryEnabled', value);
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _prefs.getBool('experimentalPatchesEnabled') ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setSentryStatus(bool value) async {
|
Future<void> enableExperimentalPatchesStatus(bool value) async {
|
||||||
await _prefs.setBool('sentryEnabled', value);
|
await _prefs.setBool('experimentalPatchesEnabled', value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> deleteTempFolder() async {
|
Future<void> deleteTempFolder() async {
|
||||||
@@ -99,7 +107,7 @@ class ManagerAPI {
|
|||||||
|
|
||||||
Future<void> deleteKeystore() async {
|
Future<void> deleteKeystore() async {
|
||||||
final File keystore = File(
|
final File keystore = File(
|
||||||
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-keystore.keystore');
|
'/sdcard/Android/data/app.revanced.manager.flutter/files/revanced-manager.keystore');
|
||||||
if (await keystore.exists()) {
|
if (await keystore.exists()) {
|
||||||
await keystore.delete();
|
await keystore.delete();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,20 +67,20 @@ class HomeView extends StatelessWidget {
|
|||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
DashboardChip(
|
|
||||||
label: I18nText('homeView.updatesAvailable'),
|
|
||||||
isSelected: model.showUpdatableApps,
|
|
||||||
onSelected: (value) {
|
|
||||||
model.toggleUpdatableApps(true);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
DashboardChip(
|
DashboardChip(
|
||||||
label: I18nText('homeView.installed'),
|
label: I18nText('homeView.installed'),
|
||||||
isSelected: !model.showUpdatableApps,
|
isSelected: !model.showUpdatableApps,
|
||||||
onSelected: (value) {
|
onSelected: (value) {
|
||||||
model.toggleUpdatableApps(false);
|
model.toggleUpdatableApps(false);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
DashboardChip(
|
||||||
|
label: I18nText('homeView.updatesAvailable'),
|
||||||
|
isSelected: model.showUpdatableApps,
|
||||||
|
onSelected: (value) {
|
||||||
|
model.toggleUpdatableApps(true);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
final Toast _toast = locator<Toast>();
|
final Toast _toast = locator<Toast>();
|
||||||
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
|
||||||
DateTime? _lastUpdate;
|
DateTime? _lastUpdate;
|
||||||
bool showUpdatableApps = true;
|
bool showUpdatableApps = false;
|
||||||
List<PatchedApplication> patchedInstalledApps = [];
|
List<PatchedApplication> patchedInstalledApps = [];
|
||||||
List<PatchedApplication> patchedUpdatableApps = [];
|
List<PatchedApplication> patchedUpdatableApps = [];
|
||||||
|
|
||||||
@@ -143,6 +143,10 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatesAreDisabled() {
|
||||||
|
_toast.show('homeView.updatesDisabled');
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
Future<void> showUpdateConfirmationDialog(BuildContext parentContext) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: parentContext,
|
context: parentContext,
|
||||||
|
|||||||
@@ -219,9 +219,7 @@ class InstallerViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
void shareResult() {
|
void shareResult() {
|
||||||
try {
|
try {
|
||||||
if (isInstalled) {
|
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
||||||
_patcherAPI.sharePatchedFile(_app.name, _app.version);
|
|
||||||
}
|
|
||||||
} on Exception catch (e, s) {
|
} on Exception catch (e, s) {
|
||||||
Sentry.captureException(e, stackTrace: s);
|
Sentry.captureException(e, stackTrace: s);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,9 +61,16 @@ class PatchesSelectorViewModel extends BaseViewModel {
|
|||||||
|
|
||||||
void selectAllPatches(bool isSelected) {
|
void selectAllPatches(bool isSelected) {
|
||||||
selectedPatches.clear();
|
selectedPatches.clear();
|
||||||
if (isSelected) {
|
|
||||||
|
if (isSelected && _managerAPI.areExperimentalPatchesEnabled() == false) {
|
||||||
|
selectedPatches
|
||||||
|
.addAll(patches.where((element) => isPatchSupported(element)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSelected && _managerAPI.areExperimentalPatchesEnabled()) {
|
||||||
selectedPatches.addAll(patches);
|
selectedPatches.addAll(patches);
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,23 @@ class SettingsView extends StatelessWidget {
|
|||||||
subtitle: 'settingsView.sourcesLabelHint',
|
subtitle: 'settingsView.sourcesLabelHint',
|
||||||
onTap: () => model.showSourcesDialog(context),
|
onTap: () => model.showSourcesDialog(context),
|
||||||
),
|
),
|
||||||
|
CustomSwitchTile(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
|
title: I18nText(
|
||||||
|
'settingsView.experimentalPatchesLabel',
|
||||||
|
child: const Text(
|
||||||
|
'',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
subtitle:
|
||||||
|
I18nText('settingsView.experimentalPatchesHint'),
|
||||||
|
value: model.areExperimentalPatchesEnabled(),
|
||||||
|
onTap: (value) =>
|
||||||
|
model.useExperimentalPatches(value)),
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding:
|
contentPadding:
|
||||||
const EdgeInsets.symmetric(horizontal: 20.0),
|
const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
@@ -187,28 +204,28 @@ class SettingsView extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
_settingsDivider,
|
_settingsDivider,
|
||||||
SettingsSection(
|
// SettingsSection(
|
||||||
title: 'settingsView.logsSectionTitle',
|
// title: 'settingsView.logsSectionTitle',
|
||||||
children: <Widget>[
|
// children: <Widget>[
|
||||||
CustomSwitchTile(
|
// CustomSwitchTile(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
// padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||||
title: I18nText(
|
// title: I18nText(
|
||||||
'settingsView.sentryLabel',
|
// 'settingsView.sentryLabel',
|
||||||
child: const Text(
|
// child: const Text(
|
||||||
'',
|
// '',
|
||||||
style: TextStyle(
|
// style: TextStyle(
|
||||||
fontSize: 20,
|
// fontSize: 20,
|
||||||
fontWeight: FontWeight.w500,
|
// fontWeight: FontWeight.w500,
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
),
|
// ),
|
||||||
subtitle: I18nText('settingsView.sentryHint'),
|
// subtitle: I18nText('settingsView.sentryHint'),
|
||||||
value: model.isSentryEnabled(),
|
// value: model.isSentryEnabled(),
|
||||||
onTap: (value) => model.useSentry(value),
|
// onTap: (value) => model.useSentry(value),
|
||||||
),
|
// ),
|
||||||
],
|
// ],
|
||||||
),
|
// ),
|
||||||
_settingsDivider,
|
// _settingsDivider,
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
title: 'settingsView.infoSectionTitle',
|
title: 'settingsView.infoSectionTitle',
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
|||||||
@@ -315,15 +315,23 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable sentry using switch boolean
|
// bool isSentryEnabled() {
|
||||||
|
// return _managerAPI.isSentryEnabled();
|
||||||
|
// }
|
||||||
|
|
||||||
bool isSentryEnabled() {
|
// void useSentry(bool value) {
|
||||||
return _managerAPI.isSentryEnabled();
|
// _managerAPI.setSentryStatus(value);
|
||||||
|
// _toast.showBottom('settingsView.restartAppForChanges');
|
||||||
|
// notifyListeners();
|
||||||
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _managerAPI.areExperimentalPatchesEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void useSentry(bool value) {
|
void useExperimentalPatches(bool value) {
|
||||||
_managerAPI.setSentryStatus(value);
|
_managerAPI.enableExperimentalPatchesStatus(value);
|
||||||
_toast.showBottom('settingsView.restartAppForChanges');
|
_toast.showBottom('settingsView.enabledExperimentalPatches');
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,50 +14,74 @@ class AvailableUpdatesCard extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return apps.isEmpty
|
return CustomCard(
|
||||||
? CustomCard(
|
child: Center(
|
||||||
child: Center(
|
child: Column(
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
children: <Widget>[
|
Icon(
|
||||||
Icon(
|
size: 40,
|
||||||
size: 40,
|
Icons.update_disabled,
|
||||||
Icons.update_disabled,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 16),
|
|
||||||
I18nText(
|
|
||||||
'homeView.noUpdates',
|
|
||||||
child: Text(
|
|
||||||
'',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
|
||||||
color: Theme.of(context).colorScheme.secondary,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
const SizedBox(height: 16),
|
||||||
: ListView(
|
I18nText(
|
||||||
shrinkWrap: true,
|
'homeView.WIP',
|
||||||
padding: EdgeInsets.zero,
|
child: Text(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
'',
|
||||||
children: apps
|
textAlign: TextAlign.center,
|
||||||
.map((app) => ApplicationItem(
|
style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||||
icon: app.icon,
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
name: app.name,
|
),
|
||||||
patchDate: app.patchDate,
|
),
|
||||||
changelog: app.changelog,
|
)
|
||||||
isUpdatableApp: true,
|
],
|
||||||
//TODO: Find a better way to do update functionality
|
),
|
||||||
onPressed: () {}
|
),
|
||||||
// () =>
|
);
|
||||||
// locator<HomeViewModel>().navigateToPatcher(
|
// return apps.isEmpty
|
||||||
// app,
|
// ? CustomCard(
|
||||||
// ),
|
// child: Center(
|
||||||
))
|
// child: Column(
|
||||||
.toList(),
|
// children: <Widget>[
|
||||||
);
|
// Icon(
|
||||||
|
// size: 40,
|
||||||
|
// Icons.update_disabled,
|
||||||
|
// color: Theme.of(context).colorScheme.secondary,
|
||||||
|
// ),
|
||||||
|
// const SizedBox(height: 16),
|
||||||
|
// I18nText(
|
||||||
|
// 'homeView.noUpdates',
|
||||||
|
// child: Text(
|
||||||
|
// '',
|
||||||
|
// textAlign: TextAlign.center,
|
||||||
|
// style: Theme.of(context).textTheme.subtitle1!.copyWith(
|
||||||
|
// color: Theme.of(context).colorScheme.secondary,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// : ListView(
|
||||||
|
// shrinkWrap: true,
|
||||||
|
// padding: EdgeInsets.zero,
|
||||||
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
|
// children: apps
|
||||||
|
// .map((app) => ApplicationItem(
|
||||||
|
// icon: app.icon,
|
||||||
|
// name: app.name,
|
||||||
|
// patchDate: app.patchDate,
|
||||||
|
// changelog: app.changelog,
|
||||||
|
// isUpdatableApp: true,
|
||||||
|
// //TODO: Find a better way to do update functionality
|
||||||
|
// onPressed: () {}
|
||||||
|
// // () =>
|
||||||
|
// // locator<HomeViewModel>().navigateToPatcher(
|
||||||
|
// // app,
|
||||||
|
// // ),
|
||||||
|
// ))
|
||||||
|
// .toList(),
|
||||||
|
// );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_i18n/flutter_i18n.dart';
|
import 'package:flutter_i18n/flutter_i18n.dart';
|
||||||
|
import 'package:revanced_manager/app/app.locator.dart';
|
||||||
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
|
import 'package:revanced_manager/services/toast.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_material_button.dart';
|
||||||
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
import 'package:revanced_manager/ui/widgets/shared/custom_card.dart';
|
||||||
|
|
||||||
@@ -15,6 +18,8 @@ class PatchItem extends StatefulWidget {
|
|||||||
bool isSelected;
|
bool isSelected;
|
||||||
final Function(bool) onChanged;
|
final Function(bool) onChanged;
|
||||||
final Widget? child;
|
final Widget? child;
|
||||||
|
final toast = locator<Toast>();
|
||||||
|
final _managerAPI = locator<ManagerAPI>();
|
||||||
|
|
||||||
PatchItem(
|
PatchItem(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
@@ -40,8 +45,23 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||||
child: CustomCard(
|
child: CustomCard(
|
||||||
|
backgroundColor: widget.isUnsupported &&
|
||||||
|
widget._managerAPI.areExperimentalPatchesEnabled() == false
|
||||||
|
? Theme.of(context).colorScheme.brightness == Brightness.light
|
||||||
|
? Colors.grey[400]
|
||||||
|
: Colors.grey[700]
|
||||||
|
: null,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() => widget.isSelected = !widget.isSelected);
|
setState(() {
|
||||||
|
if (widget.isUnsupported &&
|
||||||
|
!widget._managerAPI.areExperimentalPatchesEnabled()
|
||||||
|
) {
|
||||||
|
widget.isSelected = false;
|
||||||
|
widget.toast.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
|
} else {
|
||||||
|
widget.isSelected = !widget.isSelected;
|
||||||
|
}
|
||||||
|
});
|
||||||
widget.onChanged(widget.isSelected);
|
widget.onChanged(widget.isSelected);
|
||||||
},
|
},
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -83,7 +103,9 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
color: Theme.of(context)
|
||||||
|
.colorScheme
|
||||||
|
.onSecondaryContainer,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -101,7 +123,17 @@ class _PatchItemState extends State<PatchItem> {
|
|||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
),
|
),
|
||||||
onChanged: (newValue) {
|
onChanged: (newValue) {
|
||||||
setState(() => widget.isSelected = newValue!);
|
setState(() {
|
||||||
|
if (widget.isUnsupported &&
|
||||||
|
!widget._managerAPI.areExperimentalPatchesEnabled()
|
||||||
|
) {
|
||||||
|
widget.isSelected = false;
|
||||||
|
widget.toast
|
||||||
|
.showBottom('patchItem.unsupportedPatchVersion');
|
||||||
|
} else {
|
||||||
|
widget.isSelected = newValue!;
|
||||||
|
}
|
||||||
|
});
|
||||||
widget.onChanged(widget.isSelected);
|
widget.onChanged(widget.isSelected);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class _ApplicationItemState extends State<ApplicationItem>
|
|||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
CustomMaterialButton(
|
CustomMaterialButton(
|
||||||
label: widget.isUpdatableApp
|
label: widget.isUpdatableApp
|
||||||
? I18nText('applicationItem.infoButton')
|
? I18nText('applicationItem.patchButton')
|
||||||
: I18nText('applicationItem.infoButton'),
|
: I18nText('applicationItem.infoButton'),
|
||||||
onPressed: widget.onPressed,
|
onPressed: widget.onPressed,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,22 +5,25 @@ class CustomCard extends StatelessWidget {
|
|||||||
final Widget child;
|
final Widget child;
|
||||||
final Function()? onTap;
|
final Function()? onTap;
|
||||||
final EdgeInsetsGeometry? padding;
|
final EdgeInsetsGeometry? padding;
|
||||||
|
final Color? backgroundColor;
|
||||||
|
|
||||||
const CustomCard({
|
const CustomCard(
|
||||||
Key? key,
|
{Key? key,
|
||||||
this.isFilled = true,
|
this.isFilled = true,
|
||||||
required this.child,
|
required this.child,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.padding,
|
this.padding,
|
||||||
}) : super(key: key);
|
this.backgroundColor})
|
||||||
|
: super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Material(
|
return Material(
|
||||||
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
type: isFilled ? MaterialType.card : MaterialType.transparency,
|
||||||
color: isFilled
|
color: isFilled
|
||||||
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
? backgroundColor?.withOpacity(0.4) ??
|
||||||
: Colors.transparent,
|
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
|
||||||
|
: backgroundColor ?? Colors.transparent,
|
||||||
borderRadius: BorderRadius.circular(16),
|
borderRadius: BorderRadius.circular(16),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 0.0.34+34
|
version: 0.0.39+39
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.5 <3.0.0"
|
sdk: ">=2.17.5 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user