Browse Source

Fixed planning url link and added loading dialog on link scanned

Arnaud Vergnet 3 years ago
parent
commit
2fc2db39c7

+ 3
- 3
App.js View File

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {Platform, StatusBar, YellowBox} from 'react-native';
4
+import {Platform, StatusBar, View, YellowBox} 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/Overrides/CustomIntroSlider";
@@ -18,10 +18,9 @@ import ConnectionManager from "./src/managers/ConnectionManager";
18 18
 import URLHandler from "./src/utils/URLHandler";
19 19
 import {setSafeBounceHeight} from "react-navigation-collapsible";
20 20
 import {enableScreens} from 'react-native-screens';
21
-import {View} from "react-native-animatable";
22 21
 
23 22
 // Native optimizations https://reactnavigation.org/docs/react-native-screens
24
-enableScreens();
23
+enableScreens(true);
25 24
 
26 25
 
27 26
 YellowBox.ignoreWarnings([ // collapsible headers cause this warning, just ignore as it is not an issue
@@ -72,6 +71,7 @@ export default class App extends React.Component<Props, State> {
72 71
         this.loadAssetsAsync().then(() => {
73 72
             this.onLoadFinished();
74 73
         });
74
+        // console.log(Linking.makeUrl('path/into/app', { hello: 'world', goodbye: 'now' }))
75 75
     }
76 76
 
77 77
     /**

+ 10
- 1
src/components/Dialogs/LoadingConfirmDialog.js View File

@@ -11,6 +11,7 @@ type Props = {
11 11
     title: string,
12 12
     titleLoading: string,
13 13
     message: string,
14
+    startLoading: boolean,
14 15
 }
15 16
 
16 17
 type State = {
@@ -19,8 +20,16 @@ type State = {
19 20
 
20 21
 class LoadingConfirmDialog extends React.PureComponent<Props, State> {
21 22
 
23
+    static defaultProps = {
24
+        title: '',
25
+        message: '',
26
+        onDismiss: () => {},
27
+        onAccept: () => {return Promise.resolve()},
28
+        startLoading: false,
29
+    }
30
+
22 31
     state = {
23
-        loading: false,
32
+        loading: this.props.startLoading,
24 33
     };
25 34
 
26 35
     /**

+ 16
- 1
src/screens/Home/ScannerScreen.js View File

@@ -10,6 +10,7 @@ import {Linking} from "expo";
10 10
 import AlertDialog from "../../components/Dialogs/AlertDialog";
11 11
 import i18n from 'i18n-js';
12 12
 import CustomTabBar from "../../components/Tabbar/CustomTabBar";
13
+import LoadingConfirmDialog from "../../components/Dialogs/LoadingConfirmDialog";
13 14
 
14 15
 type Props = {};
15 16
 type State = {
@@ -18,6 +19,7 @@ type State = {
18 19
     dialogVisible: boolean,
19 20
     dialogTitle: string,
20 21
     dialogMessage: string,
22
+    loading: boolean,
21 23
 };
22 24
 
23 25
 class ScannerScreen extends React.Component<Props, State> {
@@ -28,6 +30,7 @@ class ScannerScreen extends React.Component<Props, State> {
28 30
         dialogVisible: false,
29 31
         dialogTitle: "",
30 32
         dialogMessage: "",
33
+        loading: false,
31 34
     };
32 35
 
33 36
     constructor() {
@@ -46,7 +49,7 @@ class ScannerScreen extends React.Component<Props, State> {
46 49
         if (!URLHandler.isUrlValid(data))
47 50
             this.showErrorDialog();
48 51
         else {
49
-            this.setState({scanned: true});
52
+            this.showOpeningDialog();
50 53
             Linking.openURL(data);
51 54
         }
52 55
     };
@@ -108,6 +111,13 @@ class ScannerScreen extends React.Component<Props, State> {
108 111
         });
109 112
     };
110 113
 
114
+    showOpeningDialog = () => {
115
+        this.setState({
116
+            loading: true,
117
+            scanned: true,
118
+        });
119
+    };
120
+
111 121
     showErrorDialog() {
112 122
         this.setState({
113 123
             dialogVisible: true,
@@ -166,6 +176,11 @@ class ScannerScreen extends React.Component<Props, State> {
166 176
                     title={this.state.dialogTitle}
167 177
                     message={this.state.dialogMessage}
168 178
                 />
179
+                <LoadingConfirmDialog
180
+                    visible={this.state.loading}
181
+                    titleLoading={i18n.t("general.loading")}
182
+                    startLoading={true}
183
+                />
169 184
             </View>
170 185
         );
171 186
     }

+ 1
- 1
src/utils/URLHandler.js View File

@@ -8,7 +8,7 @@ export default class URLHandler {
8 8
     static EVENT_INFO_URL_PATH = "event";
9 9
 
10 10
     static CLUB_INFO_ROUTE = "club-information";
11
-    static EVENT_INFO_ROUTE = "home-planning-information";
11
+    static EVENT_INFO_ROUTE = "planning-information";
12 12
 
13 13
     onInitialURLParsed: Function;
14 14
     onDetectURL: Function;

Loading…
Cancel
Save