Documentation

Technical documentation for the PestControlOS CRM and Android app.

Architecture, security, Firestore model, and feature details for developers and technical reviewers.

Android: Work View (schedule)

Technical specification for the calendar and scheduling module in the PestControlOS Android app.

Data model

  • Collections: Work View events are stored per technician in Firestore collections (e.g. user_workview or {userId}_workview). Document fields typically include: event type (job/contract/follow-up), start time, end time, assigned technician, linked job/contract IDs, status.
  • Date normalization: Timestamps are normalized (e.g. UTC or consistent timezone) for cross-platform compatibility with the CRM calendar.

Calendar behaviour

  • Daily view: Fixed time slots 08:00–17:30, 30-minute intervals. "Tap a slot to add" creates an event at that slot. Events can have custom start/end (e.g. 08:30–15:00) via "Custom time…" dialog; format accepts 08:30 or 0830, 15:00 or 1500.
  • Calendar view: Browse and jump to dates; used for navigation to daily view.
  • Event types: Jobs, contracts, follow-ups; visibility may be role-dependent.
  • Edit time: Per-event "Edit Time" updates start and optionally end; duration preserved if only one is changed.
  • Drag-and-drop: Long-press an event, drag to another time-slot bar; start time snaps to slot, duration preserved when event has an end time.

Completion and lifecycle

  • Confirmation: Marking routines/visits done triggers a confirmation prompt.
  • Contract last visit: Contract "last visit" is updated; schedule cleanup runs for completed items.
  • Multi-user: Users 002 and 004 can view and manage multiple technicians’ work views (combined calendar). Enforced by Firestore rules and client-side filtering by technician ID.

Reminders (in-app only)

  • Scheduler: WorkManager schedules an in-app notification record approximately 30 minutes before scheduled events. No FCM push; no system notifications.
  • Storage: Notification records written to Firestore (e.g. notifications/{user}/items). Reminders de-duplicated and cancelled when events are completed or rescheduled.

Home screen widget

  • Content: Work View title, today’s date, next 3 jobs (time, name, address). Data cached when Work View is opened. Widget layout must not use ImageView/drawable/PNG (RemoteViews restrictions). See WIDGET_TROUBLESHOOTING.md if the widget does not display.