175 lines
4.8 KiB
TypeScript
175 lines
4.8 KiB
TypeScript
import HandlersSvg from "@/assets/icons/svg/handers.svg";
|
|
import LogoSvg from "@/assets/icons/svg/logo.svg";
|
|
import UserinfoTotalSvg from "@/assets/icons/svg/userinfoTotal.svg";
|
|
import { useTranslation } from 'react-i18next';
|
|
import { Linking, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
|
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
import QRDownloadScreen from "./qrCode";
|
|
|
|
interface AppDownloadProps {
|
|
IOS_APP_STORE_URL: string,
|
|
ANDROID_APK_URL: string,
|
|
platform: string
|
|
}
|
|
|
|
export const AppDownload = (props: AppDownloadProps) => {
|
|
const { t } = useTranslation();
|
|
const insets = useSafeAreaInsets();
|
|
const { IOS_APP_STORE_URL, ANDROID_APK_URL, platform } = props
|
|
const handleAppStoreDownload = () => {
|
|
Linking.openURL(IOS_APP_STORE_URL);
|
|
};
|
|
|
|
const handlePlayStoreDownload = () => {
|
|
Linking.openURL(ANDROID_APK_URL);
|
|
};
|
|
|
|
return (
|
|
<View style={[styles.container, { paddingTop: insets.top }]}>
|
|
{/* Main Content */}
|
|
<View style={styles.content}>
|
|
{/* App Icon */}
|
|
<LogoSvg />
|
|
|
|
{/* App Name */}
|
|
<Text style={styles.appName}>MemoWake</Text>
|
|
{/* QRCode */}
|
|
|
|
<View style={styles.qrCodeContainer}>
|
|
<UserinfoTotalSvg style={{ marginBottom: -20, zIndex: 1 }} />
|
|
<HandlersSvg style={{ marginBottom: -4, zIndex: 3 }} />
|
|
<View style={styles.qrCode}>
|
|
<QRDownloadScreen url={platform == "ios" ? IOS_APP_STORE_URL : ANDROID_APK_URL} />
|
|
</View>
|
|
</View>
|
|
{/* Description */}
|
|
<Text style={styles.description}>
|
|
{t('mobileDescription', { ns: 'download' })}
|
|
</Text>
|
|
|
|
{/* Download Button */}
|
|
<TouchableOpacity
|
|
style={styles.downloadButton}
|
|
onPress={Platform.OS === 'ios' ? handleAppStoreDownload : handlePlayStoreDownload}
|
|
>
|
|
<Text style={styles.downloadButtonText}>
|
|
{t('download', { ns: 'download' })}
|
|
</Text>
|
|
</TouchableOpacity>
|
|
</View>
|
|
</View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
padding: 20,
|
|
backgroundColor: '#FFB645'
|
|
},
|
|
qrCodeContainer: {
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
qrCodeBg: {
|
|
justifyContent: 'center',
|
|
alignItems: 'center'
|
|
},
|
|
qrCode: {
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
padding: 16,
|
|
borderRadius: 24,
|
|
zIndex: 2,
|
|
backgroundColor: '#fff',
|
|
},
|
|
closeButton: {
|
|
width: 30,
|
|
height: 30,
|
|
borderRadius: 15,
|
|
backgroundColor: 'rgba(255, 255, 255, 0.3)',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
closeButtonText: {
|
|
color: '#fff',
|
|
fontSize: 18,
|
|
lineHeight: 24,
|
|
},
|
|
content: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
paddingBottom: 40,
|
|
},
|
|
appIconImage: {
|
|
width: 100,
|
|
height: 100
|
|
},
|
|
appIconText: {
|
|
fontSize: 50,
|
|
},
|
|
appName: {
|
|
fontSize: 32,
|
|
fontWeight: 'bold',
|
|
color: '#fff',
|
|
marginBottom: 12,
|
|
},
|
|
description: {
|
|
fontSize: 16,
|
|
color: 'rgba(255, 255, 255, 0.9)',
|
|
textAlign: 'center',
|
|
marginBottom: 32,
|
|
paddingHorizontal: 40,
|
|
lineHeight: 24,
|
|
marginVertical: 32
|
|
},
|
|
downloadButton: {
|
|
backgroundColor: '#fff',
|
|
borderRadius: 30,
|
|
paddingVertical: 16,
|
|
paddingHorizontal: 40,
|
|
width: "90%",
|
|
alignItems: 'center',
|
|
shadowColor: '#000',
|
|
shadowOffset: { width: 0, height: 4 },
|
|
shadowOpacity: 0.1,
|
|
shadowRadius: 8,
|
|
elevation: 5,
|
|
marginTop: 40
|
|
},
|
|
downloadButtonText: {
|
|
color: '#4C320C',
|
|
fontSize: 18,
|
|
fontWeight: 'bold',
|
|
},
|
|
badgesContainer: {
|
|
alignItems: 'center',
|
|
paddingBottom: 40,
|
|
},
|
|
availableOnText: {
|
|
color: 'rgba(255, 255, 255, 0.8)',
|
|
fontSize: 14,
|
|
marginBottom: 12,
|
|
},
|
|
badgesRow: {
|
|
flexDirection: 'row',
|
|
justifyContent: 'center',
|
|
alignItems: 'center',
|
|
},
|
|
badgeButton: {
|
|
backgroundColor: '#fff',
|
|
borderRadius: 8,
|
|
paddingVertical: 8,
|
|
paddingHorizontal: 16,
|
|
marginHorizontal: 8,
|
|
minWidth: 120,
|
|
alignItems: 'center',
|
|
justifyContent: 'center',
|
|
height: 40,
|
|
},
|
|
badgeText: {
|
|
fontSize: 14,
|
|
fontWeight: '600',
|
|
},
|
|
}); |