动态遮挡改为模糊;优化动态tab底部文案;修复充了会员前四条动态会重复bug;修改版本号到1.2.3

This commit is contained in:
yezian 2024-02-06 20:34:51 +08:00
parent 320aab978b
commit aad1d35eb1
5 changed files with 45 additions and 133 deletions

View File

@ -2,7 +2,7 @@
"expo": { "expo": {
"name": "铁粉空间", "name": "铁粉空间",
"slug": "ironfans", "slug": "ironfans",
"version": "1.2.2", "version": "1.2.3",
"orientation": "portrait", "orientation": "portrait",
"icon": "./assets/icon.png", "icon": "./assets/icon.png",
"splash": { "splash": {

View File

@ -5,6 +5,7 @@ import {
Modal, Modal,
TouchableWithoutFeedback, TouchableWithoutFeedback,
ActivityIndicator, ActivityIndicator,
Platform,
Image as NativeImage, Image as NativeImage,
} from "react-native"; } from "react-native";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
@ -22,8 +23,6 @@ import { get } from "../../utils/storeInfo";
const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk"; const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
const vipBlurhash = "LhPFg0K+TZs;G^G9n5WVEen%n,WV";
export default function Post({ isBlur, data }) { export default function Post({ isBlur, data }) {
const blur = data?.top ? false : isBlur; const blur = data?.top ? false : isBlur;
@ -106,7 +105,7 @@ export default function Post({ isBlur, data }) {
> >
<Image <Image
style={tailwind("w-9 h-9 rounded-full")} style={tailwind("w-9 h-9 rounded-full")}
source={data.streamer_ext?.avatar?.images[0]?.urls[0]} source={data?.streamer_ext?.avatar?.images[0]?.urls[0]}
placeholder={blurhash} placeholder={blurhash}
contentFit="cover" contentFit="cover"
transition={100} transition={100}
@ -120,7 +119,7 @@ export default function Post({ isBlur, data }) {
style={tailwind("flex flex-row items-center justify-between")} style={tailwind("flex flex-row items-center justify-between")}
> >
<Text style={tailwind("text-base font-medium text-white")}> <Text style={tailwind("text-base font-medium text-white")}>
{data.streamer_ext?.name} {data?.streamer_ext?.name}
</Text> </Text>
<TouchableOpacity <TouchableOpacity
onPress={handleFollow} onPress={handleFollow}
@ -139,7 +138,7 @@ export default function Post({ isBlur, data }) {
</TouchableOpacity> </TouchableOpacity>
</View> </View>
<Text style={tailwind("text-base text-white font-medium my-2")}> <Text style={tailwind("text-base text-white font-medium my-2")}>
{data.text} {data?.text}
</Text> </Text>
{/* 媒体展示 */} {/* 媒体展示 */}
<View style={tailwind("pr-10 mb-1")}> <View style={tailwind("pr-10 mb-1")}>
@ -262,74 +261,6 @@ function ImageDisplay({ blur, media }) {
const [imageIndex, setImageIndex] = useState(); const [imageIndex, setImageIndex] = useState();
const images = media.map((item) => ({ url: item.urls[0] })); const images = media.map((item) => ({ url: item.urls[0] }));
if (blur) {
return (
<View style={tailwind("flex flex-row flex-wrap")}>
{media.length > 1 ? (
media.map((item, index) => (
<TouchableOpacity
activeOpacity={1}
key={index}
onPress={() =>
navigation.navigate("WebWithoutHeader", {
uri: process.env.EXPO_PUBLIC_WEB_URL + "/vip",
})
}
style={{
aspectRatio: 1,
...tailwind("basis-1/3 p-0.5 relative"),
}}
>
<Image
style={tailwind("w-full h-full rounded")}
placeholder={vipBlurhash}
contentFit="cover"
transition={100}
cachePolicy="disk"
/>
<View
style={tailwind(
"flex absolute top-0 left-0 items-center justify-center w-full h-full"
)}
>
<NativeImage source={require("../../assets/images/lock.png")} />
</View>
</TouchableOpacity>
))
) : (
<TouchableOpacity
activeOpacity={1}
onPress={() =>
navigation.navigate("WebWithoutHeader", {
uri: process.env.EXPO_PUBLIC_WEB_URL + "/vip",
})
}
style={{
width: 200,
height: 250,
...tailwind("relative"),
}}
>
<Image
style={tailwind("w-full h-full rounded")}
placeholder={vipBlurhash}
contentFit="cover"
transition={100}
cachePolicy="disk"
/>
<View
style={tailwind(
"flex absolute top-0 left-0 items-center justify-center w-full h-full"
)}
>
<NativeImage source={require("../../assets/images/lock.png")} />
</View>
</TouchableOpacity>
)}
</View>
);
}
if (images.length === 0) return null; if (images.length === 0) return null;
return ( return (
@ -339,14 +270,22 @@ function ImageDisplay({ blur, media }) {
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
key={index} key={index}
onPress={() => { onPress={
setIsModalVisible(true); blur
setImageIndex(index); ? () =>
}} navigation.navigate("WebWithoutHeader", {
uri: process.env.EXPO_PUBLIC_WEB_URL + "/vip",
})
: () => {
setIsModalVisible(true);
setImageIndex(index);
}
}
style={{ aspectRatio: 1, ...tailwind("basis-1/3 p-0.5") }} style={{ aspectRatio: 1, ...tailwind("basis-1/3 p-0.5") }}
> >
<Image <Image
style={tailwind("w-full h-full rounded")} style={tailwind("w-full h-full rounded")}
blurRadius={blur ? (Platform.OS === "ios" ? 100 : 10) : 0}
source={item.urls[0]} source={item.urls[0]}
placeholder={blurhash} placeholder={blurhash}
contentFit="cover" contentFit="cover"
@ -358,10 +297,17 @@ function ImageDisplay({ blur, media }) {
) : ( ) : (
<TouchableOpacity <TouchableOpacity
activeOpacity={1} activeOpacity={1}
onPress={() => { onPress={
setIsModalVisible(true); blur
setImageIndex(0); ? () =>
}} navigation.navigate("WebWithoutHeader", {
uri: process.env.EXPO_PUBLIC_WEB_URL + "/vip",
})
: () => {
setIsModalVisible(true);
setImageIndex(index);
}
}
style={{ style={{
width: width:
media[0].w < media[0].h ? (media[0].w / media[0].h) * 200 : 250, media[0].w < media[0].h ? (media[0].w / media[0].h) * 200 : 250,
@ -371,6 +317,7 @@ function ImageDisplay({ blur, media }) {
> >
<Image <Image
style={tailwind("w-full h-full rounded")} style={tailwind("w-full h-full rounded")}
blurRadius={blur ? (Platform.OS === "ios" ? 130 : 10) : 0}
source={media[0].urls[0]} source={media[0].urls[0]}
placeholder={blurhash} placeholder={blurhash}
contentFit="contain" contentFit="contain"
@ -400,32 +347,6 @@ function ImageDisplay({ blur, media }) {
function PosterDisplay({ blur, media }) { function PosterDisplay({ blur, media }) {
const tailwind = useTailwind(); const tailwind = useTailwind();
if (blur) {
return (
<View
style={{
width: 200,
height: 250,
}}
>
<Image
style={tailwind("w-full h-full rounded")}
placeholder={vipBlurhash}
contentFit="cover"
transition={100}
cachePolicy="disk"
/>
<View
style={tailwind(
"flex absolute w-full h-full left-0 top-0 z-10 justify-center items-center"
)}
>
<NativeImage source={require("../../assets/images/lock.png")} />
</View>
</View>
);
}
return ( return (
<View <View
style={{ style={{
@ -441,6 +362,7 @@ function PosterDisplay({ blur, media }) {
> >
<Image <Image
style={tailwind("w-full h-full rounded")} style={tailwind("w-full h-full rounded")}
blurRadius={blur ? (Platform.OS === "ios" ? 130 : 10) : 0}
source={media.cover_urls[0]} source={media.cover_urls[0]}
placeholder={blurhash} placeholder={blurhash}
contentFit="cover" contentFit="cover"

View File

@ -62,7 +62,7 @@ export default function FeedPosts({ blur }) {
const role = account.role; const role = account.role;
const isVip = account.is_a_member; const isVip = account.is_a_member;
if (role !== 0 || isVip === 1) { if (role !== 0 || isVip === 1) {
return; return [];
} }
try { try {
const apiUrl = process.env.EXPO_PUBLIC_API_URL; const apiUrl = process.env.EXPO_PUBLIC_API_URL;
@ -92,11 +92,11 @@ export default function FeedPosts({ blur }) {
text1: _data.msg, text1: _data.msg,
topOffset: 60, topOffset: 60,
}); });
return; return [];
} }
//id //id
if (!_data.data.app_config.config_value) return; if (!_data.data.app_config.config_value) return [];
const intIds = _data.data.app_config.config_value?.map((item) => const intIds = _data.data.app_config.config_value?.map((item) =>
parseInt(item, 10) parseInt(item, 10)
); );
@ -124,7 +124,7 @@ export default function FeedPosts({ blur }) {
text1: _data2.msg, text1: _data2.msg,
topOffset: 60, topOffset: 60,
}); });
return; return [];
} }
const topPostsData = _data2.data.list.map((item) => { const topPostsData = _data2.data.list.map((item) => {
return { ...item, top: true }; return { ...item, top: true };
@ -132,6 +132,7 @@ export default function FeedPosts({ blur }) {
return topPostsData; return topPostsData;
} catch (error) { } catch (error) {
console.error(error); console.error(error);
return [];
} }
}; };
@ -189,10 +190,6 @@ export default function FeedPosts({ blur }) {
} }
if (type === "top") { if (type === "top") {
const topPosts = await getTopPostsData(); const topPosts = await getTopPostsData();
if (!topPosts) {
setData((prev) => _data.data.list);
return;
}
setData((prev) => [...topPosts, ..._data.data.list]); setData((prev) => [...topPosts, ..._data.data.list]);
} else { } else {
setData((prev) => [...prev, ..._data.data.list]); setData((prev) => [...prev, ..._data.data.list]);
@ -273,7 +270,7 @@ export default function FeedPosts({ blur }) {
ellipsizeMode="tail" ellipsizeMode="tail"
style={tailwind("text-[#FF669E] text-base font-medium ml-1")} style={tailwind("text-[#FF669E] text-base font-medium ml-1")}
> >
开通会员订阅全部 即刻订阅全部精选内容
</Text> </Text>
</View> </View>
<View <View

View File

@ -228,7 +228,7 @@ export default function FollowPosts({ blur }) {
ellipsizeMode="tail" ellipsizeMode="tail"
style={tailwind("text-[#FF669E] text-base font-medium ml-1")} style={tailwind("text-[#FF669E] text-base font-medium ml-1")}
> >
开通会员订阅全部 即刻订阅全部精选内容
</Text> </Text>
</View> </View>
<View <View

View File

@ -8,6 +8,7 @@ import {
Text, Text,
Alert, Alert,
ScrollView, ScrollView,
Platform,
Image as NativeImage, Image as NativeImage,
} from "react-native"; } from "react-native";
import React, { useState, useEffect } from "react"; import React, { useState, useEffect } from "react";
@ -31,7 +32,7 @@ import StreamerProfileSkeleton from "./skeleton";
import { generateSignature } from "../../utils/crypto"; import { generateSignature } from "../../utils/crypto";
import Svg, { Path } from "react-native-svg"; import Svg, { Path } from "react-native-svg";
const vipBlurhash = "LhPFg0K+TZs;G^G9n5WVEen%n,WV"; const blurhash = "LcKUTa%gOYWBYRt6xuoJo~s8V@fk";
export default function StreamerProfile({ navigation, route }) { export default function StreamerProfile({ navigation, route }) {
const screenWidth = Dimensions.get("window").width; const screenWidth = Dimensions.get("window").width;
@ -673,24 +674,16 @@ export default function StreamerProfile({ navigation, route }) {
<View style={tailwind("relative w-full h-full")}> <View style={tailwind("relative w-full h-full")}>
<Image <Image
style={tailwind("w-full h-full rounded")} style={tailwind("w-full h-full rounded")}
placeholder={vipBlurhash} blurRadius={
source={blur ? null : mediaUrl} blur ? (Platform.OS === "ios" ? 130 : 10) : 0
}
placeholder={blurhash}
source={mediaUrl}
contentFit="cover" contentFit="cover"
transition={100} transition={100}
cachePolicy="disk" cachePolicy="disk"
/> />
{blur && ( {index === 3 && postsData.length > 4 && (
<View
style={tailwind(
"w-full h-full rounded absolute top-0 left-0 flex justify-center items-center"
)}
>
<NativeImage
source={require("../../assets/images/lock.png")}
/>
</View>
)}
{index === 3 && (
<View <View
style={{ style={{
backgroundColor: "rgba(0,0,0,0.5)", backgroundColor: "rgba(0,0,0,0.5)",