diff --git a/lib/app_shell.dart b/lib/app_shell.dart index 46db313cb9..e7338a3e9d 100644 --- a/lib/app_shell.dart +++ b/lib/app_shell.dart @@ -52,6 +52,7 @@ class AppShellState extends State { if (_showWalletSwitchDialog) { if (isCurrentProfileArConnect) { context.read().isUserLoggedIn().then((isLoggedIn) { + context.read().logoutIfWalletMismatch(); if (isLoggedIn) { logger.d('Wallet switch detected while logged in' ' to ArConnect. Showing wallet switch dialog.'); diff --git a/lib/authentication/ardrive_auth.dart b/lib/authentication/ardrive_auth.dart index e5c5990161..258c90fd26 100644 --- a/lib/authentication/ardrive_auth.dart +++ b/lib/authentication/ardrive_auth.dart @@ -239,6 +239,7 @@ class ArDriveAuthImpl implements ArDriveAuth { await _secureKeyValueStore.remove('password'); await _secureKeyValueStore.remove('biometricEnabled'); } + await _databaseHelpers.deleteAllTables(); currentUser = null; _userStreamController.add(null); diff --git a/lib/authentication/login/blocs/login_bloc.dart b/lib/authentication/login/blocs/login_bloc.dart index d481619321..c755f9884f 100644 --- a/lib/authentication/login/blocs/login_bloc.dart +++ b/lib/authentication/login/blocs/login_bloc.dart @@ -571,6 +571,7 @@ class LoginBloc extends Bloc { } onArConnectWalletSwitch(() async { + logger.d('Wallet switch detected on LoginBloc'); final isUserLoggedIng = await _arDriveAuth.isUserLoggedIn(); if (isUserLoggedIng && !_isArConnectWallet()) { logger.d( diff --git a/lib/components/wallet_switch_dialog.dart b/lib/components/wallet_switch_dialog.dart index 1c1a9d58fa..d9f00dd1e2 100644 --- a/lib/components/wallet_switch_dialog.dart +++ b/lib/components/wallet_switch_dialog.dart @@ -1,12 +1,8 @@ // ignore_for_file: use_build_context_synchronously -import 'package:ardrive/authentication/ardrive_auth.dart'; -import 'package:ardrive/blocs/blocs.dart'; import 'package:ardrive/utils/app_localizations_wrapper.dart'; import 'package:ardrive_ui/ardrive_ui.dart'; -import 'package:ardrive_utils/ardrive_utils.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; class WalletSwitchDialog extends StatelessWidget { final bool fromAuthPage; @@ -16,21 +12,5 @@ class WalletSwitchDialog extends StatelessWidget { Widget build(BuildContext context) => ArDriveStandardModalNew( title: appLocalizationsOf(context).walletSwitch, description: appLocalizationsOf(context).walletChangeDetected, - actions: [ - ModalAction( - action: () async { - await context.read().logout(); - await context.read().logoutProfile(); - - Navigator.pop(context); - - if (fromAuthPage) { - triggerHTMLPageReload(); - context.read().promptForWallet(); - } - }, - title: appLocalizationsOf(context).logOut, - ) - ], ); }