Browse Source

Centralized urls

Arnaud Vergnet 2 years ago
parent
commit
128af0b813

+ 1
- 1
src/components/Collapsible/CollapsibleComponent.tsx View File

34
   hasTab?: boolean;
34
   hasTab?: boolean;
35
   onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
35
   onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
36
   paddedProps?: (paddingTop: number) => Record<string, any>;
36
   paddedProps?: (paddingTop: number) => Record<string, any>;
37
-  headerColors: string;
37
+  headerColors?: string;
38
 };
38
 };
39
 
39
 
40
 type Props = CollapsibleComponentPropsType & {
40
 type Props = CollapsibleComponentPropsType & {

+ 1
- 2
src/components/Screens/WebSectionList.tsx View File

54
     data: RawData | null,
54
     data: RawData | null,
55
     isLoading?: boolean
55
     isLoading?: boolean
56
   ) => SectionListDataType<ItemT>;
56
   ) => SectionListDataType<ItemT>;
57
-  onScroll: (event: NativeSyntheticEvent<EventTarget>) => void;
58
-  collapsibleStack: Collapsible;
59
 
57
 
58
+  onScroll?: (event: NativeSyntheticEvent<EventTarget>) => void;
60
   showError?: boolean;
59
   showError?: boolean;
61
   itemHeight?: number | null;
60
   itemHeight?: number | null;
62
   updateData?: number;
61
   updateData?: number;

+ 0
- 32
src/constants/AvailableWebsites.ts View File

1
-/*
2
- * Copyright (c) 2019 - 2020 Arnaud Vergnet.
3
- *
4
- * This file is part of Campus INSAT.
5
- *
6
- * Campus INSAT is free software: you can redistribute it and/or modify
7
- *  it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * Campus INSAT is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
- * GNU General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU General Public License
17
- * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
18
- */
19
-
20
-export default {
21
-  websites: {
22
-    AMICALE: 'https://www.amicale-insat.fr/',
23
-    AVAILABLE_ROOMS: 'http://planex.insa-toulouse.fr/salles.php',
24
-    BIB: 'https://bibbox.insa-toulouse.fr/',
25
-    BLUEMIND: 'https://etud-mel.insa-toulouse.fr/webmail/',
26
-    ELUS_ETUDIANTS: 'https://etud.insa-toulouse.fr/~eeinsat/',
27
-    ENT: 'https://ent.insa-toulouse.fr/',
28
-    INSA_ACCOUNT: 'https://moncompte.insa-toulouse.fr/',
29
-    TUTOR_INSA: 'https://www.etud.insa-toulouse.fr/~tutorinsa/',
30
-    WIKETUD: 'https://wiki.etud.insa-toulouse.fr/',
31
-  },
32
-};

+ 4
- 4
src/constants/ProxiwashConstants.ts View File

17
  * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
17
  * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
18
  */
18
  */
19
 
19
 
20
+import Urls from './Urls';
21
+
20
 export enum MachineStates {
22
 export enum MachineStates {
21
   AVAILABLE,
23
   AVAILABLE,
22
   RUNNING,
24
   RUNNING,
45
     tarif: 'screens.proxiwash.washinsa.tariff',
47
     tarif: 'screens.proxiwash.washinsa.tariff',
46
     paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
48
     paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
47
     icon: 'school-outline',
49
     icon: 'school-outline',
48
-    url:
49
-      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json',
50
+    url: Urls.app.api + 'washinsa/washinsa_data.json',
50
   },
51
   },
51
   tripodeB: {
52
   tripodeB: {
52
     id: 'tripodeB',
53
     id: 'tripodeB',
56
     tarif: 'screens.proxiwash.tripodeB.tariff',
57
     tarif: 'screens.proxiwash.tripodeB.tariff',
57
     paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
58
     paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
58
     icon: 'domain',
59
     icon: 'domain',
59
-    url:
60
-      'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json',
60
+    url: Urls.app.api + 'washinsa/tripode_b_data.json',
61
   },
61
   },
62
 };
62
 };

+ 91
- 0
src/constants/Urls.tsx View File

