mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-01-11 13:46:17 +00:00
refactor: update deprecated and minor code refactors (#710)
Improve code readability & additional refactoring Commits: chore: exclude generated from analyzer refactor: add SharedPreferences to locator refactor: access shared pref from locator, and code refactor refactor: remove unwanted `await` refactor: remove `const` from `CacheConfig`
This commit is contained in:
committed by
EvadeMaster
parent
3ae4d69110
commit
6829d3cdea
@@ -1,5 +1,6 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_apps/device_apps.dart';
|
||||
import 'package:injectable/injectable.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
@@ -17,10 +18,10 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
class ManagerAPI {
|
||||
final RevancedAPI _revancedAPI = locator<RevancedAPI>();
|
||||
final GithubAPI _githubAPI = locator<GithubAPI>();
|
||||
final SharedPreferences _prefs = locator<SharedPreferences>();
|
||||
final RootAPI _rootAPI = RootAPI();
|
||||
final String patcherRepo = 'revanced-patcher';
|
||||
final String cliRepo = 'revanced-cli';
|
||||
late SharedPreferences _prefs;
|
||||
String storedPatchesFile = '/selected-patches.json';
|
||||
String defaultApiUrl = 'https://releases.revanced.app/';
|
||||
String defaultRepoUrl = 'https://api.github.com';
|
||||
@@ -31,7 +32,6 @@ class ManagerAPI {
|
||||
String defaultManagerRepo = 'revanced/revanced-manager';
|
||||
|
||||
Future<void> initialize() async {
|
||||
_prefs = await SharedPreferences.getInstance();
|
||||
storedPatchesFile =
|
||||
(await getApplicationDocumentsDirectory()).path + storedPatchesFile;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class ManagerAPI {
|
||||
_revancedAPI.clearAllCache();
|
||||
_githubAPI.clearAllCache();
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getPatches(repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user