mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-08 07:28:37 +08:00
feat:添加打开B站扫码功能
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Animated,
|
Animated,
|
||||||
Alert,
|
Alert,
|
||||||
|
Linking,
|
||||||
} from "react-native";
|
} from "react-native";
|
||||||
import * as FileSystem from "expo-file-system/legacy";
|
import * as FileSystem from "expo-file-system/legacy";
|
||||||
import * as MediaLibrary from "expo-media-library";
|
import * as MediaLibrary from "expo-media-library";
|
||||||
@@ -108,7 +109,13 @@ export function LoginModal({ visible, onClose }: Props) {
|
|||||||
const dest = `${FileSystem.cacheDirectory}bilibili_qr.png`;
|
const dest = `${FileSystem.cacheDirectory}bilibili_qr.png`;
|
||||||
const { uri } = await FileSystem.downloadAsync(qrUrl, dest);
|
const { uri } = await FileSystem.downloadAsync(qrUrl, dest);
|
||||||
await MediaLibrary.saveToLibraryAsync(uri);
|
await MediaLibrary.saveToLibraryAsync(uri);
|
||||||
Alert.alert("已保存", "二维码已存入相册");
|
Alert.alert("已保存", "二维码已存入相册,请用哔哩哔哩扫码登录", [
|
||||||
|
{ text: "关闭", style: "cancel" },
|
||||||
|
{
|
||||||
|
text: "打开哔哩哔哩扫一扫",
|
||||||
|
onPress: () => Linking.openURL("bilibili://scan"),
|
||||||
|
},
|
||||||
|
]);
|
||||||
} catch {
|
} catch {
|
||||||
Alert.alert("失败", "保存失败,请重试");
|
Alert.alert("失败", "保存失败,请重试");
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Reference in New Issue
Block a user