Browse Source

Allow to open app with links to clubs and events

Arnaud Vergnet 1 year ago
parent
commit
41b9194d98

+ 67
- 4
App.js View File

@@ -5,7 +5,7 @@ import {Platform, StatusBar} from 'react-native';
5 5
 import LocaleManager from './src/managers/LocaleManager';
6 6
 import AsyncStorageManager from "./src/managers/AsyncStorageManager";
7 7
 import CustomIntroSlider from "./src/components/Custom/CustomIntroSlider";
8
-import {SplashScreen} from 'expo';
8
+import {Linking, SplashScreen} from 'expo';
9 9
 import ThemeManager from './src/managers/ThemeManager';
10 10
 import {NavigationContainer} from '@react-navigation/native';
11 11
 import {createStackNavigator} from '@react-navigation/stack';
@@ -41,12 +41,73 @@ export default class App extends React.Component<Props, State> {
41 41
     onIntroDone: Function;
42 42
     onUpdateTheme: Function;
43 43
 
44
+    navigatorRef: Object;
45
+
46
+    defaultRoute: Array<string>;
47
+    defaultData: Object;
48
+
49
+    createDrawerNavigator: Function;
50
+
44 51
     constructor() {
45 52
         super();
46 53
         LocaleManager.initTranslations();
47 54
         this.onIntroDone = this.onIntroDone.bind(this);
48 55
         this.onUpdateTheme = this.onUpdateTheme.bind(this);
49 56
         SplashScreen.preventAutoHide();
57
+        this.navigatorRef = React.createRef();
58
+        this.defaultRoute = [];
59
+        this.defaultData = {};
60
+        // this.defaultRoute = ["main", "home", "club-information"];
61
+        // this.defaultData = {clubId: 0};
62
+        this.handleUrls();
63
+    }
64
+
65
+    handleUrls() {
66
+        console.log(Linking.makeUrl('main/home/club-information', {clubId: 1}));
67
+        Linking.addEventListener('url', this.onUrl);
68
+        Linking.parseInitialURLAsync().then(this.onParsedUrl);
69
+    }
70
+
71
+    onUrl = (url: string) => {
72
+        this.onParsedUrl(Linking.parse(url));
73
+    };
74
+
75
+    onParsedUrl = ({path, queryParams}: Object) => {
76
+        if (path !== null) {
77
+            let pathArray = path.split('/');
78
+            if (this.isClubInformationLink(pathArray))
79
+                this.handleClubInformationUrl(queryParams);
80
+            else if (this.isPlanningInformationLink(pathArray))
81
+                this.handlePlanningInformationUrl(queryParams);
82
+        }
83
+    };
84
+
85
+    isClubInformationLink(pathArray: Array<string>) {
86
+        return pathArray[0] === "main" && pathArray[1] === "home" && pathArray[2] === "club-information";
87
+    }
88
+
89
+    isPlanningInformationLink(pathArray: Array<string>) {
90
+        return pathArray[0] === "main" && pathArray[1] === "home" && pathArray[2] === "planning-information";
91
+    }
92
+
93
+    handleClubInformationUrl(params: Object) {
94
+        if (params !== undefined && params.clubId !== undefined) {
95
+            let id = parseInt(params.clubId);
96
+            if (!isNaN(id)) {
97
+                this.defaultRoute = ["main", "home", "club-information"];
98
+                this.defaultData = {clubId: id};
99
+            }
100
+        }
101
+    }
102
+
103
+    handlePlanningInformationUrl(params: Object) {
104
+        if (params !== undefined && params.eventId !== undefined) {
105
+            let id = parseInt(params.eventId);
106
+            if (!isNaN(id)) {
107
+                this.defaultRoute = ["main", "home", "planning-information"];
108
+                this.defaultData = {eventId: id};
109
+            }
110
+        }
50 111
     }
51 112
 
52 113
     /**
@@ -92,8 +153,10 @@ export default class App extends React.Component<Props, State> {
92 153
         await initExpoToken();
93 154
         try {
94 155
             await ConnectionManager.getInstance().recoverLogin();
95
-        } catch (e) {}
156
+        } catch (e) {
157
+        }
96 158
 
159
+        this.createDrawerNavigator = () => <DrawerNavigator defaultPath={this.defaultRoute} defaultData={this.defaultData}/>;
97 160
         this.onLoadFinished();
98 161
     }
99 162
 
@@ -130,9 +193,9 @@ export default class App extends React.Component<Props, State> {
130 193
         } else {
131 194
             return (
132 195
                 <PaperProvider theme={this.state.currentTheme}>
133
-                    <NavigationContainer theme={this.state.currentTheme}>
196
+                    <NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
134 197
                         <Stack.Navigator headerMode="none">
135
-                            <Stack.Screen name="Root" component={DrawerNavigator}/>
198
+                            <Stack.Screen name="Root" component={this.createDrawerNavigator}/>
136 199
                         </Stack.Navigator>
137 200
                     </NavigationContainer>
138 201
                 </PaperProvider>

+ 1
- 0
app.json View File

@@ -3,6 +3,7 @@
3 3
     "name": "Campus",
4 4
     "description": "Application mobile compatible Android et iOS pour l'Amicale INSA Toulouse. Grâce à cette application, vous avez facilement accès aux news du campus, aux emplois du temps, à l'état de la laverie, et bien d'autres services ! Ceci est une version Beta, Toutes les fonctionnalités ne sont pas encore implémentées, et il est possible de rencontrer quelques bugs.",
5 5
     "slug": "application-amicale",
6
+    "scheme": "campus-insat",
6 7
     "privacy": "public",
7 8
     "platforms": [
8 9
       "ios",

+ 1
- 1
src/components/Amicale/AuthenticatedScreen.js View File

@@ -73,7 +73,7 @@ class AuthenticatedScreen extends React.Component<Props, State> {
73 73
         if (this.errorCode === ERROR_TYPE.BAD_TOKEN) { // Token expired, logout user
74 74
             this.connectionManager.disconnect()
75 75
                 .then(() => {
76
-                    this.props.navigation.navigate("LoginScreen");
76
+                    this.props.navigation.navigate("login");
77 77
                 });
78 78
         } else if (this.allRequestsFinished())
79 79
             this.setState({loading: false});

+ 1
- 1
src/components/Amicale/LogoutDialog.js View File

@@ -19,7 +19,7 @@ class LogoutDialog extends React.PureComponent<Props> {
19 19
                 .then(() => {
20 20
                     this.props.navigation.reset({
21 21
                         index: 0,
22
-                        routes: [{name: 'Main'}],
22
+                        routes: [{name: 'main'}],
23 23
                     });
24 24
                     this.props.onDismiss();
25 25
                     resolve();

+ 1
- 1
src/components/Home/ActionsDashboardItem.js View File

@@ -21,7 +21,7 @@ class ActionsDashBoardItem extends React.PureComponent<Props> {
21 21
 
22 22
     openDrawer = () => this.props.navigation.openDrawer();
23 23
 
24
-    gotToSettings = () => this.props.navigation.navigate("SettingsScreen");
24
+    gotToSettings = () => this.props.navigation.navigate("settings");
25 25
 
26 26
     render() {
27 27
         return (

+ 17
- 17
src/components/Sidebar/Sidebar.js View File

@@ -40,33 +40,33 @@ class SideBar extends React.Component<Props, State> {
40 40
         const mainData = [
41 41
             {
42 42
                 name: i18n.t('screens.home'),
43
-                route: "Main",
43
+                route: "main",
44 44
                 icon: "home",
45 45
             },
46 46
         ];
47 47
         const amicaleData = [
48 48
             {
49 49
                 name: i18n.t('screens.login'),
50
-                route: "LoginScreen",
50
+                route: "login",
51 51
                 icon: "login",
52 52
                 onlyWhenLoggedOut: true,
53 53
                 shouldEmphasis: true,
54 54
             },
55 55
             {
56 56
                 name: i18n.t('screens.profile'),
57
-                route: "ProfileScreen",
57
+                route: "profile",
58 58
                 icon: "account",
59 59
                 onlyWhenLoggedIn: true,
60 60
             },
61 61
             {
62 62
                 name: i18n.t('clubs.clubList'),
63
-                route: "ClubListScreen",
63
+                route: "club-list",
64 64
                 icon: "account-group",
65 65
                 onlyWhenLoggedIn: true,
66 66
             },
67 67
             {
68 68
                 name: i18n.t('screens.vote'),
69
-                route: "VoteScreen",
69
+                route: "vote",
70 70
                 icon: "vote",
71 71
                 onlyWhenLoggedIn: true,
72 72
             },
@@ -81,28 +81,28 @@ class SideBar extends React.Component<Props, State> {
81 81
         const servicesData = [
82 82
             {
83 83
                 name: i18n.t('screens.menuSelf'),
84
-                route: "SelfMenuScreen",
84
+                route: "self-menu",
85 85
                 icon: "silverware-fork-knife",
86 86
             },
87 87
             {
88 88
                 name: i18n.t('screens.availableRooms'),
89
-                route: "AvailableRoomScreen",
89
+                route: "available-rooms",
90 90
                 icon: "calendar-check",
91 91
             },
92 92
             {
93 93
                 name: i18n.t('screens.bib'),
94
-                route: "BibScreen",
94
+                route: "bib",
95 95
                 icon: "book",
96 96
             },
97 97
             {
98 98
                 name: i18n.t('screens.bluemind'),
99
-                route: "BlueMindScreen",
99
+                route: "bluemind",
100 100
                 link: "https://etud-mel.insa-toulouse.fr/webmail/",
101 101
                 icon: "email",
102 102
             },
103 103
             {
104 104
                 name: i18n.t('screens.ent'),
105
-                route: "EntScreen",
105
+                route: "ent",
106 106
                 link: "https://ent.insa-toulouse.fr/",
107 107
                 icon: "notebook",
108 108
             },
@@ -110,25 +110,25 @@ class SideBar extends React.Component<Props, State> {
110 110
         const websitesData = [
111 111
             {
112 112
                 name: "Amicale",
113
-                route: "AmicaleScreen",
113
+                route: "amicale",
114 114
                 link: "https://amicale-insat.fr/",
115 115
                 icon: "alpha-a-box",
116 116
             },
117 117
             {
118 118
                 name: "Élus Étudiants",
119
-                route: "ElusEtudScreen",
119
+                route: "elus-etudiants",
120 120
                 link: "https://etud.insa-toulouse.fr/~eeinsat/",
121 121
                 icon: "alpha-e-box",
122 122
             },
123 123
             {
124 124
                 name: "Wiketud",
125
-                route: "WiketudScreen",
125
+                route: "wiketud",
126 126
                 link: "https://wiki.etud.insa-toulouse.fr",
127 127
                 icon: "wikipedia",
128 128
             },
129 129
             {
130 130
                 name: "Tutor'INSA",
131
-                route: "TutorInsaScreen",
131
+                route: "tutor-insa",
132 132
                 link: "https://www.etud.insa-toulouse.fr/~tutorinsa/",
133 133
                 icon: "school",
134 134
             },
@@ -136,12 +136,12 @@ class SideBar extends React.Component<Props, State> {
136 136
         const othersData = [
137 137
             {
138 138
                 name: i18n.t('screens.settings'),
139
-                route: "SettingsScreen",
139
+                route: "settings",
140 140
                 icon: "settings",
141 141
             },
142 142
             {
143 143
                 name: i18n.t('screens.about'),
144
-                route: "AboutScreen",
144
+                route: "about",
145 145
                 icon: "information",
146 146
             },
147 147
         ];
@@ -229,7 +229,7 @@ class SideBar extends React.Component<Props, State> {
229 229
         return (
230 230
             <View style={{height: '100%'}}>
231 231
                 <TouchableRipple
232
-                    onPress={() => this.props.navigation.navigate("TetrisScreen")}
232
+                    onPress={() => this.props.navigation.navigate("tetris")}
233 233
                 >
234 234
                     <Image
235 235
                         source={require("../../../assets/drawer-cover.png")}

+ 1
- 1
src/managers/AsyncStorageManager.js View File

@@ -61,7 +61,7 @@ export default class AsyncStorageManager {
61 61
         },
62 62
         defaultStartScreen: {
63 63
             key: 'defaultStartScreen',
64
-            default: 'Home',
64
+            default: 'home',
65 65
             current: '',
66 66
         },
67 67
         proxiwashShowBanner: {

+ 107
- 80
src/navigation/DrawerNavigator.js View File

@@ -39,12 +39,12 @@ const AboutStack = createStackNavigator();
39 39
 function AboutStackComponent() {
40 40
     return (
41 41
         <AboutStack.Navigator
42
-            initialRouteName="AboutScreen"
42
+            initialRouteName="index"
43 43
             headerMode="float"
44 44
             screenOptions={defaultScreenOptions}
45 45
         >
46 46
             <AboutStack.Screen
47
-                name="AboutScreen"
47
+                name="index"
48 48
                 component={AboutScreen}
49 49
                 options={({navigation}) => {
50 50
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -55,14 +55,14 @@ function AboutStackComponent() {
55 55
                 }}
56 56
             />
57 57
             <AboutStack.Screen
58
-                name="AboutDependenciesScreen"
58
+                name="dependencies"
59 59
                 component={AboutDependenciesScreen}
60 60
                 options={{
61 61
                     title: i18n.t('aboutScreen.libs')
62 62
                 }}
63 63
             />
64 64
             <AboutStack.Screen
65
-                name="DebugScreen"
65
+                name="debug"
66 66
                 component={DebugScreen}
67 67
                 options={{
68 68
                     title: i18n.t('aboutScreen.debug')
@@ -77,12 +77,12 @@ const SettingsStack = createStackNavigator();
77 77
 function SettingsStackComponent() {
78 78
     return (
79 79
         <SettingsStack.Navigator
80
-            initialRouteName="SettingsScreen"
80
+            initialRouteName="index"
81 81
             headerMode="float"
82 82
             screenOptions={defaultScreenOptions}
83 83
         >
84 84
             <SettingsStack.Screen
85
-                name="SettingsScreen"
85
+                name="index"
86 86
                 component={SettingsScreen}
87 87
                 options={({navigation}) => {
88 88
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -101,12 +101,12 @@ const SelfMenuStack = createStackNavigator();
101 101
 function SelfMenuStackComponent() {
102 102
     return (
103 103
         <SelfMenuStack.Navigator
104
-            initialRouteName="SelfMenuScreen"
104
+            initialRouteName="index"
105 105
             headerMode="float"
106 106
             screenOptions={defaultScreenOptions}
107 107
         >
108 108
             <SelfMenuStack.Screen
109
-                name="SelfMenuScreen"
109
+                name="index"
110 110
                 component={SelfMenuScreen}
111 111
                 options={({navigation}) => {
112 112
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -125,12 +125,12 @@ const AvailableRoomStack = createStackNavigator();
125 125
 function AvailableRoomStackComponent() {
126 126
     return (
127 127
         <AvailableRoomStack.Navigator
128
-            initialRouteName="AvailableRoomScreen"
128
+            initialRouteName="index"
129 129
             headerMode="float"
130 130
             screenOptions={defaultScreenOptions}
131 131
         >
132 132
             <AvailableRoomStack.Screen
133
-                name="AvailableRoomScreen"
133
+                name="index"
134 134
                 component={AvailableRoomScreen}
135 135
                 options={({navigation}) => {
136 136
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -149,12 +149,12 @@ const BibStack = createStackNavigator();
149 149
 function BibStackComponent() {
150 150
     return (
151 151
         <BibStack.Navigator
152
-            initialRouteName="BibScreen"
152
+            initialRouteName="index"
153 153
             headerMode="float"
154 154
             screenOptions={defaultScreenOptions}
155 155
         >
156 156
             <BibStack.Screen
157
-                name="BibScreen"
157
+                name="index"
158 158
                 component={BibScreen}
159 159
                 options={({navigation}) => {
160 160
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -173,12 +173,12 @@ const TetrisStack = createStackNavigator();
173 173
 function TetrisStackComponent() {
174 174
     return (
175 175
         <TetrisStack.Navigator
176
-            initialRouteName="TetrisScreen"
176
+            initialRouteName="index"
177 177
             headerMode="float"
178 178
             screenOptions={defaultScreenOptions}
179 179
         >
180 180
             <TetrisStack.Screen
181
-                name="TetrisScreen"
181
+                name="index"
182 182
                 component={TetrisScreen}
183 183
                 options={({navigation}) => {
184 184
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -197,12 +197,12 @@ const LoginStack = createStackNavigator();
197 197
 function LoginStackComponent() {
198 198
     return (
199 199
         <LoginStack.Navigator
200
-            initialRouteName="LoginScreen"
200
+            initialRouteName="index"
201 201
             headerMode="float"
202 202
             screenOptions={defaultScreenOptions}
203 203
         >
204 204
             <LoginStack.Screen
205
-                name="LoginScreen"
205
+                name="index"
206 206
                 component={LoginScreen}
207 207
                 options={({navigation}) => {
208 208
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -221,12 +221,12 @@ const ProfileStack = createStackNavigator();
221 221
 function ProfileStackComponent() {
222 222
     return (
223 223
         <ProfileStack.Navigator
224
-            initialRouteName="ProfileScreen"
224
+            initialRouteName="index"
225 225
             headerMode="float"
226 226
             screenOptions={defaultScreenOptions}
227 227
         >
228 228
             <ProfileStack.Screen
229
-                name="ProfileScreen"
229
+                name="index"
230 230
                 component={ProfileScreen}
231 231
                 options={({navigation}) => {
232 232
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -246,12 +246,12 @@ const VoteStack = createStackNavigator();
246 246
 function VoteStackComponent() {
247 247
     return (
248 248
         <VoteStack.Navigator
249
-            initialRouteName="VoteScreen"
249
+            initialRouteName="index"
250 250
             headerMode="float"
251 251
             screenOptions={defaultScreenOptions}
252 252
         >
253 253
             <VoteStack.Screen
254
-                name="VoteScreen"
254
+                name="index"
255 255
                 component={VoteScreen}
256 256
                 options={({navigation}) => {
257 257
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -270,12 +270,12 @@ const ClubStack = createStackNavigator();
270 270
 function ClubStackComponent() {
271 271
     return (
272 272
         <ClubStack.Navigator
273
-            initialRouteName="ClubListScreen"
273
+            initialRouteName={"index"}
274 274
             headerMode="float"
275 275
             screenOptions={defaultScreenOptions}
276 276
         >
277 277
             <ClubStack.Screen
278
-                name="ClubListScreen"
278
+                name="index"
279 279
                 component={ClubListScreen}
280 280
                 options={({navigation}) => {
281 281
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -286,7 +286,7 @@ function ClubStackComponent() {
286 286
                 }}
287 287
             />
288 288
             <ClubStack.Screen
289
-                name="ClubDisplayScreen"
289
+                name="club-information"
290 290
                 component={ClubDisplayScreen}
291 291
                 options={({navigation}) => {
292 292
                     return {
@@ -296,7 +296,7 @@ function ClubStackComponent() {
296 296
                 }}
297 297
             />
298 298
             <ClubStack.Screen
299
-                name="ClubAboutScreen"
299
+                name="club-about"
300 300
                 component={ClubAboutScreen}
301 301
                 options={({navigation}) => {
302 302
                     return {
@@ -316,61 +316,88 @@ function getDrawerContent(props) {
316 316
     return <Sidebar {...props}/>
317 317
 }
318 318
 
319
-export default function DrawerNavigator() {
320
-    return (
321
-        <Drawer.Navigator
322
-            initialRouteName={'Main'}
323
-            headerMode={'float'}
324
-            backBehavior={'initialRoute'}
325
-            drawerType={'front'}
326
-            drawerContent={(props) => getDrawerContent(props)}
327
-            screenOptions={defaultScreenOptions}
328
-        >
329
-            <Drawer.Screen
330
-                name="Main"
331
-                component={TabNavigator}
319
+type Props = {
320
+    defaultPath: Array<string>,
321
+    defaultData: Object
322
+}
323
+
324
+
325
+export default class DrawerNavigator extends React.Component<Props> {
326
+
327
+    defaultRoute: string;
328
+    defaultSubRoute: string | null;
329
+
330
+    createTabNavigator: Object;
331
+
332
+    constructor(props: Object) {
333
+        super(props);
334
+        this.defaultRoute = 'Main';
335
+        this.defaultSubRoute = null;
336
+
337
+        if (props.defaultPath.length > 0)
338
+            this.defaultRoute = props.defaultPath[0];
339
+        if (props.defaultPath.length > 1)
340
+            this.defaultSubRoute = props.defaultPath[1];
341
+
342
+        this.createTabNavigator = () => <TabNavigator defaultPath={props.defaultPath} defaultData={props.defaultData}/>
343
+    }
344
+
345
+    render() {
346
+        return (
347
+            <Drawer.Navigator
348
+                initialRouteName={this.defaultRoute}
349
+                headerMode={'float'}
350
+                backBehavior={'initialRoute'}
351
+                drawerType={'front'}
352
+                drawerContent={(props) => getDrawerContent(props)}
353
+                screenOptions={defaultScreenOptions}
332 354
             >
333
-            </Drawer.Screen>
334
-            <Drawer.Screen
335
-                name="SettingsScreen"
336
-                component={SettingsStackComponent}
337
-            />
338
-            <Drawer.Screen
339
-                name="AboutScreen"
340
-                component={AboutStackComponent}
341
-            />
342
-            <Drawer.Screen
343
-                name="SelfMenuScreen"
344
-                component={SelfMenuStackComponent}
345
-            />
346
-            <Drawer.Screen
347
-                name="AvailableRoomScreen"
348
-                component={AvailableRoomStackComponent}
349
-            />
350
-            <Drawer.Screen
351
-                name="BibScreen"
352
-                component={BibStackComponent}
353
-            />
354
-            <Drawer.Screen
355
-                name="TetrisScreen"
356
-                component={TetrisStackComponent}
357
-            />
358
-            <Drawer.Screen
359
-                name="LoginScreen"
360
-                component={LoginStackComponent}
361
-            />
362
-            <Drawer.Screen
363
-                name="ProfileScreen"
364
-                component={ProfileStackComponent}
365
-            />
366
-            <Drawer.Screen
367
-                name="ClubListScreen"
368
-                component={ClubStackComponent}
369
-            />
370
-            <Drawer.Screen
371
-                name="VoteScreen"
372
-                component={VoteStackComponent}
373
-            />
374
-        </Drawer.Navigator>
375
-    );
355
+                <Drawer.Screen
356
+                    name="main"
357
+                    component={this.createTabNavigator}
358
+                >
359
+                </Drawer.Screen>
360
+                <Drawer.Screen
361
+                    name="settings"
362
+                    component={SettingsStackComponent}
363
+                />
364
+                <Drawer.Screen
365
+                    name="about"
366
+                    component={AboutStackComponent}
367
+                />
368
+                <Drawer.Screen
369
+                    name="self-menu"
370
+                    component={SelfMenuStackComponent}
371
+                />
372
+                <Drawer.Screen
373
+                    name="available-rooms"
374
+                    component={AvailableRoomStackComponent}
375
+                />
376
+                <Drawer.Screen
377
+                    name="bib"
378
+                    component={BibStackComponent}
379
+                />
380
+                <Drawer.Screen
381
+                    name="tetris"
382
+                    component={TetrisStackComponent}
383
+                />
384
+                <Drawer.Screen
385
+                    name="login"
386
+                    component={LoginStackComponent}
387
+                />
388
+                <Drawer.Screen
389
+                    name="profile"
390
+                    component={ProfileStackComponent}
391
+                />
392
+                <Drawer.Screen
393
+                    name="club-list"
394
+                    component={ClubStackComponent}
395
+                />
396
+                <Drawer.Screen
397
+                    name="vote"
398
+                    component={VoteStackComponent}
399
+                />
400
+            </Drawer.Navigator>
401
+        );
402
+    }
376 403
 }

+ 98
- 61
src/navigation/MainTabNavigator.js View File

@@ -16,14 +16,15 @@ import AsyncStorageManager from "../managers/AsyncStorageManager";
16 16
 import HeaderButton from "../components/Custom/HeaderButton";
17 17
 import {withTheme} from 'react-native-paper';
18 18
 import i18n from "i18n-js";
19
+import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
19 20
 
20 21
 
21 22
 const TAB_ICONS = {
22
-    Home: 'triangle',
23
-    Planning: 'calendar-range',
24
-    Proxiwash: 'tshirt-crew',
25
-    Proximo: 'cart',
26
-    Planex: 'clock',
23
+    home: 'triangle',
24
+    planning: 'calendar-range',
25
+    proxiwash: 'tshirt-crew',
26
+    proximo: 'cart',
27
+    planex: 'clock',
27 28
 };
28 29
 
29 30
 const defaultScreenOptions = {
@@ -43,12 +44,12 @@ const ProximoStack = createStackNavigator();
43 44
 function ProximoStackComponent() {
44 45
     return (
45 46
         <ProximoStack.Navigator
46
-            initialRouteName="ProximoMainScreen"
47
+            initialRouteName="index"
47 48
             headerMode="float"
48 49
             screenOptions={defaultScreenOptions}
49 50
         >
50 51
             <ProximoStack.Screen
51
-                name="ProximoMainScreen"
52
+                name="index"
52 53
                 options={({navigation}) => {
53 54
                     const openDrawer = getDrawerButton.bind(this, navigation);
54 55
                     return {
@@ -59,14 +60,14 @@ function ProximoStackComponent() {
59 60
                 component={ProximoMainScreen}
60 61
             />
61 62
             <ProximoStack.Screen
62
-                name="ProximoListScreen"
63
+                name="proximo-list"
63 64
                 options={{
64 65
                     title: 'Articles'
65 66
                 }}
66 67
                 component={ProximoListScreen}
67 68
             />
68 69
             <ProximoStack.Screen
69
-                name="ProximoAboutScreen"
70
+                name="proximo-about"
70 71
                 component={ProximoAboutScreen}
71 72
                 options={{
72 73
                     title: 'Proximo',
@@ -82,12 +83,12 @@ const ProxiwashStack = createStackNavigator();
82 83
 function ProxiwashStackComponent() {
83 84
     return (
84 85
         <ProxiwashStack.Navigator
85
-            initialRouteName="ProxiwashScreen"
86
+            initialRouteName="index"
86 87
             headerMode='float'
87 88
             screenOptions={defaultScreenOptions}
88 89
         >
89 90
             <ProxiwashStack.Screen
90
-                name="ProxiwashScreen"
91
+                name="index"
91 92
                 component={ProxiwashScreen}
92 93
                 options={({navigation}) => {
93 94
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -98,7 +99,7 @@ function ProxiwashStackComponent() {
98 99
                 }}
99 100
             />
100 101
             <ProxiwashStack.Screen
101
-                name="ProxiwashAboutScreen"
102
+                name="proxiwash-about"
102 103
                 component={ProxiwashAboutScreen}
103 104
                 options={{
104 105
                     title: 'Proxiwash',
@@ -114,12 +115,12 @@ const PlanningStack = createStackNavigator();
114 115
 function PlanningStackComponent() {
115 116
     return (
116 117
         <PlanningStack.Navigator
117
-            initialRouteName="PlanningScreen"
118
+            initialRouteName="index"
118 119
             headerMode='float'
119 120
             screenOptions={defaultScreenOptions}
120 121
         >
121 122
             <PlanningStack.Screen
122
-                name="PlanningScreen"
123
+                name="index"
123 124
                 component={PlanningScreen}
124 125
                 options={({navigation}) => {
125 126
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -130,7 +131,7 @@ function PlanningStackComponent() {
130 131
                 }}
131 132
             />
132 133
             <PlanningStack.Screen
133
-                name="PlanningDisplayScreen"
134
+                name="planning-information"
134 135
                 component={PlanningDisplayScreen}
135 136
                 options={{
136 137
                     title: 'Details',
@@ -143,15 +144,15 @@ function PlanningStackComponent() {
143 144
 
144 145
 const HomeStack = createStackNavigator();
145 146
 
146
-function HomeStackComponent() {
147
+function HomeStackComponent(initialRoute: string | null, defaultData: Object) {
147 148
     return (
148 149
         <HomeStack.Navigator
149
-            initialRouteName="HomeScreen"
150
+            initialRouteName={"index"}
150 151
             headerMode="float"
151 152
             screenOptions={defaultScreenOptions}
152 153
         >
153 154
             <HomeStack.Screen
154
-                name="HomeScreen"
155
+                name="index"
155 156
                 component={HomeScreen}
156 157
                 options={({navigation}) => {
157 158
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -160,15 +161,26 @@ function HomeStackComponent() {
160 161
                         headerLeft: openDrawer
161 162
                     };
162 163
                 }}
164
+                initialParams={{data: defaultData, nextScreen: initialRoute}}
163 165
             />
164 166
             <HomeStack.Screen
165
-                name="PlanningDisplayScreen"
167
+                name="planning-information"
166 168
                 component={PlanningDisplayScreen}
167 169
                 options={{
168 170
                     title: 'Details',
169 171
                     ...TransitionPresets.ModalSlideFromBottomIOS,
170 172
                 }}
171 173
             />
174
+            <HomeStack.Screen
175
+                name="club-information"
176
+                component={ClubDisplayScreen}
177
+                options={({navigation}) => {
178
+                    return {
179
+                        title: "",
180
+                        ...TransitionPresets.ModalSlideFromBottomIOS,
181
+                    };
182
+                }}
183
+            />
172 184
         </HomeStack.Navigator>
173 185
     );
174 186
 }
@@ -178,12 +190,12 @@ const PlanexStack = createStackNavigator();
178 190
 function PlanexStackComponent() {
179 191
     return (
180 192
         <PlanexStack.Navigator
181
-            initialRouteName="HomeScreen"
193
+            initialRouteName="index"
182 194
             headerMode="float"
183 195
             screenOptions={defaultScreenOptions}
184 196
         >
185 197
             <PlanexStack.Screen
186
-                name="PlanexScreen"
198
+                name="index"
187 199
                 component={PlanexScreen}
188 200
                 options={({navigation}) => {
189 201
                     const openDrawer = getDrawerButton.bind(this, navigation);
@@ -199,46 +211,71 @@ function PlanexStackComponent() {
199 211
 
200 212
 const Tab = createMaterialBottomTabNavigator();
201 213
 
202
-function TabNavigator(props) {
203
-    const {colors} = props.theme;
204
-    return (
205
-        <Tab.Navigator
206
-            initialRouteName={AsyncStorageManager.getInstance().preferences.defaultStartScreen.current}
207
-            barStyle={{backgroundColor: colors.surface}}
208
-            screenOptions={({route}) => ({
209
-                tabBarIcon: ({focused, color, size}) => {
210
-                    let icon = TAB_ICONS[route.name];
211
-                    // tintColor is ignoring activeColor and inactiveColor for some reason
212
-                    icon = focused ? icon : icon + ('-outline');
213
-                    return <MaterialCommunityIcons name={icon} color={color} size={26}/>;
214
-                },
215
-            })}
216
-            activeColor={colors.primary}
217
-            inactiveColor={colors.tabIcon}
218
-        >
219
-            <Tab.Screen
220
-                name="Proximo"
221
-                component={ProximoStackComponent}
222
-            />
223
-            <Tab.Screen
224
-                name="Planning"
225
-                component={PlanningStackComponent}
226
-            />
227
-            <Tab.Screen
228
-                name="Home"
229
-                component={HomeStackComponent}
230
-                options={{title: i18n.t('screens.home')}}
231
-            />
232
-            <Tab.Screen
233
-                name="Proxiwash"
234
-                component={ProxiwashStackComponent}
235
-            />
236
-            <Tab.Screen
237
-                name="Planex"
238
-                component={PlanexStackComponent}
239
-            />
240
-        </Tab.Navigator>
241
-    );
214
+type Props = {
215
+    defaultPath: Array<string>,
216
+    defaultData: Object
217
+}
218
+
219
+class TabNavigator extends React.Component<Props>{
220
+
221
+    createHomeStackComponent: Object;
222
+    colors: Object;
223
+
224
+    constructor(props) {
225
+        super(props);
226
+        this.colors = props.theme.colors;
227
+        this.defaultRoute = AsyncStorageManager.getInstance().preferences.defaultStartScreen.current.toLowerCase();
228
+        this.defaultSubRoute = null;
229
+
230
+        if (props.defaultPath.length > 1)
231
+            this.defaultRoute = props.defaultPath[1];
232
+        if (props.defaultPath.length > 2)
233
+            this.defaultSubRoute = props.defaultPath[2];
234
+
235
+
236
+        this.createHomeStackComponent = () => HomeStackComponent(this.defaultSubRoute, props.defaultData);
237
+    }
238
+
239
+    render() {
240
+        return (
241
+            <Tab.Navigator
242
+                initialRouteName={this.defaultRoute}
243
+                barStyle={{backgroundColor: this.colors.surface}}
244
+                screenOptions={({route}) => ({
245
+                    tabBarIcon: ({focused, color, size}) => {
246
+                        let icon = TAB_ICONS[route.name];
247
+                        // tintColor is ignoring activeColor and inactiveColor for some reason
248
+                        icon = focused ? icon : icon + ('-outline');
249
+                        return <MaterialCommunityIcons name={icon} color={color} size={26}/>;
250
+                    },
251
+                })}
252
+                activeColor={this.colors.primary}
253
+                inactiveColor={this.colors.tabIcon}
254
+            >
255
+                <Tab.Screen
256
+                    name="proximo"
257
+                    component={ProximoStackComponent}
258
+                />
259
+                <Tab.Screen
260
+                    name="planning"
261
+                    component={PlanningStackComponent}
262
+                />
263
+                <Tab.Screen
264
+                    name="home"
265
+                    component={this.createHomeStackComponent}
266
+                    options={{title: i18n.t('screens.home')}}
267
+                />
268
+                <Tab.Screen
269
+                    name="proxiwash"
270
+                    component={ProxiwashStackComponent}
271
+                />
272
+                <Tab.Screen
273
+                    name="planex"
274
+                    component={PlanexStackComponent}
275
+                />
276
+            </Tab.Navigator>
277
+        );
278
+    }
242 279
 }
243 280
 
244 281
 export default withTheme(TabNavigator);

+ 2
- 2
src/screens/About/AboutScreen.js View File

@@ -101,7 +101,7 @@ class AboutScreen extends React.Component<Props, State> {
101 101
             showChevron: true
102 102
         },
103 103
         {
104
-            onPressCallback: () => this.props.navigation.navigate('DebugScreen'),
104
+            onPressCallback: () => this.props.navigation.navigate('debug'),
105 105
             icon: 'bug-check',
106 106
             text: i18n.t('aboutScreen.debug'),
107 107
             showChevron: true,
@@ -165,7 +165,7 @@ class AboutScreen extends React.Component<Props, State> {
165 165
             showChevron: true
166 166
         },
167 167
         {
168
-            onPressCallback: () => this.props.navigation.navigate('AboutDependenciesScreen'),
168
+            onPressCallback: () => this.props.navigation.navigate('dependencies'),
169 169
             icon: 'developer-board',
170 170
             text: i18n.t('aboutScreen.libs'),
171 171
             showChevron: true

+ 73
- 14
src/screens/Amicale/Clubs/ClubDisplayScreen.js View File

@@ -7,6 +7,7 @@ import {Linking} from "expo";
7 7
 import {Avatar, Card, Chip, Paragraph, withTheme} from 'react-native-paper';
8 8
 import ImageModal from 'react-native-image-modal';
9 9
 import i18n from "i18n-js";
10
+import AuthenticatedScreen from "../../../components/Amicale/AuthenticatedScreen";
10 11
 
11 12
 type Props = {
12 13
     navigation: Object,
@@ -21,13 +22,34 @@ function openWebLink(event, link) {
21 22
     Linking.openURL(link).catch((err) => console.error('Error opening link', err));
22 23
 }
23 24
 
25
+const FakeClub = {
26
+    "category": [
27
+        3,
28
+        6,
29
+    ],
30
+    "description": "<p class=\"ql-align-justify\">Les 100 Tours de l’INSA reviennent en force pour une cinquième édition les 5 et 6 juin prochain&nbsp;!</p><p class=\"ql-align-justify\"><br></p><p class=\"ql-align-justify\">Prépare-toi pour le plus gros évènement de l’année sur le campus de notre belle école qui nous réunit tous autour d’activités folles&nbsp;pour fêter la fin de l’année dans la bonne humeur !</p><p class=\"ql-align-justify\">L’éco-festival tournera autour d’une grande course par équipe qui nous vaut ce doux nom de 100 tours. Ce sera le moment de défier tes potes pour tenter de remporter de nombreux lots, et surtout l’admiration de tous. Mais cela ne s’arrête pas là, puisque tu pourras aussi participer à des activités à sensation, divers ateliers, et de quoi chiller avec tes potes en écoutant de la bonne musique. Tu pourras ensuite enchaîner sur LA soirée de l’année, rythmée par des artistes sur-motivés&nbsp;!</p><p class=\"ql-align-justify\"><br></p><p class=\"ql-align-justify\">Tu es bien entendu le bienvenu si l’envie te prend de rejoindre l’équipe et de nous aider à organiser cet évènement du turfu&nbsp;!</p><p class=\"ql-align-justify\"><br></p><p class=\"ql-align-justify\">La team 100 Tours</p><p class=\"ql-align-justify\"><br></p><p>Contact&nbsp;: <a href=\"mailto:100Tours@amicale-insat.fr\" target=\"_blank\">100tours@amicale-insat.fr</a></p><p>Facebook&nbsp;: Les 100 Tours de l’INSA</p><p>Instagram&nbsp;: 100tours.insatoulouse</p>",
31
+    "id": 110,
32
+    "logo": "https://www.amicale-insat.fr/storage/clubLogos/2cca8885dd3bdf902124f038b548962b.jpeg",
33
+    "name": "100 Tours",
34
+    "responsibles": [
35
+        "Juliette Duval",
36
+        "Emilie Cuminal",
37
+        "Maxime Doré",
38
+    ],
39
+};
40
+
24 41
 /**
25 42
  * Class defining a planning event information page.
43
+ * If called with data and categories navigation parameters, will use those to display the data.
44
+ * If called with clubId parameter, will fetch the information on the server
26 45
  */
27 46
 class ClubDisplayScreen extends React.Component<Props, State> {
28 47
 
29
-    displayData = this.props.route.params['data'];
30
-    categories = this.props.route.params['categories'];
48
+    displayData: Object;
49
+    categories: Object | null;
50
+    clubId: number;
51
+
52
+    shouldFetchData: boolean;
31 53
 
32 54
     colors: Object;
33 55
 
@@ -38,6 +60,19 @@ class ClubDisplayScreen extends React.Component<Props, State> {
38 60
     constructor(props) {
39 61
         super(props);
40 62
         this.colors = props.theme.colors;
63
+
64
+        if (this.props.route.params.data !== undefined && this.props.route.params.categories !== undefined) {
65
+            this.displayData = this.props.route.params.data;
66
+            this.categories = this.props.route.params.categories;
67
+            this.clubId = this.props.route.params.data.id;
68
+            this.shouldFetchData = false;
69
+        } else {
70
+            this.displayData = {};
71
+            this.categories = null;
72
+            this.clubId = this.props.route.params.clubId;
73
+            this.shouldFetchData = true;
74
+            console.log(this.clubId);
75
+        }
41 76
     }
42 77
 
43 78
     componentDidMount(): * {
@@ -45,22 +80,28 @@ class ClubDisplayScreen extends React.Component<Props, State> {
45 80
     }
46 81
 
47 82
     getCategoryName(id: number) {
48
-        for (let i = 0; i < this.categories.length; i++) {
49
-            if (id === this.categories[i].id)
50
-                return this.categories[i].name;
83
+        if (this.categories !== null) {
84
+            for (let i = 0; i < this.categories.length; i++) {
85
+                if (id === this.categories[i].id)
86
+                    return this.categories[i].name;
87
+            }
51 88
         }
52 89
         return "";
53 90
     }
54 91
 
55 92
     getCategoriesRender(categories: Array<number | null>) {
93
+        if (this.categories === null)
94
+            return null;
95
+
56 96
         let final = [];
57 97
         for (let i = 0; i < categories.length; i++) {
58
-            if (categories[i] !== null) {
98
+            let cat = categories[i];
99
+            if (cat !== null) {
59 100
                 final.push(
60 101
                     <Chip
61 102
                         style={{marginRight: 5}}
62 103
                         key={i.toString()}>
63
-                        {this.getCategoryName(categories[i])}
104
+                        {this.getCategoryName(cat)}
64 105
                     </Chip>
65 106
                 );
66 107
             }
@@ -92,11 +133,13 @@ class ClubDisplayScreen extends React.Component<Props, State> {
92 133
         );
93 134
     }
94 135
 
95
-    render() {
136
+    getScreen = (data: Object) => {
137
+        data = FakeClub;
138
+
96 139
         return (
97 140
             <ScrollView style={{paddingLeft: 5, paddingRight: 5}}>
98
-                {this.getCategoriesRender(this.displayData.category)}
99
-                {this.displayData.logo !== null ?
141
+                {this.getCategoriesRender(data.category)}
142
+                {data.logo !== null ?
100 143
                     <View style={{
101 144
                         marginLeft: 'auto',
102 145
                         marginRight: 'auto',
@@ -111,15 +154,15 @@ class ClubDisplayScreen extends React.Component<Props, State> {
111 154
                                 height: 300,
112 155
                             }}
113 156
                             source={{
114
-                                uri: this.displayData.logo,
157
+                                uri: data.logo,
115 158
                             }}
116 159
                         /></View>
117 160
                     : <View/>}
118 161
 
119
-                {this.displayData.description !== null ?
162
+                {data.description !== null ?
120 163
                     // Surround description with div to allow text styling if the description is not html
121 164
                     <Card.Content>
122
-                        <HTML html={"<div>" + this.displayData.description + "</div>"}
165
+                        <HTML html={"<div>" + data.description + "</div>"}
123 166
                               tagsStyles={{
124 167
                                   p: {color: this.colors.text,},
125 168
                                   div: {color: this.colors.text}
@@ -127,9 +170,25 @@ class ClubDisplayScreen extends React.Component<Props, State> {
127 170
                               onLinkPress={openWebLink}/>
128 171
                     </Card.Content>
129 172
                     : <View/>}
130
-                {this.getManagersRender(this.displayData.responsibles)}
173
+                {this.getManagersRender(data.responsibles)}
131 174
             </ScrollView>
132 175
         );
176
+    };
177
+
178
+    render() {
179
+        if (this.shouldFetchData)
180
+            return <AuthenticatedScreen
181
+                {...this.props}
182
+                links={[
183
+                    {
184
+                        link: 'clubs/list/' + this.clubId,
185
+                        mandatory: false,
186
+                    }
187
+                ]}
188
+                renderFunction={this.getScreen}
189
+            />;
190
+        else
191
+            return this.getScreen(this.displayData);
133 192
     }
134 193
 }
135 194
 

+ 2
- 2
src/screens/Amicale/Clubs/ClubListScreen.js View File

@@ -71,7 +71,7 @@ class ClubListScreen extends React.Component<Props, State> {
71 71
      * @return {*}
72 72
      */
73 73
     getHeaderButtons = () => {
74
-        const onPress = () => this.props.navigation.navigate("ClubAboutScreen");
74
+        const onPress = () => this.props.navigation.navigate("club-about");
75 75
         return <HeaderButton icon={'information'} onPress={onPress}/>;
76 76
     };
77 77
 
@@ -186,7 +186,7 @@ class ClubListScreen extends React.Component<Props, State> {
186 186
      * @param item The article pressed
187 187
      */
188 188
     onListItemPress(item: Object) {
189
-        this.props.navigation.navigate("ClubDisplayScreen", {data: item, categories: this.categories});
189
+        this.props.navigation.navigate("club-information", {data: item, categories: this.categories});
190 190
     }
191 191
 
192 192
     render() {

+ 1
- 1
src/screens/Amicale/LoginScreen.js View File

@@ -63,7 +63,7 @@ class LoginScreen extends React.Component<Props, State> {
63 63
 
64 64
     hideErrorDialog = () => this.setState({dialogVisible: false});
65 65
 
66
-    handleSuccess = () => this.props.navigation.navigate('ProfileScreen');
66
+    handleSuccess = () => this.props.navigation.navigate('profile');
67 67
 
68 68
     onResetPasswordClick = () => openBrowser(RESET_PASSWORD_LINK, this.colors.primary);
69 69
 

+ 11
- 7
src/screens/HomeScreen.js View File

@@ -29,6 +29,7 @@ const REFRESH_TIME = 1000 * 20; // Refresh every 20 seconds
29 29
 
30 30
 type Props = {
31 31
     navigation: Object,
32
+    route: Object,
32 33
     theme: Object,
33 34
 }
34 35
 
@@ -51,6 +52,9 @@ class HomeScreen extends React.Component<Props> {
51 52
         this.colors = props.theme.colors;
52 53
 
53 54
         this.isLoggedIn = null;
55
+        if (this.props.route.params.nextScreen !== undefined && this.props.route.params.nextScreen !== null) {
56
+            this.props.navigation.navigate(this.props.route.params.nextScreen, this.props.route.params.data);
57
+        }
54 58
     }
55 59
 
56 60
     /**
@@ -80,8 +84,8 @@ class HomeScreen extends React.Component<Props> {
80 84
 
81 85
     getHeaderButton = () => {
82 86
         const screen = this.isLoggedIn
83
-            ? "ProfileScreen"
84
-            : "LoginScreen";
87
+            ? "profile"
88
+            : "login";
85 89
         const icon = this.isLoggedIn
86 90
             ? "account"
87 91
             : "login";
@@ -93,13 +97,13 @@ class HomeScreen extends React.Component<Props> {
93 97
         />;
94 98
     };
95 99
 
96
-    onProxiwashClick = () => this.props.navigation.navigate('Proxiwash');
100
+    onProxiwashClick = () => this.props.navigation.navigate('proxiwash');
97 101
 
98 102
     onTutorInsaClick = () => openBrowser("https://www.etud.insa-toulouse.fr/~tutorinsa/", this.colors.primary);
99 103
 
100
-    onProximoClick = () => this.props.navigation.navigate('Proximo');
104
+    onProximoClick = () => this.props.navigation.navigate('proximo');
101 105
 
102
-    onMenuClick = () => this.props.navigation.navigate('SelfMenuScreen');
106
+    onMenuClick = () => this.props.navigation.navigate('self-menu');
103 107
 
104 108
     /**
105 109
      * Creates the dataset to be used in the FlatList
@@ -338,8 +342,8 @@ class HomeScreen extends React.Component<Props> {
338 342
             subtitle = i18n.t('homeScreen.dashboard.todayEventsSubtitleNA');
339 343
 
340 344
         let displayEvent = this.getDisplayEvent(futureEvents);
341
-        const clickContainerAction = () => this.props.navigation.navigate('Planning');
342
-        const clickPreviewAction = () => this.props.navigation.navigate('PlanningDisplayScreen', {data: displayEvent});
345
+        const clickContainerAction = () => this.props.navigation.navigate('planning');
346
+        const clickPreviewAction = () => this.props.navigation.navigate('planning-information', {data: displayEvent});
343 347
 
344 348
         return (
345 349
             <DashboardItem

+ 27
- 11
src/screens/Planning/PlanningDisplayScreen.js View File

@@ -15,38 +15,54 @@ type Props = {
15 15
 };
16 16
 
17 17
 type State = {
18
-    imageModalVisible: boolean,
19 18
 };
20 19
 
21 20
 function openWebLink(event, link) {
22 21
     Linking.openURL(link).catch((err) => console.error('Error opening link', err));
23 22
 }
24 23
 
24
+const FAKE_EVENT = {
25
+    "id": 142,
26
+    "title": "Soir\u00e9e Impact'INSA",
27
+    "logo": null,
28
+    "date_begin": "2020-04-22 19:00",
29
+    "date_end": "2020-04-22 00:00",
30
+    "description": "<p>R\u00e9servation salle de boom + PK pour la soir\u00e9e Impact'Insa<\/p>",
31
+    "club": "Impact Insa",
32
+    "category_id": 10,
33
+    "url": "https:\/\/www.amicale-insat.fr\/event\/142\/view"
34
+};
35
+
25 36
 /**
26 37
  * Class defining a planning event information page.
27 38
  */
28 39
 class PlanningDisplayScreen extends React.Component<Props, State> {
29 40
 
30
-    displayData = this.props.route.params['data'];
41
+    displayData: Object;
42
+    shouldFetchData: boolean;
43
+    eventId: number;
31 44
 
32 45
     colors: Object;
33 46
 
34 47
     state = {
35
-        imageModalVisible: false,
48
+
36 49
     };
37 50
 
38 51
     constructor(props) {
39 52
         super(props);
40 53
         this.colors = props.theme.colors;
41
-    }
42 54
 
43
-    showImageModal = () => {
44
-        this.setState({imageModalVisible: true});
45
-    };
46
-
47
-    hideImageModal = () => {
48
-        this.setState({imageModalVisible: false});
49
-    };
55
+        if (this.props.route.params.data !== undefined) {
56
+            this.displayData = this.props.route.params.data;
57
+            this.eventId = this.props.route.params.data.eventId;
58
+            this.shouldFetchData = false;
59
+        } else {
60
+            this.displayData = FAKE_EVENT;
61
+            this.eventId = this.props.route.params.eventId;
62
+            this.shouldFetchData = true;
63
+            console.log(this.eventId);
64
+        }
65
+    }
50 66
 
51 67
     render() {
52 68
         // console.log("rendering planningDisplayScreen");

+ 1
- 1
src/screens/Planning/PlanningScreen.js View File

@@ -185,7 +185,7 @@ export default class PlanningScreen extends React.Component<Props, State> {
185 185
      * @return {*}
186 186
      */
187 187
     getRenderItem(item: eventObject) {
188
-        const onPress = this.props.navigation.navigate.bind(this, 'PlanningDisplayScreen', {data: item});
188
+        const onPress = this.props.navigation.navigate.bind(this, 'planning-information', {data: item});
189 189
         if (item.logo !== null) {
190 190
             return (
191 191
                 <View>

+ 3
- 3
src/screens/Proximo/ProximoMainScreen.js View File

@@ -95,7 +95,7 @@ class ProximoMainScreen extends React.Component<Props, State> {
95 95
                     this.getAvailableArticles(this.articles, undefined) : []
96 96
             },
97 97
         };
98
-        this.props.navigation.navigate('ProximoListScreen', searchScreenData);
98
+        this.props.navigation.navigate('proximo-list', searchScreenData);
99 99
     }
100 100
 
101 101
     /**
@@ -103,7 +103,7 @@ class ProximoMainScreen extends React.Component<Props, State> {
103 103
      * This will open the ProximoAboutScreen
104 104
      */
105 105
     onPressAboutBtn() {
106
-        this.props.navigation.navigate('ProximoAboutScreen');
106
+        this.props.navigation.navigate('proximo-about');
107 107
     }
108 108
 
109 109
     /**
@@ -212,7 +212,7 @@ class ProximoMainScreen extends React.Component<Props, State> {
212 212
             data: item,
213 213
         };
214 214
         const subtitle = item.data.length + " " + (item.data.length > 1 ? i18n.t('proximoScreen.articles') : i18n.t('proximoScreen.article'));
215
-        const onPress = this.props.navigation.navigate.bind(this, 'ProximoListScreen', dataToSend);
215
+        const onPress = this.props.navigation.navigate.bind(this, 'proximo-list', dataToSend);
216 216
         if (item.data.length > 0) {
217 217
             return (
218 218
                 <List.Item

+ 1
- 1
src/screens/Proxiwash/ProxiwashScreen.js View File

@@ -143,7 +143,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
143 143
      * This will open the ProxiwashAboutScreen.
144 144
      */
145 145
     onAboutPress() {
146
-        this.props.navigation.navigate('ProxiwashAboutScreen');
146
+        this.props.navigation.navigate('proxiwash-about');
147 147
     }
148 148
 
149 149
     /**

+ 1
- 1
src/screens/Websites/PlanexScreen.js View File

@@ -134,7 +134,7 @@ export default class PlanexScreen extends React.Component<Props, State> {
134 134
      */
135 135
     onGoToSettings() {
136 136
         this.onHideBanner();
137
-        this.props.navigation.navigate('SettingsScreen');
137
+        this.props.navigation.navigate('settings');
138 138
     }
139 139
 
140 140
     render() {

Loading…
Cancel
Save