diff --git a/app/(application)/_layout.tsx b/app/(application)/_layout.tsx
index 2795722..3b32f68 100644
--- a/app/(application)/_layout.tsx
+++ b/app/(application)/_layout.tsx
@@ -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() {
+
)
}
diff --git a/app/(application)/announcement/[id].tsx b/app/(application)/announcement/[id].tsx
index c786929..1c62559 100644
--- a/app/(application)/announcement/[id].tsx
+++ b/app/(application)/announcement/[id].tsx
@@ -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)
}
diff --git a/app/(application)/announcement/create.tsx b/app/(application)/announcement/create.tsx
index ea8bccc..98c5a3b 100644
--- a/app/(application)/announcement/create.tsx
+++ b/app/(application)/announcement/create.tsx
@@ -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)
}
diff --git a/app/(application)/announcement/edit/[id].tsx b/app/(application)/announcement/edit/[id].tsx
index 20de0bb..60c850d 100644
--- a/app/(application)/announcement/edit/[id].tsx
+++ b/app/(application)/announcement/edit/[id].tsx
@@ -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() {
Divisi
-
+
{
dataMember.map((item: { name: any; Division: any }, index: any) => {
return (
diff --git a/app/(application)/banner/[id].tsx b/app/(application)/banner/[id].tsx
index 424cbae..a80d1fa 100644
--- a/app/(application)/banner/[id].tsx
+++ b/app/(application)/banner/[id].tsx
@@ -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)
}
diff --git a/app/(application)/banner/create.tsx b/app/(application)/banner/create.tsx
index 1e092cb..5f769ae 100644
--- a/app/(application)/banner/create.tsx
+++ b/app/(application)/banner/create.tsx
@@ -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)
}
diff --git a/app/(application)/banner/index.tsx b/app/(application)/banner/index.tsx
index 8b1a455..dc6ce62 100644
--- a/app/(application)/banner/index.tsx
+++ b/app/(application)/banner/index.tsx
@@ -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)
}
diff --git a/app/(application)/discussion/[id].tsx b/app/(application)/discussion/[id].tsx
index 9a4e242..e47e18a 100644
--- a/app/(application)/discussion/[id].tsx
+++ b/app/(application)/discussion/[id].tsx
@@ -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)
diff --git a/app/(application)/discussion/add-member/[id].tsx b/app/(application)/discussion/add-member/[id].tsx
index 2dd0775..f60275f 100644
--- a/app/(application)/discussion/add-member/[id].tsx
+++ b/app/(application)/discussion/add-member/[id].tsx
@@ -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)
}
diff --git a/app/(application)/discussion/create.tsx b/app/(application)/discussion/create.tsx
index c153e27..421c1ca 100644
--- a/app/(application)/discussion/create.tsx
+++ b/app/(application)/discussion/create.tsx
@@ -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)
}
diff --git a/app/(application)/discussion/edit/[id].tsx b/app/(application)/discussion/edit/[id].tsx
index 767f7c8..5d1641e 100644
--- a/app/(application)/discussion/edit/[id].tsx
+++ b/app/(application)/discussion/edit/[id].tsx
@@ -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)
}
diff --git a/app/(application)/discussion/member/[id].tsx b/app/(application)/discussion/member/[id].tsx
index 59999a7..7dae308 100644
--- a/app/(application)/discussion/member/[id].tsx
+++ b/app/(application)/discussion/member/[id].tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/add-member.tsx b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/add-member.tsx
index 0ed576c..332ad30 100644
--- a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/add-member.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/add-member.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/edit.tsx b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/edit.tsx
index 0d6b753..78363a0 100644
--- a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/edit.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/edit.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/index.tsx b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/index.tsx
index 5bdf203..9574196 100644
--- a/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/index.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/calendar/[detail]/index.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/calendar/create-member.tsx b/app/(application)/division/[id]/(fitur-division)/calendar/create-member.tsx
index e3d1c17..060268c 100644
--- a/app/(application)/division/[id]/(fitur-division)/calendar/create-member.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/calendar/create-member.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/edit.tsx b/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/edit.tsx
index 6df69f2..360a9d3 100644
--- a/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/edit.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/edit.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/index.tsx b/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/index.tsx
index 7344bc8..e85030f 100644
--- a/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/index.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/discussion/[detail]/index.tsx
@@ -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)
diff --git a/app/(application)/division/[id]/(fitur-division)/discussion/create.tsx b/app/(application)/division/[id]/(fitur-division)/discussion/create.tsx
index 2e1c6d7..61d1b0a 100644
--- a/app/(application)/division/[id]/(fitur-division)/discussion/create.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/discussion/create.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/document/index.tsx b/app/(application)/division/[id]/(fitur-division)/document/index.tsx
index 5db917c..5104754 100644
--- a/app/(application)/division/[id]/(fitur-division)/document/index.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/document/index.tsx
@@ -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);
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-file.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-file.tsx
index 82a5975..52c32f7 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-file.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-file.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-member.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-member.tsx
index 84d6dca..d212b12 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-member.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-member.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-task.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-task.tsx
index 3abd52b..1fb4964 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-task.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/add-task.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/cancel.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/cancel.tsx
index d9d0254..d728f82 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/cancel.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/cancel.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/edit.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/edit.tsx
index eaf71b6..9a17686 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/edit.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/edit.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/[detail]/report.tsx b/app/(application)/division/[id]/(fitur-division)/task/[detail]/report.tsx
index 5b8ba7e..8856374 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/[detail]/report.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/[detail]/report.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/create.tsx b/app/(application)/division/[id]/(fitur-division)/task/create.tsx
index 66b587a..f6d2b34 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/create.tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/create.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/(fitur-division)/task/update/[detail].tsx b/app/(application)/division/[id]/(fitur-division)/task/update/[detail].tsx
index 475e7b0..70c4132 100644
--- a/app/(application)/division/[id]/(fitur-division)/task/update/[detail].tsx
+++ b/app/(application)/division/[id]/(fitur-division)/task/update/[detail].tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/add-member.tsx b/app/(application)/division/[id]/add-member.tsx
index 9218098..7c959d5 100644
--- a/app/(application)/division/[id]/add-member.tsx
+++ b/app/(application)/division/[id]/add-member.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/edit.tsx b/app/(application)/division/[id]/edit.tsx
index 478d1e3..54901e6 100644
--- a/app/(application)/division/[id]/edit.tsx
+++ b/app/(application)/division/[id]/edit.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/info.tsx b/app/(application)/division/[id]/info.tsx
index 0132cb9..b8907be 100644
--- a/app/(application)/division/[id]/info.tsx
+++ b/app/(application)/division/[id]/info.tsx
@@ -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)
}
diff --git a/app/(application)/division/[id]/report.tsx b/app/(application)/division/[id]/report.tsx
index cadbdf0..e21d661 100644
--- a/app/(application)/division/[id]/report.tsx
+++ b/app/(application)/division/[id]/report.tsx
@@ -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 })
}
}
diff --git a/app/(application)/division/create.tsx b/app/(application)/division/create.tsx
index 516951a..74170da 100644
--- a/app/(application)/division/create.tsx
+++ b/app/(application)/division/create.tsx
@@ -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)
}
diff --git a/app/(application)/division/create/add-admin-division.tsx b/app/(application)/division/create/add-admin-division.tsx
index b8618a8..7c7950d 100644
--- a/app/(application)/division/create/add-admin-division.tsx
+++ b/app/(application)/division/create/add-admin-division.tsx
@@ -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)
}
diff --git a/app/(application)/division/report.tsx b/app/(application)/division/report.tsx
index 61399bd..aebc19e 100644
--- a/app/(application)/division/report.tsx
+++ b/app/(application)/division/report.tsx
@@ -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 })
}
}
diff --git a/app/(application)/edit-profile.tsx b/app/(application)/edit-profile.tsx
index 8f8e9e9..bc544f9 100644
--- a/app/(application)/edit-profile.tsx
+++ b/app/(application)/edit-profile.tsx
@@ -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)
}
diff --git a/app/(application)/member/[id].tsx b/app/(application)/member/[id].tsx
index 811ca10..71c0165 100644
--- a/app/(application)/member/[id].tsx
+++ b/app/(application)/member/[id].tsx
@@ -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)
}
diff --git a/app/(application)/member/create.tsx b/app/(application)/member/create.tsx
index dfaed74..91efcd7 100644
--- a/app/(application)/member/create.tsx
+++ b/app/(application)/member/create.tsx
@@ -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)
}
diff --git a/app/(application)/member/edit/[id].tsx b/app/(application)/member/edit/[id].tsx
index 8880a51..cb45140 100644
--- a/app/(application)/member/edit/[id].tsx
+++ b/app/(application)/member/edit/[id].tsx
@@ -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)
}
diff --git a/app/(application)/position/index.tsx b/app/(application)/position/index.tsx
index a2f98e6..47fe3a9 100644
--- a/app/(application)/position/index.tsx
+++ b/app/(application)/position/index.tsx
@@ -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)
diff --git a/app/(application)/project/[id]/add-file.tsx b/app/(application)/project/[id]/add-file.tsx
index cdde484..dd88cab 100644
--- a/app/(application)/project/[id]/add-file.tsx
+++ b/app/(application)/project/[id]/add-file.tsx
@@ -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)
}
diff --git a/app/(application)/project/[id]/add-member.tsx b/app/(application)/project/[id]/add-member.tsx
index e177d93..10af1ab 100644
--- a/app/(application)/project/[id]/add-member.tsx
+++ b/app/(application)/project/[id]/add-member.tsx
@@ -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)
}
diff --git a/app/(application)/project/[id]/add-task.tsx b/app/(application)/project/[id]/add-task.tsx
index cfe51da..2672b0c 100644
--- a/app/(application)/project/[id]/add-task.tsx
+++ b/app/(application)/project/[id]/add-task.tsx
@@ -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)
}
diff --git a/app/(application)/project/[id]/cancel.tsx b/app/(application)/project/[id]/cancel.tsx
index 8246be5..6f73528 100644
--- a/app/(application)/project/[id]/cancel.tsx
+++ b/app/(application)/project/[id]/cancel.tsx
@@ -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)
}
diff --git a/app/(application)/project/[id]/edit.tsx b/app/(application)/project/[id]/edit.tsx
index 5d4c941..50fc0c6 100644
--- a/app/(application)/project/[id]/edit.tsx
+++ b/app/(application)/project/[id]/edit.tsx
@@ -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)
}
diff --git a/app/(application)/project/[id]/report.tsx b/app/(application)/project/[id]/report.tsx
index d3e102d..77f67c7 100644
--- a/app/(application)/project/[id]/report.tsx
+++ b/app/(application)/project/[id]/report.tsx
@@ -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)
}
diff --git a/app/(application)/project/create.tsx b/app/(application)/project/create.tsx
index 83dbfd7..34de7be 100644
--- a/app/(application)/project/create.tsx
+++ b/app/(application)/project/create.tsx
@@ -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)
}
diff --git a/app/(application)/project/update/[detail].tsx b/app/(application)/project/update/[detail].tsx
index f0e75bb..fe77ee8 100644
--- a/app/(application)/project/update/[detail].tsx
+++ b/app/(application)/project/update/[detail].tsx
@@ -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)
}
diff --git a/app/(application)/search.tsx b/app/(application)/search.tsx
index 401bfa7..6541b76 100644
--- a/app/(application)/search.tsx
+++ b/app/(application)/search.tsx
@@ -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
+ })
}
}
diff --git a/components/ModalUpdateMaintenance.tsx b/components/ModalUpdateMaintenance.tsx
new file mode 100644
index 0000000..c278d98
--- /dev/null
+++ b/components/ModalUpdateMaintenance.tsx
@@ -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 = ({
+ 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;
diff --git a/components/auth/viewLogin.tsx b/components/auth/viewLogin.tsx
index 8173817..92068f1 100644
--- a/components/auth/viewLogin.tsx
+++ b/components/auth/viewLogin.tsx
@@ -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 (
-
+
diff --git a/components/auth/viewVerification.tsx b/components/auth/viewVerification.tsx
index 0dc96bf..e9a213d 100644
--- a/components/auth/viewVerification.tsx
+++ b/components/auth/viewVerification.tsx
@@ -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 (
-
+
diff --git a/components/calendar/headerCalendarDetail.tsx b/components/calendar/headerCalendarDetail.tsx
index b7a2839..9e3cefe 100644
--- a/components/calendar/headerCalendarDetail.tsx
+++ b/components/calendar/headerCalendarDetail.tsx
@@ -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)
}
diff --git a/components/discussion/headerDiscussionDetail.tsx b/components/discussion/headerDiscussionDetail.tsx
index 454e24a..1d5a200 100644
--- a/components/discussion/headerDiscussionDetail.tsx
+++ b/components/discussion/headerDiscussionDetail.tsx
@@ -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)
}
diff --git a/components/division/headerDivisionInfo.tsx b/components/division/headerDivisionInfo.tsx
index 7091161..b6c113d 100644
--- a/components/division/headerDivisionInfo.tsx
+++ b/components/division/headerDivisionInfo.tsx
@@ -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)
}
diff --git a/components/document/headerDocument.tsx b/components/document/headerDocument.tsx
index 8837ad4..b3a3a40 100644
--- a/components/document/headerDocument.tsx
+++ b/components/document/headerDocument.tsx
@@ -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)
diff --git a/components/document/modalMore.tsx b/components/document/modalMore.tsx
index 2f82955..2d4a2a5 100644
--- a/components/document/modalMore.tsx
+++ b/components/document/modalMore.tsx
@@ -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();
diff --git a/components/document/modalNewFolder.tsx b/components/document/modalNewFolder.tsx
index 5635e12..a790c74 100644
--- a/components/document/modalNewFolder.tsx
+++ b/components/document/modalNewFolder.tsx
@@ -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)
diff --git a/components/eventItem.tsx b/components/eventItem.tsx
index e780786..10117cc 100644
--- a/components/eventItem.tsx
+++ b/components/eventItem.tsx
@@ -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 (
diff --git a/components/member/headerMemberDetail.tsx b/components/member/headerMemberDetail.tsx
index 6e30e10..3b8044c 100644
--- a/components/member/headerMemberDetail.tsx
+++ b/components/member/headerMemberDetail.tsx
@@ -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)
}
diff --git a/components/project/headerProjectDetail.tsx b/components/project/headerProjectDetail.tsx
index 3f5a562..d29f084 100644
--- a/components/project/headerProjectDetail.tsx
+++ b/components/project/headerProjectDetail.tsx
@@ -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)
}
diff --git a/components/project/sectionFile.tsx b/components/project/sectionFile.tsx
index 32f29ce..c4643dd 100644
--- a/components/project/sectionFile.tsx
+++ b/components/project/sectionFile.tsx
@@ -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)
}
diff --git a/components/project/sectionLink.tsx b/components/project/sectionLink.tsx
index ab5a749..5685007 100644
--- a/components/project/sectionLink.tsx
+++ b/components/project/sectionLink.tsx
@@ -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)
}
diff --git a/components/project/sectionMember.tsx b/components/project/sectionMember.tsx
index 5050309..9999ec5 100644
--- a/components/project/sectionMember.tsx
+++ b/components/project/sectionMember.tsx
@@ -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 })
}
}
diff --git a/components/project/sectionTanggalTugas.tsx b/components/project/sectionTanggalTugas.tsx
index a5619fa..183adee 100644
--- a/components/project/sectionTanggalTugas.tsx
+++ b/components/project/sectionTanggalTugas.tsx
@@ -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 })
}
}
diff --git a/components/task/headerTaskDetail.tsx b/components/task/headerTaskDetail.tsx
index 83fe4db..6d1e29c 100644
--- a/components/task/headerTaskDetail.tsx
+++ b/components/task/headerTaskDetail.tsx
@@ -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)
}
diff --git a/components/task/sectionFileTask.tsx b/components/task/sectionFileTask.tsx
index c55a0ad..66d8675 100644
--- a/components/task/sectionFileTask.tsx
+++ b/components/task/sectionFileTask.tsx
@@ -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)
}
diff --git a/components/task/sectionLinkTask.tsx b/components/task/sectionLinkTask.tsx
index 5c08587..db89d58 100644
--- a/components/task/sectionLinkTask.tsx
+++ b/components/task/sectionLinkTask.tsx
@@ -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)
}
diff --git a/components/task/sectionMemberTask.tsx b/components/task/sectionMemberTask.tsx
index 7e2cc45..61f3f0d 100644
--- a/components/task/sectionMemberTask.tsx
+++ b/components/task/sectionMemberTask.tsx
@@ -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);
}
diff --git a/components/task/sectionTanggalTugasTask.tsx b/components/task/sectionTanggalTugasTask.tsx
index e365afd..c23022d 100644
--- a/components/task/sectionTanggalTugasTask.tsx
+++ b/components/task/sectionTanggalTugasTask.tsx
@@ -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);
}
diff --git a/constants/Styles.ts b/constants/Styles.ts
index 5895d8f..759d4f9 100644
--- a/constants/Styles.ts
+++ b/constants/Styles.ts
@@ -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;
\ No newline at end of file
diff --git a/lib/api.ts b/lib/api.ts
index 9ce5413..ad33ea3 100644
--- a/lib/api.ts
+++ b/lib/api.ts
@@ -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;
};
\ No newline at end of file