feat: HTTP/3 Support.

This commit is contained in:
Aunali321 2022-10-07 18:23:43 +05:30
parent a90923011a
commit 78428f6bd3
3 changed files with 5 additions and 15 deletions

View File

@ -5,19 +5,14 @@ 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:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton
class GithubAPI {
final Dio _dio = Dio(
BaseOptions(baseUrl: 'https://api.github.com'),
)..httpClientAdapter = Http2Adapter(
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
)..httpClientAdapter = NativeAdapter();
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
final Options _cacheOptions = buildCacheOptions(
const Duration(hours: 6),

View File

@ -1,12 +1,12 @@
import 'dart:io';
import 'package:collection/collection.dart';
import 'package:native_dio_client/native_dio_client.dart';
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:revanced_manager/models/patch.dart';
import 'package:timeago/timeago.dart';
import 'package:dio_http2_adapter/dio_http2_adapter.dart';
@lazySingleton
class RevancedAPI {
@ -21,12 +21,7 @@ class RevancedAPI {
_dio = Dio(BaseOptions(
baseUrl: apiUrl,
))
..httpClientAdapter = Http2Adapter(
ConnectionManager(
idleTimeout: 10000,
onClientCreate: (_, config) => config.onBadCertificate = (_) => true,
),
);
..httpClientAdapter = NativeAdapter();
_dio.interceptors.add(_dioCacheManager.interceptor);
}

View File

@ -20,7 +20,6 @@ dependencies:
ref: revanced-manager
device_info_plus: ^4.1.2
dio: ^4.0.6
dio_http2_adapter: ^2.0.0
dio_http_cache_lts: ^0.4.1
dynamic_color: ^1.5.4
dynamic_themes: ^1.1.0
@ -51,6 +50,7 @@ dependencies:
git:
url: https://github.com/SuaMusica/logcat
ref: feature/nullSafe
native_dio_client: ^0.0.1-dev+1
package_info_plus: ^1.4.3+1
path_provider: ^2.0.11
permission_handler: ^10.0.0