Skip to content

React Native Consumer App

Albin Varghese edited this page Nov 18, 2024 · 3 revisions

HydroLink Plus React Native Consumer App Documentation

Table of Contents

  1. Introduction
  2. Features
  3. Technology Stack
  4. Installation and Setup
  5. App Architecture
  6. Screens and Functionality
  7. API Integration
  8. Testing and Deployment
  9. Screenshots and Wireframes
  10. Conclusion

Introduction

The HydroLink Plus React Native Consumer App provides a user-friendly platform for consumers to monitor and manage their water usage. The app integrates with the HydroLink Plus system to offer real-time data visualization, personalized alerts, and easy payment options.


Features

  1. Real-Time Water Usage Monitoring:
    • Visualize daily, weekly, and monthly water consumption.
  2. Water Quality Insights:
    • View pH, turbidity, and conductivity levels.
  3. Notifications and Alerts:
    • Get real-time notifications for leaks, anomalies, or overuse.
  4. Billing and Payments:
    • Access and pay bills directly through the app.
  5. Customizable Limits:
    • Set daily or monthly water usage limits and receive alerts.
  6. Historical Data:
    • Review past water usage trends and analyze consumption patterns.

Technology Stack

  1. Frontend Framework:
    • React Native: Cross-platform development for iOS and Android.
  2. State Management:
    • Redux Toolkit: For managing app-wide state.
  3. Networking:
    • Axios: For API requests and data handling.
  4. UI Library:
    • React Native Paper: Pre-built UI components for consistency.
  5. Payment Integration:
    • Stripe SDK: For secure in-app payments.

Installation and Setup

Prerequisites

  1. Development Tools:
    • Node.js (>=14.x)
    • React Native CLI or Expo CLI
    • Android Studio and/or Xcode for emulators
  2. Dependencies:
    • Ensure all required libraries are installed:
      npm install

Running the App Locally

  1. Clone the Repository:

    git clone https://github.com/your-repo/hydrolink-consumer-app.git
    cd hydrolink-consumer-app
  2. Install Dependencies:

    npm install
  3. Configure Environment Variables:

    • Create a .env file:
      API_URL=https://api.hydrolink.com
      STRIPE_API_KEY=your-stripe-key
  4. Run the App:

    • For Android:
      npx react-native run-android
    • For iOS:
      npx react-native run-ios

App Architecture

graph TD
    A[UI Components] --> B[Redux Toolkit State]
    B --> C[API Layer (Axios)]
    C --> D[Authority Server API]
    A --> E[Navigation (React Navigation)]
    E --> F[Screens]
Loading
  • UI Layer: Built with React Native components and styled using Tailwind CSS.
  • State Management: Centralized state using Redux Toolkit.
  • API Layer: Handles secure communication with the Authority Server.

Screens and Functionality

Dashboard

  • Displays current water usage and quality metrics.
  • Shows alerts for leaks, tampering, or overuse.

Water Usage Analytics

  • Graphs for daily, weekly, and monthly water consumption.
  • Highlights unusual patterns or spikes.

Notifications and Alerts

  • Displays real-time alerts for leaks, high usage, or water quality issues.
  • Configurable push notifications for critical events.

Billing and Payments

  • Lists current and past bills.
  • Integrates with Stripe for secure payments.

Settings and Configuration

  • Allows users to set daily or monthly usage limits.
  • Configures notification preferences.

API Integration

Key Endpoints

  1. Fetch Usage Data:

    • Endpoint: /api/meter/usage
    • Request:
      {
          "user_id": "unique-user-id"
      }
    • Response:
      {
          "daily_usage": 50.3,
          "weekly_usage": 310.2,
          "monthly_usage": 1200.5
      }
  2. Billing Information:

    • Endpoint: /api/user/billing
    • Response:
      {
          "current_bill": 45.5,
          "due_date": "2024-12-01",
          "past_due": 0
      }
  3. Alerts and Notifications:

    • Endpoint: /api/meter/alerts
    • Response:
      [
          {
              "alert_type": "leak_detected",
              "timestamp": "2024-11-18T10:00:00Z",
              "details": "Leak detected at 10:00 AM near kitchen faucet."
          }
      ]

Testing and Deployment

Testing

  1. Unit Testing:

    • Test components using Jest.
    npm test
  2. Integration Testing:

    • Validate API integration using Postman or Insomnia.
    • Simulate user workflows on a connected device or emulator.
  3. UI Testing:

    • Test responsiveness and usability on multiple screen sizes.

Deployment

  1. Android:

    • Build APK or AAB:
      npx react-native run-android --variant=release
    • Publish on Google Play.
  2. iOS:

    • Archive and export the build in Xcode.
    • Publish on the Apple App Store.

Screenshots and Wireframes

Dashboard

(Include a screenshot or a wireframe with labeled sections showing water usage and quality metrics.)

Notifications

(Include an example notification interface with recent alerts.)

Payments Page

(Include a wireframe or screenshot demonstrating the payment flow.)

HydroLink Plus ©2024

Clone this wiki locally