mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
fix: app crash after custom source
This commit is contained in:
parent
68876a4414
commit
da6cf585c0
@ -1,6 +1,5 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
import 'package:dio_cache_interceptor/dio_cache_interceptor.dart';
|
||||||
@ -10,7 +9,6 @@ import 'package:injectable/injectable.dart';
|
|||||||
import 'package:revanced_manager/models/patch.dart';
|
import 'package:revanced_manager/models/patch.dart';
|
||||||
import 'package:revanced_manager/services/manager_api.dart';
|
import 'package:revanced_manager/services/manager_api.dart';
|
||||||
|
|
||||||
|
|
||||||
@lazySingleton
|
@lazySingleton
|
||||||
class GithubAPI {
|
class GithubAPI {
|
||||||
late Dio _dio = Dio();
|
late Dio _dio = Dio();
|
||||||
@ -61,6 +59,22 @@ class GithubAPI {
|
|||||||
Future<Map<String, dynamic>?> getLatestRelease(
|
Future<Map<String, dynamic>?> getLatestRelease(
|
||||||
String repoName,
|
String repoName,
|
||||||
) async {
|
) async {
|
||||||
|
try {
|
||||||
|
final response = await _dio.get(
|
||||||
|
'/repos/$repoName/releases',
|
||||||
|
);
|
||||||
|
return response.data[0];
|
||||||
|
} on Exception catch (e) {
|
||||||
|
if (kDebugMode) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, dynamic>?> getLatestManagerRelease(
|
||||||
|
String repoName,
|
||||||
|
) async {
|
||||||
try {
|
try {
|
||||||
final response = await _dio.get(
|
final response = await _dio.get(
|
||||||
'/repos/$repoName/releases',
|
'/repos/$repoName/releases',
|
||||||
|
@ -345,7 +345,7 @@ class HomeViewModel extends BaseViewModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>?> getLatestManagerRelease() {
|
Future<Map<String, dynamic>?> getLatestManagerRelease() {
|
||||||
return _githubAPI.getLatestRelease(_managerAPI.defaultManagerRepo);
|
return _githubAPI.getLatestManagerRelease(_managerAPI.defaultManagerRepo);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> getLatestPatcherReleaseTime() {
|
Future<String?> getLatestPatcherReleaseTime() {
|
||||||
|
Loading…
Reference in New Issue
Block a user