Browse Source

Do not show banner if user has logged in

Arnaud Vergnet 1 year ago
parent
commit
aaf7084297
2 changed files with 12 additions and 1 deletions
  1. 6
    0
      src/screens/Amicale/LoginScreen.js
  2. 6
    1
      src/screens/Home/HomeScreen.js

+ 6
- 0
src/screens/Amicale/LoginScreen.js View File

@@ -10,6 +10,7 @@ import {withCollapsible} from "../../utils/withCollapsible";
10 10
 import {Collapsible} from "react-navigation-collapsible";
11 11
 import CustomTabBar from "../../components/Tabbar/CustomTabBar";
12 12
 import type {CustomTheme} from "../../managers/ThemeManager";
13
+import AsyncStorageManager from "../../managers/AsyncStorageManager";
13 14
 
14 15
 type Props = {
15 16
     navigation: Object,
@@ -81,6 +82,11 @@ class LoginScreen extends React.Component<Props, State> {
81 82
     hideErrorDialog = () => this.setState({dialogVisible: false});
82 83
 
83 84
     handleSuccess = () => {
85
+        // Do not show the login banner again
86
+        AsyncStorageManager.getInstance().savePref(
87
+            AsyncStorageManager.getInstance().preferences.homeShowBanner.key,
88
+            '0'
89
+        );
84 90
         if (this.nextScreen == null)
85 91
             this.props.navigation.goBack();
86 92
         else

+ 6
- 1
src/screens/Home/HomeScreen.js View File

@@ -150,7 +150,9 @@ class HomeScreen extends React.Component<Props, State> {
150 150
     }
151 151
 
152 152
     onBannerTimeout = () => {
153
-        this.setState({bannerVisible: AsyncStorageManager.getInstance().preferences.homeShowBanner.current === "1"})
153
+        this.setState({
154
+            bannerVisible: AsyncStorageManager.getInstance().preferences.homeShowBanner.current === "1"
155
+        })
154 156
     }
155 157
 
156 158
     onScreenFocus = () => {
@@ -160,6 +162,9 @@ class HomeScreen extends React.Component<Props, State> {
160 162
                 headerRight: this.getHeaderButton,
161 163
             });
162 164
         }
165
+        if (this.isLoggedIn) {
166
+            this.setState({bannerVisible: false})
167
+        }
163 168
         // handle link open when home is not focused or created
164 169
         this.handleNavigationParams();
165 170
     };

Loading…
Cancel
Save