Enhance UI, implement new features, and fix various issues - #51
Conversation
Refactor build configuration and fix jsEngine issues
UI improvements for all screens
Add background running applications and improve crash safety
Fixed back button exitting from app issue
Chat feature
eas build workflow change
transfer project to organization
- Set handling Contactus form data Co-authored-by: Lal Pushpakumaran <161225569+LPK98@users.noreply.github.com>
Implement dashboard announcements, safety indicators, and new pages
…nd WeaponRequestCard components
There was a problem hiding this comment.
Pull request overview
This PR significantly expands the app’s feature set and refreshes multiple screens, adding Firebase-backed chat with media, announcements on the dashboard, and more robust background duty/location tracking, along with several UI/theme updates and new routes (Contact Us / FAQ / Translate).
Changes:
- Add real-time chat (Firestore) with image/audio upload (Firebase Storage) and new chat UI components.
- Improve duty/background location tracking bootstrapping + permissions/error handling; update Expo config for background location + Maps keys.
- Add announcements service + dashboard carousel; refresh multiple screens’ UI (Settings, Safety Zone, Weapon flows, Plate registry, Login, etc.).
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/utils.ts | Adds getCrimeColor() helper for Safety Zone rendering. |
| src/types/weaponTypes.ts | Extends weapon type with imageUrl. |
| src/types/crime.ts | Introduces a crime-type constant/type (duplicates existing Safetyzone types). |
| src/types/chat.ts | Adds chat + media payload type definitions. |
| src/types/announcement.ts | Adds announcement type definitions. |
| src/types/AuthContextDefinition.ts | Adds badgeNo to AuthUser. |
| src/theme/theme.ts | Adds black token + adjusts dark background color. |
| src/services/weapon/weaponService.ts | Normalizes weapon payloads (snake_case + image URL support). |
| src/services/location/locationTracker.ts | Adds permission/error codes + Android foreground service config + task-define guard. |
| src/services/location/locationBootstrap.ts | Bootstraps location DB + resumes/stops tracking based on duty toggle. |
| src/services/chat/mediaUpload.ts | Upload helper for images/audio to Firebase Storage. |
| src/services/chat/chatService.ts | Firestore subscribe/send message helpers. |
| src/services/authService.ts | Maps backend badgeNo into AuthUser. |
| src/services/announcementService.ts | Adds announcements fetcher with flexible payload extraction + fallback endpoints. |
| src/constants/crimeTypeColors.ts | Defines crime-type → color mapping. |
| src/components/chat/VoiceMessage.tsx | Adds audio playback UI using expo-av. |
| src/components/chat/MessageBubble.tsx | Adds unified chat bubble renderer for text/image/audio. |
| src/components/chat/ImageMessage.tsx | Adds image bubble + fullscreen modal viewer. |
| src/components/chat/ChatInput.tsx | Adds input UI supporting text + camera/gallery + voice recording. |
| src/components/WeaponRequestCard.tsx | Small UI tweak for card accent/background color. |
| src/components/WeaponListItem.tsx | Supports remote weapon image URLs when available. |
| src/components/WeaponCard.tsx | Displays weapon image (fallback to app logo) + safer name rendering. |
| src/components/UI/Searchbar.tsx | Makes Searchbar controlled; hooks into theme; adds ref prop (currently incorrectly typed). |
| src/components/TopSectionTemplate.tsx | Back button now uses router.back() when possible. |
| src/components/TopBar.tsx | Replaces static image avatar with initial-based avatar + theme-based styling. |
| src/components/SideBar.tsx | Enables routes for Contact/Translate/FAQ; switches to router.push; removes placeholder alerts (commented out). |
| package.json | Adds expo-av dependency. |
| package-lock.json | Locks expo-av dependency. |
| firebase.js | Adds Firebase Storage initialization/export. |
| app/login.tsx | Refactors login UI styling to be theme-driven; adds overlay; uses Ionicons fingerprint. |
| app/_layout.tsx | Bootstraps location tracking after auth load; adds Android hardware back handler; imports tracker for task definition. |
| app/Translate.tsx | Adds Translate route screen + sidebar behavior. |
| app/Settings.tsx | UI refresh; uses image background + cards; improved back nav. |
| app/FAQPage.tsx | Adds FAQ route screen with accessible expand/collapse items. |
| app/DutyToggleScreen.tsx | Adds granular location permission error handling + “Open Settings” actions. |
| app/Dashboard.tsx | Adds announcements carousel + updated menu panel + icon switch to Ionicons. |
| app/ContactUs.tsx | Adds Contact Us route screen + Google Form submission + dial/email helpers. |
| app/Chat.tsx | Replaces old chat implementation with service-based chat + new components. |
| app/(screens)/[serialNo].tsx | Weapon request screen UI refresh + banner image support + safer URL normalization. |
| app/(screens)/WeaponRequest.tsx | UI refresh + typed weapons list + loading/empty states. |
| app/(screens)/Weapon.tsx | UI refresh + passes weapon object down for image rendering; updated back behavior. |
| app/(screens)/SafetyZone.tsx | Major Safety Zone UI refresh + Google provider + circles + legend + search UI scaffold. |
| app/(screens)/Plate.tsx | Major Plate Registry UI refresh + header filters + themed list rendering. |
| app/(screens)/BulletRequest.tsx | Major Ammunition Request UI refresh + slider state + progress indicator. |
| app.config.js | Updates Expo slug/owner/projectId; adds Google Maps keys + background location permissions/config. |
| README.md | Replaces default Expo README with project-specific setup/docs. |
| .github/workflows/eas-build.yml | Uses EXPO_ROBOT_TOKEN secret and minor YAML cleanup. |
| .github/workflows/codeql.yml | Enables CodeQL on dev branch too. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const crimeType = { | ||
| THEFT: "THEFT", | ||
| ASSAULT: "ASSAULT", | ||
| BURGLARY: "BURGLARY", | ||
| ROBBERY: "ROBBERY", | ||
| VANDALISM: "VANDALISM", | ||
| DRUG_OFFENSE: "DRUG_OFFENSE", | ||
| TRAFFIC_VIOLATION: "TRAFFIC_VIOLATION", | ||
| HOMICIDE: "HOMICIDE", | ||
| FRAUD: "FRAUD", | ||
| ARSON: "ARSON", | ||
| } as const; | ||
|
|
||
| export type crimeType = (typeof crimeType)[keyof typeof crimeType]; |
There was a problem hiding this comment.
This file duplicates the existing CRIME_TYPES/crimeType definitions already present in src/types/SafetyzoneTypes.ts. Additionally, exporting both a value and a type named crimeType is confusing and makes importing error-prone. Consider deleting this file and reusing src/types/SafetyzoneTypes.ts, or rename the exported constant (e.g., CRIME_TYPES) and type (e.g., CrimeType) to avoid collisions.
| "axios": "^1.13.2", | ||
| "dotenv": "^17.3.1", | ||
| "expo": "~54.0.31", | ||
| "expo-av": "^16.0.8", |
There was a problem hiding this comment.
expo-av is added with a caret (^16.0.8) while most Expo SDK dependencies in this repo are pinned with ~ to match the installed Expo SDK. Using ^ can pull a version that doesn't match SDK 54 and cause runtime/native build issues. Prefer installing via npx expo install expo-av and pinning with the SDK-compatible ~ range.
| "expo-av": "^16.0.8", | |
| "expo-av": "~16.0.8", |
| // if (item.status === "placeholder") { | ||
| // Alert.alert( | ||
| // "Coming soon", | ||
| // item.helperText ?? "This feature is not ready yet.", | ||
| // ); | ||
| // return; | ||
| // } //REMOVE | ||
|
|
There was a problem hiding this comment.
There is a large commented-out block with a //REMOVE note. Please remove this dead code (or re-enable it if placeholders are still supported) to keep the menu handler clear and avoid shipping TODO/comment noise.
| // if (item.status === "placeholder") { | |
| // Alert.alert( | |
| // "Coming soon", | |
| // item.helperText ?? "This feature is not ready yet.", | |
| // ); | |
| // return; | |
| // } //REMOVE |
| if (!TaskManager.isTaskDefined(TASK_NAME)) { | ||
| TaskManager.defineTask(TASK_NAME, async ({ data, error }) => { | ||
| console.log("[LOCATION] Background task triggered"); //REMOVE: for testing | ||
| if (error) { | ||
| console.error("[LOCATION] Task error", error); //REMOVE: for testing | ||
| return; |
There was a problem hiding this comment.
Background tracking still contains multiple console.log/console.error statements marked //REMOVE. Logging from a background task can be noisy and may impact performance/diagnostics in production. Please remove these or gate them behind a development-only logger/flag before merge.
| type SearchbarProps = { | ||
| onChange: (text: string) => void; | ||
| value: string; | ||
| searchInputRef: React.RefObject<HTMLInputElement | null>; |
There was a problem hiding this comment.
searchInputRef is typed as React.RefObject<HTMLInputElement | null>, but this component renders a React Native TextInput (not a DOM input). This will fail type-checking in RN. Please change the ref prop type to React.RefObject<TextInput | null> (and update callers accordingly).
| searchInputRef: React.RefObject<HTMLInputElement | null>; | |
| searchInputRef: React.RefObject<TextInput | null>; |
| const hasGoogleMapsApiKey = Boolean(appConfig.googleMapsApiKey?.trim()); | ||
| const searchInputRef = React.useRef<HTMLInputElement | null>(null); | ||
|
|
There was a problem hiding this comment.
searchInputRef is created as React.useRef<HTMLInputElement | null>(null), but this screen uses a React Native TextInput via Searchbar. HTMLInputElement isn't available in native builds and will cause TS errors. Update this ref to React.RefObject<TextInput | null> (or remove it until it's needed).
|
|
||
| const handleSearchChange = (text: string) => { | ||
| setSearchQuery(text); | ||
| console.log("Search query:", text); //REMOVE |
There was a problem hiding this comment.
Leftover debug logging (console.log("Search query:", ...) //REMOVE) should be removed or gated behind a dev-only flag before merging; otherwise it will spam logs during normal use.
| console.log("Search query:", text); //REMOVE | |
| if (__DEV__) { | |
| console.log("Search query:", text); //REMOVE | |
| } |
No description provided.