calendar sync fixes

This commit is contained in:
Kima
2024-03-01 19:00:19 +01:00
parent 010867260c
commit 7ebc470a7b
4 changed files with 20 additions and 7 deletions

View File

@@ -35,6 +35,8 @@ class ThirdPartyProvider with ChangeNotifier {
}) {
_context = context;
_linkedAccounts = initialLinkedAccounts ?? [];
if (_linkedAccounts.isEmpty) restore();
}
Future<void> restore() async {
@@ -56,12 +58,12 @@ class ThirdPartyProvider with ChangeNotifier {
if (!await _googleSignIn.isSignedIn()) {
GoogleSignInAccount? account = await _googleSignIn.signIn();
LinkedAccount linked = LinkedAccount(
type: AccountType.google,
username: account?.email ?? '',
displayName: account?.displayName ?? '',
id: account?.id ?? '',
);
LinkedAccount linked = LinkedAccount.fromJson({
'type': 'google',
'username': account?.email ?? '',
'display_name': account?.displayName ?? '',
'id': account?.id ?? ''
});
_linkedAccounts.add(linked);
return account;