mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2025-05-12 05:25:36 +02:00
chore: update dependencies (#772)
* chore: updated some dependencies * refactor: reimplemented cache interceptor * Revert "Updated dependencies & migrated breaking changes" This reverts commit e6743b0d6b2552fdbf1c99d23e158e682362dd5d. * chore: migrated flutter_local_notifications * revert: reimplemented cache interceptor
This commit is contained in:
parent
37b583f560
commit
197770b68b
10 changed files with 199 additions and 92 deletions
|
@ -13,7 +13,7 @@ import 'package:revanced_manager/models/patch.dart';
|
|||
@lazySingleton
|
||||
class GithubAPI {
|
||||
late Dio _dio = Dio();
|
||||
|
||||
|
||||
final _cacheOptions = CacheOptions(
|
||||
store: MemCacheStore(),
|
||||
maxStale: const Duration(days: 1),
|
||||
|
@ -73,7 +73,9 @@ class GithubAPI {
|
|||
}
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>?> getLatestRelease(String repoName) async {
|
||||
Future<Map<String, dynamic>?> getLatestRelease(
|
||||
String repoName,
|
||||
) async {
|
||||
try {
|
||||
final response = await _dio.get(
|
||||
'/repos/$repoName/releases',
|
||||
|
@ -119,9 +121,13 @@ class GithubAPI {
|
|||
return [];
|
||||
}
|
||||
|
||||
Future<File?> getLatestReleaseFile(String extension, String repoName) async {
|
||||
Future<File?> getLatestReleaseFile(
|
||||
String extension,
|
||||
String repoName,
|
||||
) async {
|
||||
try {
|
||||
final Map<String, dynamic>? release = await getLatestRelease(repoName);
|
||||
final Map<String, dynamic>? release =
|
||||
await getLatestRelease(repoName);
|
||||
if (release != null) {
|
||||
final Map<String, dynamic>? asset =
|
||||
(release['assets'] as List<dynamic>).firstWhereOrNull(
|
||||
|
@ -160,7 +166,8 @@ class GithubAPI {
|
|||
|
||||
Future<String> getLastestReleaseVersion(String repoName) async {
|
||||
try {
|
||||
final Map<String, dynamic>? release = await getLatestRelease(repoName);
|
||||
final Map<String, dynamic>? release =
|
||||
await getLatestRelease(repoName);
|
||||
if (release != null) {
|
||||
return release['tag_name'];
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue