diff --git a/.easignore b/.easignore index 0998532..80ea523 100644 --- a/.easignore +++ b/.easignore @@ -39,5 +39,7 @@ app-example x.ts x.sh -/android -/ios \ No newline at end of file + +.env + +android/ \ No newline at end of file diff --git a/.gitignore b/.gitignore index e9af40e..b169fb4 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ yarn-error.* # local env files .env*.local +#env +.env + # typescript *.tsbuildinfo @@ -41,4 +44,5 @@ x.ts x.sh google-services.json -mobile-darmasaba-firebase-adminsdk-fbsvc-f5abb292b5.json +service-account.json + diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..8a00feb --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,37 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +**Desa+** is a React Native (Expo) mobile app for village administration — managing announcements, projects, discussions, members, divisions, and documents. Primary platforms are Android and iOS. + +## Commands + +```bash +npm run start # Start Expo dev server +npm run android # Run on Android +npm run ios # Run on iOS +npm run lint # Expo lint +npm run test # Jest tests +npm run build:android # Production Android build via EAS (bumps version first) +``` + +Run a single test file: +```bash +bunx jest path/to/test.tsx --no-coverage +``` + +> Project uses **Bun** as the package manager (`bun.lock` present). Use `bun add` / `bunx` instead of `npm install` / `npx`. + +## Architecture + +See @docs/ARCHITECTURE.md + +## Key Conventions + +See @docs/CONVENTIONS.md + +## File Health + +See @docs/FILE-HEALTH.md diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 0000000..e9e3e32 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1,86 @@ +# Project Overview: Desa+ + +Desa+ is a mobile application built with React Native and Expo, designed to facilitate management and communication within villages/communities. It aims to streamline village administration, inter-community communication, and the management of essential information. + +## Key Features: +- Village announcements and information +- Community discussion forum +- Village activity calendar +- Village documentation and archives +- Project and task management +- Member and organizational structure management +- Push notifications for important updates +- Verification and authentication features + +## Technologies Used: +- **React Native**: Cross-platform mobile development framework. +- **Expo**: Platform for React Native application development. +- **Firebase**: Backend services including Authentication, Realtime Database, and Cloud Messaging. +- **Redux Toolkit**: State management. +- **React Navigation**: Application navigation. +- **TypeScript**: For type safety. + +## Building and Running: + +### Installation +1. **Clone the repository:** + ```bash + git clone + cd mobile-darmasaba + ``` +2. **Install dependencies:** + ```bash + npm install + ``` +3. **Configure environment variables:** + Create a `.env` file in the root directory and add the following variables: + ``` + URL_API= + URL_OTP= + URL_STORAGE= + URL_FIREBASE_DB= + PASS_ENC= + WA_SERVER_TOKEN= + IOS_GOOGLE_SERVICES_FILE= + ``` + +### Running the Application +- **Start development server:** + ```bash + npx expo start + ``` +- **Run on Android emulator/device:** + ```bash + npm run android + ``` +- **Run on iOS simulator/device:** + ```bash + npm run ios + ``` + +### Build Production +- **Build Android production package:** + ```bash + npm run build:android + ``` + +## Development Conventions: + +### Project Structure: +- `app/`: Main page files. +- `components/`: Reusable UI components, categorized by feature (e.g., `announcement/`, `auth/`, `discussion/`). +- `assets/`: Images and static assets. +- `constants/`: Global constants. +- `lib/`: Libraries and utilities. + +### Contribution Guidelines: +1. Fork the repository. +2. Create a new feature branch (`git checkout -b feature/FeatureName`). +3. Commit your changes (`git commit -m 'Add FeatureName feature'`). +4. Push to the branch (`git push origin feature/FeatureName`). +5. Create a pull request. + +## Platform Support: +- ✅ Android +- ✅ iOS +- ❌ Web (not yet optimized) diff --git a/Panduan-Penggunaan-Aplikasi.md b/Panduan-Penggunaan-Aplikasi.md new file mode 100644 index 0000000..406d762 --- /dev/null +++ b/Panduan-Penggunaan-Aplikasi.md @@ -0,0 +1,249 @@ +# Panduan Aplikasi Desa+ + +## Daftar Isi + +1. [Gambaran Umum Aplikasi](#gambaran-umum-aplikasi) +2. [User Roles dan Hak Akses](#user-roles-dan-hak-akses) +3. [Fitur-fitur Aplikasi](#fitur-fitur-aplikasi) +4. [Troubleshooting](#troubleshooting) + +## Gambaran Umum Aplikasi + +Aplikasi Desa+ adalah platform digital berbasis mobile yang dirancang untuk khusus untuk pegawai desa dalam mengelola data dan memantau progres kegiatan internal. Aplikasi ini menyediakan berbagai fitur seperti pengelolaan data per divisi, pemantauan kegiatan umum, forum diskusi, pengumuman, hingga manajemen folder dokumen, aplikasi ini membantu meningkatkan efisiensi kerja, koordinasi, serta transparansi di lingkungan desa. + +### Teknologi yang Digunakan + +- React Native dengan Expo +- Firebase (Authentication, Realtime Database, Cloud Messaging) +- Redux Toolkit untuk manajemen state +- TypeScript untuk type safety + +## User Roles dan Hak Akses + +Aplikasi Desa+ memiliki sistem hierarki peran pengguna sebagai berikut: + +### 1. Super Admin + +- **Hak akses:** + - Semua fitur dan fungsi dalam aplikasi + - Manajemen pengguna dengan role Wakil Super Admin, Admin, Wakil Admin, dan User + - Akses ke semua data dan fungsi administratif + +### 2. Wakil Super Admin + +- **Hak akses:** + - Manajemen pengguna dengan role Admin, Wakil Admin, dan User + - Akses ke sebagian besar fitur administratif + - Dapat mengelola banner + +### 3. Admin + +- **Hak akses:** + - Manajemen pengguna dengan role Wakil Admin dan User + - Akses ke fitur-fitur administratif dasar + - Tidak dapat mengelola Wakil Super Admin dan Super Admin + +### 4. Wakil Admin + +- **Hak akses:** + - Manajemen pengguna dengan role User + - Akses terbatas ke fitur-fitur administratif + - Tidak dapat mengelola Admin ke atas + +### 5. User + +- **Hak akses:** + - Akses ke fitur-fitur umum + - Tidak dapat mengelola pengguna lain + - Tidak dapat mengakses fungsi administratif (kecuali dalam divisi dimana pengguna tersebut adalah anggota) + +## Fitur-fitur Aplikasi + +### 1. Otentikasi (Login & Verifikasi) + +**Deskripsi:** Sistem login menggunakan nomor telepon dan verifikasi OTP (One Time Password) + +- **Fungsi:** Memverifikasi identitas pengguna sebelum mengakses aplikasi +- **Siapa yang bisa mengakses:** Semua pengguna yang terdaftar + +### 2. Dashboard/Home Screen + +**Deskripsi:** Tampilan utama aplikasi yang menampilkan informasi dan akses cepat ke berbagai fitur + +- **Fungsi:** Menyediakan ringkasan informasi desa dan akses cepat ke fitur-fitur utama +- **Siapa yang bisa mengakses:** Semua pengguna yang telah login +- **Komponen:** + - Carousel banner untuk promosi atau informasi penting + - Fitur untuk mengakses semua fitur aplikasi + - Grafik progres kegiatan + - Grafik jumlah dokumen + - Daftar kegiatan terupdate + - Daftar divisi aktif + - Daftar acara mendatang + - Diskusi terbaru + +### 3. Pencarian + +**Deskripsi:** Fitur untuk mencari anggota, kegiatan dan divisi + +- **Fungsi:** Mencari anggota, kegiatan dan divisi +- **Siapa yang bisa mengakses:** Semua pengguna + +### 4. Notifikasi + +**Deskripsi:** Sistem notifikasi untuk memberitahu pengguna tentang aktivitas penting + +- **Fungsi:** Memberitahu pengguna tentang pengumuman, komentar, atau aktivitas lainnya +- **Siapa yang bisa mengakses:** Semua pengguna + +### 5. Profil + +**Deskripsi:** Fitur untuk melihat dan mengedit informasi pribadi pengguna + +- **Fungsi:** Menampilkan dan mengelola informasi akun pengguna +- **Siapa yang bisa mengakses:** Pengguna yang bersangkutan + +### 6. Banner + +**Deskripsi:** Fitur untuk mengelola banner promosi atau informasi penting di halaman utama + +- **Fungsi:** Menampilkan informasi atau promosi penting di tampilan awal +- **Siapa yang bisa mengakses:** Super Admin, Wakil Super Admin + +### 7. Lembaga Desa + +**Deskripsi:** Fitur untuk mengelola berbagai lembaga dalam desa + +- **Fungsi:** Mengorganisir struktur organisasi desa berdasarkan lembaga +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin + - Melihat: Super Admin + +### 8. Jabatan + +**Deskripsi:** Fitur untuk mengelola posisi atau jabatan + +- **Fungsi:** Mengelola data jabatan +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Wakil Admin + - Melihat: Semua pengguna + +### 9. Anggota + +**Deskripsi:** Fitur untuk mengelola data pengguna + +- **Fungsi:** Menyimpan dan mengelola informasi tentang pengguna +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Wakil Admin + - Melihat: Semua pengguna + +### 10. Diskusi Umum + +**Deskripsi:** Forum diskusi untuk komunikasi anggota terpilih + +- **Fungsi:** Tempat berdiskusi mengenai berbagai topik yang berkaitan dengan desa +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin + - Melihat: Semua pengguna + - Berkomentar: Pengguna terpilih + +### 11. Kegiatan/Proyek + +**Deskripsi:** Fitur untuk mengelola dan melacak proyek atau kegiatan desa + +- **Fungsi:** Mengelola dan memonitor kemajuan proyek-proyek desa +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus/Membatalkan/Mengelola anggota: Super Admin, Wakil Super Admin, Admin + - Mengelola detail (file, task, link, laporan) : Super Admin, Wakil Super Admin, Admin, Anggota dari kegiatan + - Melihat: Semua pengguna +- **Status Kegiatan:** + - Segera: Proyek yang akan segera dimulai + - Dikerjakan: Proyek yang sedang dalam proses pengerjaan + - Selesai: Proyek yang telah selesai + - Batal: Proyek yang dibatalkan + +### 12. Pengumuman + +**Deskripsi:** Fitur untuk membuat, melihat, dan mengelola pengumuman desa + +- **Fungsi:** Menyebarkan informasi penting kepada anggota divisi terpilih +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin + - Melihat: + - Super admin: Semua pengumuman + - Wakil super admin & admin : Pengumuman sesuai lembaga desa + - Lainnya: Pengumuman yang ditujukan ke divisi mereka + +### 13. Divisi + +**Deskripsi:** Fitur untuk mengelola data desa berdasarkan divisi + +- **Fungsi:** Mengorganisir tugas-tugas berdasarkan divisi-divisi tertentu +- **Catatan:** Anggota divisi (role : Wakil Admin dan User) yg diangkat menjadi "Admin Divisi", mendapat akses khusus untuk mengelola divisi tersebut +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin + - Edit Divisi / Non aktifkan Divisi tertentu / Mengelola Anggota divisi tertentu : Super Admin, Wakil Super Admin, Admin, Admin Divisi + - Laporan semua divisi : Super Admin, Wakil Super Admin + - Laporan divisi tertentu : semua pengguna + - Melihat: Semua pengguna + +### 14. Diskusi Divisi + +**Deskripsi:** Forum diskusi khusus untuk masing-masing divisi + +- **Fungsi:** Tempat berdiskusi secara internal dalam divisi +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Admin Divisi + - Memberi komentar : Super Admin, Wakil Super Admin, Admin, Anggota divisi + - Melihat: Semua pengguna + +### 15. Tugas Divisi + +**Deskripsi:** Fitur untuk mengelola tugas-tugas dalam masing-masing divisi + +- **Fungsi:** Menetapkan dan melacak tugas-tugas yang harus diselesaikan oleh anggota divisi +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Admin Divisi + - Mengelola detail (file, task, link, laporan) : Super Admin, Wakil Super Admin, Admin, Anggota divisi + - Melihat: Semua pengguna + +### 16. Dokumen Divisi + +**Deskripsi:** Sistem manajemen dokumen untuk menyimpan dan mengelola file-file disetiap divisi + +- **Fungsi:** Menyimpan dokumen penting dalam struktur folder disetiap divisi +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Anggota divisi + - Melihat: Semua pengguna + +### 17. Kalender/Acara Divisi + +**Deskripsi:** Fitur untuk menjadwalkan dan mengelola acara-acara desa disetiap divisi + +- **Fungsi:** Menjadwalkan kegiatan dan acara penting desa disetiap divisi +- **Siapa yang bisa mengakses:** + - Pembuatan/Edit/Hapus: Super Admin, Wakil Super Admin, Admin, Anggota divisi + - Melihat: Semua pengguna + - Riwayat: Semua pengguna + +## Troubleshooting + +### Masalah Login + +- Pastikan nomor telepon yang dimasukkan sudah benar dan terdaftar +- Pastikan koneksi internet stabil saat menerima OTP +- Jika tidak menerima OTP, coba kirim ulang setelah beberapa menit + +### Tidak Bisa Mengakses Fitur Tertentu + +- Pastikan peran Anda memiliki hak akses ke fitur tersebut +- Beberapa fitur hanya tersedia untuk peran tertentu (misalnya Admin ke atas) + +### Lupa Password + +- Aplikasi ini menggunakan sistem login OTP, jadi tidak ada password yang disimpan +- Cukup gunakan nomor telepon dan minta OTP kembali + +## Dukungan dan Bantuan + +Jika Anda mengalami masalah atau memiliki pertanyaan tentang penggunaan aplikasi, silakan hubungi tim pengembang aplikasi. diff --git a/QWEN.md b/QWEN.md new file mode 100644 index 0000000..aa15d4a --- /dev/null +++ b/QWEN.md @@ -0,0 +1,153 @@ +# Desa+ Mobile Application - Project Overview + +## Project Summary +Desa+ is a comprehensive village/desa management mobile application built with React Native and Expo. The application serves as a digital platform for village administration, community communication, and information management. It provides various features to facilitate village governance, resident communication, and administrative tasks. + +## Architecture & Technology Stack +- **Framework**: React Native with Expo (SDK 53) +- **State Management**: Redux Toolkit with React-Redux +- **Navigation**: Expo Router with React Navigation +- **Backend Services**: Firebase (Authentication, Realtime Database, Cloud Messaging) +- **UI Components**: Custom-built components with React Native elements +- **Language**: TypeScript for type safety +- **Build System**: EAS (Expo Application Service) for builds and deployments + +## Key Features +- Announcement and village information system +- Community discussion forums +- Village event calendar +- Document management and archiving +- Project and task management +- Member and organizational structure management +- Push notifications for important updates +- Verification and authentication features + +## Project Structure +``` +├── app/ # Application routes and pages (Expo Router) +│ ├── (application)/ # Main application screens +│ │ ├── announcement/ +│ │ ├── banner/ +│ │ ├── discussion/ +│ │ ├── division/ +│ │ ├── group/ +│ │ ├── member/ +│ │ ├── position/ +│ │ ├── project/ +│ │ ├── _layout.tsx +│ │ ├── edit-profile.tsx +│ │ ├── feature.tsx +│ │ ├── home.tsx +│ │ ├── notification.tsx +│ │ ├── profile.tsx +│ │ └── search.tsx +│ ├── _layout.tsx # Root layout +│ ├── index.tsx # Splash/login screen +│ ├── verification.tsx # OTP verification screen +├── components/ # Reusable UI components +│ ├── announcement/ +│ ├── auth/ +│ ├── banner/ +│ ├── calendar/ +│ ├── discussion/ +│ ├── division/ +│ ├── document/ +│ ├── group/ +│ ├── home/ +│ ├── member/ +│ ├── position/ +│ ├── project/ +│ ├── task/ +│ ├── alertKonfirmasi.ts +│ ├── AppHeader.tsx +│ ├── Text.tsx +│ └── ... (many more components) +├── constants/ # Constants and styles +│ ├── Colors.ts +│ ├── ColorsStatus.ts +│ ├── ConstEnv.ts +│ ├── Headers.ts +│ ├── RoleUser.ts +│ ├── Styles.ts +│ └── ... (other constants) +├── assets/ # Static assets (images, fonts) +├── lib/ # Business logic and API utilities +├── providers/ # Context providers (AuthProvider) +├── android/ # Android native code +├── ios/ # iOS native code +├── scripts/ # Build and utility scripts +├── index.js # Entry point +├── app.config.js # Expo configuration +├── package.json # Dependencies and scripts +└── eas.json # EAS build configuration +``` + +## Environment Configuration +The application uses environment variables defined in a `.env` file: +- `URL_API` - API endpoint +- `URL_OTP` - OTP service endpoint +- `URL_STORAGE` - Storage endpoint +- `URL_FIREBASE_DB` - Firebase database URL +- `PASS_ENC` - Encryption password +- `WA_SERVER_TOKEN` - WhatsApp server token +- `IOS_GOOGLE_SERVICES_FILE` - Path to iOS Google services file + +## Building and Running + +### Development +1. Install dependencies: + ```bash + npm install + ``` + +2. Run the development server: + ```bash + npx expo start + ``` + +3. For platform-specific builds: + - Android: `npm run android` + - iOS: `npm run ios` + - Web: `npm run web` + +### Production Builds +- Android: `npm run build:android` (uses EAS to build an app bundle) + +### Testing +- Run tests: `npm run test` + +### Linting +- Check code quality: `npm run lint` + +## Key Dependencies +- `@react-native-firebase/*` - Firebase integration +- `@react-navigation/*` - Navigation solutions +- `@reduxjs/toolkit` - State management +- `expo-router` - File-based routing +- `react-native-gesture-handler` - Touch gesture support +- `react-native-reanimated` - Advanced animations +- `react-native-svg` - SVG rendering support + +## Development Conventions +- Uses TypeScript for type safety +- Implements custom styling through the Styles.ts constant file +- Follows Expo's file-based routing convention +- Uses Redux Toolkit for centralized state management +- Implements custom components in the components directory +- Uses absolute imports with @/ alias (e.g., "@/components/...") +- Implements Firebase for authentication and real-time data + +## Deployment +- Uses EAS for building and submitting to app stores +- Supports both Android (APK and App Bundle) and iOS (TestFlight/App Store) +- Configured for internal testing, preview, and production distributions + +## Special Features +- Background message handling for push notifications +- Biometric authentication support +- Image picking and media library access +- Document picker functionality +- Date/time pickers with localization +- Custom toast notifications +- Carousel components for featured content +- Data visualization with charts \ No newline at end of file diff --git a/README.md b/README.md index cd4feb8..b9a9edb 100644 --- a/README.md +++ b/README.md @@ -1,50 +1,114 @@ -# Welcome to your Expo app 👋 +# Desa+ -This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). +Desa+ (Desa Plus) adalah aplikasi mobile berbasis React Native yang dikembangkan dengan Expo untuk membantu pengelolaan dan komunikasi di lingkungan desa/kelurahan. Aplikasi ini menyediakan berbagai fitur untuk memudahkan administrasi desa, komunikasi antar warga, dan pengelolaan informasi penting. -## Get started +## Fitur Utama -1. Install dependencies +- 📢 Pengumuman dan informasi desa +- 💬 Forum diskusi komunitas +- 📅 Kalender kegiatan desa +- 📄 Dokumentasi dan arsip desa +- 📊 Pengelolaan proyek dan tugas desa +- 👥 Manajemen anggota dan struktur organisasi +- 📱 Notifikasi push untuk informasi penting +- 🎯 Fitur verifikasi dan otentikasi +## Teknologi yang Digunakan + +- [React Native](https://reactnative.dev/) - Framework mobile cross-platform +- [Expo](https://expo.dev/) - Platform pengembangan aplikasi React Native +- [Firebase](https://firebase.google.com/) - Backend services (Authentication, Realtime Database, Cloud Messaging) +- [Redux Toolkit](https://redux-toolkit.js.org/) - State management +- [React Navigation](https://reactnavigation.org/) - Navigasi aplikasi +- [TypeScript](https://www.typescriptlang.org/) - Type safety + +## Instalasi + +1. Clone repository ini + ```bash + git clone + cd mobile-darmasaba + ``` + +2. Install dependencies ```bash npm install ``` -2. Start the app - - ```bash - npx expo start +3. Konfigurasi environment variables + Buat file `.env` di root direktori dan tambahkan variabel berikut: + ``` + URL_API= + URL_OTP= + URL_STORAGE= + URL_FIREBASE_DB= + PASS_ENC= + WA_SERVER_TOKEN= + IOS_GOOGLE_SERVICES_FILE= ``` -In the output, you'll find options to open the app in a +4. Jalankan aplikasi + ```bash + npx expo start + ``` -- [development build](https://docs.expo.dev/develop/development-builds/introduction/) -- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) -- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) -- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo +## Struktur Proyek -You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). - -## Get a fresh project - -When you're ready, run: - -```bash -npm run reset-project +``` +├── app/ # File-file halaman utama +├── components/ # Komponen reusable +│ ├── announcement/ # Komponen pengumuman +│ ├── auth/ # Komponen otentikasi +│ ├── discussion/ # Komponen forum diskusi +│ ├── document/ # Komponen dokumentasi +│ ├── project/ # Komponen pengelolaan proyek +│ └── ... +├── assets/ # Gambar dan aset statis +├── constants/ # Konstanta global +├── lib/ # Library dan utilitas +└── ... ``` -This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. +## Platform Support -## Learn more +Aplikasi ini didukung untuk: +- ✅ Android +- ✅ iOS +- ❌ Web (belum dioptimalkan) -To learn more about developing your project with Expo, look at the following resources: +## Development -- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). -- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. +Untuk menjalankan aplikasi di masing-masing platform: -## Join the community +### Android +```bash +npm run android +``` -Join our community of developers creating universal apps. +### iOS +```bash +npm run ios +``` -- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. -- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. +### Build Production + +Untuk membuat build production Android: +```bash +npm run build:android +``` + +## Kontribusi + +1. Fork repository ini +2. Buat branch fitur baru (`git checkout -b fitur/NamaFitur`) +3. Commit perubahan Anda (`git commit -m 'Tambahkan fitur NamaFitur'`) +4. Push ke branch (`git push origin fitur/NamaFitur`) +5. Buat pull request + +## Lisensi + +Proyek ini dilisensikan di bawah lisensi MIT - lihat file [LICENSE](LICENSE) untuk detail selengkapnya. + +## Dukungan + +Jika Anda menemukan masalah atau memiliki pertanyaan, silakan buka issue di repository ini. diff --git a/__tests__/ErrorBoundary-test.tsx b/__tests__/ErrorBoundary-test.tsx new file mode 100644 index 0000000..820db69 --- /dev/null +++ b/__tests__/ErrorBoundary-test.tsx @@ -0,0 +1,77 @@ +import React from 'react'; +import { render, fireEvent } from '@testing-library/react-native'; +import ErrorBoundary from '@/components/ErrorBoundary'; + +// Komponen yang sengaja throw error saat render +const BrokenComponent = () => { + throw new Error('Test error boundary!'); +}; + +// Komponen normal +const NormalComponent = () => <>; + +// Suppress React's error boundary console output selama test + +beforeEach(() => { + jest.spyOn(console, 'error').mockImplementation(() => {}); +}); + +afterEach(() => { + (console.error as jest.Mock).mockRestore(); +}); + +describe('ErrorBoundary', () => { + it('merender children dengan normal jika tidak ada error', () => { + // Tidak boleh throw dan tidak menampilkan teks error + const { queryByText } = render( + + + + ); + expect(queryByText('Terjadi Kesalahan')).toBeNull(); + }); + + it('menampilkan UI fallback ketika child throw error', () => { + const { getByText } = render( + + + + ); + expect(getByText('Terjadi Kesalahan')).toBeTruthy(); + }); + + it('menampilkan pesan error yang dilempar', () => { + const { getByText } = render( + + + + ); + expect(getByText('Test error boundary!')).toBeTruthy(); + }); + + it('merender custom fallback jika prop fallback diberikan', () => { + const { getByText } = render( + }> + + + ); + // Custom fallback fragment kosong — pastikan teks default tidak muncul + expect(() => getByText('Terjadi Kesalahan')).toThrow(); + }); + + it('mereset error state saat tombol Coba Lagi ditekan', () => { + const { getByText } = render( + + + + ); + + const button = getByText('Coba Lagi'); + expect(button).toBeTruthy(); + + // Tekan tombol reset — hasError kembali false, BrokenComponent throw lagi + // sehingga fallback muncul kembali (membuktikan reset berjalan) + fireEvent.press(button); + expect(getByText('Terjadi Kesalahan')).toBeTruthy(); + }); +}); diff --git a/android/app/build.gradle b/android/app/build.gradle index d72ff57..79eea55 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -92,8 +92,8 @@ android { applicationId 'mobiledarmasaba.app' minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 1 - versionName "1.0.0" + versionCode 21 + versionName "2.2.0" } signingConfigs { debug { diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 7d0060e..303e9d2 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,9 @@ + + + diff --git a/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png b/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png index aa3c1ee..3b89a92 100644 Binary files a/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png and b/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png differ diff --git a/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png b/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png index c0f2efa..14ad2be 100644 Binary files a/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png and b/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png differ diff --git a/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png b/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png index 512203e..5a1603b 100644 Binary files a/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png and b/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png differ diff --git a/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png b/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png index 0d568ee..21736c3 100644 Binary files a/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png and b/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png differ diff --git a/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png b/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png index 2972681..8d3aee3 100644 Binary files a/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png and b/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp index 6dedfd7..02cacc6 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp index 76c44ed..82d26df 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.webp differ diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp index b927d9e..26470b1 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp and b/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp index 7b50255..13f42b9 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp index 05999d9..8183975 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.webp differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp index 4b4da61..ee7ebfd 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp and b/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp index 26120a2..49e490d 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp index ee305c9..1a79686 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.webp differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp index c7c0362..7c72465 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp index aeb59d6..27a12fa 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp index efa9d2b..6f40958 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.webp differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp index a988a8c..b422de5 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp index 03d1a79..134c474 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp index a6196a6..d9d4cfa 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.webp differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp index 3e85d31..bc7a885 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/android/app/src/main/res/values/strings.xml b/android/app/src/main/res/values/strings.xml index 6fe43b0..323157f 100644 --- a/android/app/src/main/res/values/strings.xml +++ b/android/app/src/main/res/values/strings.xml @@ -1,5 +1,5 @@ - mobile-darmasaba + Desa+ automatic contain false diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 819335c..3e5d436 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,9 +1,9 @@