Skip to content

Conversation

arys
Copy link

@arys arys commented Oct 13, 2025

Summary by CodeRabbit

  • New Features

    • Added a provider-based option for crowd-connected location integration.
  • Refactor

    • Reworked view lifecycle to a presenter-centric initialization for faster, more reliable loading and simpler setup.
  • Bug Fixes

    • Preload action is now explicitly unavailable and surfaces a clear error when invoked.
  • Chores

    • Updated Android dependencies to 5.1.x.

Copy link

coderabbitai bot commented Oct 13, 2025

Walkthrough

Android Gradle dependencies for ExpoFP libraries were bumped (fplan, crowdconnected to 5.1.0); the background module remains commented in the file. ExpofpModule’s preload now logs and immediately rejects its Promise with PRELOAD_UNAVAILABLE. ExpofpViewManager was refactored to use ExpoFpView and a presenter-based initialization with optional CrowdConnected provider, updating method signatures accordingly.

Changes

Cohort / File(s) Summary of Changes
Gradle dependencies
android/build.gradle
Updated com.expofp:fplan and com.expofp:crowdconnected to 5.1.0. com.expofp:crowdconnectedbackground remains commented (example shows 5.1.0 in comment). No other build config changes.
Module preload behavior
android/src/main/java/com/expofp/ExpofpModule.kt
Removed UI-thread preload logic and previous success path; replaced with a log and immediate Promise rejection with PRELOAD_UNAVAILABLE and a descriptive message. Updated imports (removed unused/react-specific ones, added android.util.Log). Method signature unchanged.
View manager refactor
android/src/main/java/com/expofp/ExpofpViewManager.kt
Changed ExpofpViewManager to manage ExpoFpView (SimpleViewManager<ExpoFpView>). createViewInstance, onDropViewInstance, and setSettings signatures updated to use ExpoFpView. Initialization reworked to initialize ExpoFpPlan, create a presenter from an Expo key, optionally construct an IExpoFpLocationProvider for CrowdConnected via createCrowdConnectedProvider, and attach the presenter to the view. Removed previous offline/zip-loading and global location-provider flows. Added/updated imports for ExpoFpPlan, ExpoFpView, presenters, and CrowdConnected classes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant RN as React Native
  participant VM as ExpofpViewManager
  participant V as ExpoFpView
  participant Plan as ExpoFpPlan
  participant Presenter as Plan Presenter
  participant CC as CrowdConnected Provider

  RN->>VM: createViewInstance()
  VM-->>RN: ExpoFpView (V)

  RN->>VM: setSettings(V, settingsMap)
  VM->>Plan: initialize(context)
  VM->>Plan: extract ExpoFpKey from URL
  VM->>Presenter: create Presenter with ExpoFpKey
  alt CrowdConnected enabled in settings
    VM->>CC: createCrowdConnectedProvider(settings)
    VM->>Presenter: attachLocationProvider(CC)
  end
  VM->>V: attachPresenter(Presenter)
Loading
sequenceDiagram
  autonumber
  participant JS as JS bridge
  participant Mod as ExpofpModule

  JS->>Mod: preload(url)
  Note right of Mod: New behavior
  Mod->>Mod: Log "preload: not implemented"
  Mod-->>JS: Reject Promise with PRELOAD_UNAVAILABLE + message
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I thump my feet at version five,
New views hop in, presenters thrive.
The preload sighs, "not ready yet,"
CrowdConnected waits to be set.
I nibble code and send a cheer—🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The title “feat(android): update to 5” is too generic and does not clearly specify which dependency or component is being updated, making it hard for reviewers to understand the primary change at a glance. Consider renaming the title to something more descriptive, for example “feat(android): bump Fplan and CrowdConnected SDKs to v5.1.0 and migrate ExpofpViewManager to ExpoFpView,” to clearly convey the key updates.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/move-android-v5

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between befef73 and 6b7cbaa.

📒 Files selected for processing (3)
  • android/build.gradle (1 hunks)
  • android/src/main/java/com/expofp/ExpofpModule.kt (1 hunks)
  • android/src/main/java/com/expofp/ExpofpViewManager.kt (1 hunks)

Comment on lines 54 to 65
isAllowedInBackground = enableBackground,
isHeadingEnabled = true,
aliases = aliases,
notificationText = "Indoor navigation is active",
serviceIcon = R.drawable.placeholder_icon
)

return if (enableBackground) {
ExpoFpCrowdConnectedBackgroundLocationProvider(application, settings)
} else {
ExpoFpCrowdConnectedLocationProvider(application, settings)
}
Copy link

@coderabbitai coderabbitai bot Oct 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

enableBackground is undeclared

Both branches reference enableBackground, but the property (and its React prop setter) were removed. This file will fail to compile. Please reintroduce the backing field and setter so the value can be provided from JS.

Apply this diff to restore the missing pieces:

 class ExpofpViewManager : SimpleViewManager<ExpoFpView>() {
     private var reactContext: ThemedReactContext? = null
+    private var enableBackground: Boolean = false
@@
     @ReactProp(name = "settings")
     fun setSettings(view: ExpoFpView, settingsMap: ReadableMap?) {
@@
         view.attachPresenter(p)
     }
+
+    @ReactProp(name = "enableBackground")
+    fun setEnableBackground(view: ExpoFpView, value: Boolean) {
+        enableBackground = value
+    }
 }
