Browse Source

Replaced bug report modal by a screen

Arnaud Vergnet 3 years ago
parent
commit
9e251ad150

+ 9
- 0
src/navigation/MainNavigator.js View File

@@ -29,6 +29,7 @@ import ClubListScreen from "../screens/Amicale/Clubs/ClubListScreen";
29 29
 import ClubAboutScreen from "../screens/Amicale/Clubs/ClubAboutScreen";
30 30
 import ClubDisplayScreen from "../screens/Amicale/Clubs/ClubDisplayScreen";
31 31
 import {createScreenCollapsibleStack, getWebsiteStack} from "../utils/CollapsibleUtils";
32
+import BugReportScreen from "../screens/Other/FeedbackScreen";
32 33
 
33 34
 const modalTransition = Platform.OS === 'ios' ? TransitionPresets.ModalPresentationIOS : TransitionPresets.ModalSlideFromBottomIOS;
34 35
 
@@ -158,6 +159,14 @@ function MainStackComponent(props: { createTabNavigator: () => React.Node }) {
158 159
                     title: i18n.t('screens.vote'),
159 160
                 }}
160 161
             />
162
+
163
+            <MainStack.Screen
164
+                name="feedback"
165
+                component={BugReportScreen}
166
+                options={{
167
+                    title: i18n.t('screens.feedback'),
168
+                }}
169
+            />
161 170
         </MainStack.Navigator>
162 171
     );
163 172
 }

+ 12
- 97
src/screens/About/AboutScreen.js View File

@@ -5,23 +5,12 @@ import {FlatList, Linking, Platform, View} from 'react-native';
5 5
 import i18n from "i18n-js";
6 6
 import appJson from '../../../app';
7 7
 import AsyncStorageManager from "../../managers/AsyncStorageManager";
8
-import CustomModal from "../../components/Overrides/CustomModal";
9
-import {Avatar, Button, Card, List, Text, Title, withTheme} from 'react-native-paper';
8
+import {Avatar, Card, List, Title, withTheme} from 'react-native-paper';
10 9
 
