Skip to content

fix: gate iOS geofence enablement on a dictionary config#621

Merged
mrehan27 merged 1 commit into
feature/geofence-on-devicefrom
fix-ios-geofence-config-type-check
Jul 25, 2026
Merged

fix: gate iOS geofence enablement on a dictionary config#621
mrehan27 merged 1 commit into
feature/geofence-on-devicefrom
fix-ios-geofence-config-type-check

Conversation

@mrehan27

@mrehan27 mrehan27 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the iOS-only inconsistency Bugbot flagged on #620.

The geofence enablement checks used key presence (config["geofence"] != nil), while the module builder NativeGeofence.module(from:) only builds the module for a dictionary value (config["geofence"] as? [String: Any]). So a non-map geofence value — e.g. null bridged from JS — would:

  • register the implied Location module (NativeLocation.module(..., geofenceEnabled: true)), and
  • default allowBackgroundDelivery on,

…without actually adding the geofence module.

Both checks now use the same as? [String: Any] cast. Normal cases (geofence: {}, { locationMode }, or absent) are unchanged; only a malformed/non-map value now correctly reads as not-configured.

Android already gates on getTypedValue<Map<String, Any>> for both the enable check and the module, so no change there.


Note

Low Risk
Narrow initialization guard change; only affects malformed/non-map geofence config, with normal dictionary or absent config unchanged.

Overview
Fixes inconsistent iOS geofence gating when geofence is present in init config but not a map (e.g. null from JS).

geofenceConfigured and geofenceAdded now use config["geofence"] as? [String: Any] != nil, matching NativeGeofence.module(from:). Previously, key presence alone could turn on implied Location registration and default allowBackgroundDelivery without actually adding the geofence module. Valid geofence objects and omitted config behave as before.

Reviewed by Cursor Bugbot for commit 7241dd8. Bugbot is set up for automated code reviews on this repo. Configure here.

The geofence enablement checks used key presence (config["geofence"] != nil)
while NativeGeofence.module(from:) only builds the module for a dictionary
value. A non-map geofence value (e.g. null bridged from JS) would enable the
implied Location module and default allowBackgroundDelivery on without adding
the geofence module. Both checks now use the same `as? [String: Any]` cast.

Android already gates on getTypedValue<Map<String, Any>>, so no change there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrehan27
mrehan27 requested a review from a team as a code owner July 25, 2026 10:07
@mrehan27 mrehan27 self-assigned this Jul 25, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


@mrehan27
mrehan27 merged commit 6820128 into feature/geofence-on-device Jul 25, 2026
13 of 16 checks passed
@mrehan27
mrehan27 deleted the fix-ios-geofence-config-type-check branch July 25, 2026 10:09
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.

1 participant