webview改为隐身模式;视频显示封面;去除推荐滚动到最上动画;钱包每次聚焦都刷新;完善待添加微信

This commit is contained in:
yezian 2023-12-30 18:47:12 +08:00
parent 9002e59541
commit 3ccca0a488
8 changed files with 104 additions and 78 deletions

View File

@ -261,11 +261,11 @@ export default function EditStreamerProfile({ navigation, route }) {
{
notChanged: true,
id: { video_ids: streamerData.data.streamer.shorts.video_ids },
//todo:uri
uri: streamerData?.data?.streamer?.shorts?.videos[0]?.urls[0],
old_uri:
streamerData?.data?.streamer?.shorts?.videos[0]?.cover_urls[0],
},
setOldPhotos(streamerData.data.streamer.album.images),
]);
setOldPhotos(streamerData.data.streamer.album.images);
setIsloading(false);
} catch (error) {
console.error(error);

View File

@ -175,7 +175,7 @@ export default function FeedStream() {
//
const handleRefresh = async () => {
startRotation();
flatListRef.current.scrollToOffset({ animated: true, offset: 0 });
flatListRef.current.scrollToOffset({ animated: false, offset: 0 });
setRefreshing(true);
await getData("top");
setRefreshing(false);

View File

@ -1,5 +1,5 @@
import { View, Text, Image, TouchableOpacity } from "react-native";
import React, { useState, useEffect } from "react";
import React, { useState, useEffect, useCallback } from "react";
import { useTailwind } from "tailwind-rn";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import { Divider, Icon } from "@rneui/themed";
@ -10,6 +10,7 @@ import baseRequest from "../../utils/baseRequest";
import Toast from "react-native-toast-message";
import * as Linking from "expo-linking";
import { generateSignature } from "../../utils/crypto";
import { useFocusEffect } from "@react-navigation/native";
export default function Wallet({ navigation, route }) {
const tailwind = useTailwind();
@ -19,52 +20,57 @@ export default function Wallet({ navigation, route }) {
const [tokenAndMobilePhone, setTokenAndMobilePhone] = useState("");
const [data, setData] = useState("");
//focus
useEffect(() => {
const getData = async () => {
//
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
const account = await get("account");
const base = await baseRequest();
const signature = await generateSignature({
...base,
mid: account.mid,
});
try {
//
const accountResponse = await fetch(
`${apiUrl}/api/account/list_by_mid?signature=${signature}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...base,
mid: account.mid,
}),
useFocusEffect(
useCallback(() => {
const getData = async () => {
//
const apiUrl = process.env.EXPO_PUBLIC_API_URL;
const account = await get("account");
const base = await baseRequest();
const signature = await generateSignature({
...base,
mid: account.mid,
});
try {
//
const accountResponse = await fetch(
`${apiUrl}/api/account/list_by_mid?signature=${signature}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...base,
mid: account.mid,
}),
}
);
const accountData = await accountResponse.json();
if (accountData.ret === -1) {
Toast.show({
type: "error",
text1: accountData.msg,
topOffset: 60,
});
return;
}
);
const accountData = await accountResponse.json();
if (accountData.ret === -1) {
Toast.show({
type: "error",
text1: accountData.msg,
topOffset: 60,
await save("account", accountData.data.account);
setData(accountData.data.account);
const tokenCache = await get("token");
const temToken = encodeURIComponent(tokenCache);
const mobilePhone = await get("mobile_phone");
setTokenAndMobilePhone({
token: temToken,
mobile_phone: mobilePhone,
});
return;
} catch (error) {
console.error(error);
}
await save("account", accountData.data.account);
setData(accountData.data.account);
const tokenCache = await get("token");
const temToken = encodeURIComponent(tokenCache);
const mobilePhone = await get("mobile_phone");
setTokenAndMobilePhone({ token: temToken, mobile_phone: mobilePhone });
} catch (error) {
console.error(error);
}
};
getData();
}, []);
};
getData();
}, [])
);
return (
<View

View File

@ -143,6 +143,7 @@ export default function WebWithHeader({ navigation, route }) {
return (
<>
<WebView
incognito
source={{
uri: route.params.uri,
}}

View File

@ -6,6 +6,7 @@ import {
Modal,
TouchableOpacity,
Image as NativeImage,
Alert,
} from "react-native";
import { Image } from "expo-image";
import React, { useState, useEffect } from "react";
@ -49,7 +50,7 @@ export default function AlreadyAddWechat({}) {
"Content-Type": "application/json",
},
body: JSON.stringify({
tab: 1,
tab: 2,
offset: top ? 0 : offset, //
limit: 20,
...base,
@ -97,11 +98,7 @@ export default function AlreadyAddWechat({}) {
//
const copy = async (data) => {
await Clipboard.setStringAsync(data);
Toast.show({
type: "success",
text1: "已复制到剪贴板",
topOffset: 60,
});
Alert.alert(null, "复制成功");
};
return (
<Modal
@ -123,7 +120,7 @@ export default function AlreadyAddWechat({}) {
style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")}
>
{currentOrder.consumer_wechat ? (
<View style={tailwind("flex flex-col")}>
<View style={tailwind("flex flex-col w-full")}>
<View
style={tailwind("flex flex-row items-center justify-center")}
>
@ -139,10 +136,14 @@ export default function AlreadyAddWechat({}) {
{currentOrder?.account?.name}
</Text>
</View>
<Text style={tailwind("text-white text-base font-medium")}>
<Text style={tailwind("mt-2 text-white text-base font-medium")}>
Ta的微信号
</Text>
<View style={tailwind("flex flex-row")}>
<View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_wechat}
</Text>
@ -158,10 +159,14 @@ export default function AlreadyAddWechat({}) {
</Text>
</TouchableOpacity>
</View>
<Text style={tailwind("text-white text-base font-medium")}>
<Text style={tailwind("mt-2 text-white text-base font-medium")}>
添加时请备注
</Text>
<View style={tailwind("flex flex-row")}>
<View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] mb-4 px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_note}
</Text>

View File

@ -6,6 +6,7 @@ import {
Modal,
TouchableOpacity,
Image as NativeImage,
Alert,
} from "react-native";
import { Image } from "expo-image";
import React, { useState, useEffect } from "react";
@ -97,11 +98,7 @@ export default function HaveNotAddWechat({}) {
//
const copy = async (data) => {
await Clipboard.setStringAsync(data);
Toast.show({
type: "success",
text1: "已复制到剪贴板",
topOffset: 60,
});
Alert.alert(null, "复制成功");
};
//
const handleConfirm = async () => {
@ -160,7 +157,7 @@ export default function HaveNotAddWechat({}) {
style={tailwind("p-4 rounded-2xl bg-[#1E1C29] items-center w-3/4")}
>
{currentOrder.consumer_wechat ? (
<View style={tailwind("flex flex-col")}>
<View style={tailwind("flex flex-col w-full")}>
<View
style={tailwind("flex flex-row items-center justify-center")}
>
@ -176,10 +173,14 @@ export default function HaveNotAddWechat({}) {
{currentOrder?.account?.name}
</Text>
</View>
<Text style={tailwind("text-white text-base font-medium")}>
<Text style={tailwind("mt-2 text-white text-base font-medium")}>
Ta的微信号
</Text>
<View style={tailwind("flex flex-row")}>
<View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_wechat}
</Text>
@ -195,10 +196,14 @@ export default function HaveNotAddWechat({}) {
</Text>
</TouchableOpacity>
</View>
<Text style={tailwind("text-white text-base font-medium")}>
<Text style={tailwind("mt-2 text-white text-base font-medium")}>
添加时请备注
</Text>
<View style={tailwind("flex flex-row")}>
<View
style={tailwind(
"flex flex-row bg-[#FFFFFF1A] mb-4 px-4 py-2 rounded-lg justify-between"
)}
>
<Text style={tailwind("text-white text-base font-medium")}>
{currentOrder?.consumer_note}
</Text>

View File

@ -593,10 +593,6 @@
background-color: rgb(255 255 255 / var(--tw-bg-opacity))
}
.bg-white\/30 {
background-color: rgb(255 255 255 / 0.3)
}
.bg-yellow-400 {
--tw-bg-opacity: 1;
background-color: rgb(250 204 21 / var(--tw-bg-opacity))
@ -721,6 +717,14 @@
text-align: right
}
.text-start {
text-align: start
}
.text-end {
text-align: end
}
.text-2xl {
font-size: 1.5rem;
line-height: 2rem

View File

@ -788,11 +788,6 @@
"backgroundColor": "rgb(255 255 255 / var(--tw-bg-opacity))"
}
},
"bg-white/30": {
"style": {
"backgroundColor": "rgb(255 255 255 / 0.3)"
}
},
"bg-yellow-400": {
"style": {
"--tw-bg-opacity": 1,
@ -960,6 +955,16 @@
"textAlign": "right"
}
},
"text-start": {
"style": {
"textAlign": "start"
}
},
"text-end": {
"style": {
"textAlign": "end"
}
},
"text-2xl": {
"style": {
"fontSize": 24,