11 10
 const links = {
12 11
     appstore: 'https://apps.apple.com/us/app/campus-amicale-insat/id1477722148',
13 12
     playstore: 'https://play.google.com/store/apps/details?id=fr.amicaleinsat.application',
14 13
     git: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/README.md',
15
-    bugsMail: 'mailto:vergnet@etud.insa-toulouse.fr?' +
16
-        'subject=' +
17
-        '[BUG] Application Amicale INSA Toulouse' +
18
-        '&body=' +
19
-        'Coucou Arnaud ça bug c\'est nul,\n\n' +
20
-        'Informations sur ton système si tu sais (iOS ou Android, modèle du tel, version):\n\n\n' +
21
-        'Nature du problème :\n\n\n' +
22
-        'Étapes pour reproduire ce pb :\n\n\n\n' +
23
-        'Stp corrige le pb, bien cordialement.',
24
-    bugsGit: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/issues',
25 14
     changelog: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/Changelog.md',
26 15
     license: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/src/branch/master/LICENSE',
27 16
     authorMail: "mailto:vergnet@etud.insa-toulouse.fr?" +
@@ -78,9 +67,9 @@ class AboutScreen extends React.Component<Props, State> {
78 67
             showChevron: true
79 68
         },
80 69
         {
81
-            onPressCallback: () => this.openBugReportModal(),
70
+            onPressCallback: () => this.props.navigation.navigate("feedback"),
82 71
             icon: 'bug',
83
-            text: i18n.t('aboutScreen.bugs'),
72
+            text: i18n.t('screens.feedback'),
84 73
             showChevron: true
85 74
         },
86 75
         {
@@ -193,21 +182,11 @@ class AboutScreen extends React.Component<Props, State> {
193 182
         },
194 183
     ];
195 184
 
196
-    getCardItem: Function;
197
-    getMainCard: Function;
198
-    onModalRef: Function;
199
-    onPressMail: Function;
200
-    onPressGit: Function;
201 185
 
202 186
     colors: Object;
203 187
 
204 188
     constructor(props) {
205 189
         super(props);
206
-        this.getCardItem = this.getCardItem.bind(this);
207
-        this.getMainCard = this.getMainCard.bind(this);
208
-        this.onModalRef = this.onModalRef.bind(this);
209
-        this.onPressMail = openWebLink.bind(this, links.bugsMail);
210
-        this.onPressGit = openWebLink.bind(this, links.bugsGit);
211 190
         this.colors = props.theme.colors;
212 191
     }
213 192
 
@@ -340,7 +319,7 @@ class AboutScreen extends React.Component<Props, State> {
340 319
      *
341 320
      * @returns {*}
342 321
      */
343
-    getCardItem({item}: Object) {
322
+    getCardItem = ({item}: Object) => {
344 323
         let shouldShow = item === undefined
345 324
             || !item.showOnlyInDebug
346 325
             || (item.showOnlyInDebug && this.state.isDebugUnlocked);
@@ -366,7 +345,7 @@ class AboutScreen extends React.Component<Props, State> {
366 345
             }
367 346
         } else
368 347
             return null;
369
-    }
348
+    };
370 349
 
371 350
     /**
372 351
      * Tries to unlock debug mode
@@ -388,62 +367,12 @@ class AboutScreen extends React.Component<Props, State> {
388 367
     }
389 368
 
390 369
     /**
391
-     * Gets the bug report modal's content
392
-     *
393
-     * @return {*}
394
-     */
395
-    getBugReportModal() {
396
-        return (
397
-            <View style={{
398
-                flex: 1,
399
-                padding: 20
400
-            }}>
401
-                <Title>{i18n.t('aboutScreen.bugs')}</Title>
402
-                <Text>
403
-                    {i18n.t('aboutScreen.bugsDescription')}
404
-                </Text>
405
-                <Button
406
-                    icon="email"
407
-                    mode="contained"
408
-                    style={{
409
-                        marginTop: 20,
410
-                        marginLeft: 'auto',
411
-                        marginRight: 'auto',
412
-                    }}
413
-                    onPress={this.onPressMail}>
414
-                    {i18n.t('aboutScreen.bugsMail')}
415
-                </Button>
416
-                <Button
417
-                    icon="git"
418
-                    mode="contained"
419
-                    style={{
420
-                        marginTop: 20,
421
-                        marginLeft: 'auto',
422
-                        marginRight: 'auto',
423
-                    }}
424
-                    onPress={this.onPressGit}>
425
-                    {i18n.t('aboutScreen.bugsGit')}
426
-                </Button>
427
-            </View>
428
-        );
429
-    }
430
-
431
-    /**
432
-     * opens the bug report modal
433
-     */
434
-    openBugReportModal() {
435
-        if (this.modalRef) {
436
-            this.modalRef.open();
437
-        }
438
-    }
439
-
440
-    /**
441 370
      * Gets a card, depending on the given item's id
442 371
      *
443 372
      * @param item The item to show
444 373
      * @return {*}
445 374
      */
446
-    getMainCard({item}: Object) {
375
+    getMainCard = ({item}: Object) => {
447 376
         switch (item.id) {
448 377
             case 'app':
449 378
                 return this.getAppCard();
@@ -453,29 +382,15 @@ class AboutScreen extends React.Component<Props, State> {
453 382
                 return this.getTechnoCard();
454 383
         }
455 384
         return <View/>;
456
-    }
457
-
458
-    /**
459
-     * Callback used when receiving the modal ref
460
-     *
461
-     * @param ref
462
-     */
463
-    onModalRef(ref: Object) {
464
-        this.modalRef = ref;
465
-    }
385
+    };
466 386
 
467 387
     render() {
468 388
         return (
469
-            <View style={{padding: 5}}>
470
-                <CustomModal onRef={this.onModalRef}>
471
-                    {this.getBugReportModal()}
472
-                </CustomModal>
473
-                <FlatList
474
-                    style={{padding: 5}}
475
-                    data={this.dataOrder}
476
-                    renderItem={this.getMainCard}
477
-                />
478
-            </View>
389
+            <FlatList
390
+                style={{padding: 5}}
391
+                data={this.dataOrder}
392
+                renderItem={this.getMainCard}
393
+            />
479 394
         );
480 395
     }
481 396
 }

+ 104
- 0
src/screens/Other/FeedbackScreen.js View File

@@ -0,0 +1,104 @@
1
+// @flow
2
+
3
+import * as React from 'react';
4
+import {Avatar, Button, Card, Paragraph, withTheme} from "react-native-paper";
5
+import i18n from "i18n-js";
6
+import {ScrollView} from "react-native";
7
+import {Linking} from "expo";
8
+import type {CustomTheme} from "../../managers/ThemeManager";
9
+
10
+type Props = {
11
+    theme: CustomTheme
12
+};
13
+
14
+const links = {
15
+    bugsMail: `mailto:vergnet@etud.insa-toulouse.fr
16
+?subject=[BUG] Application CAMPUS
17
+&body=Coucou Arnaud ça bug c'est nul,\n\n
18
+Informations sur ton système si tu sais (iOS ou Android, modèle du tel, version):\n\n\n
19
+Nature du problème :\n\n\n
20
+Étapes pour reproduire ce pb :\n\n\n\n
21
+Stp corrige le pb, bien cordialement.`,
22
+    bugsGit: 'https://git.etud.insa-toulouse.fr/vergnet/application-amicale/issues/new',
23
+    facebook: "https://www.facebook.com/campus.insat",
24
+    feedbackMail: `mailto:vergnet@etud.insa-toulouse.fr
25
+?subject=[FEEDBACK] Application CAMPUS
26
+&body=Coucou Arnaud j'ai du feedback\n\n\n\nBien cordialement.`,
27
+    feedbackGit: "https://git.etud.insa-toulouse.fr/vergnet/application-amicale/issues/new",
28
+}
29
+
30
+class FeedbackScreen extends React.Component<Props> {
31
+
32
+    getButtons(isBug: boolean) {
33
+        return (
34
+            <Card.Actions>
35
+                <Button
36
+                    icon="email"
37
+                    mode="contained"
38
+                    style={{
39
+                        marginLeft: 'auto',
40
+                    }}
41
+                    onPress={() => Linking.openURL(isBug ? links.bugsMail : links.feedbackMail)}>
42
+                    MAIL
43
+                </Button>
44
+                <Button
45
+                    icon="git"
46
+                    mode="contained"
47
+                    style={{
48
+                        marginLeft: 10,
49
+                    }}
50
+                    onPress={() => Linking.openURL(isBug ? links.bugsGit : links.feedbackGit)}>
51
+                    GIT
52
+                </Button>
53
+                <Button
54
+                    icon="facebook"
55
+                    mode="contained"
56
+                    style={{
57
+                        marginLeft: 10,
58
+                    }}
59
+                    onPress={() => Linking.openURL(links.facebook)}>
60
+                    Facebook
61
+                </Button>
62
+            </Card.Actions>
63
+        );
64
+    }
65
+
66
+    render() {
67
+        return (
68
+            <ScrollView style={{padding: 5}}>
69
+                <Card>
70
+                    <Card.Title
71
+                        title={i18n.t('feedbackScreen.bugs')}
72
+                        subtitle={i18n.t('feedbackScreen.bugsSubtitle')}
73
+                        left={(props) => <Avatar.Icon {...props} icon="bug"/>}
74
+                    />
75
+                    <Card.Content>
76
+                        <Paragraph>
77
+                            {i18n.t('feedbackScreen.bugsDescription')}
78
+                        </Paragraph>
79
+                        <Paragraph style={{color: this.props.theme.colors.primary}}>
80
+                            {i18n.t('feedbackScreen.contactMeans')}
81
+                        </Paragraph>
82
+                    </Card.Content>
83
+                    {this.getButtons(true)}
84
+                </Card>
85
+
86
+                <Card style={{marginTop: 20, marginBottom: 10}}>
87
+                    <Card.Title
88
+                        title={i18n.t('feedbackScreen.feedback')}
89
+                        subtitle={i18n.t('feedbackScreen.feedbackSubtitle')}
90
+                        left={(props) => <Avatar.Icon {...props} icon="comment"/>}
91
+                    />
92
+                    <Card.Content>
93
+                        <Paragraph>
94
+                            {i18n.t('feedbackScreen.feedbackDescription')}
95
+                        </Paragraph>
96
+                    </Card.Content>
97
+                    {this.getButtons(false)}
98
+                </Card>
99
+            </ScrollView>
100
+        );
101
+    }
102
+}
103
+
104
+export default withTheme(FeedbackScreen);

+ 11
- 5
translations/en.json View File

@@ -24,7 +24,8 @@
24 24
     "logout": "Logout",
25 25
     "profile": "Profile",
26 26
     "vote": "Elections",
27
-    "scanner": "Scanotron 3000"
27
+    "scanner": "Scanotron 3000",
28
+    "feedback": "Feedback"
28 29
   },
