Skip to content

Commit

Permalink
refactor: remove sentry and crowdin (#730)
Browse files Browse the repository at this point in the history
We no longer use sentry and crowdin.
  • Loading branch information
Aunali321 authored Mar 5, 2023
1 parent 68ccefc commit 5617535
Show file tree
Hide file tree
Showing 19 changed files with 198 additions and 283 deletions.
3 changes: 0 additions & 3 deletions .env

This file was deleted.

2 changes: 0 additions & 2 deletions assets/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@
"exportSectionTitle": "Import & export",
"aboutLabel": "About",
"snackbarMessage": "Copied to clipboard",
"sentryLabel": "Sentry logging",
"sentryHint": "Send anonymous logs to help us improve ReVanced Manager",
"restartAppForChanges": "Restart the app to apply changes",
"deleteKeystoreLabel": "Delete keystore",
"deleteKeystoreHint": "Delete the keystore used to sign the app",
Expand Down
2 changes: 0 additions & 2 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:revanced_manager/services/crowdin_api.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
Expand Down Expand Up @@ -38,7 +37,6 @@ import 'package:stacked_services/stacked_services.dart';
LazySingleton(classType: PatcherAPI),
LazySingleton(classType: RevancedAPI),
LazySingleton(classType: GithubAPI),
LazySingleton(classType: CrowdinAPI),
LazySingleton(classType: Toast),
],
)
Expand Down
27 changes: 0 additions & 27 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_i18n/flutter_i18n.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/services/crowdin_api.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/manager_api.dart';
import 'package:revanced_manager/services/patcher_api.dart';
import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/ui/theme/dynamic_theme_builder.dart';
import 'package:revanced_manager/ui/views/navigation/navigation_view.dart';
import 'package:revanced_manager/utils/environment.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:stacked_themes/stacked_themes.dart';
import 'package:timezone/data/latest.dart' as tz;
Expand All @@ -25,36 +22,12 @@ Future main() async {
await locator<ManagerAPI>().initialize();
final String apiUrl = locator<ManagerAPI>().getApiUrl();
await locator<RevancedAPI>().initialize(apiUrl);
await locator<CrowdinAPI>().initialize();
final bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
final String repoUrl = locator<ManagerAPI>().getRepoUrl();
locator<GithubAPI>().initialize(repoUrl);
await locator<PatcherAPI>().initialize();
tz.initializeTimeZones();
prefs = await SharedPreferences.getInstance();

await SentryFlutter.init(
(options) {
options
..dsn = isSentryEnabled ? Environment.sentryDSN : ''
..environment = 'alpha'
..release = '0.1'
..tracesSampleRate = 1.0
..anrEnabled = true
..enableOutOfMemoryTracking = true
..sampleRate = isSentryEnabled ? 1.0 : 0.0
..beforeSend = (event, hint) {
if (isSentryEnabled) {
return event;
} else {
return null;
}
} as BeforeSendCallback?;
},
appRunner: () {
runApp(const MyApp());
},
);
runApp(const MyApp());
}

Expand Down
63 changes: 0 additions & 63 deletions lib/services/crowdin_api.dart

This file was deleted.

56 changes: 33 additions & 23 deletions lib/services/github_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import 'dart:io';
import 'package:collection/collection.dart';
import 'package:dio/dio.dart';
import 'package:dio_http_cache_lts/dio_http_cache_lts.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
import 'package:injectable/injectable.dart';
import 'package:revanced_manager/models/patch.dart';
import 'package:sentry_dio/sentry_dio.dart';
import 'package:sentry_flutter/sentry_flutter.dart';

@lazySingleton
class GithubAPI {
Expand Down Expand Up @@ -38,19 +37,20 @@ class GithubAPI {
);

_dio.interceptors.add(_dioCacheManager.interceptor);
_dio.addSentry(
captureFailedRequests: true,
);
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}

Future<void> clearAllCache() async {
try {
await _dioCacheManager.clearAll();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}

Expand All @@ -61,8 +61,10 @@ class GithubAPI {
options: _cacheOptions,
);
return response.data[0];
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Expand Down Expand Up @@ -92,10 +94,12 @@ class GithubAPI {
'\n' as String,
)
.toList();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
return [];
}

Future<File?> getLatestReleaseFile(String extension, String repoName) async {
Expand All @@ -112,9 +116,10 @@ class GithubAPI {
);
}
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return null;
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
return null;
}
Expand All @@ -127,10 +132,12 @@ class GithubAPI {
final List<dynamic> list = jsonDecode(f.readAsStringSync());
patches = list.map((patch) => Patch.fromJson(patch)).toList();
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return List.empty();
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}

return patches;
}

Expand All @@ -142,9 +149,12 @@ class GithubAPI {
} else {
return 'Unknown';
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
return '';
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}

return 'Unknown';
}
}
}
34 changes: 17 additions & 17 deletions lib/services/manager_api.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';
import 'dart:io';
import 'package:device_apps/device_apps.dart';
import 'package:flutter/foundation.dart';
import 'package:injectable/injectable.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:path_provider/path_provider.dart';
Expand All @@ -10,7 +11,6 @@ import 'package:revanced_manager/models/patched_application.dart';
import 'package:revanced_manager/services/github_api.dart';
import 'package:revanced_manager/services/revanced_api.dart';
import 'package:revanced_manager/services/root_api.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';

@lazySingleton
Expand Down Expand Up @@ -98,14 +98,6 @@ class ManagerAPI {
await _prefs.setBool('useDarkTheme', value);
}

bool isSentryEnabled() {
return _prefs.getBool('sentryEnabled') ?? true;
}

Future<void> setSentryStatus(bool value) async {
await _prefs.setBool('sentryEnabled', value);
}

bool areUniversalPatchesEnabled() {
return _prefs.getBool('universalPatchesEnabled') ?? false;
}
Expand Down Expand Up @@ -179,8 +171,10 @@ class ManagerAPI {
try {
_revancedAPI.clearAllCache();
_githubAPI.clearAllCache();
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
}
}

Expand All @@ -196,8 +190,10 @@ class ManagerAPI {
} else {
return await _githubAPI.getPatches(repoName);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return [];
}
}
Expand All @@ -213,8 +209,10 @@ class ManagerAPI {
} else {
return await _githubAPI.getLatestReleaseFile('.jar', repoName);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Expand All @@ -230,8 +228,10 @@ class ManagerAPI {
} else {
return await _githubAPI.getLatestReleaseFile('.apk', repoName);
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
} on Exception catch (e) {
if (kDebugMode) {
print(e);
}
return null;
}
}
Expand Down
Loading

0 comments on commit 5617535

Please sign in to comment.