mirror of
https://github.com/revanced/revanced-manager.git
synced 2025-06-12 20:57:36 +02:00
revert: "refactor: update deprecated and minor code refactors (#710)"
This reverts commit 6829d3cdea
.
Signed-off-by: EvadeMaster <93124920+EvadeMaster@users.noreply.github.com>
This commit is contained in:
@ -7,14 +7,11 @@ import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
@lazySingleton
|
||||
class CrowdinAPI {
|
||||
CrowdinAPI() {
|
||||
initialize();
|
||||
}
|
||||
Dio _dio = Dio();
|
||||
DioCacheManager get _dioCacheManager => DioCacheManager(CacheConfig());
|
||||
String get apiKey => Environment.crowdinKEY;
|
||||
late Dio _dio = Dio();
|
||||
final DioCacheManager _dioCacheManager = DioCacheManager(CacheConfig());
|
||||
final apiKey = Environment.crowdinKEY;
|
||||
|
||||
void initialize() {
|
||||
Future<void> initialize() async {
|
||||
try {
|
||||
_dio = Dio(
|
||||
BaseOptions(
|
||||
@ -27,7 +24,7 @@ class CrowdinAPI {
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +32,7 @@ class CrowdinAPI {
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +56,7 @@ class CrowdinAPI {
|
||||
|
||||
return targetLanguages;
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class GithubAPI {
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ class GithubAPI {
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ class GithubAPI {
|
||||
);
|
||||
return response.data[0];
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -93,7 +93,7 @@ class GithubAPI {
|
||||
)
|
||||
.toList();
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -113,7 +113,7 @@ class GithubAPI {
|
||||
}
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -128,7 +128,7 @@ class GithubAPI {
|
||||
patches = list.map((patch) => Patch.fromJson(patch)).toList();
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
return patches;
|
||||
@ -143,7 +143,7 @@ class GithubAPI {
|
||||
return 'Unknown';
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
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';
|
||||
@ -18,10 +17,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';
|
||||
@ -32,6 +31,7 @@ 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) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getPatches(repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -231,7 +231,7 @@ class ManagerAPI {
|
||||
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ class PatcherAPI {
|
||||
_patches = await _managerAPI.getPatches();
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
_patches = List.empty();
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ class PatcherAPI {
|
||||
}
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -152,7 +152,7 @@ class PatcherAPI {
|
||||
}
|
||||
return originalFilePath;
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return originalFilePath;
|
||||
}
|
||||
}
|
||||
@ -174,7 +174,7 @@ class PatcherAPI {
|
||||
selectedPatches.add(settingsPatch);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
@ -207,11 +207,11 @@ class PatcherAPI {
|
||||
'keyStoreFilePath': _keyStoreFile.path,
|
||||
},
|
||||
);
|
||||
} on Exception catch (e) {
|
||||
} on Exception catch (e, s) {
|
||||
if (kDebugMode) {
|
||||
print(e);
|
||||
}
|
||||
rethrow;
|
||||
throw await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -233,7 +233,7 @@ class PatcherAPI {
|
||||
return await DeviceApps.isAppInstalled(patchedApp.packageName);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -244,15 +244,11 @@ class PatcherAPI {
|
||||
try {
|
||||
if (_outFile != null) {
|
||||
final String newName = _getFileName(appName, version);
|
||||
CRFileSaver.saveFileWithDialog(
|
||||
SaveFileDialogParams(
|
||||
sourceFilePath: _outFile!.path,
|
||||
destinationFileName: newName,
|
||||
),
|
||||
);
|
||||
CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
|
||||
sourceFilePath: _outFile!.path, destinationFileName: newName,),);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -267,7 +263,7 @@ class PatcherAPI {
|
||||
ShareExtend.share(shareFile.path, 'file');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ class RevancedAPI {
|
||||
captureFailedRequests: true,
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ class RevancedAPI {
|
||||
try {
|
||||
await _dioCacheManager.clearAll();
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class RevancedAPI {
|
||||
contributors[name] = repo['contributors'];
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return {};
|
||||
}
|
||||
return contributors;
|
||||
@ -80,7 +80,7 @@ class RevancedAPI {
|
||||
final List<dynamic> patches = response.data;
|
||||
return patches.map((patch) => Patch.fromJson(patch)).toList();
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ class RevancedAPI {
|
||||
(t['name'] as String).endsWith(extension),
|
||||
);
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -116,7 +116,7 @@ class RevancedAPI {
|
||||
return release['version'];
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -133,7 +133,7 @@ class RevancedAPI {
|
||||
return await DefaultCacheManager().getSingleFile(url);
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
@ -154,7 +154,7 @@ class RevancedAPI {
|
||||
return format(timestamp, locale: 'en_short');
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
|
@ -11,7 +11,7 @@ class RootAPI {
|
||||
final bool? isRooted = await Root.isRootAvailable();
|
||||
return isRooted != null && isRooted;
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,7 @@ class RootAPI {
|
||||
}
|
||||
return false;
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ class RootAPI {
|
||||
return apps.map((pack) => pack.trim()).toList();
|
||||
}
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return List.empty();
|
||||
}
|
||||
return List.empty();
|
||||
@ -126,7 +126,7 @@ class RootAPI {
|
||||
await mountApk(packageName, originalFilePath);
|
||||
return true;
|
||||
} on Exception catch (e, s) {
|
||||
Sentry.captureException(e, stackTrace: s).ignore();
|
||||
await Sentry.captureException(e, stackTrace: s);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user