Browse Source

Do not show banner if user has logged in

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

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

150
     }
150
     }
151
 
151
 
152
     onBannerTimeout = () => {
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
     onScreenFocus = () => {
158
     onScreenFocus = () => {
160
                 headerRight: this.getHeaderButton,
162
                 headerRight: this.getHeaderButton,
161
             });
163
             });
162
         }
164
         }
165
+        if (this.isLoggedIn) {
166
+            this.setState({bannerVisible: false})
167
+        }
163
         // handle link open when home is not focused or created
168
         // handle link open when home is not focused or created
164
         this.handleNavigationParams();
169
         this.handleNavigationParams();
165
     };
170
     };

Loading…
Cancel
Save