🤖 Prompt for AI Agents
In android/src/main/java/com/expofp/ExpofpViewManager.kt around lines 54–65, the
property enableBackground was removed but still referenced when constructing the
location provider; reintroduce a backing Boolean field (default false) and a
React prop setter so JS can pass the value. Add a private var
enableBackground:Boolean = false in the manager and implement a @ReactProp(name
= "enableBackground") setter method that updates that field from incoming JS
props (or calls setNeedsUpdate on the view) so the code paths using
enableBackground compile and reflect the JS-provided value.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arys like bot says I don't see the enableBackground declaration, does it come with new library version?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

chika-kasymov
chika-kasymov previously approved these changes Oct 13, 2025
isAllowedInBackground = enableBackground,
isHeadingEnabled = true,
aliases = aliases,
notificationText = "Indoor navigation is active",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: not localized

Comment on lines 54 to 65
isAllowedInBackground = enableBackground,
isHeadingEnabled = true,
aliases = aliases,
notificationText = "Indoor navigation is active",
serviceIcon = R.drawable.placeholder_icon
)

return if (enableBackground) {
ExpoFpCrowdConnectedBackgroundLocationProvider(application, settings)
} else {
ExpoFpCrowdConnectedLocationProvider(application, settings)
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arys like bot says I don't see the enableBackground declaration, does it come with new library version?

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
android/src/main/java/com/expofp/ExpofpViewManager.kt (1)

57-57: Localize the notification text.

The hardcoded English string was previously flagged and remains unaddressed. Users with non-English locales will see untranslated text in the system notification.

Move the text to a string resource:

-            notificationText = "Indoor navigation is active",
+            notificationText = context.getString(R.string.indoor_navigation_active),
🧹 Nitpick comments (1)
android/src/main/java/com/expofp/ExpofpViewManager.kt (1)

72-72: Consider removing redundant ExpoFpPlan initialization.

ExpoFpPlan.initialize(context) is already called in createViewInstance (line 24). Re-initializing in setSettings may be unnecessary unless settings can change at runtime or the view can be reused. Verify whether this is intentional or can be removed.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b7cbaa and 8eb47f9.

📒 Files selected for processing (3)
  • android/build.gradle (1 hunks)
  • android/src/main/java/com/expofp/ExpofpModule.kt (1 hunks)
  • android/src/main/java/com/expofp/ExpofpViewManager.kt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • android/build.gradle
🔇 Additional comments (3)
android/src/main/java/com/expofp/ExpofpModule.kt (1)

13-16: Previous concern resolved.

The promise rejection has been implemented as suggested in previous reviews, preventing JS callers from hanging indefinitely while the preload feature remains unimplemented in Android v5.

android/src/main/java/com/expofp/ExpofpViewManager.kt (2)

17-17: LGTM!

The refactor to use ExpoFpView instead of generic View improves type safety. The initialization of ExpoFpPlan during view creation is appropriate for the presenter-based architecture.

Also applies to: 22-26, 28-30


48-48: Clarify the intent of the empty string default for oneSignalUserId.

If oneSignalUserId is not provided or is null, the code defaults to an empty string. Verify whether an empty alias is semantically valid for the CrowdConnected SDK or if the alias entry should be omitted entirely when the value is absent.

token = token,
secret = secret,
navigationType = ExpoFpCrowdConnectedNavigationType.ALL,
isAllowedInBackground = false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Make background mode configurable from JavaScript.

The isAllowedInBackground property is hardcoded to false, preventing JavaScript code from controlling background location tracking. This limits flexibility and may break use cases that require background positioning.

Consider adding a React prop and backing field to expose this setting:

 class ExpofpViewManager : SimpleViewManager<ExpoFpView>() {
     private var reactContext: ThemedReactContext? = null
+    private var enableBackground: Boolean = false

Then update the provider creation:

         val settings = ExpoFpCrowdConnectedLocationProviderSettings(
             appKey = appKey,
             token = token,
             secret = secret,
             navigationType = ExpoFpCrowdConnectedNavigationType.ALL,
-            isAllowedInBackground = false,
+            isAllowedInBackground = enableBackground,
             isHeadingEnabled = true,
             aliases = aliases,
             notificationText = "Indoor navigation is active",
             serviceIcon = R.drawable.placeholder_icon
         )

And add a setter:

    @ReactProp(name = "enableBackground")
    fun setEnableBackground(view: ExpoFpView, value: Boolean) {
        enableBackground = value
    }
🤖 Prompt for AI Agents
In android/src/main/java/com/expofp/ExpofpViewManager.kt around line 54,
isAllowedInBackground is hardcoded to false which prevents JS from toggling
background location; add a private backing field (e.g. enableBackground: Boolean
= false) to the ViewManager, expose a React prop name (e.g.
"enableBackground"/"enableBackgroundLocation") and implement a @ReactProp setter
that updates the backing field, then use that backing field when
constructing/creating the provider (replace the hardcoded false with
enableBackground) so the JS prop controls background mode.

isHeadingEnabled = true,
aliases = aliases,
notificationText = "Indoor navigation is active",
serviceIcon = R.drawable.placeholder_icon
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Replace the placeholder icon with a production asset.

Using R.drawable.placeholder_icon in production code can result in a poor user experience if the placeholder is visually unappealing or confusing.

🤖 Prompt for AI Agents
In android/src/main/java/com/expofp/ExpofpViewManager.kt around line 58, the
code sets serviceIcon = R.drawable.placeholder_icon which is a temporary asset;
replace this with the correct production drawable resource (e.g.,
R.drawable.service_icon_prod) by adding the final asset files into the
appropriate res/drawable(-density) folders, update the reference here to the
production resource name, ensure naming follows Android resource conventions,
and verify the image renders correctly across screen densities and themes.

@arys arys merged commit 1f39f6d into main Oct 14, 2025
1 check passed
@amego-releases amego-releases bot mentioned this pull request Oct 2, 2025
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