Context
Ref: #1 — Native GovTech Learning App for Public Education Systems
TAP Buddy is designed as an offline-first mobile application targeting low-connectivity environments. Core systems like the Sync Engine require real-time awareness of the device's network state to function correctly.
Problem
Currently, there is no standardized way to check network connectivity across the application.
- Duplicated Logic — Individual modules might write their own network checks, violating the DRY principle.
- Hard-to-Test Code — Directly querying network status makes it difficult to simulate offline scenarios in unit tests.
- Tight Coupling — Relying directly on external libraries ties our core logic to specific implementations.
Proposed Solution
Create a dedicated INetworkService interface and a mock implementation in a new shared-utils/network directory.
Core Components
| Component |
Purpose |
INetworkService |
An abstract interface exposing methods like isOnline(). |
MockNetworkService |
A mock implementation that allows developers to toggle online/offline state for testing. |
Deliverables
Why This Matters
This acts as a foundational utility. By using an interface, we can cleanly swap the mock implementation for the real @react-native-community/netinfo later without rewriting the Sync Engine.
Context
Ref: #1 — Native GovTech Learning App for Public Education Systems
TAP Buddy is designed as an offline-first mobile application targeting low-connectivity environments. Core systems like the Sync Engine require real-time awareness of the device's network state to function correctly.
Problem
Currently, there is no standardized way to check network connectivity across the application.
Proposed Solution
Create a dedicated
INetworkServiceinterface and a mock implementation in a newshared-utils/networkdirectory.Core Components
INetworkServiceisOnline().MockNetworkServiceDeliverables
INetworkServiceinterface is defined.MockNetworkServiceimplementation is provided.shared-utils/networkdirectory to prevent merge conflicts.Why This Matters
This acts as a foundational utility. By using an interface, we can cleanly swap the mock implementation for the real
@react-native-community/netinfolater without rewriting the Sync Engine.