29 30
   "intro": {
30 31
     "slide1": {
@@ -99,10 +100,6 @@
99 100
   "aboutScreen": {
100 101
     "appstore": "See on the Appstore",
101 102
     "playstore": "See on the Playstore",
102
-    "bugs": "Report Bugs",
103
-    "bugsDescription": "Reporting bugs helps us make the app better. Please be as precise as possible when describing your problem!",
104
-    "bugsMail": "Send a Mail",
105
-    "bugsGit": "Open an issue on Git",
106 103
     "changelog": "Changelog",
107 104
     "license": "License",
108 105
     "debug": "Debug",
@@ -389,5 +386,14 @@
389 386
   },
390 387
   "planningScreen": {
391 388
     "invalidEvent": "Could not find the event. Please make sure the event you are trying to access is valid."
389
+  },
390
+  "feedbackScreen": {
391
+    "bugs": "Report Bugs",
392
+    "bugsSubtitle": "Did you find a bug? Let us know!",
393
+    "bugsDescription": "Reporting bugs helps us make the app better. To do so, use one of the buttons below and be as precise as possible when describing your problem!",
394
+    "feedback": "Feedback",
395
+    "feedbackSubtitle": "Let us know what you think!",
396
+    "feedbackDescription": "Do you have a feature you want to be added/changed/removed, want to give your opinion on the app or simply chat with the dev? Use one of the links below!",
397
+    "contactMeans": "Using Git is recommended, to use it simply login with your INSA account."
392 398
   }
393 399
 }

+ 12
- 5
translations/fr.json View File

@@ -24,7 +24,8 @@
24 24
     "logout": "Se Déconnecter",
25 25
     "profile": "Profil",
26 26
     "vote": "Élections",
27
-    "scanner": "Scanotron 3000"
27
+    "scanner": "Scanotron 3000",
28
+    "feedback": "Votre avis"
28 29
   },
