Skip to content

Commit

Permalink
fix attach drive
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagocarvalhodev committed Dec 9, 2024
1 parent e3610e7 commit 23c471d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
1 change: 1 addition & 0 deletions lib/app_shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class AppShellState extends State<AppShell> {
if (_showWalletSwitchDialog) {
if (isCurrentProfileArConnect) {
context.read<ArDriveAuth>().isUserLoggedIn().then((isLoggedIn) {
context.read<ProfileCubit>().logoutIfWalletMismatch();
if (isLoggedIn) {
logger.d('Wallet switch detected while logged in'
' to ArConnect. Showing wallet switch dialog.');
Expand Down
1 change: 1 addition & 0 deletions lib/authentication/ardrive_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ class ArDriveAuthImpl implements ArDriveAuth {
await _secureKeyValueStore.remove('password');
await _secureKeyValueStore.remove('biometricEnabled');
}

await _databaseHelpers.deleteAllTables();
currentUser = null;
_userStreamController.add(null);
Expand Down
1 change: 1 addition & 0 deletions lib/authentication/login/blocs/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
}

onArConnectWalletSwitch(() async {
logger.d('Wallet switch detected on LoginBloc');
final isUserLoggedIng = await _arDriveAuth.isUserLoggedIn();
if (isUserLoggedIng && !_isArConnectWallet()) {
logger.d(
Expand Down
20 changes: 0 additions & 20 deletions lib/components/wallet_switch_dialog.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<ArDriveAuth>().logout();
await context.read<ProfileCubit>().logoutProfile();

Navigator.pop(context);

if (fromAuthPage) {
triggerHTMLPageReload();
context.read<ProfileAddCubit>().promptForWallet();
}
},
title: appLocalizationsOf(context).logOut,
)
],
);
}

0 comments on commit 23c471d

Please sign in to comment.