feat: disable sentry for time being.

This commit is contained in:
Aunali321 2022-10-19 18:53:13 +05:30
parent f2d5cc91db
commit 39500f054d
4 changed files with 60 additions and 61 deletions

View File

@ -19,34 +19,35 @@ Future main() async {
await locator<ManagerAPI>().initialize(); await locator<ManagerAPI>().initialize();
String apiUrl = locator<ManagerAPI>().getApiUrl(); String apiUrl = locator<ManagerAPI>().getApiUrl();
await locator<RevancedAPI>().initialize(apiUrl); await locator<RevancedAPI>().initialize(apiUrl);
bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled(); // bool isSentryEnabled = locator<ManagerAPI>().isSentryEnabled();
locator<GithubAPI>().initialize(); locator<GithubAPI>().initialize();
await locator<PatcherAPI>().initialize(); await locator<PatcherAPI>().initialize();
tz.initializeTimeZones(); tz.initializeTimeZones();
// Remove this section if you are building from source and don't have sentry configured // Remove this section if you are building from source and don't have sentry configured
await SentryFlutter.init( // await SentryFlutter.init(
(options) { // (options) {
options // options
..dsn = isSentryEnabled ? '' : '' // ..dsn = isSentryEnabled ? '' : ''
..environment = 'alpha' // ..environment = 'alpha'
..release = '0.1' // ..release = '0.1'
..tracesSampleRate = 1.0 // ..tracesSampleRate = 1.0
..anrEnabled = true // ..anrEnabled = true
..enableOutOfMemoryTracking = true // ..enableOutOfMemoryTracking = true
..sampleRate = isSentryEnabled ? 1.0 : 0.0 // ..sampleRate = isSentryEnabled ? 1.0 : 0.0
..beforeSend = (event, hint) { // ..beforeSend = (event, hint) {
if (isSentryEnabled) { // if (isSentryEnabled) {
return event; // return event;
} else { // } else {
return null; // return null;
} // }
} as BeforeSendCallback?; // } as BeforeSendCallback?;
}, // },
appRunner: () { // appRunner: () {
// runApp(const MyApp());
// },
// );
runApp(const MyApp()); runApp(const MyApp());
},
);
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {

View File

@ -82,13 +82,13 @@ class ManagerAPI {
await _prefs.setBool('useDarkTheme', value); await _prefs.setBool('useDarkTheme', value);
} }
bool isSentryEnabled() { // bool isSentryEnabled() {
return _prefs.getBool('sentryEnabled') ?? true; // return _prefs.getBool('sentryEnabled') ?? true;
} // }
Future<void> setSentryStatus(bool value) async { // Future<void> setSentryStatus(bool value) async {
await _prefs.setBool('sentryEnabled', value); // await _prefs.setBool('sentryEnabled', value);
} // }
Future<void> deleteTempFolder() async { Future<void> deleteTempFolder() async {
final Directory dir = Directory('/data/local/tmp/revanced-manager'); final Directory dir = Directory('/data/local/tmp/revanced-manager');

View File

@ -187,28 +187,28 @@ class SettingsView extends StatelessWidget {
], ],
), ),
_settingsDivider, _settingsDivider,
SettingsSection( // SettingsSection(
title: 'settingsView.logsSectionTitle', // title: 'settingsView.logsSectionTitle',
children: <Widget>[ // children: <Widget>[
CustomSwitchTile( // CustomSwitchTile(
padding: const EdgeInsets.symmetric(horizontal: 20.0), // padding: const EdgeInsets.symmetric(horizontal: 20.0),
title: I18nText( // title: I18nText(
'settingsView.sentryLabel', // 'settingsView.sentryLabel',
child: const Text( // child: const Text(
'', // '',
style: TextStyle( // style: TextStyle(
fontSize: 20, // fontSize: 20,
fontWeight: FontWeight.w500, // fontWeight: FontWeight.w500,
), // ),
), // ),
), // ),
subtitle: I18nText('settingsView.sentryHint'), // subtitle: I18nText('settingsView.sentryHint'),
value: model.isSentryEnabled(), // value: model.isSentryEnabled(),
onTap: (value) => model.useSentry(value), // onTap: (value) => model.useSentry(value),
), // ),
], // ],
), // ),
_settingsDivider, // _settingsDivider,
SettingsSection( SettingsSection(
title: 'settingsView.infoSectionTitle', title: 'settingsView.infoSectionTitle',
children: <Widget>[ children: <Widget>[

View File

@ -315,17 +315,15 @@ class SettingsViewModel extends BaseViewModel {
); );
} }
// disable sentry using switch boolean // bool isSentryEnabled() {
// return _managerAPI.isSentryEnabled();
// }
bool isSentryEnabled() { // void useSentry(bool value) {
return _managerAPI.isSentryEnabled(); // _managerAPI.setSentryStatus(value);
} // _toast.showBottom('settingsView.restartAppForChanges');
// notifyListeners();
void useSentry(bool value) { // }
_managerAPI.setSentryStatus(value);
_toast.showBottom('settingsView.restartAppForChanges');
notifyListeners();
}
void deleteKeystore() { void deleteKeystore() {
_managerAPI.deleteKeystore(); _managerAPI.deleteKeystore();