import React from 'react'; import { Modal, View, Image, TouchableOpacity, BackHandler, Platform } from 'react-native'; import { useTheme } from '@/providers/ThemeProvider'; import Text from './Text'; import * as Linking from 'expo-linking'; import Styles from '@/constants/Styles'; interface ModalUpdateMaintenanceProps { visible: boolean; type: 'update' | 'maintenance'; isForceUpdate?: boolean; onDismiss?: () => void; appName?: string; customDescription?: string; androidStoreUrl?: string; iosStoreUrl?: string; } const ModalUpdateMaintenance: React.FC = ({ visible, type, isForceUpdate = false, onDismiss, appName = 'Desa+', customDescription, androidStoreUrl = 'https://play.google.com/store/apps/details?id=mobiledarmasaba.app', iosStoreUrl = 'https://apps.apple.com/id/app/desa-plus-desa/id6752375538' }) => { const { colors } = useTheme(); const handleUpdate = () => { const storeUrl = Platform.OS === 'ios' ? iosStoreUrl : androidStoreUrl; Linking.openURL(storeUrl); }; const handleCloseApp = () => { // For maintenance mode, we might want to exit the app or just keep the modal. // React Native doesn't have a built-in "exit" for iOS, but for Android: if (Platform.OS === 'android') { BackHandler.exitApp(); } }; return ( { if (!isForceUpdate && type === 'update') { onDismiss?.(); } }} > {/* Background decorative circles could be added here if we had SVGs or images */} {type === 'update' ? 'Update Tersedia' : 'Perbaikan'} {customDescription ? customDescription : (type === 'update' ? `Versi terbaru dari ${appName} tersedia di Store. Silakan buka Store untuk menginstalnya.` : 'Aplikasi saat ini sedang dalam pemeliharaan untuk peningkatan sistem. Silakan coba kembali beberapa saat lagi.')} {type === 'update' ? ( <> Update {!isForceUpdate && ( Nanti )} ) : ( <> // // // {Platform.OS === 'android' ? 'Close App' : 'Please check back later'} // // )} ); }; export default ModalUpdateMaintenance;