fix: gate iOS geofence enablement on a dictionary config#621
Merged
mrehan27 merged 1 commit intoJul 25, 2026
Merged
Conversation
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>
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the iOS-only inconsistency Bugbot flagged on #620.
The geofence enablement checks used key presence (
config["geofence"] != nil), while the module builderNativeGeofence.module(from:)only builds the module for a dictionary value (config["geofence"] as? [String: Any]). So a non-mapgeofencevalue — e.g.nullbridged from JS — would:NativeLocation.module(..., geofenceEnabled: true)), andallowBackgroundDeliveryon,…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
geofenceconfig, with normal dictionary or absent config unchanged.Overview
Fixes inconsistent iOS geofence gating when
geofenceis present in init config but not a map (e.g.nullfrom JS).geofenceConfiguredandgeofenceAddednow useconfig["geofence"] as? [String: Any] != nil, matchingNativeGeofence.module(from:). Previously, key presence alone could turn on implied Location registration and defaultallowBackgroundDeliverywithout actually adding the geofence module. Validgeofenceobjects 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.