Skip to content

Conversation

@arys
Copy link

@arys arys commented Jan 6, 2026

Summary by CodeRabbit

  • New Features
    • Added plan preloading functionality to accelerate app load times
    • Introduced in-memory caching system for preloaded plan data
    • Enhanced URL parsing and parameter extraction for improved compatibility

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes introduce URL parsing utilities and a preload caching system, then implement a new preload workflow in ExpofpModule that validates URLs, derives parameters, caches preloaded plan information, and provides error handling. ExpofpViewManager is refactored to use these shared utilities and support retrieval of preloaded presenters from cache with fallback to standard creation.

Changes

Cohort / File(s) Summary
URL Parsing & Caching Infrastructure
android/src/main/java/com/expofp/ExpofpModule.kt
New ExpofpUrlUtils object with getExpoKeyFromUrl(url: String): String? and extractAdditionalParamsFromUrl(url: String): List<ExpoFpPlanParameter> for URL parsing. New ExpofpPreloadCache object with put(), get(), and clear() methods for in-memory caching of preloaded plan info by expoKey.
Preload Workflow Implementation
android/src/main/java/com/expofp/ExpofpModule.kt
New preload(url: String, promise: Promise) method that validates expoKey from URL, derives additional parameters, asynchronously initializes ExpoFpPlan, invokes preloader with ExpoFpLinkType.ExpoKey and additionalParams, caches results, and resolves a map with expoKey and url. Includes error handling that rejects with PRELOAD_FAILED on exceptions.
Presenter Initialization Refactoring
android/src/main/java/com/expofp/ExpofpViewManager.kt
Removed private getExpoKeyFromUrl() helper and replaced with shared ExpofpUrlUtils methods. Introduced preloaded presenter retrieval path that checks ExpofpPreloadCache and uses preloaded presenter if available, otherwise creates new presenter. Updated setSettings flow to use new URL utilities and pass additionalParams.

Sequence Diagrams

sequenceDiagram
    participant Client as React Native Client
    participant Module as ExpofpModule
    participant Utils as ExpofpUrlUtils
    participant Plan as ExpoFpPlan
    participant Cache as ExpofpPreloadCache
    participant Promise as Promise

    Client->>Module: preload(url)
    Module->>Utils: getExpoKeyFromUrl(url)
    Utils-->>Module: expoKey
    Module->>Utils: extractAdditionalParamsFromUrl(url)
    Utils-->>Module: additionalParams
    
    rect rgb(220, 240, 250)
    Note over Module: Async Initialization
    Module->>Plan: Initialize ExpoFpPlan
    Plan-->>Module: Ready
    Module->>Plan: preloader.preloadPlan(ExpoKey(expoKey), additionalParams)
    Plan-->>Module: ExpoFpPreloadedPlanInfo
    end
    
    Module->>Cache: put(expoKey, preloadedInfo)
    Cache-->>Module: Cached
    Module->>Promise: resolve({expoKey, url})
    Promise-->>Client: Success
    
    rect rgb(255, 240, 240)
    Note over Module,Promise: On Error
    Module->>Promise: reject(PRELOAD_FAILED)
    Promise-->>Client: Error
    end
Loading
sequenceDiagram
    participant ViewManager as ExpofpViewManager
    participant Utils as ExpofpUrlUtils
    participant Cache as ExpofpPreloadCache
    participant Plan as ExpoFpPlan
    participant Presenter as PlanPresenter

    ViewManager->>Utils: getExpoKeyFromUrl(url)
    Utils-->>ViewManager: expoKey
    ViewManager->>Utils: extractAdditionalParamsFromUrl(url)
    Utils-->>ViewManager: additionalParams
    
    ViewManager->>Cache: get(expoKey)
    
    alt Preloaded Info Found
        rect rgb(240, 255, 240)
        Note over ViewManager,Plan: Preloaded Path
        Cache-->>ViewManager: preloadedInfo
        ViewManager->>Plan: preloader.getPreloadedPlanPresenter(preloadedInfo)
        Plan-->>ViewManager: preloadedPresenter
        end
    else No Preloaded Info
        rect rgb(255, 250, 240)
        Note over ViewManager,Presenter: Standard Creation Path
        Cache-->>ViewManager: null
        ViewManager->>Plan: Create presenter with ExpoKey(expoKey), additionalParams
        Plan-->>ViewManager: newPresenter
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops of joy through caches deep,
URLs parsed, preloads we keep,
Presenters primed and ready to go,
With ExpofpPlans all aglow!

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 036c1e6 and 3a764a3.

📒 Files selected for processing (2)
  • android/src/main/java/com/expofp/ExpofpModule.kt
  • android/src/main/java/com/expofp/ExpofpViewManager.kt

Comment @coderabbitai help to get the list of available commands and usage tips.

@arys arys merged commit aa39257 into main Jan 6, 2026
1 check was pending
@amego-releases amego-releases bot mentioned this pull request Jan 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants