amalia/24-feb-26 #29
@@ -9,16 +9,18 @@ import HeaderRightPositionList from "@/components/position/headerRightPositionLi
|
||||
import HeaderRightProjectList from "@/components/project/headerProjectList";
|
||||
import Text from "@/components/Text";
|
||||
import ToastCustom from "@/components/toastCustom";
|
||||
import { apiReadOneNotification } from "@/lib/api";
|
||||
import ModalUpdateMaintenance from "@/components/ModalUpdateMaintenance";
|
||||
import { apiGetVersion, apiReadOneNotification } from "@/lib/api";
|
||||
import { pushToPage } from "@/lib/pushToPage";
|
||||
import store from "@/lib/store";
|
||||
import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import Constants from "expo-constants";
|
||||
import { getApp } from "@react-native-firebase/app";
|
||||
import { getMessaging, onMessage } from "@react-native-firebase/messaging";
|
||||
import { Redirect, router, Stack, usePathname } from "expo-router";
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect } from "react";
|
||||
import { StatusBar } from 'expo-status-bar';
|
||||
import { useEffect, useState } from "react";
|
||||
import { Easing, Notifier, NotifierComponents } from 'react-native-notifier';
|
||||
import { Provider } from "react-redux";
|
||||
import { useTheme } from "@/providers/ThemeProvider";
|
||||
@@ -27,6 +29,80 @@ export default function RootLayout() {
|
||||
const { token, decryptToken, isLoading } = useAuthSession()
|
||||
const pathname = usePathname()
|
||||
const { colors } = useTheme()
|
||||
const [modalUpdateMaintenance, setModalUpdateMaintenance] = useState(false)
|
||||
const [modalType, setModalType] = useState<'update' | 'maintenance'>('update')
|
||||
const [isForceUpdate, setIsForceUpdate] = useState(false)
|
||||
const [updateMessage, setUpdateMessage] = useState('')
|
||||
|
||||
const currentVersion = Constants.expoConfig?.version ?? '0.0.0'
|
||||
|
||||
const compareVersions = (v1: string, v2: string) => {
|
||||
const parts1 = v1.split('.').map(Number);
|
||||
const parts2 = v2.split('.').map(Number);
|
||||
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
||||
const p1 = parts1[i] || 0;
|
||||
const p2 = parts2[i] || 0;
|
||||
if (p1 < p2) return -1;
|
||||
if (p1 > p2) return 1;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
const checkVersion = async () => {
|
||||
try {
|
||||
const response = await apiGetVersion();
|
||||
if (response.success && response.data) {
|
||||
const maintenance = response.data.find((item: any) => item.id === 'mobile_maintenance')?.value === 'true';
|
||||
const latestVersion = response.data.find((item: any) => item.id === 'mobile_latest_version')?.value || '0.0.0';
|
||||
const minVersion = response.data.find((item: any) => item.id === 'mobile_minimum_version')?.value || '0.0.0';
|
||||
const message = response.data.find((item: any) => item.id === 'mobile_message_update')?.value || '';
|
||||
|
||||
if (maintenance) {
|
||||
setModalType('maintenance');
|
||||
setModalUpdateMaintenance(true);
|
||||
setIsForceUpdate(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (compareVersions(currentVersion, minVersion) === -1) {
|
||||
setModalType('update');
|
||||
setIsForceUpdate(true);
|
||||
setUpdateMessage(message);
|
||||
setModalUpdateMaintenance(true);
|
||||
} else if (compareVersions(currentVersion, latestVersion) === -1) {
|
||||
// Check if this soft update version was already dismissed
|
||||
const dismissedVersion = await AsyncStorage.getItem('dismissed_update_version');
|
||||
if (dismissedVersion !== latestVersion) {
|
||||
setModalType('update');
|
||||
setIsForceUpdate(false);
|
||||
setUpdateMessage(message);
|
||||
setModalUpdateMaintenance(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Failed to check version:', error);
|
||||
}
|
||||
};
|
||||
|
||||
checkVersion();
|
||||
}, [currentVersion]);
|
||||
|
||||
const handleDismissUpdate = async () => {
|
||||
if (!isForceUpdate) {
|
||||
try {
|
||||
const response = await apiGetVersion();
|
||||
const latestVersion = response.data.find((item: any) => item.id === 'mobile_latest_version')?.value;
|
||||
if (latestVersion) {
|
||||
await AsyncStorage.setItem('dismissed_update_version', latestVersion);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
setModalUpdateMaintenance(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleReadNotification(id: string, category: string, idContent: string, title: string) {
|
||||
try {
|
||||
@@ -246,6 +322,13 @@ export default function RootLayout() {
|
||||
</Stack>
|
||||
<StatusBar style={'light'} translucent={false} backgroundColor="black" />
|
||||
<ToastCustom />
|
||||
<ModalUpdateMaintenance
|
||||
visible={modalUpdateMaintenance}
|
||||
type={modalType}
|
||||
isForceUpdate={isForceUpdate}
|
||||
customDescription={updateMessage}
|
||||
onDismiss={handleDismissUpdate}
|
||||
/>
|
||||
</Provider>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -89,9 +89,11 @@ export default function DetailAnnouncement() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengambil data' })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ export default function CreateAnnouncement() {
|
||||
async function handleCreate() {
|
||||
try {
|
||||
setLoading(true)
|
||||
console.log('jalan')
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const fd = new FormData()
|
||||
|
||||
@@ -90,7 +91,7 @@ export default function CreateAnnouncement() {
|
||||
}
|
||||
|
||||
fd.append("data", JSON.stringify(
|
||||
{ user: hasil, groups: divisionMember, ...dataForm }
|
||||
{ user: 'apaya', groups: divisionMember, ...dataForm }
|
||||
))
|
||||
|
||||
const response = await apiCreateAnnouncement(fd)
|
||||
@@ -100,11 +101,16 @@ export default function CreateAnnouncement() {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menambahkan data', })
|
||||
router.back();
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||
const message = error?.response?.data?.message || "Tidak dapat terhubung ke server"
|
||||
|
||||
Toast.show({
|
||||
type: 'small',
|
||||
text1: message
|
||||
})
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -147,9 +147,11 @@ export default function EditAnnouncement() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
@@ -309,7 +311,7 @@ export default function EditAnnouncement() {
|
||||
<View style={[Styles.rowSpaceBetween, Styles.mv05]}>
|
||||
<Text style={[Styles.textDefaultSemiBold]}>Divisi</Text>
|
||||
</View>
|
||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, {backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
<View style={[Styles.borderAll, Styles.round05, Styles.p10, { backgroundColor: colors.card, borderColor: colors.icon + '20' }]}>
|
||||
{
|
||||
dataMember.map((item: { name: any; Division: any }, index: any) => {
|
||||
return (
|
||||
|
||||
@@ -106,9 +106,11 @@ export default function EditBanner() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -88,9 +88,11 @@ export default function CreateBanner() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan data', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -56,9 +56,11 @@ export default function BannerList() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menghapus data', })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -158,8 +158,11 @@ export default function DetailDiscussionGeneral() {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSendKomentar(false)
|
||||
}
|
||||
@@ -175,8 +178,11 @@ export default function DetailDiscussionGeneral() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSendKomentar(false)
|
||||
handleViewEditKomentar()
|
||||
@@ -193,8 +199,11 @@ export default function DetailDiscussionGeneral() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSendKomentar(false)
|
||||
setVisible(false)
|
||||
|
||||
@@ -84,9 +84,11 @@ export default function AddMemberDiscussionDetail() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan anggota', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -156,9 +156,11 @@ export default function CreateDiscussionGeneral() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -157,9 +157,11 @@ export default function EditDiscussionGeneral() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -67,8 +67,11 @@ export default function MemberDiscussionDetail() {
|
||||
await apiDeleteMemberDiscussionGeneral({ user: hasil, idUser: chooseUser.idUser }, id)
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengeluarkan anggota dari diskusi', })
|
||||
handleLoad(false)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengeluarkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -92,9 +92,11 @@ export default function AddMemberCalendarEvent() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -57,9 +57,11 @@ export default function EditEventCalendar() {
|
||||
setData({ ...response.data, dateStart: moment(response.data.dateStartFormat, 'DD-MM-YYYY').format('DD-MM-YYYY') })
|
||||
setIdCalendar(response.data.idCalendar)
|
||||
setChoose({ val: response.data.repeatEventTyper, label: valueTypeEventRepeat.find((item) => item.id == response.data.repeatEventTyper)?.name || "" })
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal mendapatkan data', })
|
||||
const message = error?.response?.data?.message || "Gagal mendapatkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,9 +156,11 @@ export default function EditEventCalendar() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah acara"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -137,9 +137,11 @@ export default function DetailEventCalendar() {
|
||||
dispatch(setUpdateCalendar({ ...update, member: !update.member }));
|
||||
}
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModalMember(false)
|
||||
}
|
||||
|
||||
@@ -83,9 +83,11 @@ export default function CreateCalendarAddMember() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal membuat acara"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -89,9 +89,11 @@ export default function DiscussionDivisionEdit() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -202,8 +202,11 @@ export default function DiscussionDetail() {
|
||||
setKomentar("")
|
||||
updateTrigger()
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSend(false);
|
||||
}
|
||||
@@ -222,8 +225,11 @@ export default function DiscussionDetail() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengedit komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSend(false);
|
||||
handleViewEditKomentar()
|
||||
@@ -243,8 +249,11 @@ export default function DiscussionDetail() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus komentar"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSend(false)
|
||||
setVisible(false)
|
||||
|
||||
@@ -81,9 +81,11 @@ export default function CreateDiscussionDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -235,9 +235,11 @@ export default function DocumentDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah nama"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingRename(false)
|
||||
setRename(false)
|
||||
@@ -258,9 +260,11 @@ export default function DocumentDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,9 +288,11 @@ export default function DocumentDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal membagikan"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setShare(false);
|
||||
}
|
||||
|
||||
@@ -120,9 +120,11 @@ export default function TaskDivisionAddFile() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -86,9 +86,11 @@ export default function AddMemberTask() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -133,9 +133,11 @@ export default function TaskDivisionAddTask() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -62,9 +62,11 @@ export default function TaskDivisionCancel() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal membatalkan kegiatan"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -80,9 +80,11 @@ export default function TaskDivisionEdit() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -80,9 +80,11 @@ export default function TaskDivisionReport() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -105,9 +105,11 @@ export default function CreateTaskDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -125,9 +125,11 @@ export default function UpdateProjectTaskDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSubmit(false)
|
||||
}
|
||||
|
||||
@@ -89,9 +89,11 @@ export default function AddMemberDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -56,9 +56,11 @@ export default function EditDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -78,9 +78,11 @@ export default function InformationDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengeluarkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
@@ -96,9 +98,11 @@ export default function InformationDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah status admin"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -94,8 +94,11 @@ export default function ReportDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, });
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -77,9 +77,11 @@ export default function CreateDivision() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingBtn(false)
|
||||
}
|
||||
|
||||
@@ -66,9 +66,11 @@ export default function CreateDivisionAddAdmin() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -112,8 +112,11 @@ export default function Report() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,9 +188,14 @@ export default function EditProfile() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengupdate data', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
|
||||
Toast.show({
|
||||
type: 'small',
|
||||
text1: message
|
||||
})
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -55,9 +55,11 @@ export default function MemberDetail() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengambil data' })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -185,9 +185,11 @@ export default function CreateMember() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -211,9 +211,11 @@ export default function EditMember() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -88,8 +88,11 @@ export default function Index() {
|
||||
const hasil = await decryptToken(String(token?.current))
|
||||
const response = await apiDeletePosition({ user: hasil, isActive: chooseData.active }, chooseData.id)
|
||||
dispatch(setUpdatePosition(!update))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengupdate data', })
|
||||
@@ -107,8 +110,11 @@ export default function Index() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSubmit(false)
|
||||
setVisibleEdit(false)
|
||||
|
||||
@@ -118,9 +118,11 @@ export default function ProjectAddFile() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -45,9 +45,11 @@ export default function AddMemberProject() {
|
||||
setIdGroup(responseGroup.data.idGroup)
|
||||
const responsemember = await apiGetUser({ user: hasil, active: "true", search: search, group: String(responseGroup.data.idGroup) })
|
||||
setData(responsemember.data.filter((i: any) => i.idUserRole != 'supadmin'))
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengambil data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,9 +88,11 @@ export default function AddMemberProject() {
|
||||
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||
router.back()
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -126,9 +126,11 @@ export default function ProjectAddTask() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -58,9 +58,11 @@ export default function ProjectCancel() {
|
||||
Toast.show({ type: 'small', text1: 'Berhasil membatalkan kegiatan', })
|
||||
router.back();
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal membatalkan kegiatan"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -77,9 +77,11 @@ export default function EditProject() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -77,9 +77,11 @@ export default function ReportProject() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -151,9 +151,11 @@ export default function CreateProject() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
|
||||
@@ -118,9 +118,11 @@ export default function UpdateProjectTask() {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingSubmit(false)
|
||||
}
|
||||
|
||||
@@ -65,9 +65,14 @@ export default function Search() {
|
||||
setDataDivisi([])
|
||||
setDataProject([])
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return Toast.show({ type: 'small', text1: 'Gagal melakukan pencarian', })
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal melakukan pencarian"
|
||||
|
||||
Toast.show({
|
||||
type: 'small',
|
||||
text1: message
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
121
components/ModalUpdateMaintenance.tsx
Normal file
121
components/ModalUpdateMaintenance.tsx
Normal file
@@ -0,0 +1,121 @@
|
||||
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<ModalUpdateMaintenanceProps> = ({
|
||||
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 (
|
||||
<Modal
|
||||
visible={visible}
|
||||
animationType="fade"
|
||||
transparent={false}
|
||||
onRequestClose={() => {
|
||||
if (!isForceUpdate && type === 'update') {
|
||||
onDismiss?.();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<View style={[Styles.modalUpdateContainer, { backgroundColor: colors.primary }]}>
|
||||
{/* Background decorative circles could be added here if we had SVGs or images */}
|
||||
<View style={Styles.modalUpdateDecorativeCircle1} />
|
||||
<View style={Styles.modalUpdateDecorativeCircle2} />
|
||||
|
||||
<View style={Styles.modalUpdateContent}>
|
||||
<Image
|
||||
source={require('@/assets/images/logo-dark.png')}
|
||||
style={Styles.modalUpdateLogo}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
|
||||
<View style={Styles.modalUpdateTextContainer}>
|
||||
<Text style={Styles.modalUpdateTitle}>
|
||||
{type === 'update' ? 'Update Tersedia' : 'Perbaikan'}
|
||||
</Text>
|
||||
<Text style={[Styles.modalUpdateDescription, { opacity: 0.8 }]}>
|
||||
{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.')}
|
||||
</Text>
|
||||
</View>
|
||||
|
||||
<View style={Styles.modalUpdateButtonContainer}>
|
||||
{type === 'update' ? (
|
||||
<>
|
||||
<TouchableOpacity
|
||||
style={[Styles.modalUpdatePrimaryButton, { backgroundColor: 'white' }]}
|
||||
onPress={handleUpdate}
|
||||
activeOpacity={0.8}
|
||||
>
|
||||
<Text style={[Styles.modalUpdatePrimaryButtonText, { color: colors.primary }]}>
|
||||
Update
|
||||
</Text>
|
||||
</TouchableOpacity>
|
||||
|
||||
{!isForceUpdate && (
|
||||
<TouchableOpacity
|
||||
style={Styles.modalUpdateSecondaryButton}
|
||||
onPress={onDismiss}
|
||||
activeOpacity={0.7}
|
||||
>
|
||||
<Text style={Styles.modalUpdateSecondaryButtonText}>Nanti</Text>
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<></>
|
||||
// <TouchableOpacity
|
||||
// style={[Styles.modalUpdatePrimaryButton, { backgroundColor: 'white' }]}
|
||||
// onPress={handleCloseApp}
|
||||
// activeOpacity={0.8}
|
||||
// >
|
||||
// <Text style={[Styles.modalUpdatePrimaryButtonText, { color: colors.primary }]}>
|
||||
// {Platform.OS === 'android' ? 'Close App' : 'Please check back later'}
|
||||
// </Text>
|
||||
// </TouchableOpacity>
|
||||
)}
|
||||
</View>
|
||||
</View>
|
||||
</View>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
|
||||
export default ModalUpdateMaintenance;
|
||||
@@ -22,7 +22,7 @@ export default function ViewLogin({ onValidate }: Props) {
|
||||
const [disableLogin, setDisableLogin] = useState(true)
|
||||
const [phone, setPhone] = useState('')
|
||||
const { signIn, encryptToken } = useAuthSession();
|
||||
const { colors, theme } = useTheme();
|
||||
const { colors, activeTheme } = useTheme();
|
||||
|
||||
const handleCheckPhone = async () => {
|
||||
try {
|
||||
@@ -38,13 +38,18 @@ export default function ViewLogin({ onValidate }: Props) {
|
||||
if (responseOtp == 200) {
|
||||
await AsyncStorage.setItem('user', response.id)
|
||||
return onValidate({ phone: `62${phone}`, otp })
|
||||
} else {
|
||||
return Toast.show({ type: 'small', text1: 'Gagal mengirim kode verifikasi', position: 'bottom' })
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return Toast.show({ type: 'small', text1: response.message, position: 'bottom' })
|
||||
}
|
||||
} catch (error) {
|
||||
return Toast.show({ type: 'small', text1: `Terjadi kesalahan, coba lagi`, position: 'bottom' })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal login"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingLogin(false)
|
||||
}
|
||||
@@ -52,11 +57,11 @@ export default function ViewLogin({ onValidate }: Props) {
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<StatusBar style={theme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||
<StatusBar style={activeTheme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||
<View style={[Styles.p20, Styles.h100]}>
|
||||
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
||||
<Image
|
||||
source={theme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||
source={activeTheme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||
style={[{ width: 300, height: 150 }]}
|
||||
width={270}
|
||||
height={110}
|
||||
@@ -82,7 +87,7 @@ export default function ViewLogin({ onValidate }: Props) {
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={{ alignItems: 'center' }}>
|
||||
<Image
|
||||
source={theme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||
source={activeTheme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||
style={{ width: 86, height: 27 }}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
|
||||
@@ -21,7 +21,7 @@ export default function ViewVerification({ phone, otp }: Props) {
|
||||
const [value, setValue] = useState('');
|
||||
const [otpFix, setOtpFix] = useState(otp)
|
||||
const { signIn, encryptToken } = useAuthSession();
|
||||
const { colors, theme } = useTheme();
|
||||
const { colors, activeTheme } = useTheme();
|
||||
|
||||
const login = async () => {
|
||||
const valueUser = await AsyncStorage.getItem('user');
|
||||
@@ -59,11 +59,11 @@ export default function ViewVerification({ phone, otp }: Props) {
|
||||
|
||||
return (
|
||||
<SafeAreaView style={{ flex: 1, backgroundColor: colors.background }}>
|
||||
<StatusBar style={theme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||
<StatusBar style={activeTheme === 'dark' ? 'light' : 'dark'} translucent={false} backgroundColor={colors.background} />
|
||||
<View style={[Styles.p20, Styles.h100]} >
|
||||
<View style={{ alignItems: "center", marginTop: 70, marginBottom: 50 }}>
|
||||
<Image
|
||||
source={theme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||
source={activeTheme === 'dark' ? require("../../assets/images/logo-dark.png") : require("../../assets/images/logo.png")}
|
||||
style={[{ width: 300, height: 150 }]}
|
||||
width={270}
|
||||
height={110}
|
||||
@@ -101,7 +101,7 @@ export default function ViewVerification({ phone, otp }: Props) {
|
||||
<View style={{ flex: 1 }} />
|
||||
<View style={[{ alignItems: 'center' }]}>
|
||||
<Image
|
||||
source={theme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||
source={activeTheme === 'dark' ? require("../../assets/images/cogniti-dark.png") : require("../../assets/images/cogniti-light.png")}
|
||||
style={{ width: 86, height: 27 }}
|
||||
resizeMode="contain"
|
||||
/>
|
||||
|
||||
@@ -38,9 +38,11 @@ export default function HeaderRightCalendarDetail({ id, idReminder }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
|
||||
@@ -40,9 +40,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
@@ -59,9 +61,11 @@ export default function HeaderRightDiscussionDetail({ id, status, isActive }: Pr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ export default function HeaderRightDivisionInfo({ id, active }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah status"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
|
||||
@@ -40,9 +40,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal membuat folder"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setLoadingFolder(false)
|
||||
setNewFolder(false)
|
||||
@@ -93,9 +95,11 @@ export default function HeaderRightDocument({ path, isMember }: { path: string,
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengunggah file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
setLoading(false)
|
||||
|
||||
@@ -71,9 +71,11 @@ export default function ModalMore({
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, });
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', });
|
||||
const message = error?.response?.data?.message || "Gagal memindahkan file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setIsCut(false);
|
||||
onClose();
|
||||
@@ -95,9 +97,11 @@ export default function ModalMore({
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, });
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', });
|
||||
const message = error?.response?.data?.message || "Gagal menyalin file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setIsCopy(false);
|
||||
onClose();
|
||||
|
||||
@@ -29,9 +29,11 @@ export function ModalNewFolder({ path, onCreated }: { path: string, onCreated: (
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal membuat folder"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
onCreated()
|
||||
setLoadingFolder(false)
|
||||
|
||||
@@ -13,20 +13,20 @@ type Props = {
|
||||
}
|
||||
|
||||
export default function EventItem({ category, title, user, jamAwal, jamAkhir, onPress }: Props) {
|
||||
const { theme, colors } = useTheme();
|
||||
const { activeTheme, colors } = useTheme();
|
||||
|
||||
const getBackgroundColor = (cat: 'purple' | 'orange') => {
|
||||
if (theme === 'dark') {
|
||||
if (activeTheme === 'dark') {
|
||||
return cat === 'orange' ? '#547792' : '#1D546D';
|
||||
}
|
||||
return cat === 'orange' ? '#D6E6F2' : '#A9B5DF';
|
||||
};
|
||||
|
||||
const getStickColor = (cat: 'purple' | 'orange') => {
|
||||
if (theme === 'dark') {
|
||||
if (activeTheme === 'dark') {
|
||||
return cat === 'orange' ? '#94B4C1' : '#5F9598';
|
||||
}
|
||||
return cat === 'orange' ? '#F5F5F5' : '#7886C7' ;
|
||||
return cat === 'orange' ? '#F5F5F5' : '#7886C7';
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -37,8 +37,11 @@ export default function HeaderRightMemberDetail({ active, id }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengupdate data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
|
||||
@@ -44,8 +44,11 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menghapus kegiatan', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error :any ) {
|
||||
console.error(error)
|
||||
const message = error?.response?.data?.message || "Gagal menghapus kegiatan"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
@@ -61,8 +64,11 @@ export default function HeaderRightProjectDetail({ id, status }: Props) {
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error :any ) {
|
||||
console.error(error)
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan link"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setAddLink(false)
|
||||
}
|
||||
|
||||
@@ -86,9 +86,11 @@ export default function SectionFile({ status, member, refreshing }: { status: nu
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -68,9 +68,11 @@ export default function SectionLink({ status, member, refreshing }: { status: nu
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus link"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -88,8 +88,11 @@ export default function SectionMember({ status, refreshing }: { status: number |
|
||||
dispatch(setUpdateProject({ ...update, member: !update.member }))
|
||||
setModal(false);
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,11 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
|
||||
setSelect(false);
|
||||
Toast.show({ type: 'small', text1: 'Berhasil mengubah data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,8 +111,11 @@ export default function SectionTanggalTugasProject({ status, member, refreshing
|
||||
setModal(false);
|
||||
Toast.show({ type: 'small', text1: 'Berhasil menghapus data', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,8 +45,11 @@ export default function HeaderRightTaskDetail({ id, division, status, isAdminDiv
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error)
|
||||
const message = error?.response?.data?.message || "Gagal menghapus tugas"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setVisible(false)
|
||||
}
|
||||
@@ -62,8 +65,11 @@ export default function HeaderRightTaskDetail({ id, division, status, isAdminDiv
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: 'Gagal menambahkan link', })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error)
|
||||
const message = error?.response?.data?.message || "Gagal menambahkan link"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setAddLink(false)
|
||||
}
|
||||
|
||||
@@ -119,9 +119,11 @@ export default function SectionFileTask({ refreshing, isMemberDivision }: { refr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus file"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -62,9 +62,11 @@ export default function SectionLinkTask({ refreshing, isMemberDivision }: { refr
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Terjadi kesalahan', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus link"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false)
|
||||
}
|
||||
|
||||
@@ -88,9 +88,11 @@ export default function SectionMemberTask({ refreshing, isAdminDivision }: { ref
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal menghapus anggota', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus anggota"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false);
|
||||
}
|
||||
|
||||
@@ -73,9 +73,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal mengubah data', })
|
||||
const message = error?.response?.data?.message || "Gagal mengubah data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setSelect(false)
|
||||
}
|
||||
@@ -109,9 +111,11 @@ export default function SectionTanggalTugasTask({ refreshing, isMemberDivision }
|
||||
} else {
|
||||
Toast.show({ type: 'small', text1: response.message, })
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (error : any ) {
|
||||
console.error(error);
|
||||
Toast.show({ type: 'small', text1: 'Gagal menghapus data', })
|
||||
const message = error?.response?.data?.message || "Gagal menghapus data"
|
||||
|
||||
Toast.show({ type: 'small', text1: message })
|
||||
} finally {
|
||||
setModal(false);
|
||||
}
|
||||
|
||||
@@ -885,7 +885,87 @@ const Styles = StyleSheet.create({
|
||||
borderRadius: 5,
|
||||
alignItems: 'center',
|
||||
gap: 10,
|
||||
}
|
||||
},
|
||||
modalUpdateContainer: {
|
||||
flex: 1,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
paddingHorizontal: 30,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
modalUpdateDecorativeCircle1: {
|
||||
position: 'absolute',
|
||||
width: 300,
|
||||
height: 300,
|
||||
borderRadius: 150,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.05)',
|
||||
top: -50,
|
||||
right: -50,
|
||||
},
|
||||
modalUpdateDecorativeCircle2: {
|
||||
position: 'absolute',
|
||||
width: 200,
|
||||
height: 200,
|
||||
borderRadius: 100,
|
||||
backgroundColor: 'rgba(255, 255, 255, 0.03)',
|
||||
bottom: -30,
|
||||
left: -30,
|
||||
},
|
||||
modalUpdateContent: {
|
||||
width: '100%',
|
||||
alignItems: 'flex-start',
|
||||
zIndex: 1,
|
||||
},
|
||||
modalUpdateLogo: {
|
||||
width: 200,
|
||||
height: 100,
|
||||
marginBottom: 40,
|
||||
alignSelf: 'center',
|
||||
},
|
||||
modalUpdateTextContainer: {
|
||||
marginBottom: 40,
|
||||
},
|
||||
modalUpdateTitle: {
|
||||
fontSize: 32,
|
||||
fontWeight: 'bold',
|
||||
color: 'white',
|
||||
marginBottom: 20,
|
||||
lineHeight: 38,
|
||||
},
|
||||
modalUpdateDescription: {
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
lineHeight: 24,
|
||||
},
|
||||
modalUpdateButtonContainer: {
|
||||
width: '100%',
|
||||
alignItems: 'center',
|
||||
},
|
||||
modalUpdatePrimaryButton: {
|
||||
width: '100%',
|
||||
paddingVertical: 15,
|
||||
borderRadius: 12,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
marginBottom: 15,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 2 },
|
||||
shadowOpacity: 0.2,
|
||||
shadowRadius: 4,
|
||||
elevation: 3,
|
||||
},
|
||||
modalUpdatePrimaryButtonText: {
|
||||
fontSize: 16,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
modalUpdateSecondaryButton: {
|
||||
paddingVertical: 10,
|
||||
},
|
||||
modalUpdateSecondaryButtonText: {
|
||||
fontSize: 16,
|
||||
color: 'white',
|
||||
fontWeight: '500',
|
||||
},
|
||||
})
|
||||
|
||||
export default Styles;
|
||||
@@ -758,4 +758,9 @@ export const apiGetNotification = async ({ user, page }: { user: string, page?:
|
||||
export const apiReadOneNotification = async (data: { user: string, id: string }) => {
|
||||
const response = await api.put(`/mobile/home/notification`, data)
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const apiGetVersion = async () => {
|
||||
const response = await api.get(`mobile/version`);
|
||||
return response.data;
|
||||
};
|
||||
Reference in New Issue
Block a user