Skip to content

Commit

Permalink
Merge pull request #1595 from dedis/work-fe1-dmassonn-fix-offline-wro…
Browse files Browse the repository at this point in the history
…ngly-redirect

Fix offline wrongly redirect
  • Loading branch information
dayan9265 authored May 26, 2023
2 parents db016e4 + 0bf54d7 commit dcd5a6b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 2 additions & 6 deletions fe1-web/src/features/home/screens/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ const Home: FunctionComponent<unknown> = () => {
useEffect(() => {
// Return the function to unsubscribe from the event so it gets removed on unmount
return navigation.addListener('focus', () => {
// The screen is now focused, check if we are connected to a lao
if (isConnected) {
// if we enter this screen and connected to a lao
// disconnect from this lao
disconnectFromLao();
}
// The screen is now focused, disconnect from the current lao if any
disconnectFromLao();
});
}, [navigation, isConnected, disconnectFromLao]);

Expand Down
4 changes: 1 addition & 3 deletions fe1-web/src/features/lao/navigation/LaoNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { makeIcon } from 'core/components/PoPIcon';
import { AppScreen } from 'core/navigation/AppNavigation';
import { drawerNavigationOptions } from 'core/navigation/ScreenOptions';
import { LaoParamList } from 'core/navigation/typing/LaoParamList';
import { getNetworkManager } from 'core/network';
import { Color, Spacing, Typography } from 'core/styles';
import STRINGS from 'resources/strings';

Expand Down Expand Up @@ -86,8 +85,7 @@ const LaoDrawerContent = ({ descriptors, navigation, state }: DrawerContentCompo
<DrawerItem
label={STRINGS.navigation_lao_disconnect_title}
onPress={() => {
getNetworkManager().disconnectFromAll();

// when going back to the app home, it will automatically disconnect from the lao
navigation.navigate(STRINGS.navigation_app_home, {
screen: STRINGS.navigation_home_home,
});
Expand Down

0 comments on commit dcd5a6b

Please sign in to comment.