29 30
   "intro": {
30 31
     "slide1": {
@@ -99,10 +100,6 @@
99 100
   "aboutScreen": {
100 101
     "appstore": "Voir sur l'Appstore",
101 102
     "playstore": "Voir sur le Playstore",
102
-    "bugs": "Rapporter des Bugs",
103
-    "bugsDescription": "Rapporter les bugs nous aide à améliorer l'appli. Merci de décrire votre problème le plus précisément possible !",
104
-    "bugsMail": "Envoyer un Mail",
105
-    "bugsGit": "Ouvrir un ticket sur Git",
106 103
     "changelog": "Historique des modifications",
107 104
     "license": "Licence",
108 105
     "debug": "Debug",
@@ -389,5 +386,15 @@
389 386
   },
390 387
   "planningScreen": {
391 388
     "invalidEvent": "Impossible de trouver l'événement. Merci de vérifier que l'événement que vous voulez voir est valide."
389
+  },
390
+  "feedbackScreen": {
391
+    "bugs": "Rapporter des Bugs",
392
+    "bugsSubtitle": "Vous avez trouvé un bug ?",
393
+    "bugsDescription": "Rapporter les bugs nous aide à améliorer l'appli. Pour cela, merci d'utiliser un des boutons ci-dessous et de décrire votre problème le plus précisément possible !",
394
+    "feedback": "Feedback",
395
+    "feedbackSubtitle": "Did nous ce que vous pensez!",
396
+    "feedbackDescription": "Vous voulez voir une fonctionnalité ajoutée/modifiée/supprimée ?, vous voulez donner votre opinion sur l'appli ou simplement discuter avec les devs ? Utilisez un des liens ci-dessous !",
397
+    "contactMeans": "L'utilisation de Git est recommandée, pour l'utiliser, connectez vous avec vos identifiants INSA."
398
+
392 399
   }
393 400
 }

Loading…
Cancel
Save