From 3fe5882145cdc6dfb0e3b3cdd5008c834f935a3a Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Sat, 6 May 2023 05:39:46 +0530 Subject: [PATCH 1/5] feat: remove cronet --- android/app/build.gradle | 4 --- android/build.gradle | 1 - lib/services/github_api.dart | 25 ++----------- lib/services/revanced_api.dart | 36 ++++--------------- .../views/app_selector/app_selector_view.dart | 2 +- lib/utils/check_for_gms.dart | 10 ------ pubspec.yaml | 1 - 7 files changed, 10 insertions(+), 69 deletions(-) delete mode 100644 lib/utils/check_for_gms.dart diff --git a/android/app/build.gradle b/android/app/build.gradle index a9c10eb24f..dd210b2b1a 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -79,10 +79,6 @@ dependencies { implementation("org.bouncycastle:bcpkix-jdk15on:1.70") implementation("com.android.tools.build:apksig:7.2.2") - // MicroG cronet - implementation("org.microg:cronet-common:$cronetVersion") - implementation("org.microg:cronet-native:$cronetVersion") - // Core libraries coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5' diff --git a/android/build.gradle b/android/build.gradle index 2d13b78c77..0910f54910 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,4 @@ buildscript { - ext.cronetVersion = '102.5005.125' ext.kotlin_version = '1.7.10' repositories { google() diff --git a/lib/services/github_api.dart b/lib/services/github_api.dart index 7316953881..b453e645c1 100644 --- a/lib/services/github_api.dart +++ b/lib/services/github_api.dart @@ -7,13 +7,12 @@ import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:injectable/injectable.dart'; -import 'package:native_dio_adapter/native_dio_adapter.dart'; import 'package:revanced_manager/models/patch.dart'; @lazySingleton class GithubAPI { late Dio _dio = Dio(); - + final _cacheOptions = CacheOptions( store: MemCacheStore(), maxStale: const Duration(days: 1), @@ -33,22 +32,6 @@ class GithubAPI { Future initialize(String repoUrl) async { try { - if (Platform.isIOS || Platform.isMacOS || Platform.isAndroid) { - final CronetEngine androidCronetEngine = await CronetEngine.build( - userAgent: 'ReVanced Manager', - enableBrotli: true, - enableQuic: true, - ); - _dio.httpClientAdapter = - NativeAdapter(androidCronetEngine: androidCronetEngine); - - _dio = Dio( - BaseOptions( - baseUrl: repoUrl, - ), - ); - } - _dio = Dio( BaseOptions( baseUrl: repoUrl, @@ -126,8 +109,7 @@ class GithubAPI { String repoName, ) async { try { - final Map? release = - await getLatestRelease(repoName); + final Map? release = await getLatestRelease(repoName); if (release != null) { final Map? asset = (release['assets'] as List).firstWhereOrNull( @@ -166,8 +148,7 @@ class GithubAPI { Future getLastestReleaseVersion(String repoName) async { try { - final Map? release = - await getLatestRelease(repoName); + final Map? release = await getLatestRelease(repoName); if (release != null) { return release['tag_name']; } else { diff --git a/lib/services/revanced_api.dart b/lib/services/revanced_api.dart index 720c4f6548..1c6d3f9eff 100644 --- a/lib/services/revanced_api.dart +++ b/lib/services/revanced_api.dart @@ -8,9 +8,7 @@ import 'package:dio_cache_interceptor/dio_cache_interceptor.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:injectable/injectable.dart'; -import 'package:native_dio_adapter/native_dio_adapter.dart'; import 'package:revanced_manager/models/patch.dart'; -import 'package:revanced_manager/utils/check_for_gms.dart'; import 'package:timeago/timeago.dart'; @lazySingleton @@ -25,34 +23,12 @@ class RevancedAPI { Future initialize(String apiUrl) async { try { - final bool isGMSInstalled = await checkForGMS(); - - if (!isGMSInstalled) { - _dio = Dio( - BaseOptions( - baseUrl: apiUrl, - ), - ); - log('ReVanced API: Using default engine + $isGMSInstalled'); - } else { - if (Platform.isIOS || Platform.isMacOS || Platform.isAndroid) { - final CronetEngine androidCronetEngine = await CronetEngine.build( - userAgent: 'ReVanced Manager', - enableBrotli: true, - enableQuic: true, - ); - _dio.httpClientAdapter = - NativeAdapter(androidCronetEngine: androidCronetEngine); - - _dio = Dio( - BaseOptions( - baseUrl: apiUrl, - ), - ); - } - - log('ReVanced API: Using CronetEngine + $isGMSInstalled'); - } + _dio = Dio( + BaseOptions( + baseUrl: apiUrl, + ), + ); + _dio.interceptors.add(DioCacheInterceptor(options: _cacheOptions)); } on Exception catch (e) { if (kDebugMode) { diff --git a/lib/ui/views/app_selector/app_selector_view.dart b/lib/ui/views/app_selector/app_selector_view.dart index a70a51ff8a..487f08a8c5 100644 --- a/lib/ui/views/app_selector/app_selector_view.dart +++ b/lib/ui/views/app_selector/app_selector_view.dart @@ -78,7 +78,7 @@ class _AppSelectorViewState extends State { child: model.noApps ? Center( child: I18nText( - 'appSelectorView.noApps', + 'appSelectorView.noAppsLabel', child: Text( '', style: TextStyle( diff --git a/lib/utils/check_for_gms.dart b/lib/utils/check_for_gms.dart deleted file mode 100644 index 79474eae18..0000000000 --- a/lib/utils/check_for_gms.dart +++ /dev/null @@ -1,10 +0,0 @@ -// Check for google mobile services on device - -import 'package:device_apps/device_apps.dart'; - -Future checkForGMS() async { - bool isGMSInstalled = true; - isGMSInstalled = await DeviceApps.isAppInstalled('com.google.android.gms') || - await DeviceApps.isAppInstalled('com.android.vending'); - return isGMSInstalled; -} diff --git a/pubspec.yaml b/pubspec.yaml index 525426a1ec..351edf410e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,7 +56,6 @@ dependencies: package_info_plus: ^3.0.3 path_provider: ^2.0.14 permission_handler: ^10.2.0 - native_dio_adapter: ^0.1.0 pull_to_refresh: ^2.0.0 root: git: From 170fc537acb195eca74b2857ed93663275e134de Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Sun, 7 May 2023 04:14:57 +0530 Subject: [PATCH 2/5] fix: fix armv7 dialog shown for x86, x86_64 --- lib/ui/views/patcher/patcher_viewmodel.dart | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/ui/views/patcher/patcher_viewmodel.dart b/lib/ui/views/patcher/patcher_viewmodel.dart index 06ead03cee..e7dffdcb5a 100644 --- a/lib/ui/views/patcher/patcher_viewmodel.dart +++ b/lib/ui/views/patcher/patcher_viewmodel.dart @@ -86,13 +86,11 @@ class PatcherViewModel extends BaseViewModel { } Future showArmv7WarningDialog(BuildContext context) async { - final bool armv7 = await AboutInfo.getInfo().then( - (info) => - info['arch'] != null && - info['arch']!.contains('armeabi-v7a') && - !info['arch']!.contains('arm64-v8a'), - ); - + final bool armv7 = await AboutInfo.getInfo().then((info) { + final List archs = info['arch']; + final supportedAbis = ['arm64-v8a', 'x86', 'x86_64']; + return !archs.any((arch) => supportedAbis.contains(arch)); + }); if (context.mounted && armv7) { return showDialog( context: context, From e509be4e21c472a69e2d91039a1e355a5fc7eb91 Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Mon, 8 May 2023 21:19:45 +0530 Subject: [PATCH 3/5] chore(deps): bump patcher to 7.1.1 --- android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index dd210b2b1a..40653d79f6 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -73,7 +73,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // ReVanced - implementation "app.revanced:revanced-patcher:7.0.0" + implementation "app.revanced:revanced-patcher:7.1.1" // Signing & aligning implementation("org.bouncycastle:bcpkix-jdk15on:1.70") From 3e565f25be5dd3a32bc4d4548c4603dda2aacf83 Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Mon, 8 May 2023 21:27:07 +0530 Subject: [PATCH 4/5] fix(appselector): closing dialog closes app selector --- lib/ui/views/app_selector/app_selector_viewmodel.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/ui/views/app_selector/app_selector_viewmodel.dart b/lib/ui/views/app_selector/app_selector_viewmodel.dart index 47e5249bfd..d747e1b8f7 100644 --- a/lib/ui/views/app_selector/app_selector_viewmodel.dart +++ b/lib/ui/views/app_selector/app_selector_viewmodel.dart @@ -137,7 +137,6 @@ class AppSelectorViewModel extends BaseViewModel { isFilled: false, onPressed: () { Navigator.pop(context); - Navigator.pop(context); }, label: Row( mainAxisAlignment: MainAxisAlignment.center, From 31fc7b74c207df7302019278df58ba2e22c87c7f Mon Sep 17 00:00:00 2001 From: Aunali321 Date: Mon, 8 May 2023 21:38:19 +0530 Subject: [PATCH 5/5] build: bump version to v1.1.0 --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 351edf410e..16abba5496 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ homepage: https://github.com/revanced/revanced-manager publish_to: 'none' -version: 1.0.0+100000000 +version: 1.1.0+100100000 environment: sdk: ">=2.17.5 <3.0.0"