Compare commits

...

11 Commits

Author SHA1 Message Date
Ushie
6b999b0a0c build: bump version to v0.0.39 2022-11-02 00:06:29 +03:00
oSumAtrIX
b00d2d16d4 feat: simplify logging (#305)
Co-authored-by: Ushie <ushiekane@gmail.com>
2022-11-02 00:02:51 +03:00
Boris M
97d4da568b fix: allow tapping on patch card when experimental switch is enabled (#464) 2022-11-02 00:02:33 +03:00
Ushie
e563049f6a build: bump version to v0.0.38 2022-11-01 19:04:23 +03:00
Ushie
cc00d0dc08 bump: kotlin gradle plugin (#461) 2022-11-01 19:03:26 +03:00
Aunali321
2a220c3984 fix: custom sources. 2022-11-01 19:03:30 +05:30
Aunali321
1d440d25be fix: dont select all patches if experimental toggle is off. 2022-11-01 15:36:06 +05:30
Aunali321
ba5234e850 feat: experimental settings to allow patch on any app version. 2022-11-01 15:26:15 +05:30
Ushie
293f7150f1 build: bump version to v0.0.37 2022-10-31 00:59:57 +03:00
Ushie
41b1cec8d3 feat: move to new API domain 2022-10-31 00:57:12 +03:00
Ushie
c129c1eeae build: bump version to v0.0.36
totally didnt forget to bump last night
2022-10-20 10:08:33 +03:00
11 changed files with 103 additions and 34 deletions

View File

@@ -180,7 +180,7 @@ class MainActivity : FlutterActivity() {
patcher.addPatches(patches)
patcher.executePatches().forEach { (patch, res) ->
if (res.isSuccess) {
val msg = "[success] $patch"
val msg = "Applied $patch"
handler.post {
installerChannel.invokeMethod(
"update",
@@ -193,7 +193,7 @@ class MainActivity : FlutterActivity() {
}
return@forEach
}
val msg = "[error] $patch:" + res.exceptionOrNull()!!.printStackTrace()
val msg = "$patch failed.\nError:\n" + res.exceptionOrNull()!!.printStackTrace()
handler.post {
installerChannel.invokeMethod(
"update",

View File

@@ -1,6 +1,6 @@
buildscript {
ext.cronetVersion = '102.5005.125'
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.7.20'
repositories {
google()
mavenCentral()

View File

@@ -84,7 +84,8 @@
"patchItem": {
"unsupportedWarningButton": "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": {
"widgetTitle": "Installer",
@@ -132,6 +133,9 @@
"apiURLLabel": "API URL",
"apiURLHint": "Configure your custom API URL",
"selectApiURL": "Select URL",
"experimentalPatchesLabel": "Experimental Patch support",
"experimentalPatchesHint": "Enable to use unsupported patches in any app version",
"enabledExperimentalPatches": "Experimental patches enabled",
"aboutLabel": "About",
"snackbarMessage": "Copied to clipboard",
"sentryLabel": "Sentry Logging",

View File

@@ -5,9 +5,7 @@ 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';
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/utils/check_for_gms.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_dio/sentry_dio.dart';
@@ -32,20 +30,10 @@ class GithubAPI {
void initialize() async {
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.addSentry(
captureFailedRequests: true,

View File

@@ -20,7 +20,7 @@ class ManagerAPI {
final String patcherRepo = 'revanced-patcher';
final String cliRepo = 'revanced-cli';
late SharedPreferences _prefs;
String defaultApiUrl = 'https://releases.rvcd.win/';
String defaultApiUrl = 'https://releases.revanced.app/';
String defaultPatcherRepo = 'revanced/revanced-patcher';
String defaultPatchesRepo = 'revanced/revanced-patches';
String defaultIntegrationsRepo = 'revanced/revanced-integrations';
@@ -90,6 +90,14 @@ class ManagerAPI {
// await _prefs.setBool('sentryEnabled', value);
// }
bool areExperimentalPatchesEnabled() {
return _prefs.getBool('experimentalPatchesEnabled') ?? false;
}
Future<void> enableExperimentalPatchesStatus(bool value) async {
await _prefs.setBool('experimentalPatchesEnabled', value);
}
Future<void> deleteTempFolder() async {
final Directory dir = Directory('/data/local/tmp/revanced-manager');
if (await dir.exists()) {

View File

@@ -61,9 +61,16 @@ class PatchesSelectorViewModel extends BaseViewModel {
void selectAllPatches(bool isSelected) {
selectedPatches.clear();
if (isSelected) {
if (isSelected && _managerAPI.areExperimentalPatchesEnabled() == false) {
selectedPatches
.addAll(patches.where((element) => isPatchSupported(element)));
}
if (isSelected && _managerAPI.areExperimentalPatchesEnabled()) {
selectedPatches.addAll(patches);
}
notifyListeners();
}

View File

@@ -136,6 +136,23 @@ class SettingsView extends StatelessWidget {
subtitle: 'settingsView.sourcesLabelHint',
onTap: () => model.showSourcesDialog(context),
),
CustomSwitchTile(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText(
'settingsView.experimentalPatchesLabel',
child: const Text(
'',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
),
),
),
subtitle:
I18nText('settingsView.experimentalPatchesHint'),
value: model.areExperimentalPatchesEnabled(),
onTap: (value) =>
model.useExperimentalPatches(value)),
ListTile(
contentPadding:
const EdgeInsets.symmetric(horizontal: 20.0),

View File

@@ -325,6 +325,16 @@ class SettingsViewModel extends BaseViewModel {
// notifyListeners();
// }
bool areExperimentalPatchesEnabled() {
return _managerAPI.areExperimentalPatchesEnabled();
}
void useExperimentalPatches(bool value) {
_managerAPI.enableExperimentalPatchesStatus(value);
_toast.showBottom('settingsView.enabledExperimentalPatches');
notifyListeners();
}
void deleteKeystore() {
_managerAPI.deleteKeystore();
_toast.showBottom('settingsView.deletedKeystore');

View File

@@ -1,5 +1,8 @@
import 'package:flutter/material.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_card.dart';
@@ -15,6 +18,8 @@ class PatchItem extends StatefulWidget {
bool isSelected;
final Function(bool) onChanged;
final Widget? child;
final toast = locator<Toast>();
final _managerAPI = locator<ManagerAPI>();
PatchItem(
{Key? key,
@@ -40,8 +45,23 @@ class _PatchItemState extends State<PatchItem> {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0),
child: CustomCard(
backgroundColor: widget.isUnsupported &&
widget._managerAPI.areExperimentalPatchesEnabled() == false
? Theme.of(context).colorScheme.brightness == Brightness.light
? Colors.grey[400]
: Colors.grey[700]
: null,
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);
},
child: Column(
@@ -83,7 +103,9 @@ class _PatchItemState extends State<PatchItem> {
overflow: TextOverflow.visible,
style: TextStyle(
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,
),
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);
},
),

View File

@@ -5,22 +5,25 @@ class CustomCard extends StatelessWidget {
final Widget child;
final Function()? onTap;
final EdgeInsetsGeometry? padding;
final Color? backgroundColor;
const CustomCard({
Key? key,
this.isFilled = true,
required this.child,
this.onTap,
this.padding,
}) : super(key: key);
const CustomCard(
{Key? key,
this.isFilled = true,
required this.child,
this.onTap,
this.padding,
this.backgroundColor})
: super(key: key);
@override
Widget build(BuildContext context) {
return Material(
type: isFilled ? MaterialType.card : MaterialType.transparency,
color: isFilled
? Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
: Colors.transparent,
? backgroundColor?.withOpacity(0.4) ??
Theme.of(context).colorScheme.secondaryContainer.withOpacity(0.4)
: backgroundColor ?? Colors.transparent,
borderRadius: BorderRadius.circular(16),
child: InkWell(
onTap: onTap,

View File

@@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager
publish_to: 'none'
version: 0.0.34+34
version: 0.0.39+39
environment:
sdk: ">=2.17.5 <3.0.0"