This commit is contained in:
yezian 2023-12-29 00:27:44 +08:00
parent 3ec08ed754
commit 36ac1adfb4
186 changed files with 31426 additions and 0 deletions

3
.env Normal file
View File

@ -0,0 +1,3 @@
EXPO_PUBLIC_API_URL=https://api.tiefen.fun
EXPO_PUBLIC_RSA_KEY=-----BEGIN PUBLIC KEY-----MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAMXPIjKV6CMi5O9tIXJWNIfnqXjqOZ1KmRByRAP073DU+gzMLygzEsrztJzbz/K/Julkz6XhheZ8vdz+boAl1HsCAwEAAQ==-----END PUBLIC KEY-----
EXPO_PUBLIC_WEB_URL=https://tiefen.fun

4
.expo-shared/assets.json Normal file
View File

@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
test.jsx
example.jsx
# macOS
.DS_Store

469
App.jsx Normal file
View File

@ -0,0 +1,469 @@
import React, {
useState,
useEffect,
useReducer,
useMemo,
createContext,
useCallback,
} from "react";
import { View } from "react-native";
import * as SplashScreen from "expo-splash-screen";
import HomeTab from "./screeens/HomeTab";
import Login from "./screeens/Login";
import StreamerProfile from "./screeens/StreamerProfile";
import UserProfile from "./screeens/UserProfile";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { TailwindProvider } from "tailwind-rn";
import utilities from "./tailwind.json";
import ForgetPassword from "./screeens/Login/ForgetPassword";
import SetPassword from "./screeens/Login/SetPassword";
import Toast from "react-native-toast-message";
import loginReducer from "./utils/loginReducer";
import MessageDetail from "./screeens/Messages/MessageDetail";
import EditUserProfile from "./screeens/EditUserProfile";
import Wallet from "./screeens/Wallet";
import UnlockedWechat from "./screeens/UnlockedWechat";
import EditStreamerProfile from "./screeens/EditStreamerProfile";
import Relationship from "./screeens/Relationship";
import StreamerVerification from "./screeens/StreamerVerification";
import EditPlatformOrder from "./screeens/EditPlatformOrder";
import StreamerInviteUser from "./screeens/StreamerInviteUser";
import Setting from "./screeens/Setting";
import WechatWaitingToAdd from "./screeens/WechatWaitingToAdd";
import Search from "./screeens/Search";
import WebWithHeader from "./screeens/WebWithHeader";
import UpdateModal from "./components/UpdateModal";
import { Icon } from "@rneui/themed";
import { StatusBar } from "expo-status-bar";
import { save, get, remove, storeAppInfo } from "./utils/storeInfo";
import baseRequest from "./utils/baseRequest";
import { generateSignature } from "./utils/crypto";
const RootStack = createNativeStackNavigator();
export const AuthContext = createContext("");
SplashScreen.preventAutoHideAsync();
export default function App() {
//app
const MyTheme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
background: "#07050A",
},
};
//
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
//
const [state, dispatch] = useReducer(loginReducer, {
isSignin: false,
userToken: null,
});
const authContext = useMemo(
() => ({
signIn: async (data, mobilePhone, regionCode) => {
await save("token", data.data.token);
await save("account", data.data.account);
await save("mobile_phone", mobilePhone);
await save("region_code", regionCode);
dispatch({ type: "SIGN_IN", token: data.data.token });
},
signOut: async () => {
const base = await baseRequest();
const account = await get("account");
const signature = await generateSignature({
mid: account?.mid,
...base,
});
try {
await fetch(`${apiUrl}/api/login/logout?signature=${signature}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
mid: account?.mid,
...base,
}),
});
await remove("token");
await remove("account");
} catch (error) {
console.error(error);
} finally {
dispatch({ type: "SIGN_OUT" });
}
},
}),
[]
);
//
const [appIsReady, setAppIsReady] = useState(false);
//
const [isUpdateModalVisible, setIsUpdateModalVisible] = useState(false);
//
const [versionData, setVersionData] = useState({});
useEffect(() => {
async function prepare() {
await storeAppInfo();
try {
const token = await get("token");
const account = await get("account");
const base = await baseRequest();
const signature = await generateSignature({
...base,
});
if (token && account) {
const response = await fetch(
`${apiUrl}/api/login/validate?signature=${signature}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...base,
}),
}
);
const data = await response.json();
if (data.ret === 1) {
dispatch({ type: "SIGN_IN", token: token });
}
}
//
const checkUpdataResponse = await fetch(
`${apiUrl}/api/version/is_there_a_new_version_available?signature=${signature}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...base,
}),
}
);
const checkUpdataData = await checkUpdataResponse.json();
if (checkUpdataData.ret === -1) {
return;
}
if (checkUpdataData.data.result) {
setIsUpdateModalVisible(true);
setVersionData(checkUpdataData.data);
}
} catch (e) {
console.warn(e);
} finally {
setAppIsReady(true);
}
}
prepare();
}, []);
const onLayoutRootView = useCallback(async () => {
if (appIsReady) {
await SplashScreen.hideAsync();
}
}, [appIsReady]);
if (!appIsReady) {
return null;
}
return (
<TailwindProvider utilities={utilities}>
<AuthContext.Provider value={authContext}>
<SafeAreaProvider>
<StatusBar style="light" translucent />
<View style={{ flex: 1, backgroundColor: "#07050A" }}>
<NavigationContainer onReady={onLayoutRootView} theme={MyTheme}>
<RootStack.Navigator>
{state.isSignin ? (
<>
<RootStack.Screen
name="HomeTab"
component={HomeTab}
options={{
headerShown: false,
}}
/>
<RootStack.Screen
name="StreamerProfile"
component={StreamerProfile}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
headerRight: () => (
<Icon
type="ionicon"
name="ellipsis-vertical"
size={32}
color="white"
/>
),
headerTransparent: true,
title: "",
})}
/>
<RootStack.Screen
name="UserProfile"
component={UserProfile}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
headerTransparent: true,
title: "",
})}
/>
<RootStack.Screen
name="WechatWaitingToAdd"
component={WechatWaitingToAdd}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "待添加微信",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="MessageDetail"
component={MessageDetail}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="EditUserProfile"
component={EditUserProfile}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="Wallet"
component={Wallet}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
headerTransparent: true,
title: "我的钱包",
headerTitleStyle: { color: "white" },
})}
/>
<RootStack.Screen
name="Setting"
component={Setting}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="Relationship"
component={Relationship}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "关系",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="StreamerVerification"
component={StreamerVerification}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="UnlockedWechat"
component={UnlockedWechat}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "已解锁微信",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="EditStreamerProfile"
component={EditStreamerProfile}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "编辑主页",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="EditPlatformOrder"
component={EditPlatformOrder}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "编辑平台",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="StreamerInviteUser"
component={StreamerInviteUser}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
title: "邀请分成",
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
<RootStack.Screen
name="Search"
component={Search}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="WebWithHeader"
component={WebWithHeader}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
</>
) : (
<>
<RootStack.Screen
name="Login"
component={Login}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="ForgetPassword"
component={ForgetPassword}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="SetPassword"
component={SetPassword}
options={{ headerShown: false }}
/>
<RootStack.Screen
name="WebWithHeader"
component={WebWithHeader}
options={({ navigation }) => ({
headerLeft: () => (
<Icon
type="ionicon"
name="chevron-back"
size={32}
color="white"
onPress={() => navigation.goBack()}
/>
),
headerTitleStyle: { color: "white" },
headerStyle: { backgroundColor: "#07050A" },
})}
/>
</>
)}
</RootStack.Navigator>
</NavigationContainer>
</View>
<Toast />
<UpdateModal
visible={isUpdateModalVisible}
setVisible={setIsUpdateModalVisible}
data={versionData}
/>
</SafeAreaProvider>
</AuthContext.Provider>
</TailwindProvider>
);
}

67
app.json Normal file
View File

@ -0,0 +1,67 @@
{
"expo": {
"name": "铁粉空间",
"slug": "ironfans",
"version": "1.0.9",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "cover",
"backgroundColor": "#07050A"
},
"updates": {
"fallbackToCacheTimeout": 0,
"url": "https://u.expo.dev/3d853b59-c9c3-493b-aa60-769d96a7d719"
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.jueweijue.ironfans",
"infoPlist": {
"NSPhotoLibraryUsageDescription": "允许铁粉空间访问您的相册",
"NSPhotoLibraryAddUsageDescription": "允许铁粉空间保存图片到相册"
}
},
"android": {
"package": "com.jueweijue.ironfans",
"permissions": [
"android.permission.CAMERA",
"android.permission.RECORD_AUDIO",
"android.permission.READ_EXTERNAL_STORAGE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.ACCESS_MEDIA_LOCATION",
"android.permission.REQUEST_INSTALL_PACKAGES"
]
},
"web": {
"favicon": "./assets/favicon.png"
},
"runtimeVersion": {
"policy": "sdkVersion"
},
"plugins": [
[
"expo-camera",
{
"cameraPermission": "允许铁粉空间使用您的相机"
}
],
[
"expo-media-library",
{
"photosPermission": "允许铁粉空间访问您的相册",
"savePhotosPermission": "允许铁粉空间保存图片到相册",
"isAccessMediaLocationEnabled": true
}
]
],
"extra": {
"eas": {
"projectId": "630ead99-fefe-4c52-b249-8f7489b14566"
}
}
}
}

BIN
assets/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 123 KiB

BIN
assets/icon/12DP/ID@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

BIN
assets/icon/12DP/ID@3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
assets/icon/12DP/fan@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
assets/icon/12DP/fan@3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 497 B

BIN
assets/icon/32DP/...@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 B

BIN
assets/icon/32DP/...@3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 385 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 503 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

BIN
assets/images/icon_earn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
assets/images/icon_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
assets/images/icon_gift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
assets/images/icon_left.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
assets/images/icon_play.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
assets/images/icon_post.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Some files were not shown because too many files have changed in this diff Show More