Skip to content

feat: implement network connectivity monitor interface #26

Description

@rohansaini-02

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.

  1. Duplicated Logic — Individual modules might write their own network checks, violating the DRY principle.
  2. Hard-to-Test Code — Directly querying network status makes it difficult to simulate offline scenarios in unit tests.
  3. 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

  • INetworkService interface is defined.
  • MockNetworkService implementation is provided.
  • Code resides in an independent shared-utils/network directory 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/netinfo later without rewriting the Sync Engine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions