54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import { AppDownload } from '@/components/download/app';
|
|
import PCDownload from '@/components/download/pc';
|
|
import React, { useEffect, useState } from 'react';
|
|
import { Platform, Text, View } from 'react-native';
|
|
|
|
const IOS_APP_STORE_URL = 'https://apps.apple.com/cn/app/id6748205761';
|
|
const ANDROID_APK_URL = 'https://cdn.memorywake.com/apks/application-f086a38c-dac1-43f1-9d24-e4378c2ce121.apk';
|
|
export default function DownloadScreen() {
|
|
|
|
const [loading, setLoading] = useState(false)
|
|
const [platform, setPlatform] = useState('')
|
|
// 判断是什么平台
|
|
const getPlatform = () => {
|
|
let platform;
|
|
if (Platform.OS === 'ios') {
|
|
platform = 'ios';
|
|
} else if (Platform.OS === 'android') {
|
|
platform = 'android';
|
|
} else {
|
|
platform = 'pc';
|
|
}
|
|
return platform;
|
|
}
|
|
|
|
useEffect(() => {
|
|
setLoading(true)
|
|
const platform = getPlatform();
|
|
setPlatform(platform)
|
|
setLoading(false)
|
|
}, [])
|
|
|
|
|
|
if (loading) {
|
|
return (
|
|
<View className="flex-1 bg-bgPrimary justify-center items-center">
|
|
<Text className="text-white">loading...</Text>
|
|
</View>
|
|
);
|
|
}
|
|
return (
|
|
<View style={{ flex: 1 }}>
|
|
{
|
|
platform === 'pc' && <PCDownload IOS_APP_STORE_URL={IOS_APP_STORE_URL} ANDROID_APK_URL={ANDROID_APK_URL} />
|
|
}
|
|
{
|
|
(platform === 'ios' || platform === 'android') && (
|
|
<AppDownload IOS_APP_STORE_URL={IOS_APP_STORE_URL} ANDROID_APK_URL={ANDROID_APK_URL} platform={platform} />
|
|
)
|
|
}
|
|
</View>
|
|
|
|
)
|
|
}
|