dindong - Technical Documentation -- System Architecture & Implementation Details

dindong - Technical Documentation

System Architecture & Implementation Details


1. Technology Stack

dindong is built as a highly performant, cross-platform mobile application utilizing:

Framework: [Flutter](https://flutter.dev/) (3.6.0+) for 60fps UI and platform-agnostic logic.

State Management: [Riverpod](https://riverpod.dev/) for a reactive, compile-safe, and testable data flow.

Backend & Sync: [Firebase](https://firebase.google.com/) (Firestore & Auth) for real-time cloud synchronization and secure user identity.

Notifications:`flutter_local_notifications` for system-level scheduling and action handling.

Critical Alerts: `alarm` package to ensure high-priority alerts bypass system restrictions.

Monetization: [RevenueCat](https://www.revenuecat.com/) (`purchases_flutter`) for cross-platform subscription management and entitlement enforcement.


---

 2. Architecture Overview

The application follows a modular MVVM-S (Model-View-ViewModel-Service) pattern to ensure scalability and separation of concerns.


Layered Structure:

 `lib/models`: Immutable data classes (using `freezed` or standard JSON serialization) representing Reminders and Categories.

`lib/services`: Logic-heavy singletons handling low-level tasks:

    *   `SyncService`: Manages Firestore read/writes and listeners.

    *   `NotificationService`: Abstracts OS-level notification scheduling.

    *   `PaymentService`: Wraps the RevenueCat SDK logic.

*   **`lib/providers`**: Riverpod `StateNotifiers` that hold the "source of truth" for the UI.

    *   `ReminderNotifier`: Orchestrates the complex interaction between local state, cloud sync, and scheduled notifications.

    *   `ProStatusNotifier`: Monitors the user's subscription state in real-time.

lib/screens & widgets`**: Reactive UI components that rebuild based on provider state.


---


 3. Real-Time Sync Logic

The core of dindong is its real-time reactive stream.

1.  Subscription: `SyncService` maintains a persistent Firestore snapshot stream.

2.  Broadcast: When a reminder state changes (Edited, Snoozed, Ringing) on any device, Firestore broadcasts the update.

3.  Local Execution: The `ReminderNotifier` on all connected devices receives the new data, updates the local list, and immediately calls the `NotificationService` to reschedule or cancel local system alarms.

4.  Cross-Device Alarms: The `isRinging` flag in Firestore triggers the `alarm` engine on all authenticated devices simultaneously.


---

4. RevenueCat Implementation

RevenueCat acts as the "Gatekeeper" for dindong's premium features (Unlimited Reminders & Cloud Sync).


Initialization (`lib/services/payment_service.dart`):

The SDK is initialized with platform-specific API keys. We leverage RevenueCat's debug logging during development to ensure purchase flows are transparent.


Entitlement Check:

We use a robust, case-insensitive check for the `dindong pro` entitlement:

```dart

final isDindongProActive = activeKeys.any((key) => 

  key.toLowerCase().trim() == 'dindong pro'

);

```


Real-Time Entitlement Updates:

We implement the `addCustomerInfoUpdateListener`. This ensures that if a user subscribes on another device, the local app state updates instantly without a restart, unlocking Pro features immediately across the device cloud.


Contextual Paywall:

Instead of a generic "Go Pro" button, dindong uses a contextual trigger. When a non-pro user attempts to add more than 2 reminders for a specific day, the app intercepts the save action and presents the `PaywallScreen`. This screen dynamically fetches `Offerings` (Monthly/Yearly) from RevenueCat, showing localized pricing and features.


---

5. Deployment & Build

To maintain dynamic icon support and category flexibility, release builds are performed with icon tree-shaking disabled:

```powershell

flutter build apk --release --no-tree-shake-icons

flutter build appbundle --release --no-tree-shake-icons

```


Yorumlar

Bu blogdaki popüler yayınlar

PRIVACY POLICY / Gizlilik Politikası

Privacy Policy for Digital Planner