mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
feat: remove cronet
This commit is contained in:
parent
2ebd38ff68
commit
3fe5882145
@ -79,10 +79,6 @@ dependencies {
|
|||||||
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
implementation("org.bouncycastle:bcpkix-jdk15on:1.70")
|
||||||
implementation("com.android.tools.build:apksig:7.2.2")
|
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
|
// Core libraries
|
||||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
ext.cronetVersion = '102.5005.125'
|
|
||||||
ext.kotlin_version = '1.7.10'
|
ext.kotlin_version = '1.7.10'
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
|
@ -7,13 +7,12 @@ import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.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_adapter/native_dio_adapter.dart';
|
|
||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class GithubAPI {
|
class GithubAPI {
|
||||||
late Dio _dio = Dio();
|
late Dio _dio = Dio();
|
||||||
|
|
||||||
final _cacheOptions = CacheOptions(
|
final _cacheOptions = CacheOptions(
|
||||||
store: MemCacheStore(),
|
store: MemCacheStore(),
|
||||||
maxStale: const Duration(days: 1),
|
maxStale: const Duration(days: 1),
|
||||||
@ -33,22 +32,6 @@ class GithubAPI {
|
|||||||
|
|
||||||
Future<void> initialize(String repoUrl) async {
|
Future<void> initialize(String repoUrl) async {
|
||||||
try {
|
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(
|
_dio = Dio(
|
||||||
BaseOptions(
|
BaseOptions(
|
||||||
baseUrl: repoUrl,
|
baseUrl: repoUrl,
|
||||||
@ -126,8 +109,7 @@ class GithubAPI {
|
|||||||
String repoName,
|
String repoName,
|
||||||
) async {
|
) async {
|
||||||
try {
|
try {
|
||||||
final Map<String, dynamic>? release =
|
final Map<String, dynamic>? release = await getLatestRelease(repoName);
|
||||||
await getLatestRelease(repoName);
|
|
||||||
if (release != null) {
|
if (release != null) {
|
||||||
final Map<String, dynamic>? asset =
|
final Map<String, dynamic>? asset =
|
||||||
(release['assets'] as List<dynamic>).firstWhereOrNull(
|
(release['assets'] as List<dynamic>).firstWhereOrNull(
|
||||||
@ -166,8 +148,7 @@ class GithubAPI {
|
|||||||
|
|
||||||
Future<String> getLastestReleaseVersion(String repoName) async {
|
Future<String> getLastestReleaseVersion(String repoName) async {
|
||||||
try {
|
try {
|
||||||
final Map<String, dynamic>? release =
|
final Map<String, dynamic>? release = await getLatestRelease(repoName);
|
||||||
await getLatestRelease(repoName);
|
|
||||||
if (release != null) {
|
if (release != null) {
|
||||||
return release['tag_name'];
|
return release['tag_name'];
|
||||||
} else {
|
} else {
|
||||||
|
@ -8,9 +8,7 @@ import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.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_adapter/native_dio_adapter.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:timeago/timeago.dart';
|
import 'package:timeago/timeago.dart';
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
@ -25,34 +23,12 @@ class RevancedAPI {
|
|||||||
|
|
||||||
Future<void> initialize(String apiUrl) async {
|
Future<void> initialize(String apiUrl) async {
|
||||||
try {
|
try {
|
||||||
final bool isGMSInstalled = await checkForGMS();
|
_dio = Dio(
|
||||||
|
BaseOptions(
|
||||||
|
baseUrl: apiUrl,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
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.interceptors.add(DioCacheInterceptor(options: _cacheOptions));
|
_dio.interceptors.add(DioCacheInterceptor(options: _cacheOptions));
|
||||||
} on Exception catch (e) {
|
} on Exception catch (e) {
|
||||||
if (kDebugMode) {
|
if (kDebugMode) {
|
||||||
|
@ -78,7 +78,7 @@ class _AppSelectorViewState extends State<AppSelectorView> {
|
|||||||
child: model.noApps
|
child: model.noApps
|
||||||
? Center(
|
? Center(
|
||||||
child: I18nText(
|
child: I18nText(
|
||||||
'appSelectorView.noApps',
|
'appSelectorView.noAppsLabel',
|
||||||
child: Text(
|
child: Text(
|
||||||
'',
|
'',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
// Check for google mobile services on device
|
|
||||||
|
|
||||||
import 'package:device_apps/device_apps.dart';
|
|
||||||
|
|
||||||
Future<bool> checkForGMS() async {
|
|
||||||
bool isGMSInstalled = true;
|
|
||||||
isGMSInstalled = await DeviceApps.isAppInstalled('com.google.android.gms') ||
|
|
||||||
await DeviceApps.isAppInstalled('com.android.vending');
|
|
||||||
return isGMSInstalled;
|
|
||||||
}
|
|
@ -56,7 +56,6 @@ dependencies:
|
|||||||
package_info_plus: ^3.0.3
|
package_info_plus: ^3.0.3
|
||||||
path_provider: ^2.0.14
|
path_provider: ^2.0.14
|
||||||
permission_handler: ^10.2.0
|
permission_handler: ^10.2.0
|
||||||
native_dio_adapter: ^0.1.0
|
|
||||||
pull_to_refresh: ^2.0.0
|
pull_to_refresh: ^2.0.0
|
||||||
root:
|
root:
|
||||||
git:
|
git:
|
||||||
|
Loading…
Reference in New Issue
Block a user