Skip to content

chore: register geofence module with native SDKs#355

Open
mrehan27 wants to merge 1 commit into
mbl-1783-geofence-module-basefrom
mbl-1783-geofence-module
Open

chore: register geofence module with native SDKs#355
mrehan27 wants to merge 1 commit into
mbl-1783-geofence-module-basefrom
mbl-1783-geofence-module

Conversation

@mrehan27

@mrehan27 mrehan27 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Wires the geofence module into the native SDK builders during initialize() on Android and iOS. Geofence runs automatically once registered (no Flutter-facing methods) and depends on the Location module, which is registered — with the app's config if provided, otherwise defaults (manual) — whenever geofence is enabled.

  • Android — new CustomerIOGeofence bridge registers ModuleGeofence; the reference is isolated in its own class so a disabled/compileOnly dependency can't trigger NoClassDefFoundError. initialize() registers Location when either location or geofence is configured.
  • iOSinitialize() adds GeofenceModule() plus LocationModule under the canImport guards.

Ticket

MBL-1783 — Flutter: add geofencing support

PR stack

  1. Build enablement + config → feature/geofence-on-device (chore: add geofence module build enablement and config #354)
  2. (this PR) Register geofence module with native SDKs → stacks on chore: add geofence module build enablement and config #354
  3. Enable geofence in sample apps → coming next

⚠️ Stacked on #354 — review/merge that first; this PR targets its branch.

Testing

flutter analyze + unit tests pass. Validated by building both sample apps against local geofence natives: Android APK links the geofence artifact; iOS Runner.app links CioLocationGeofence.framework.


Note

Medium Risk
Changes SDK initialization and location/geofence registration, which affects background location behavior when geofence is enabled; mitigated by compile-time flags and isolated bridge classes on Android.

Overview
Geofencing is wired into native SDK setup on Android and iOS so it starts automatically when the Flutter app passes a geofence block in initialize() (no new Dart method channel API).

On Android, an optional CustomerIOGeofence bridge is added to the plugin module list when CIO_GEOFENCE_ENABLED is on; initialize() registers ModuleGeofence via that bridge. Location is now configured when either location or geofence is present (geofence-only apps still get location with defaults), still guarded by CIO_LOCATION_ENABLED so optional native artifacts are not referenced when disabled.

On iOS, initialize() registers GeofenceModule() when geofence is in the init params (canImport(CioLocationGeofence)), and registers LocationModule when location or geofence is configured, using location tracking mode from location or defaulting to manual.

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

@mrehan27 mrehan27 requested a review from a team as a code owner June 26, 2026 16:50
@mrehan27 mrehan27 self-assigned this Jun 26, 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.


Comment thread ios/customer_io/Sources/customer_io/CustomerIOPlugin.swift Outdated
@mrehan27 mrehan27 changed the title feat: register geofence module with native SDKs chore: register geofence module with native SDKs Jun 26, 2026
@mrehan27 mrehan27 force-pushed the mbl-1783-geofence-module-base branch from 0c03543 to b36030a Compare June 26, 2026 21:02
@mrehan27 mrehan27 force-pushed the mbl-1783-geofence-module branch from cbdda98 to 168c84a Compare June 26, 2026 21:03

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 168c84a. Configure here.

Comment thread android/src/main/kotlin/io/customer/customer_io/CustomerIOPlugin.kt Outdated
Wires the geofence module into the native SDK builders during initialize()
on Android and iOS. Geofence runs automatically once registered and depends
on the location module, which is registered (with the app's config or
defaults) whenever geofence is enabled.

iOS guards against a Flutter-null 'geofence' key (NSNull) by casting to a
dictionary, so geofence/location are only registered when a GeofenceConfig
is actually provided.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mrehan27 mrehan27 force-pushed the mbl-1783-geofence-module branch from 168c84a to 8d7653e Compare June 26, 2026 22:05
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