forked from vergnet/application-amicale
Merge branch 'bare' of https://git.etud.insa-toulouse.fr/vergnet/application-amicale into bare
This commit is contained in:
commit
a56d2978e1
10 changed files with 83 additions and 21 deletions
2
App.js
2
App.js
|
@ -17,6 +17,7 @@ import ConnectionManager from "./src/managers/ConnectionManager";
|
|||
import URLHandler from "./src/utils/URLHandler";
|
||||
import {setSafeBounceHeight} from "react-navigation-collapsible";
|
||||
import {enableScreens} from 'react-native-screens';
|
||||
import SplashScreen from 'react-native-splash-screen'
|
||||
|
||||
// Native optimizations https://reactnavigation.org/docs/react-native-screens
|
||||
enableScreens(true);
|
||||
|
@ -175,6 +176,7 @@ export default class App extends React.Component<Props, State> {
|
|||
showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
|
||||
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
|
||||
});
|
||||
SplashScreen.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package fr.amicaleinsat.application;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.facebook.react.ReactActivity;
|
||||
import com.facebook.react.ReactActivityDelegate;
|
||||
import com.facebook.react.ReactRootView;
|
||||
|
@ -7,6 +8,8 @@ import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
|
|||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
|
||||
import org.devio.rn.splashscreen.SplashScreen;
|
||||
|
||||
public class MainActivity extends ReactActivity {
|
||||
|
||||
// Added automatically by Expo Config
|
||||
|
@ -18,6 +21,11 @@ public class MainActivity extends ReactActivity {
|
|||
sendBroadcast(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
SplashScreen.show(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the main component registered from JavaScript.
|
||||
|
|
|
@ -21,7 +21,6 @@ public class BasePackageList {
|
|||
new expo.modules.permissions.PermissionsPackage(),
|
||||
new expo.modules.securestore.SecureStorePackage(),
|
||||
new expo.modules.sqlite.SQLitePackage(),
|
||||
new expo.modules.updates.UpdatesPackage(),
|
||||
new expo.modules.webbrowser.WebBrowserPackage()
|
||||
);
|
||||
}
|
||||
|
|
BIN
android/app/src/main/res/drawable-xxhdpi/launch_screen.png
Normal file
BIN
android/app/src/main/res/drawable-xxhdpi/launch_screen.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 KiB |
12
android/app/src/main/res/layout/launch_screen.xml
Normal file
12
android/app/src/main/res/layout/launch_screen.xml
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorPrimary"
|
||||
android:scaleType="fitCenter"
|
||||
android:src="@drawable/launch_screen" />
|
||||
</RelativeLayout>
|
|
@ -4,4 +4,5 @@
|
|||
<color name="navigationBarColor">#121212</color>
|
||||
<color name="colorPrimaryDark">#be1522</color>
|
||||
<color name="colorPrimary">#be1522</color>
|
||||
<color name="primary_dark">#be1522</color>
|
||||
</resources>
|
|
@ -14,10 +14,20 @@
|
|||
#import <UMReactNativeAdapter/UMNativeModulesProxy.h>
|
||||
#import <UMReactNativeAdapter/UMModuleRegistryAdapter.h>
|
||||
|
||||
#import <React/RCTLinkingManager.h>
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
@synthesize window = _window;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application
|
||||
openURL:(NSURL *)url
|
||||
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
|
||||
{
|
||||
return [RCTLinkingManager application:application openURL:url options:options];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
||||
{
|
||||
self.moduleRegistryAdapter = [[UMModuleRegistryAdapter alloc] initWithModuleRegistryProvider:[[UMModuleRegistryProvider alloc] init]];
|
||||
|
|
|
@ -43,4 +43,5 @@ target 'Campus' do
|
|||
|
||||
# react-native-cli autolinking
|
||||
use_native_modules!
|
||||
|
||||
end
|
||||
|
|
19
package.json
19
package.json
|
@ -18,21 +18,13 @@
|
|||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"expo": "^37.0.0",
|
||||
"react": "~16.9.0",
|
||||
"react-dom": "16.9.0",
|
||||
"react-native": "~0.61.5",
|
||||
"react-native-gesture-handler": "~1.6.0",
|
||||
"react-native-reanimated": "~1.7.0",
|
||||
"react-native-screens": "~2.2.0",
|
||||
"react-native-unimodules": "~0.9.0",
|
||||
"react-native-web": "~0.11.7",
|
||||
"@expo/vector-icons": "^10.0.0",
|
||||
"@react-native-community/masked-view": "0.1.6",
|
||||
"@react-navigation/bottom-tabs": "^5.1.1",
|
||||
"@react-navigation/drawer": "^5.1.1",
|
||||
"@react-navigation/native": "^5.0.9",
|
||||
"@react-navigation/stack": "^5.1.1",
|
||||
"expo": "^37.0.0",
|
||||
"expo-barcode-scanner": "~8.1.0",
|
||||
"expo-camera": "latest",
|
||||
"expo-linear-gradient": "~8.1.0",
|
||||
|
@ -40,17 +32,26 @@
|
|||
"expo-permissions": "~8.1.0",
|
||||
"expo-secure-store": "~8.1.0",
|
||||
"i18n-js": "^3.3.0",
|
||||
"react": "~16.9.0",
|
||||
"react-dom": "16.9.0",
|
||||
"react-native": "~0.61.5",
|
||||
"react-native-animatable": "^1.3.3",
|
||||
"react-native-app-intro-slider": "^4.0.0",
|
||||
"react-native-appearance": "~0.3.3",
|
||||
"react-native-autolink": "^3.0.0",
|
||||
"react-native-calendars": "^1.260.0",
|
||||
"react-native-collapsible": "^1.5.2",
|
||||
"react-native-gesture-handler": "~1.6.0",
|
||||
"react-native-image-modal": "^1.0.6",
|
||||
"react-native-modalize": "^1.3.6",
|
||||
"react-native-paper": "^3.8.0",
|
||||
"react-native-reanimated": "~1.7.0",
|
||||
"react-native-render-html": "^4.1.2",
|
||||
"react-native-safe-area-context": "0.7.3",
|
||||
"react-native-screens": "~2.2.0",
|
||||
"react-native-splash-screen": "^3.2.0",
|
||||
"react-native-unimodules": "~0.9.0",
|
||||
"react-native-web": "~0.11.7",
|
||||
"react-native-webview": "8.1.1",
|
||||
"react-navigation-collapsible": "^5.5.0",
|
||||
"react-navigation-header-buttons": "^3.0.5"
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
// @flow
|
||||
|
||||
import {Linking} from 'expo';
|
||||
import {Linking} from 'react-native';
|
||||
|
||||
export default class URLHandler {
|
||||
|
||||
static SCHEME = "campus-insat://";
|
||||
|
||||
static CLUB_INFO_URL_PATH = "club";
|
||||
static EVENT_INFO_URL_PATH = "event";
|
||||
|
||||
|
@ -20,21 +22,47 @@ export default class URLHandler {
|
|||
|
||||
listen() {
|
||||
Linking.addEventListener('url', this.onUrl);
|
||||
Linking.parseInitialURLAsync().then(this.onInitialUrl);
|
||||
Linking.getInitialURL().then(this.onInitialUrl);
|
||||
}
|
||||
|
||||
onUrl = ({url}: Object) => {
|
||||
let data = URLHandler.getUrlData(Linking.parse(url));
|
||||
onUrl = ({url}: { url: string }) => {
|
||||
if (url != null) {
|
||||
let data = URLHandler.getUrlData(URLHandler.parseUrl(url));
|
||||
if (data !== null)
|
||||
this.onDetectURL(data);
|
||||
}
|
||||
};
|
||||
|
||||
onInitialUrl = ({path, queryParams}: Object) => {
|
||||
let data = URLHandler.getUrlData({path, queryParams});
|
||||
onInitialUrl = (url: ?string) => {
|
||||
if (url != null) {
|
||||
let data = URLHandler.getUrlData(URLHandler.parseUrl(url));
|
||||
if (data !== null)
|
||||
this.onInitialURLParsed(data);
|
||||
}
|
||||
};
|
||||
|
||||
static parseUrl(url: string) {
|
||||
let params = {};
|
||||
let path = "";
|
||||
let temp = url.replace(URLHandler.SCHEME, "");
|
||||
if (temp != null) {
|
||||
let array = temp.split("?");
|
||||
if (array != null && array.length > 0) {
|
||||
path = array[0];
|
||||
}
|
||||
if (array != null && array.length > 1) {
|
||||
let tempParams = array[1].split("&");
|
||||
for (let i = 0; i < tempParams.length; i++) {
|
||||
let paramsArray = tempParams[i].split("=");
|
||||
if (paramsArray.length > 1) {
|
||||
params[paramsArray[0]] = paramsArray[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {path: path, queryParams: params};
|
||||
}
|
||||
|
||||
static getUrlData({path, queryParams}: Object) {
|
||||
let data = null;
|
||||
if (path !== null) {
|
||||
|
@ -47,7 +75,7 @@ export default class URLHandler {
|
|||
}
|
||||
|
||||
static isUrlValid(url: string) {
|
||||
return this.getUrlData(Linking.parse(url)) !== null;
|
||||
return this.getUrlData(URLHandler.parseUrl(url)) !== null;
|
||||
}
|
||||
|
||||
static isClubInformationLink(path: string) {
|
||||
|
|
Loading…
Reference in a new issue