Fix old data restoring on reinstall (Android) (#170)

* Disable Auto Backup on Android

* Capture exceptions for Sentry in auth
This commit is contained in:
Tommy Chow 2022-08-01 17:55:12 -04:00 • committed by GitHub
parent 43d55c785b
commit e88806a8f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 5 deletions

View file

@ -13,7 +13,8 @@
<application
android:label="Frosty"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:allowBackup="false">
<activity
android:name=".MainActivity"
android:exported="true"

View file

@ -7,6 +7,7 @@ import 'package:frosty/constants/constants.dart';
import 'package:frosty/core/user/user_store.dart';
import 'package:frosty/main.dart';
import 'package:mobx/mobx.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:webview_flutter/webview_flutter.dart';
part 'auth_store.g.dart';
@ -120,7 +121,13 @@ abstract class AuthBase with Store {
}
_error = null;
} catch (e) {
} catch (e, stackTrace) {
// If auth initialization failed, log the error to Sentry.
await Sentry.captureException(
e,
stackTrace: stackTrace,
);
debugPrint(e.toString());
_error = e.toString();
}
@ -145,8 +152,14 @@ abstract class AuthBase with Store {
// Set the login status to logged in.
if (user.details != null) _isLoggedIn = true;
} catch (error) {
debugPrint('Login failed due to $error');
} catch (e, stackTrace) {
// If login failed, log the error to Sentry.
await Sentry.captureException(
e,
stackTrace: stackTrace,
);
debugPrint('Login failed due to $e');
}
}
@ -174,7 +187,13 @@ abstract class AuthBase with Store {
_isLoggedIn = false;
debugPrint('Successfully logged out');
} catch (e) {
} catch (e, stackTrace) {
// If logout failed, log the error to Sentry.
await Sentry.captureException(
e,
stackTrace: stackTrace,
);
debugPrint(e.toString());
}
}