Documentation

Technical documentation for the PestControlOS CRM and Android app.

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

Android: Messaging

Technical specification for in-app messaging in the PestControlOS Android app.

Data model

  • Firestore: Conversations backed by Firestore. 1:1 chats use conversation IDs like james_ian (ordered or hashed to ensure consistency). Shared group conversation for team messages.
  • Documents: Message documents contain sender, text, timestamp, optional urgent flag. Query by conversation ID; order by timestamp.

Retention

  • Non-urgent: Messages can be auto-deleted after approximately 30 minutes. Implemented via Cloud Functions (scheduled or onWrite) or client-side TTL; optional.
  • Urgent: Per-message flag to retain urgent messages; excluded from auto-deletion. Used for critical notifications that must remain in history.

Access control

  • Firestore rules restrict read/write to participants of the conversation. Group conversation: all authenticated staff or role-based. Client only reads/writes conversations the user is allowed to see.

Integration

  • Messaging screen shows conversation list and thread; unread indicators on home screen. Deep-link from in-app notification to messaging thread when notification references a message.