1
+/*
2
+ * Copyright (c) 2019 - 2020 Arnaud Vergnet.
3
+ *
4
+ * This file is part of Campus INSAT.
5
+ *
6
+ * Campus INSAT is free software: you can redistribute it and/or modify
7
+ *  it under the terms of the GNU General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * Campus INSAT is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+ * GNU General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU General Public License
17
+ * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
18
+ */
19
+
20
+const STUDENT_SERVER = 'https://etud.insa-toulouse.fr/';
21
+const AMICALE_SERVER = 'https://www.amicale-insat.fr/';
22
+const GIT_SERVER =
23
+  'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/';
24
+
25
+const AMICALE_ENDPOINT = AMICALE_SERVER + 'api/';
26
+
27
+const APP_ENDPOINT = STUDENT_SERVER + '~amicale_app/v2/';
28
+const PROXIMO_ENDPOINT = STUDENT_SERVER + '~proximo/data/stock-v2.json';
29
+const APP_IMAGES_ENDPOINT = STUDENT_SERVER + '~amicale_app/images/';
30
+
31
+export default {
32
+  amicale: {
33
+    api: APP_ENDPOINT,
34
+    resetPassword: AMICALE_SERVER + 'password/reset',
35
+    events: AMICALE_ENDPOINT + 'event/list',
36
+  },
37
+  app: {
38
+    api: APP_ENDPOINT,
39
+    dashboard: APP_ENDPOINT + 'dashboard/dashboard_data.json',
40
+    menu: APP_ENDPOINT + 'menu/menu_data.json',
41
+  },
42
+  proximo: PROXIMO_ENDPOINT,
43
+  images: {
44
+    proxiwash: APP_IMAGES_ENDPOINT + 'Proxiwash.png',
45
+    washer: APP_IMAGES_ENDPOINT + 'ProxiwashLaveLinge.png',
46
+    dryer: APP_IMAGES_ENDPOINT + 'ProxiwashSecheLinge.png',
47
+    proximo: APP_IMAGES_ENDPOINT + 'Proximo.png',
48
+    clubs: APP_IMAGES_ENDPOINT + 'Clubs.png',
49
+    profile: APP_IMAGES_ENDPOINT + 'ProfilAmicaliste.png',
50
+    equipment: APP_IMAGES_ENDPOINT + 'Materiel.png',
51
+    vote: APP_IMAGES_ENDPOINT + 'Vote.png',
52
+    amicale: APP_IMAGES_ENDPOINT + 'WebsiteAmicale.png',
53
+    wiketud: APP_IMAGES_ENDPOINT + 'Wiketud.png',
54
+    elusEtudiants: APP_IMAGES_ENDPOINT + 'EEC.png',
55
+    tutorInsa: APP_IMAGES_ENDPOINT + 'TutorINSA.png',
56
+    bib: APP_IMAGES_ENDPOINT + 'Bib.png',
57
+    menu: APP_IMAGES_ENDPOINT + 'RU.png',
58
+    availableRooms: APP_IMAGES_ENDPOINT + 'Salles.png',
59
+    bluemind: APP_IMAGES_ENDPOINT + 'Bluemind.png',
60
+    ent: APP_IMAGES_ENDPOINT + 'ENT.png',
61
+    insaAccount: APP_IMAGES_ENDPOINT + 'Account.png',
62
+  },
63
+  websites: {
64
+    amicale: AMICALE_SERVER,
65
+    availableRooms: 'http://planex.insa-toulouse.fr/salles.php',
66
+    bib: 'https://bibbox.insa-toulouse.fr/',
67
+    bluemind: 'https://etud-mel.insa-toulouse.fr/webmail/',
68
+    elusEtudiants: STUDENT_SERVER + '~eeinsat/',
69
+    ent: 'https://ent.insa-toulouse.fr/',
70
+    insaAccount: 'https://moncompte.insa-toulouse.fr/',
71
+    tutorInsa: STUDENT_SERVER + '~tutorinsa/',
72
+    wiketud: 'https://wiki.etud.insa-toulouse.fr/',
73
+  },
74
+  about: {
75
+    appstore: 'https://apps.apple.com/us/app/campus-amicale-insat/id1477722148',
76
+    playstore:
77
+      'https://play.google.com/store/apps/details?id=fr.amicaleinsat.application',
78
+    react: 'https://facebook.github.io/react-native/',
79
+    git: GIT_SERVER + 'src/branch/master/README.md',
80
+    changelog: GIT_SERVER + 'src/branch/master/Changelog.md',
81
+    license: GIT_SERVER + 'src/branch/master/LICENSE',
82
+  },
83
+  feedback: {
84
+    git: GIT_SERVER,
85
+    trello: 'https://trello.com/b/RMej49Uq/application-campus-insa',
86
+    facebook: 'https://www.facebook.com/campus.insat',
87
+    mail: `mailto:app@amicale-insat.fr?subject=[FEEDBACK] Application CAMPUS
88
+&body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
89
+    discord: 'https://discord.gg/W8MeTec',
90
+  },
91
+};

+ 27
- 64
src/managers/ServicesManager.ts View File

19
 
19
 
20
 import i18n from 'i18n-js';
20
 import i18n from 'i18n-js';
21
 import { StackNavigationProp } from '@react-navigation/stack';
21
 import { StackNavigationProp } from '@react-navigation/stack';
22
-import AvailableWebsites from '../constants/AvailableWebsites';
23
 import ConnectionManager from './ConnectionManager';
22
 import ConnectionManager from './ConnectionManager';
24
 import type { FullDashboardType } from '../screens/Home/HomeScreen';
23
 import type { FullDashboardType } from '../screens/Home/HomeScreen';
25
 import getStrippedServicesList from '../utils/Services';
24
 import getStrippedServicesList from '../utils/Services';
26
-
27
-// AMICALE
28
-const CLUBS_IMAGE =
29
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Clubs.png';
30
-const PROFILE_IMAGE =
31
-  'https://etud.insa-toulouse.fr/~amicale_app/images/ProfilAmicaliste.png';
32
-const EQUIPMENT_IMAGE =
33
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Materiel.png';
34
-const VOTE_IMAGE = 'https://etud.insa-toulouse.fr/~amicale_app/images/Vote.png';
35
-const AMICALE_IMAGE =
36
-  'https://etud.insa-toulouse.fr/~amicale_app/images/WebsiteAmicale.png';
37
-
38
-// STUDENTS
39
-const PROXIMO_IMAGE =
40
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Proximo.png';
41
-const WIKETUD_IMAGE =
42
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Wiketud.png';
43
-const EE_IMAGE = 'https://etud.insa-toulouse.fr/~amicale_app/images/EEC.png';
44
-const TUTORINSA_IMAGE =
45
-  'https://etud.insa-toulouse.fr/~amicale_app/images/TutorINSA.png';
46
-
47
-// INSA
48
-const BIB_IMAGE = 'https://etud.insa-toulouse.fr/~amicale_app/images/Bib.png';
49
-const RU_IMAGE = 'https://etud.insa-toulouse.fr/~amicale_app/images/RU.png';
50
-const ROOM_IMAGE =
51
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Salles.png';
52
-const EMAIL_IMAGE =
53
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Bluemind.png';
54
-const ENT_IMAGE = 'https://etud.insa-toulouse.fr/~amicale_app/images/ENT.png';
55
-const ACCOUNT_IMAGE =
56
-  'https://etud.insa-toulouse.fr/~amicale_app/images/Account.png';
57
-
58
-// SPECIAL
59
-const WASHER_IMAGE =
60
-  'https://etud.insa-toulouse.fr/~amicale_app/images/ProxiwashLaveLinge.png';
61
-const DRYER_IMAGE =
62
-  'https://etud.insa-toulouse.fr/~amicale_app/images/ProxiwashSecheLinge.png';
25
+import Urls from '../constants/Urls';
63
 
26
 
64
 const AMICALE_LOGO = require('../../assets/amicale.png');
27
 const AMICALE_LOGO = require('../../assets/amicale.png');
65
 
28
 
127
         key: SERVICES_KEY.CLUBS,
90
         key: SERVICES_KEY.CLUBS,
128
         title: i18n.t('screens.clubs.title'),
91
         title: i18n.t('screens.clubs.title'),
129
         subtitle: i18n.t('screens.services.descriptions.clubs'),
92
         subtitle: i18n.t('screens.services.descriptions.clubs'),
130
-        image: CLUBS_IMAGE,
93
+        image: Urls.images.clubs,
131
         onPress: (): void => this.onAmicaleServicePress('club-list'),
94
         onPress: (): void => this.onAmicaleServicePress('club-list'),
132
       },
95
       },
133
       {
96
       {
134
         key: SERVICES_KEY.PROFILE,
97
         key: SERVICES_KEY.PROFILE,
135
         title: i18n.t('screens.profile.title'),
98
         title: i18n.t('screens.profile.title'),
136
         subtitle: i18n.t('screens.services.descriptions.profile'),
99
         subtitle: i18n.t('screens.services.descriptions.profile'),
137
-        image: PROFILE_IMAGE,
100
+        image: Urls.images.profile,
138
         onPress: (): void => this.onAmicaleServicePress('profile'),
101
         onPress: (): void => this.onAmicaleServicePress('profile'),
139
       },
102
       },
140
       {
103
       {
141
         key: SERVICES_KEY.EQUIPMENT,
104
         key: SERVICES_KEY.EQUIPMENT,
142
         title: i18n.t('screens.equipment.title'),
105
         title: i18n.t('screens.equipment.title'),
143
         subtitle: i18n.t('screens.services.descriptions.equipment'),
106
         subtitle: i18n.t('screens.services.descriptions.equipment'),
144
-        image: EQUIPMENT_IMAGE,
107
+        image: Urls.images.equipment,
145
         onPress: (): void => this.onAmicaleServicePress('equipment-list'),
108
         onPress: (): void => this.onAmicaleServicePress('equipment-list'),
146
       },
109
       },
147
       {
110
       {
148
         key: SERVICES_KEY.AMICALE_WEBSITE,
111
         key: SERVICES_KEY.AMICALE_WEBSITE,
149
         title: i18n.t('screens.websites.amicale'),
112
         title: i18n.t('screens.websites.amicale'),
150
         subtitle: i18n.t('screens.services.descriptions.amicaleWebsite'),
113
         subtitle: i18n.t('screens.services.descriptions.amicaleWebsite'),
151
-        image: AMICALE_IMAGE,
114
+        image: Urls.images.amicale,
152
         onPress: (): void =>
115
         onPress: (): void =>
153
           nav.navigate('website', {
116
           nav.navigate('website', {
154
-            host: AvailableWebsites.websites.AMICALE,
117
+            host: Urls.websites.amicale,
155
             title: i18n.t('screens.websites.amicale'),
118
             title: i18n.t('screens.websites.amicale'),
156
           }),
119
           }),
157
       },
120
       },
159
         key: SERVICES_KEY.VOTE,
122
         key: SERVICES_KEY.VOTE,
160
         title: i18n.t('screens.vote.title'),
123
         title: i18n.t('screens.vote.title'),
161
         subtitle: i18n.t('screens.services.descriptions.vote'),
124
         subtitle: i18n.t('screens.services.descriptions.vote'),
162
-        image: VOTE_IMAGE,
125
+        image: Urls.images.vote,
163
         onPress: (): void => this.onAmicaleServicePress('vote'),
126
         onPress: (): void => this.onAmicaleServicePress('vote'),
164
       },
127
       },
165
     ];
128
     ];
168
         key: SERVICES_KEY.PROXIMO,
131
         key: SERVICES_KEY.PROXIMO,
169
         title: i18n.t('screens.proximo.title'),
132
         title: i18n.t('screens.proximo.title'),
170
         subtitle: i18n.t('screens.services.descriptions.proximo'),
133
         subtitle: i18n.t('screens.services.descriptions.proximo'),
171
-        image: PROXIMO_IMAGE,
134
+        image: Urls.images.proximo,
172
         onPress: (): void => nav.navigate('proximo'),
135
         onPress: (): void => nav.navigate('proximo'),
173
         badgeFunction: (dashboard: FullDashboardType): number =>
136
         badgeFunction: (dashboard: FullDashboardType): number =>
174
           dashboard.proximo_articles,
137
           dashboard.proximo_articles,
177
         key: SERVICES_KEY.WIKETUD,
140
         key: SERVICES_KEY.WIKETUD,
178
         title: 'Wiketud',
141
         title: 'Wiketud',
179
         subtitle: i18n.t('screens.services.descriptions.wiketud'),
142
         subtitle: i18n.t('screens.services.descriptions.wiketud'),
180
-        image: WIKETUD_IMAGE,
143
+        image: Urls.images.wiketud,
181
         onPress: (): void =>
144
         onPress: (): void =>
182
           nav.navigate('website', {
145
           nav.navigate('website', {
183
-            host: AvailableWebsites.websites.WIKETUD,
146
+            host: Urls.websites.wiketud,
184
             title: 'Wiketud',
147
             title: 'Wiketud',
185
           }),
148
           }),
186
       },
149
       },
188
         key: SERVICES_KEY.ELUS_ETUDIANTS,
151
         key: SERVICES_KEY.ELUS_ETUDIANTS,
189
         title: 'Élus Étudiants',
152
         title: 'Élus Étudiants',
190
         subtitle: i18n.t('screens.services.descriptions.elusEtudiants'),
153
         subtitle: i18n.t('screens.services.descriptions.elusEtudiants'),
191
-        image: EE_IMAGE,
154
+        image: Urls.images.elusEtudiants,
192
         onPress: (): void =>
155
         onPress: (): void =>
193
           nav.navigate('website', {
156
           nav.navigate('website', {
194
-            host: AvailableWebsites.websites.ELUS_ETUDIANTS,
157
+            host: Urls.websites.elusEtudiants,
195
             title: 'Élus Étudiants',
158
             title: 'Élus Étudiants',
196
           }),
159
           }),
197
       },
160
       },
199
         key: SERVICES_KEY.TUTOR_INSA,
162
         key: SERVICES_KEY.TUTOR_INSA,
200
         title: "Tutor'INSA",
163
         title: "Tutor'INSA",
201
         subtitle: i18n.t('screens.services.descriptions.tutorInsa'),
164
         subtitle: i18n.t('screens.services.descriptions.tutorInsa'),
202
-        image: TUTORINSA_IMAGE,
165
+        image: Urls.images.tutorInsa,
203
         onPress: (): void =>
166
         onPress: (): void =>
204
           nav.navigate('website', {
167
           nav.navigate('website', {
205
-            host: AvailableWebsites.websites.TUTOR_INSA,
168
+            host: Urls.websites.tutorInsa,
206
             title: "Tutor'INSA",
169
             title: "Tutor'INSA",
207
           }),
170
           }),
208
         badgeFunction: (dashboard: FullDashboardType): number =>
171
         badgeFunction: (dashboard: FullDashboardType): number =>
214
         key: SERVICES_KEY.RU,
177
         key: SERVICES_KEY.RU,
215
         title: i18n.t('screens.menu.title'),
178
         title: i18n.t('screens.menu.title'),
216
         subtitle: i18n.t('screens.services.descriptions.self'),
179
         subtitle: i18n.t('screens.services.descriptions.self'),
217
-        image: RU_IMAGE,
180
+        image: Urls.images.menu,
218
         onPress: (): void => nav.navigate('self-menu'),
181
         onPress: (): void => nav.navigate('self-menu'),
219
         badgeFunction: (dashboard: FullDashboardType): number =>
182
         badgeFunction: (dashboard: FullDashboardType): number =>
220
           dashboard.today_menu.length,
183
           dashboard.today_menu.length,
223
         key: SERVICES_KEY.AVAILABLE_ROOMS,
186
         key: SERVICES_KEY.AVAILABLE_ROOMS,
224
         title: i18n.t('screens.websites.rooms'),
187
         title: i18n.t('screens.websites.rooms'),
225
         subtitle: i18n.t('screens.services.descriptions.availableRooms'),
188
         subtitle: i18n.t('screens.services.descriptions.availableRooms'),
226
-        image: ROOM_IMAGE,
189
+        image: Urls.images.availableRooms,
227
         onPress: (): void =>
190
         onPress: (): void =>
228
           nav.navigate('website', {
191
           nav.navigate('website', {
229
-            host: AvailableWebsites.websites.AVAILABLE_ROOMS,
192
+            host: Urls.websites.availableRooms,
230
             title: i18n.t('screens.websites.rooms'),
193
             title: i18n.t('screens.websites.rooms'),
231
           }),
194
           }),
232
       },
195
       },
234
         key: SERVICES_KEY.BIB,
197
         key: SERVICES_KEY.BIB,
235
         title: i18n.t('screens.websites.bib'),
198
         title: i18n.t('screens.websites.bib'),
236
         subtitle: i18n.t('screens.services.descriptions.bib'),
199
         subtitle: i18n.t('screens.services.descriptions.bib'),
237
-        image: BIB_IMAGE,
200
+        image: Urls.images.bib,
238
         onPress: (): void =>
201
         onPress: (): void =>
239
           nav.navigate('website', {
202
           nav.navigate('website', {
240
-            host: AvailableWebsites.websites.BIB,
203
+            host: Urls.websites.bib,
241
             title: i18n.t('screens.websites.bib'),
204
             title: i18n.t('screens.websites.bib'),
242
           }),
205
           }),
243
       },
206
       },
245
         key: SERVICES_KEY.EMAIL,
208
         key: SERVICES_KEY.EMAIL,
246
         title: i18n.t('screens.websites.mails'),
209
         title: i18n.t('screens.websites.mails'),
247
         subtitle: i18n.t('screens.services.descriptions.mails'),
210
         subtitle: i18n.t('screens.services.descriptions.mails'),
248
-        image: EMAIL_IMAGE,
211
+        image: Urls.images.bluemind,
249
         onPress: (): void =>
212
         onPress: (): void =>
250
           nav.navigate('website', {
213
           nav.navigate('website', {
251
-            host: AvailableWebsites.websites.BLUEMIND,
214
+            host: Urls.websites.bluemind,
252
             title: i18n.t('screens.websites.mails'),
215
             title: i18n.t('screens.websites.mails'),
253
           }),
216
           }),
254
       },
217
       },
256
         key: SERVICES_KEY.ENT,
219
         key: SERVICES_KEY.ENT,
257
         title: i18n.t('screens.websites.ent'),
220
         title: i18n.t('screens.websites.ent'),
258
         subtitle: i18n.t('screens.services.descriptions.ent'),
221
         subtitle: i18n.t('screens.services.descriptions.ent'),
259
-        image: ENT_IMAGE,
222
+        image: Urls.images.ent,
260
         onPress: (): void =>
223
         onPress: (): void =>
261
           nav.navigate('website', {
224
           nav.navigate('website', {
262
-            host: AvailableWebsites.websites.ENT,
225
+            host: Urls.websites.ent,
263
             title: i18n.t('screens.websites.ent'),
226
             title: i18n.t('screens.websites.ent'),
264
           }),
227
           }),
265
       },
228
       },
267
         key: SERVICES_KEY.INSA_ACCOUNT,
230
         key: SERVICES_KEY.INSA_ACCOUNT,
268
         title: i18n.t('screens.insaAccount.title'),
231
         title: i18n.t('screens.insaAccount.title'),
269
         subtitle: i18n.t('screens.services.descriptions.insaAccount'),
232
         subtitle: i18n.t('screens.services.descriptions.insaAccount'),
270
-        image: ACCOUNT_IMAGE,
233
+        image: Urls.images.insaAccount,
271
         onPress: (): void =>
234
         onPress: (): void =>
272
           nav.navigate('website', {
235
           nav.navigate('website', {
273
-            host: AvailableWebsites.websites.INSA_ACCOUNT,
236
+            host: Urls.websites.insaAccount,
274
             title: i18n.t('screens.insaAccount.title'),
237
             title: i18n.t('screens.insaAccount.title'),
275
           }),
238
           }),
276
       },
239
       },
280
         key: SERVICES_KEY.WASHERS,
243
         key: SERVICES_KEY.WASHERS,
281
         title: i18n.t('screens.proxiwash.washers'),
244
         title: i18n.t('screens.proxiwash.washers'),
282
         subtitle: i18n.t('screens.services.descriptions.washers'),
245
         subtitle: i18n.t('screens.services.descriptions.washers'),
283
-        image: WASHER_IMAGE,
246
+        image: Urls.images.washer,
284
         onPress: (): void => nav.navigate('proxiwash'),
247
         onPress: (): void => nav.navigate('proxiwash'),
285
         badgeFunction: (dashboard: FullDashboardType): number =>
248
         badgeFunction: (dashboard: FullDashboardType): number =>
286
           dashboard.available_washers,
249
           dashboard.available_washers,
289
         key: SERVICES_KEY.DRYERS,
252
         key: SERVICES_KEY.DRYERS,
290
         title: i18n.t('screens.proxiwash.dryers'),
253
         title: i18n.t('screens.proxiwash.dryers'),
291
         subtitle: i18n.t('screens.services.descriptions.washers'),
254
         subtitle: i18n.t('screens.services.descriptions.washers'),
292
-        image: DRYER_IMAGE,
255
+        image: Urls.images.dryer,
293
         onPress: (): void => nav.navigate('proxiwash'),
256
         onPress: (): void => nav.navigate('proxiwash'),
294
         badgeFunction: (dashboard: FullDashboardType): number =>
257
         badgeFunction: (dashboard: FullDashboardType): number =>
295
           dashboard.available_dryers,
258
           dashboard.available_dryers,

+ 8
- 18
src/screens/About/AboutScreen.tsx View File

34
 import OptionsDialog from '../../components/Dialogs/OptionsDialog';
34
 import OptionsDialog from '../../components/Dialogs/OptionsDialog';
35
 import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
35
 import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
36
 import GENERAL_STYLES from '../../constants/Styles';
36
 import GENERAL_STYLES from '../../constants/Styles';
37
+import Urls from '../../constants/Urls';
37
 
38
 
38
 const APP_LOGO = require('../../../assets/android.icon.round.png');
39
 const APP_LOGO = require('../../../assets/android.icon.round.png');
39
 
40
 
53
   mail?: string;
54
   mail?: string;
54
 };
55
 };
55
 
56
 
56
-const links = {
57
-  appstore: 'https://apps.apple.com/us/app/campus-amicale-insat/id1477722148',
58
-  playstore:
59
-    'https://play.google.com/store/apps/details?id=fr.amicaleinsat.application',
60
-  git:
61
-    'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/README.md',
62
-  changelog:
63
-    'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/Changelog.md',
64
-  license:
65
-    'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/LICENSE',
66
-  react: 'https://facebook.github.io/react-native/',
67
-};
68
-
69
 type PropsType = {
57
 type PropsType = {
70
   navigation: StackNavigationProp<any>;
58
   navigation: StackNavigationProp<any>;
71
 };
59
 };
177
   appData: Array<ListItemType> = [
165
   appData: Array<ListItemType> = [
178
     {
166
     {
179
       onPressCallback: () => {
167
       onPressCallback: () => {
180
-        openWebLink(Platform.OS === 'ios' ? links.appstore : links.playstore);
168
+        openWebLink(
169
+          Platform.OS === 'ios' ? Urls.about.appstore : Urls.about.playstore
170
+        );
181
       },
171
       },
182
       icon: Platform.OS === 'ios' ? 'apple' : 'google-play',
172
       icon: Platform.OS === 'ios' ? 'apple' : 'google-play',
183
       text:
173
       text:
197
     },
187
     },
198
     {
188
     {
199
       onPressCallback: () => {
189
       onPressCallback: () => {
200
-        openWebLink(links.git);
190
+        openWebLink(Urls.about.git);
201
       },
191
       },
202
       icon: 'git',
192
       icon: 'git',
203
       text: 'Git',
193
       text: 'Git',
205
     },
195
     },
206
     {
196
     {
207
       onPressCallback: () => {
197
       onPressCallback: () => {
208
-        openWebLink(links.changelog);
198
+        openWebLink(Urls.about.changelog);
209
       },
199
       },
210
       icon: 'refresh',
200
       icon: 'refresh',
211
       text: i18n.t('screens.about.changelog'),
201
       text: i18n.t('screens.about.changelog'),
213
     },
203
     },
214
     {
204
     {
215
       onPressCallback: () => {
205
       onPressCallback: () => {
216
-        openWebLink(links.license);
206
+        openWebLink(Urls.about.license);
217
       },
207
       },
218
       icon: 'file-document',
208
       icon: 'file-document',
219
       text: i18n.t('screens.about.license'),
209
       text: i18n.t('screens.about.license'),
237
   technoData = [
227
   technoData = [
238
     {
228
     {
239
       onPressCallback: () => {
229
       onPressCallback: () => {
240
-        openWebLink(links.react);
230
+        openWebLink(Urls.about.react);
241
       },
231
       },
242
       icon: 'react',
232
       icon: 'react',
243
       text: i18n.t('screens.about.reactNative'),
233
       text: i18n.t('screens.about.reactNative'),

+ 3
- 5
src/screens/Amicale/LoginScreen.tsx View File

32
 import ConnectionManager from '../../managers/ConnectionManager';
32
 import ConnectionManager from '../../managers/ConnectionManager';
33
 import ErrorDialog from '../../components/Dialogs/ErrorDialog';
33
 import ErrorDialog from '../../components/Dialogs/ErrorDialog';
34
 import AsyncStorageManager from '../../managers/AsyncStorageManager';
34
 import AsyncStorageManager from '../../managers/AsyncStorageManager';
35
-import AvailableWebsites from '../../constants/AvailableWebsites';
36
 import { MASCOT_STYLE } from '../../components/Mascot/Mascot';
35
 import { MASCOT_STYLE } from '../../components/Mascot/Mascot';
37
 import MascotPopup from '../../components/Mascot/MascotPopup';
36
 import MascotPopup from '../../components/Mascot/MascotPopup';
38
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
37
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
39
 import { MainStackParamsList } from '../../navigation/MainNavigator';
38
 import { MainStackParamsList } from '../../navigation/MainNavigator';
40
 import GENERAL_STYLES from '../../constants/Styles';
39
 import GENERAL_STYLES from '../../constants/Styles';
40
+import Urls from '../../constants/Urls';
41
 
41
 
42
 type LoginScreenNavigationProp = StackScreenProps<MainStackParamsList, 'login'>;
42
 type LoginScreenNavigationProp = StackScreenProps<MainStackParamsList, 'login'>;
43
 
43
 
59
 
59
 
60
 const ICON_AMICALE = require('../../../assets/amicale.png');
60
 const ICON_AMICALE = require('../../../assets/amicale.png');
61
 
61
 
62
-const RESET_PASSWORD_PATH = 'https://www.amicale-insat.fr/password/reset';
63
-
64
 const emailRegex = /^.+@.+\..+$/;
62
 const emailRegex = /^.+@.+\..+$/;
65
 
63
 
66
 const styles = StyleSheet.create({
64
 const styles = StyleSheet.create({
134
   onResetPasswordClick = () => {
132
   onResetPasswordClick = () => {
135
     const { navigation } = this.props;
133
     const { navigation } = this.props;
136
     navigation.navigate('website', {
134
     navigation.navigate('website', {
137
-      host: AvailableWebsites.websites.AMICALE,
138
-      path: RESET_PASSWORD_PATH,
135
+      host: Urls.websites.amicale,
136
+      path: Urls.amicale.resetPassword,
139
       title: i18n.t('screens.websites.amicale'),
137
       title: i18n.t('screens.websites.amicale'),
140
     });
138
     });
141
   };
139
   };

+ 2
- 2
src/screens/Amicale/ProfileScreen.tsx View File

36
   Item,
36
   Item,
37
 } from '../../components/Overrides/CustomHeaderButton';
37
 } from '../../components/Overrides/CustomHeaderButton';
38
 import CardList from '../../components/Lists/CardList/CardList';
38
 import CardList from '../../components/Lists/CardList/CardList';
39
-import AvailableWebsites from '../../constants/AvailableWebsites';
40
 import Mascot, { MASCOT_STYLE } from '../../components/Mascot/Mascot';
39
 import Mascot, { MASCOT_STYLE } from '../../components/Mascot/Mascot';
41
 import ServicesManager, { SERVICES_KEY } from '../../managers/ServicesManager';
40
 import ServicesManager, { SERVICES_KEY } from '../../managers/ServicesManager';
42
 import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
41
 import CollapsibleFlatList from '../../components/Collapsible/CollapsibleFlatList';
43
 import type { ServiceItemType } from '../../managers/ServicesManager';
42
 import type { ServiceItemType } from '../../managers/ServicesManager';
44
 import GENERAL_STYLES from '../../constants/Styles';
43
 import GENERAL_STYLES from '../../constants/Styles';
44
+import Urls from '../../constants/Urls';
45
 
45
 
46
 type PropsType = {
46
 type PropsType = {
47
   navigation: StackNavigationProp<any>;
47
   navigation: StackNavigationProp<any>;
298
               mode="contained"
298
               mode="contained"
299
               onPress={() => {
299
               onPress={() => {
300
                 navigation.navigate('website', {
300
                 navigation.navigate('website', {
301
-                  host: AvailableWebsites.websites.AMICALE,
301
+                  host: Urls.websites.amicale,
302
                   path: this.data?.link,
302
                   path: this.data?.link,
303
                   title: i18n.t('screens.websites.amicale'),
303
                   title: i18n.t('screens.websites.amicale'),
304
                 });
304
                 });

+ 2
- 4
src/screens/Home/HomeScreen.tsx View File

51
 import { getDisplayEvent, getFutureEvents } from '../../utils/Home';
51
 import { getDisplayEvent, getFutureEvents } from '../../utils/Home';
52
 import type { PlanningEventType } from '../../utils/Planning';
52
 import type { PlanningEventType } from '../../utils/Planning';
53
 import GENERAL_STYLES from '../../constants/Styles';
53
 import GENERAL_STYLES from '../../constants/Styles';
54
-// import DATA from "../dashboard_data.json";
54
+import Urls from '../../constants/Urls';
55
 
55
 
56
-const DATA_URL =
57
-  'https://etud.insa-toulouse.fr/~amicale_app/v2/dashboard/dashboard_data.json';
58
 const FEED_ITEM_HEIGHT = 500;
56
 const FEED_ITEM_HEIGHT = 500;
59
 
57
 
60
 const SECTIONS_ID = ['dashboard', 'news_feed'];
58
 const SECTIONS_ID = ['dashboard', 'news_feed'];
476
             createDataset={this.createDataset}
474
             createDataset={this.createDataset}
477
             autoRefreshTime={REFRESH_TIME}
475
             autoRefreshTime={REFRESH_TIME}
478
             refreshOnFocus
476
             refreshOnFocus
479
-            fetchUrl={DATA_URL}
477
+            fetchUrl={Urls.app.dashboard}
480
             renderItem={this.getRenderItem}
478
             renderItem={this.getRenderItem}
481
             itemHeight={FEED_ITEM_HEIGHT}
479
             itemHeight={FEED_ITEM_HEIGHT}
482
             onScroll={this.onScroll}
480
             onScroll={this.onScroll}

+ 6
- 14
src/screens/Other/FeedbackScreen.tsx View File

22
 import i18n from 'i18n-js';
22
 import i18n from 'i18n-js';
23
 import { Linking, StyleSheet, View } from 'react-native';
23
 import { Linking, StyleSheet, View } from 'react-native';
24
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
24
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
25
-
26
-const links = {
27
-  bugsGit: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/',
28
-  trello: 'https://trello.com/b/RMej49Uq/application-campus-insa',
29
-  facebook: 'https://www.facebook.com/campus.insat',
30
-  feedbackMail: `mailto:app@amicale-insat.fr?subject=[FEEDBACK] Application CAMPUS
31
-&body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
32
-  feedbackDiscord: 'https://discord.gg/W8MeTec',
33
-};
25
+import Urls from '../../constants/Urls';
34
 
26
 
35
 const styles = StyleSheet.create({
27
 const styles = StyleSheet.create({
36
   container: {
28
   container: {
63
             mode="contained"
55
             mode="contained"
64
             style={styles.button}
56
             style={styles.button}
65
             onPress={() => {
57
             onPress={() => {
66
-              Linking.openURL(links.feedbackMail);
58
+              Linking.openURL(Urls.feedback.mail);
67
             }}
59
             }}
68
           >
60
           >
69
             MAIL
61
             MAIL
74
             color="#2e88fe"
66
             color="#2e88fe"
75
             style={styles.button}
67
             style={styles.button}
76
             onPress={() => {
68
             onPress={() => {
77
-              Linking.openURL(links.facebook);
69
+              Linking.openURL(Urls.feedback.facebook);
78
             }}
70
             }}
79
           >
71
           >
80
             Facebook
72
             Facebook
85
             color="#7289da"
77
             color="#7289da"
86
             style={styles.button}
78
             style={styles.button}
87
             onPress={() => {
79
             onPress={() => {
88
-              Linking.openURL(links.feedbackDiscord);
80
+              Linking.openURL(Urls.feedback.discord);
89
             }}
81
             }}
90
           >
82
           >
91
             Discord
83
             Discord
99
             color="#609927"
91
             color="#609927"
100
             style={styles.button}
92
             style={styles.button}
101
             onPress={() => {
93
             onPress={() => {
102
-              Linking.openURL(links.bugsGit);
94
+              Linking.openURL(Urls.feedback.git);
103
             }}
95
             }}
104
           >
96
           >
105
             GITETUD
97
             GITETUD
110
             color="#026AA7"
102
             color="#026AA7"
111
             style={styles.button}
103
             style={styles.button}
112
             onPress={() => {
104
             onPress={() => {
113
-              Linking.openURL(links.trello);
105
+              Linking.openURL(Urls.feedback.trello);
114
             }}
106
             }}
115
           >
107
           >
116
             TRELLO
108
             TRELLO

+ 2
- 2
src/screens/Planning/PlanningScreen.tsx View File

36
 import MascotPopup from '../../components/Mascot/MascotPopup';
36
 import MascotPopup from '../../components/Mascot/MascotPopup';
37
 import AsyncStorageManager from '../../managers/AsyncStorageManager';
37
 import AsyncStorageManager from '../../managers/AsyncStorageManager';
38
 import GENERAL_STYLES from '../../constants/Styles';
38
 import GENERAL_STYLES from '../../constants/Styles';
39
+import Urls from '../../constants/Urls';
39
 
40
 
40
 LocaleConfig.locales.fr = {
41
 LocaleConfig.locales.fr = {
41
   monthNames: [
42
   monthNames: [
88
   calendarShowing: boolean;
89
   calendarShowing: boolean;
89
 };
90
 };
90
 
91
 
91
-const FETCH_URL = 'https://www.amicale-insat.fr/api/event/list';
92
 const AGENDA_MONTH_SPAN = 3;
92
 const AGENDA_MONTH_SPAN = 3;
93
 
93
 
94
 const styles = StyleSheet.create({
94
 const styles = StyleSheet.create({
174
 
174
 
175
     if (canRefresh) {
175
     if (canRefresh) {
176
       this.setState({ refreshing: true });
176
       this.setState({ refreshing: true });
177
-      readData(FETCH_URL)
177
+      readData(Urls.amicale.events)
178
         .then((fetchedData: Array<PlanningEventType>) => {
178
         .then((fetchedData: Array<PlanningEventType>) => {
179
           this.setState({
179
           this.setState({
180
             refreshing: false,
180
             refreshing: false,

+ 3
- 4
src/screens/Proxiwash/ProxiwashAboutScreen.tsx View File

23
 import { Card, Avatar, Paragraph, Title } from 'react-native-paper';
23
 import { Card, Avatar, Paragraph, Title } from 'react-native-paper';
24
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
24
 import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
25
 import ProxiwashConstants from '../../constants/ProxiwashConstants';
25
 import ProxiwashConstants from '../../constants/ProxiwashConstants';
26
-
27
-const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
26
+import Urls from '../../constants/Urls';
28
 
27
 
29
 export type LaundromatType = {
28
 export type LaundromatType = {
30
   id: string;
29
   id: string;
85
  */
84
  */
86
 export default function ProxiwashAboutScreen() {
85
 export default function ProxiwashAboutScreen() {
87
   return (
86
   return (
88
-    <CollapsibleScrollView style={styles.container} hasTab>
87
+    <CollapsibleScrollView style={styles.container} hasTab={true}>
89
       <View style={styles.imageContainer}>
88
       <View style={styles.imageContainer}>
90
-        <Image source={{ uri: LOGO }} style={styles.image} />
89
+        <Image source={{ uri: Urls.images.proxiwash }} style={styles.image} />
91
       </View>
90
       </View>
92
 
91
 
93
       {getCardItem(ProxiwashConstants.washinsa)}
92
       {getCardItem(ProxiwashConstants.washinsa)}

+ 3
- 6
src/screens/Services/Proximo/ProximoAboutScreen.tsx View File

21
 import { Image, StyleSheet, View } from 'react-native';
21
 import { Image, StyleSheet, View } from 'react-native';
22
 import i18n from 'i18n-js';
22
 import i18n from 'i18n-js';
23
 import { Card, Avatar, Paragraph, Text } from 'react-native-paper';
23
 import { Card, Avatar, Paragraph, Text } from 'react-native-paper';
24
-import CustomTabBar, {
25
-  TAB_BAR_HEIGHT,
26
-} from '../../../components/Tabbar/CustomTabBar';
24
+import { TAB_BAR_HEIGHT } from '../../../components/Tabbar/CustomTabBar';
27
 import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
25
 import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
28
-
29
-const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proximo.png';
26
+import Urls from '../../../constants/Urls';
30
 
27
 
31
 const styles = StyleSheet.create({
28
 const styles = StyleSheet.create({
32
   container: {
29
   container: {
57
   return (
54
   return (
58
     <CollapsibleScrollView style={styles.container}>
55
     <CollapsibleScrollView style={styles.container}>
59
       <View style={styles.imageContainer}>
56
       <View style={styles.imageContainer}>
60
-        <Image source={{ uri: LOGO }} style={styles.image} />
57
+        <Image source={{ uri: Urls.images.proximo }} style={styles.image} />
61
       </View>
58
       </View>
62
       <Text>{i18n.t('screens.proximo.description')}</Text>
59
       <Text>{i18n.t('screens.proximo.description')}</Text>
63
       <Card style={styles.card}>
60
       <Card style={styles.card}>

+ 2
- 2
src/screens/Services/Proximo/ProximoMainScreen.tsx View File

27
 } from '../../../components/Overrides/CustomHeaderButton';
27
 } from '../../../components/Overrides/CustomHeaderButton';
28
 import type { SectionListDataType } from '../../../components/Screens/WebSectionList';
28
 import type { SectionListDataType } from '../../../components/Screens/WebSectionList';
29
 import { StyleSheet } from 'react-native';
29
 import { StyleSheet } from 'react-native';
30
+import Urls from '../../../constants/Urls';
30
 
31
 
31
-const DATA_URL = 'https://etud.insa-toulouse.fr/~proximo/data/stock-v2.json';
32
 const LIST_ITEM_HEIGHT = 84;
32
 const LIST_ITEM_HEIGHT = 84;
33
 
33
 
34
 export type ProximoCategoryType = {
34
 export type ProximoCategoryType = {
320
         navigation={navigation}
320
         navigation={navigation}
321
         autoRefreshTime={0}
321
         autoRefreshTime={0}
322
         refreshOnFocus={false}
322
         refreshOnFocus={false}
323
-        fetchUrl={DATA_URL}
323
+        fetchUrl={Urls.proximo}
324
         renderItem={this.getRenderItem}
324
         renderItem={this.getRenderItem}
325
       />
325
       />
326
     );
326
     );

+ 2
- 4
src/screens/Services/SelfMenuScreen.tsx View File

25
 import DateManager from '../../managers/DateManager';
25
 import DateManager from '../../managers/DateManager';
26
 import WebSectionList from '../../components/Screens/WebSectionList';
26
 import WebSectionList from '../../components/Screens/WebSectionList';
27
 import type { SectionListDataType } from '../../components/Screens/WebSectionList';
27
 import type { SectionListDataType } from '../../components/Screens/WebSectionList';
28
-
29
-const DATA_URL =
30
-  'https://etud.insa-toulouse.fr/~amicale_app/menu/menu_data.json';
28
+import Urls from '../../constants/Urls';
31
 
29
 
32
 type PropsType = {
30
 type PropsType = {
33
   navigation: StackNavigationProp<any>;
31
   navigation: StackNavigationProp<any>;
198
         navigation={navigation}
196
         navigation={navigation}
199
         autoRefreshTime={0}
197
         autoRefreshTime={0}
200
         refreshOnFocus={false}
198
         refreshOnFocus={false}
201
-        fetchUrl={DATA_URL}
199
+        fetchUrl={Urls.app.menu}
202
         renderItem={this.getRenderItem}
200
         renderItem={this.getRenderItem}
203
         renderSectionHeader={this.getRenderSectionHeader}
201
         renderSectionHeader={this.getRenderSectionHeader}
204
         stickyHeader
202
         stickyHeader

+ 6
- 6
src/screens/Services/WebsiteScreen.tsx View File

20
 import * as React from 'react';
20
 import * as React from 'react';
21
 import { StackNavigationProp } from '@react-navigation/stack';
21
 import { StackNavigationProp } from '@react-navigation/stack';
22
 import WebViewScreen from '../../components/Screens/WebViewScreen';
22
 import WebViewScreen from '../../components/Screens/WebViewScreen';
23
-import AvailableWebsites from '../../constants/AvailableWebsites';
24
 import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
23
 import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
24
+import Urls from '../../constants/Urls';
25
 
25
 
26
 type Props = {
26
 type Props = {
27
   navigation: StackNavigationProp<any>;
27
   navigation: StackNavigationProp<any>;
42
 
42
 
43
 const BIB_BACK_BUTTON =
43
 const BIB_BACK_BUTTON =
44
   "<div style='width: 100%; display: flex'>" +
44
   "<div style='width: 100%; display: flex'>" +
45
-  `<a style='margin: auto' href='${AvailableWebsites.websites.BIB}'>` +
45
+  `<a style='margin: auto' href='${Urls.websites.bib}'>` +
46
   "<button id='customBackButton' class='btn btn-primary'>Retour</button>" +
46
   "<button id='customBackButton' class='btn btn-primary'>Retour</button>" +
47
   '</a>' +
47
   '</a>' +
48
   '</div>';
48
   '</div>';
63
     props.navigation.addListener('focus', this.onScreenFocus);
63
     props.navigation.addListener('focus', this.onScreenFocus);
64
     this.injectedJS = {};
64
     this.injectedJS = {};
65
     this.customPaddingFunctions = {};
65
     this.customPaddingFunctions = {};
66
-    this.injectedJS[AvailableWebsites.websites.AVAILABLE_ROOMS] =
66
+    this.injectedJS[Urls.websites.availableRooms] =
67
       `document.querySelector('head').innerHTML += '${ENABLE_MOBILE_STRING}';` +
67
       `document.querySelector('head').innerHTML += '${ENABLE_MOBILE_STRING}';` +
68
       `document.querySelector('head').innerHTML += '${AVAILABLE_ROOMS_STYLE}'; true;`;
68
       `document.querySelector('head').innerHTML += '${AVAILABLE_ROOMS_STYLE}'; true;`;
69
 
69
 
70
-    this.injectedJS[AvailableWebsites.websites.BIB] =
70
+    this.injectedJS[Urls.websites.bib] =
71
       `document.querySelector('head').innerHTML += '${ENABLE_MOBILE_STRING}';` +
71
       `document.querySelector('head').innerHTML += '${ENABLE_MOBILE_STRING}';` +
72
       `document.querySelector('head').innerHTML += '${BIB_STYLE}';` +
72
       `document.querySelector('head').innerHTML += '${BIB_STYLE}';` +
73
       'if ($(".hero-unit-form").length > 0 && $("#customBackButton").length === 0)' +
73
       'if ($(".hero-unit-form").length > 0 && $("#customBackButton").length === 0)' +
74
       `$(".hero-unit-form").append("${BIB_BACK_BUTTON}");true;`;
74
       `$(".hero-unit-form").append("${BIB_BACK_BUTTON}");true;`;
75
 
75
 
76
-    this.customPaddingFunctions[AvailableWebsites.websites.BLUEMIND] = (
76
+    this.customPaddingFunctions[Urls.websites.bluemind] = (
77
       padding: number
77
       padding: number
78
     ): string => {
78
     ): string => {
79
       return (
79
       return (
82
         "$('#mailview-bottom').css('min-height', 500);"
82
         "$('#mailview-bottom').css('min-height', 500);"
83
       );
83
       );
84
     };
84
     };
85
-    this.customPaddingFunctions[AvailableWebsites.websites.WIKETUD] = (
85
+    this.customPaddingFunctions[Urls.websites.wiketud] = (
86
       padding: number
86
       padding: number
87
     ): string => {
87
     ): string => {
88
       return (
88
       return (

+ 3
- 3
src/utils/WebData.ts View File

17
  * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
17
  * along with Campus INSAT.  If not, see <https://www.gnu.org/licenses/>.
18
  */
18
  */
19
 
19
 
20
+import Urls from '../constants/Urls';
21
+
20
 export const ERROR_TYPE = {
22
 export const ERROR_TYPE = {
21
   SUCCESS: 0,
23
   SUCCESS: 0,
22
   BAD_CREDENTIALS: 1,
24
   BAD_CREDENTIALS: 1,
40
   data: T;
42
   data: T;
41
 };
43
 };
42
 
44
 
43
-const API_ENDPOINT = 'https://www.amicale-insat.fr/api/';
44
-
45
 /**
45
 /**
46
  * Checks if the given API response is valid.
46
  * Checks if the given API response is valid.
47
  *
47
  *
81
       if (params != null) {
81
       if (params != null) {
82
         requestParams = { ...params };
82
         requestParams = { ...params };
83
       }
83
       }
84
-      fetch(API_ENDPOINT + path, {
84
+      fetch(Urls.amicale.api + path, {
85
         method,
85
         method,
86
         headers: new Headers({
86
         headers: new Headers({
87
           'Accept': 'application/json',
87
           'Accept': 'application/json',

Loading…
Cancel
Save