diff --git a/App.jsx b/App.jsx
index e92ba35..dff5568 100644
--- a/App.jsx
+++ b/App.jsx
@@ -63,6 +63,7 @@ import * as Clipboard from "expo-clipboard";
import PrivatyModal from "./components/PrivatyModal";
import * as Sentry from "@sentry/react-native";
import { ImageViewerProvider } from "./context/ImageViewProvider";
+import { VipVisibilityProvider } from "./context/VipVisibilityProvider";
const RootStack = createNativeStackNavigator();
@@ -303,521 +304,525 @@ const App = () => {
-
- {state.isSignin ? (
- <>
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- >
-
+
+ {state.isSignin ? (
+ <>
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ >
+
+
+ ),
+ headerRight: () => (
+
-
- ),
- headerRight: () => (
-
- ),
- headerTransparent: true,
- title: "",
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- headerTransparent: true,
- title: "",
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "待添加微信",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- headerTransparent: true,
- title: "我的钱包",
- headerTitleStyle: { color: "white" },
- })}
- />
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "关系",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "已解锁微信",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "编辑主页",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "编辑平台",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "动态",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "发布动态",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "图文动态(空间内)",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "视频动态(空间内)",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- >
-
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
/>
-
- ),
- headerTransparent: true,
- title: "",
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- >
-
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
/>
-
- ),
- headerTransparent: true,
- title: "",
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- >
-
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
/>
-
- ),
- headerTransparent: true,
- title: "",
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- headerRight: () => (
-
- navigation.navigate("WebWithHeader", {
- title: "平台准则",
- uri: `${process.env.EXPO_PUBLIC_WEB_URL}/doc/platformguidelines`,
- })
- }
- >
-
- 平台准则
-
-
- ),
- title: "开通空间",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "分享空间",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "重新编辑",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "审核未通过",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "编辑资料",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- title: "照片墙",
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- >
- ) : (
- <>
-
-
-
- ({
- headerLeft: () => (
- navigation.goBack()}
- />
- ),
- headerTitleStyle: { color: "white" },
- headerStyle: { backgroundColor: "#07050A" },
- })}
- />
- >
- )}
-
-
- {
- setIsPrivatyModalOpen(false);
- setChecked(true);
- }}
- />
+ ),
+ title: "",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ headerTransparent: true,
+ title: "我的钱包",
+ headerTitleStyle: { color: "white" },
+ })}
+ />
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "关系",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "已解锁微信",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "编辑主页",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "编辑平台",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "动态",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "发布动态",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "图文动态(空间内)",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "视频动态(空间内)",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ >
+
+
+ ),
+ headerTransparent: true,
+ title: "",
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ >
+
+
+ ),
+ headerTransparent: true,
+ title: "",
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ >
+
+
+ ),
+ headerTransparent: true,
+ title: "",
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ headerRight: () => (
+
+ navigation.navigate("WebWithHeader", {
+ title: "平台准则",
+ uri: `${process.env.EXPO_PUBLIC_WEB_URL}/doc/platformguidelines`,
+ })
+ }
+ >
+
+ 平台准则
+
+
+ ),
+ title: "开通空间",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "分享空间",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "重新编辑",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "审核未通过",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "编辑资料",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ title: "照片墙",
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ >
+ ) : (
+ <>
+
+
+
+ ({
+ headerLeft: () => (
+ navigation.goBack()}
+ />
+ ),
+ headerTitleStyle: { color: "white" },
+ headerStyle: { backgroundColor: "#07050A" },
+ })}
+ />
+ >
+ )}
+
+
+ {
+ setIsPrivatyModalOpen(false);
+ setChecked(true);
+ }}
+ />
+
diff --git a/context/VipVisibilityProvider.jsx b/context/VipVisibilityProvider.jsx
new file mode 100644
index 0000000..73c1044
--- /dev/null
+++ b/context/VipVisibilityProvider.jsx
@@ -0,0 +1,49 @@
+import React, { useState, createContext, useContext, useEffect } from "react";
+import baseRequest from "../utils/baseRequest";
+import { generateSignature } from "../utils/crypto";
+
+const VipVisibilityContext = createContext();
+
+export const VipVisibilityProvider = ({ children }) => {
+ const [isVipVisible, setIsVipVisible] = useState(true);
+
+ useEffect(() => {
+ const init = async () => {
+ try {
+ const apiUrl = process.env.EXPO_PUBLIC_API_URL;
+ const base = await baseRequest();
+ const signature = await generateSignature({
+ ...base,
+ });
+ const _response = await fetch(
+ `${apiUrl}/api/moment/is_moment_image_encrypt_enabled?signature=${signature}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify({
+ ...base,
+ }),
+ }
+ );
+ const _data = await _response.json();
+ if (_data.ret === -1) {
+ return;
+ }
+ setIsVipVisible(_data.data === 1 ? true : false);
+ } catch (error) {
+ console.error(error);
+ }
+ };
+ init();
+ }, []);
+
+ return (
+
+ {children}
+
+ );
+};
+
+export const useVipVisibility = () => useContext(VipVisibilityContext);
diff --git a/screeens/Posts/index.jsx b/screeens/Posts/index.jsx
index a05dc65..335f3f9 100644
--- a/screeens/Posts/index.jsx
+++ b/screeens/Posts/index.jsx
@@ -16,11 +16,15 @@ import baseRequest from "../../utils/baseRequest";
import { generateSignature } from "../../utils/crypto";
import Toast from "react-native-toast-message";
import { TabView, SceneMap, TabBar } from "react-native-tab-view";
+import { useVipVisibility } from "../../context/VipVisibilityProvider";
export default function Posts({ navigation }) {
const tailwind = useTailwind();
const insets = useSafeAreaInsets();
+ //查看是否展示vip功能
+ const { isVipVisible } = useVipVisibility();
+
//每次focus都更新一次数据,查看会员状态是否改变
const [blur, setBlur] = useState(true);
useFocusEffect(
@@ -60,7 +64,7 @@ export default function Posts({ navigation }) {
}
const role = accountData.data.account.role;
const isVip = accountData.data.account.is_a_member;
- if (role !== 0 || isVip === 1) {
+ if (role !== 0 || isVip === 1 || !isVipVisible) {
setBlur(false);
} else {
setBlur(true);
@@ -71,7 +75,7 @@ export default function Posts({ navigation }) {
}
};
getData();
- }, [])
+ }, [isVipVisible])
);
//tab组件相关
diff --git a/screeens/StreamerPosts/index.jsx b/screeens/StreamerPosts/index.jsx
index 33527c4..454e0ef 100644
--- a/screeens/StreamerPosts/index.jsx
+++ b/screeens/StreamerPosts/index.jsx
@@ -15,10 +15,14 @@ import { FlashList } from "@shopify/flash-list";
import Post from "../../components/Post";
import { get } from "../../utils/storeInfo";
import { useSafeAreaInsets } from "react-native-safe-area-context";
+import { useVipVisibility } from "../../context/VipVisibilityProvider";
export default function StreamerPosts({ navigation, route }) {
const insets = useSafeAreaInsets();
+ //查看是否展示vip功能
+ const { isVipVisible } = useVipVisibility();
+
//获取会员价格
const [vipPrice, setVipPrice] = useState();
const getVipPrice = async () => {
@@ -126,7 +130,7 @@ export default function StreamerPosts({ navigation, route }) {
const account = await get("account");
const role = account.role;
const isVip = account.is_a_member;
- if (role !== 0 || isVip === 1) {
+ if (role !== 0 || isVip === 1 || !isVipVisible) {
return setBlur(false);
}
return setBlur(true);
diff --git a/screeens/StreamerProfile/index.jsx b/screeens/StreamerProfile/index.jsx
index 53cb4e8..d353a93 100644
--- a/screeens/StreamerProfile/index.jsx
+++ b/screeens/StreamerProfile/index.jsx
@@ -30,6 +30,7 @@ import StreamerProfileSkeleton from "./skeleton";
import { generateSignature } from "../../utils/crypto";
import Svg, { Path } from "react-native-svg";
import { useImageViewer } from "../../context/ImageViewProvider";
+import { useVipVisibility } from "../../context/VipVisibilityProvider";
const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
@@ -54,13 +55,16 @@ export default function StreamerProfile({ navigation, route }) {
});
}, []);
+ //查看是否展示vip功能
+ const { isVipVisible } = useVipVisibility();
+
//动态是否需要blur
const [blur, setBlur] = useState(true);
const checkBlur = async () => {
const account = await get("account");
const role = account.role;
const isVip = account.is_a_member;
- if (role !== 0 || isVip === 1) {
+ if (role !== 0 || isVip === 1 || !isVipVisible) {
return setBlur(false);
}
return setBlur(true);
diff --git a/utils/storeInfo.js b/utils/storeInfo.js
index 8667b4e..c4dc053 100644
--- a/utils/storeInfo.js
+++ b/utils/storeInfo.js
@@ -35,7 +35,6 @@ export async function storeAppInfo() {
}
const b_did = await getDid();
- console.log(b_did);
const b_ver = Application.nativeApplicationVersion;
const b_dt = Device.osName === "Android" ? 0 : 1;
const b_ch = "production";