mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-24 03:31:03 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b999b0a0c | ||
|
|
b00d2d16d4 | ||
|
|
97d4da568b | ||
|
|
e563049f6a | ||
|
|
cc00d0dc08 | ||
|
|
2a220c3984 | ||
|
|
1d440d25be | ||
|
|
ba5234e850 |
@@ -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()
|
||||||
|
|||||||
@@ -84,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",
|
||||||
@@ -132,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",
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -90,6 +90,14 @@ class ManagerAPI {
|
|||||||
// await _prefs.setBool('sentryEnabled', value);
|
// await _prefs.setBool('sentryEnabled', value);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _prefs.getBool('experimentalPatchesEnabled') ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> enableExperimentalPatchesStatus(bool value) async {
|
||||||
|
await _prefs.setBool('experimentalPatchesEnabled', value);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> deleteTempFolder() async {
|
Future<void> deleteTempFolder() async {
|
||||||
final Directory dir = Directory('/data/local/tmp/revanced-manager');
|
final Directory dir = Directory('/data/local/tmp/revanced-manager');
|
||||||
if (await dir.exists()) {
|
if (await dir.exists()) {
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -325,6 +325,16 @@ class SettingsViewModel extends BaseViewModel {
|
|||||||
// notifyListeners();
|
// notifyListeners();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
bool areExperimentalPatchesEnabled() {
|
||||||
|
return _managerAPI.areExperimentalPatchesEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
void useExperimentalPatches(bool value) {
|
||||||
|
_managerAPI.enableExperimentalPatchesStatus(value);
|
||||||
|
_toast.showBottom('settingsView.enabledExperimentalPatches');
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
void deleteKeystore() {
|
void deleteKeystore() {
|
||||||
_managerAPI.deleteKeystore();
|
_managerAPI.deleteKeystore();
|
||||||
_toast.showBottom('settingsView.deletedKeystore');
|
_toast.showBottom('settingsView.deletedKeystore');
|
||||||
|
|||||||
@@ -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);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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.37+37
|
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