重构应用程序架构,添加 OpenIM SDK 初始化和引导逻辑
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import OpenIMSDK from "@openim/rn-client-sdk";
|
||||
import {
|
||||
DarkTheme,
|
||||
DefaultTheme,
|
||||
@@ -6,11 +5,11 @@ import {
|
||||
} from "@react-navigation/native";
|
||||
import { Stack } from "expo-router";
|
||||
import { StatusBar } from "expo-status-bar";
|
||||
import RNFS from "react-native-fs";
|
||||
import "react-native-reanimated";
|
||||
import "../global.css";
|
||||
|
||||
import { useColorScheme } from "@/hooks/use-color-scheme";
|
||||
import { AppBootstrapProvider } from "@/providers/app-bootstrap-provider";
|
||||
|
||||
export const unstable_settings = {
|
||||
anchor: "(tabs)",
|
||||
@@ -19,27 +18,18 @@ export const unstable_settings = {
|
||||
export default function RootLayout() {
|
||||
const colorScheme = useColorScheme();
|
||||
|
||||
RNFS.mkdir(RNFS.DocumentDirectoryPath + "/tmp");
|
||||
|
||||
OpenIMSDK.initSDK({
|
||||
apiAddr: "https://openim-api.riwsan.com/api",
|
||||
wsAddr: "wss://openim-api.riwsan.com/msg_gateway",
|
||||
dataDir: RNFS.DocumentDirectoryPath + "/tmp",
|
||||
logFilePath: RNFS.DocumentDirectoryPath + "/tmp",
|
||||
logLevel: 5,
|
||||
isLogStandardOutput: true,
|
||||
});
|
||||
|
||||
return (
|
||||
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
|
||||
<Stack>
|
||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||
<Stack.Screen
|
||||
name="modal"
|
||||
options={{ presentation: "modal", title: "Modal" }}
|
||||
/>
|
||||
</Stack>
|
||||
<StatusBar style="auto" />
|
||||
</ThemeProvider>
|
||||
<AppBootstrapProvider>
|
||||
<ThemeProvider value={colorScheme === "dark" ? DarkTheme : DefaultTheme}>
|
||||
<Stack>
|
||||
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
|
||||
<Stack.Screen
|
||||
name="modal"
|
||||
options={{ presentation: "modal", title: "Modal" }}
|
||||
/>
|
||||
</Stack>
|
||||
<StatusBar style="auto" />
|
||||
</ThemeProvider>
|
||||
</AppBootstrapProvider>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user