Arnaud Vergnet 3 years ago
parent
commit
a56d2978e1

+ 2
- 0
App.js View File

17
 import URLHandler from "./src/utils/URLHandler";
17
 import URLHandler from "./src/utils/URLHandler";
18
 import {setSafeBounceHeight} from "react-navigation-collapsible";
18
 import {setSafeBounceHeight} from "react-navigation-collapsible";
19
 import {enableScreens} from 'react-native-screens';
19
 import {enableScreens} from 'react-native-screens';
20
+import SplashScreen from 'react-native-splash-screen'
20
 
21
 
21
 // Native optimizations https://reactnavigation.org/docs/react-native-screens
22
 // Native optimizations https://reactnavigation.org/docs/react-native-screens
22
 enableScreens(true);
23
 enableScreens(true);
175
             showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
176
             showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
176
             showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
177
             showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
177
         });
178
         });
179
+        SplashScreen.hide();
178
     }
180
     }
179
 
181
 
180
     /**
182
     /**

+ 8
- 0
android/app/src/main/java/fr/amicaleinsat/application/MainActivity.java View File

1
 package fr.amicaleinsat.application;
1
 package fr.amicaleinsat.application;
2
 
2
 
3
+import android.os.Bundle;
3
 import com.facebook.react.ReactActivity;
4
 import com.facebook.react.ReactActivity;
4
 import com.facebook.react.ReactActivityDelegate;
5
 import com.facebook.react.ReactActivityDelegate;
5
 import com.facebook.react.ReactRootView;
6
 import com.facebook.react.ReactRootView;
7
 import android.content.Intent;
8
 import android.content.Intent;
8
 import android.content.res.Configuration;
9
 import android.content.res.Configuration;
9
 
10
 
11
+import org.devio.rn.splashscreen.SplashScreen;
12
+
10
 public class MainActivity extends ReactActivity {
13
 public class MainActivity extends ReactActivity {
11
 
14
 
12
     // Added automatically by Expo Config
15
     // Added automatically by Expo Config
18
         sendBroadcast(intent);
21
         sendBroadcast(intent);
19
     }
22
     }
20
 
23
 
24
+   @Override
25
+    protected void onCreate(Bundle savedInstanceState) {
26
+        SplashScreen.show(this);
27
+        super.onCreate(savedInstanceState);
28
+    }
21
 
29
 
22
     /**
30
     /**
23
      * Returns the name of the main component registered from JavaScript.
31
      * Returns the name of the main component registered from JavaScript.

+ 0
- 1
android/app/src/main/java/fr/amicaleinsat/application/generated/BasePackageList.java View File

21
         new expo.modules.permissions.PermissionsPackage(),
21
         new expo.modules.permissions.PermissionsPackage(),
22
         new expo.modules.securestore.SecureStorePackage(),
22
         new expo.modules.securestore.SecureStorePackage(),
23
         new expo.modules.sqlite.SQLitePackage(),
23
         new expo.modules.sqlite.SQLitePackage(),
24
-        new expo.modules.updates.UpdatesPackage(),
25
         new expo.modules.webbrowser.WebBrowserPackage()
24
         new expo.modules.webbrowser.WebBrowserPackage()
26
     );
25
     );
27
   }
26
   }

BIN
android/app/src/main/res/drawable-xxhdpi/launch_screen.png View File


+ 12
- 0
android/app/src/main/res/layout/launch_screen.xml View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
+                android:orientation="vertical" android:layout_width="match_parent"
4
+                android:layout_height="match_parent">
5
+
6
+    <ImageView
7
+        android:layout_width="match_parent"
8
+        android:layout_height="match_parent"
9
+        android:background="@color/colorPrimary"
10
+        android:scaleType="fitCenter"
11
+        android:src="@drawable/launch_screen" />
12
+</RelativeLayout>

+ 1
- 0
android/app/src/main/res/values/colors.xml View File

4
   <color name="navigationBarColor">#121212</color>
4
   <color name="navigationBarColor">#121212</color>
5
   <color name="colorPrimaryDark">#be1522</color>
5
   <color name="colorPrimaryDark">#be1522</color>
6
   <color name="colorPrimary">#be1522</color>
6
   <color name="colorPrimary">#be1522</color>
7
+  <color name="primary_dark">#be1522</color>
7
 </resources>
8
 </resources>

+ 10
- 0
ios/Campus/AppDelegate.m View File

14
 #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
14
 #import <UMReactNativeAdapter/UMNativeModulesProxy.h>
15
 #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
15
 #import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
16
 
16
 
17
+#import <React/RCTLinkingManager.h>
18
+
17
 @implementation AppDelegate
19
 @implementation AppDelegate
18
 
20
 
19
 @synthesize window = _window;
21
 @synthesize window = _window;
20
 
22
 
23
+- (BOOL)application:(UIApplication *)application
24
+   openURL:(NSURL *)url
25
+   options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
26
+{
27
+  return [RCTLinkingManager application:application openURL:url options:options];
28
+}
29
+
30
+
21
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
31
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
22
 {
32
 {
23
   self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
33
   self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];

+ 1
- 0
ios/Podfile View File

43
 
43
 
44
   # react-native-cli autolinking
44
   # react-native-cli autolinking
45
   use_native_modules!
45
   use_native_modules!
46
+
46
 end
47
 end

+ 10
- 9
package.json View File

18
     ]
18
     ]
19
   },
19
   },
20
   "dependencies": {
20
   "dependencies": {
21
-    "expo": "^37.0.0",
22
-    "react": "~16.9.0",
23
-    "react-dom": "16.9.0",
24
-    "react-native": "~0.61.5",
25
-    "react-native-gesture-handler": "~1.6.0",
26
-    "react-native-reanimated": "~1.7.0",
27
-    "react-native-screens": "~2.2.0",
28
-    "react-native-unimodules": "~0.9.0",
29
-    "react-native-web": "~0.11.7",
30
     "@expo/vector-icons": "^10.0.0",
21
     "@expo/vector-icons": "^10.0.0",
31
     "@react-native-community/masked-view": "0.1.6",
22
     "@react-native-community/masked-view": "0.1.6",
32
     "@react-navigation/bottom-tabs": "^5.1.1",
23
     "@react-navigation/bottom-tabs": "^5.1.1",
33
     "@react-navigation/drawer": "^5.1.1",
24
     "@react-navigation/drawer": "^5.1.1",
34
     "@react-navigation/native": "^5.0.9",
25
     "@react-navigation/native": "^5.0.9",
35
     "@react-navigation/stack": "^5.1.1",
26
     "@react-navigation/stack": "^5.1.1",
27
+    "expo": "^37.0.0",
36
     "expo-barcode-scanner": "~8.1.0",
28
     "expo-barcode-scanner": "~8.1.0",
37
     "expo-camera": "latest",
29
     "expo-camera": "latest",
38
     "expo-linear-gradient": "~8.1.0",
30
     "expo-linear-gradient": "~8.1.0",
40
     "expo-permissions": "~8.1.0",
32
     "expo-permissions": "~8.1.0",
41
     "expo-secure-store": "~8.1.0",
33
     "expo-secure-store": "~8.1.0",
42
     "i18n-js": "^3.3.0",
34
     "i18n-js": "^3.3.0",
35
+    "react": "~16.9.0",
36
+    "react-dom": "16.9.0",
37
+    "react-native": "~0.61.5",
43
     "react-native-animatable": "^1.3.3",
38
     "react-native-animatable": "^1.3.3",
44
     "react-native-app-intro-slider": "^4.0.0",
39
     "react-native-app-intro-slider": "^4.0.0",
45
     "react-native-appearance": "~0.3.3",
40
     "react-native-appearance": "~0.3.3",
46
     "react-native-autolink": "^3.0.0",
41
     "react-native-autolink": "^3.0.0",
47
     "react-native-calendars": "^1.260.0",
42
     "react-native-calendars": "^1.260.0",
48
     "react-native-collapsible": "^1.5.2",
43
     "react-native-collapsible": "^1.5.2",
44
+    "react-native-gesture-handler": "~1.6.0",
49
     "react-native-image-modal": "^1.0.6",
45
     "react-native-image-modal": "^1.0.6",
50
     "react-native-modalize": "^1.3.6",
46
     "react-native-modalize": "^1.3.6",
51
     "react-native-paper": "^3.8.0",
47
     "react-native-paper": "^3.8.0",
48
+    "react-native-reanimated": "~1.7.0",
52
     "react-native-render-html": "^4.1.2",
49
     "react-native-render-html": "^4.1.2",
53
     "react-native-safe-area-context": "0.7.3",
50
     "react-native-safe-area-context": "0.7.3",
51
+    "react-native-screens": "~2.2.0",
52
+    "react-native-splash-screen": "^3.2.0",
53
+    "react-native-unimodules": "~0.9.0",
54
+    "react-native-web": "~0.11.7",
54
     "react-native-webview": "8.1.1",
55
     "react-native-webview": "8.1.1",
55
     "react-navigation-collapsible": "^5.5.0",
56
     "react-navigation-collapsible": "^5.5.0",
56
     "react-navigation-header-buttons": "^3.0.5"
57
     "react-navigation-header-buttons": "^3.0.5"

+ 39
- 11
src/utils/URLHandler.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
-import {Linking} from 'expo';
3
+import {Linking} from 'react-native';
4
 
4
 
5
 export default class URLHandler {
5
 export default class URLHandler {
6
 
6
 
7
+    static SCHEME = "campus-insat://";
8
+
7
     static CLUB_INFO_URL_PATH = "club";
9
     static CLUB_INFO_URL_PATH = "club";
8
     static EVENT_INFO_URL_PATH = "event";
10
     static EVENT_INFO_URL_PATH = "event";
9
 
11
 
20
 
22
 
21
     listen() {
23
     listen() {
22
         Linking.addEventListener('url', this.onUrl);
24
         Linking.addEventListener('url', this.onUrl);
23
-        Linking.parseInitialURLAsync().then(this.onInitialUrl);
25
+        Linking.getInitialURL().then(this.onInitialUrl);
24
     }
26
     }
25
 
27
 
26
-    onUrl = ({url}: Object) => {
27
-        let data = URLHandler.getUrlData(Linking.parse(url));
28
-        if (data !== null)
29
-            this.onDetectURL(data);
28
+    onUrl = ({url}: { url: string }) => {
29
+        if (url != null) {
30
+            let data = URLHandler.getUrlData(URLHandler.parseUrl(url));
31
+            if (data !== null)
32
+                this.onDetectURL(data);
33
+        }
30
     };
34
     };
31
 
35
 
32
-    onInitialUrl = ({path, queryParams}: Object) => {
33
-        let data = URLHandler.getUrlData({path, queryParams});
34
-        if (data !== null)
35
-            this.onInitialURLParsed(data);
36
+    onInitialUrl = (url: ?string) => {
37
+        if (url != null) {
38
+            let data = URLHandler.getUrlData(URLHandler.parseUrl(url));
39
+            if (data !== null)
40
+                this.onInitialURLParsed(data);
41
+        }
36
     };
42
     };
37
 
43
 
44
+    static parseUrl(url: string) {
45
+        let params = {};
46
+        let path = "";
47
+        let temp = url.replace(URLHandler.SCHEME, "");
48
+        if (temp != null) {
49
+            let array = temp.split("?");
50
+            if (array != null && array.length > 0) {
51
+                path = array[0];
52
+            }
53
+            if (array != null && array.length > 1) {
54
+                let tempParams = array[1].split("&");
55
+                for (let i = 0; i < tempParams.length; i++) {
56
+                    let paramsArray = tempParams[i].split("=");
57
+                    if (paramsArray.length > 1) {
58
+                        params[paramsArray[0]] = paramsArray[1];
59
+                    }
60
+                }
61
+            }
62
+        }
63
+        return {path: path, queryParams: params};
64
+    }
65
+
38
     static getUrlData({path, queryParams}: Object) {
66
     static getUrlData({path, queryParams}: Object) {
39
         let data = null;
67
         let data = null;
40
         if (path !== null) {
68
         if (path !== null) {
47
     }
75
     }
48
 
76
 
49
     static isUrlValid(url: string) {
77
     static isUrlValid(url: string) {
50
-        return this.getUrlData(Linking.parse(url)) !== null;
78
+        return this.getUrlData(URLHandler.parseUrl(url)) !== null;
51
     }
79
     }
52
 
80
 
53
     static isClubInformationLink(path: string) {
81
     static isClubInformationLink(path: string) {

Loading…
Cancel
Save