Conversation
Integrate native Android and iOS location modules into the Flutter SDK. Adds platform interface, method channel, native bridges, config classes, and dependency declarations for the location feature. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Location is now opt-in: iOS uses a CocoaPods subspec with #if canImport guards, Android uses compileOnly with try-catch for NoClassDefFoundError. Customers who don't need location no longer pull in the dependency. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…onal location iOS: Replace #if canImport(CioLocation) with #if CIO_LOCATION_ENABLED compiler flag set via podspec subspec's pod_target_xcconfig. This is deterministic regardless of CocoaPods linking mode. Android: Replace NoClassDefFoundError try-catch with BuildConfig flag controlled by customerio_location_enabled gradle property. Dependency is conditionally included as implementation or compileOnly based on the property. No runtime exception handling needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
|
rootProject.hasProperty() returns true even for customerio_location_enabled=false. Use findProperty().toBoolean() to correctly respect the property's actual value. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| private func requestLocationUpdate() { | ||
| CustomerIO.location.requestLocationUpdate() | ||
| } |
There was a problem hiding this comment.
iOS location access lacks error handling unlike Android
Medium Severity
The iOS CustomerIOLocation calls CustomerIO.location.setLastKnownLocation(location) and CustomerIO.location.requestLocationUpdate() directly without any error handling. In contrast, the Android side wraps ModuleLocation.instance().locationServices in runCatching and returns null on failure, gracefully no-oping. If the location module isn't added during initialization (e.g., a user enables the location subspec but omits LocationConfig in Flutter config), the iOS code could crash at runtime while Android handles it safely.
Additional Locations (1)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| 'screenViewUse': screenViewUse?.name, | ||
| 'inApp': inAppConfig?.toMap(), | ||
| 'push': pushConfig.toMap(), | ||
| 'location': locationConfig?.toMap(), |
There was a problem hiding this comment.
Config toMap() output breaks existing test assertion
Low Severity
Adding 'location': locationConfig?.toMap() to toMap() always includes a 'location' key in the output map, even when locationConfig is null. The existing test in customer_io_config_test.dart (line 116: expect(config.toMap(), expectedMap)) creates a config without locationConfig, so the actual map now contains 'location': null while the expected map has no 'location' key. This causes the test to fail since Dart map equality considers a missing key different from a key with a null value.


Summary
Adds support for the Customer.io Location module in the Flutter SDK.
CustomerIOLocationPlatformwithsetLastKnownLocation()andrequestLocationUpdate()APIsLocationTrackingModeenum (off,manual,onAppStart) andLocationConfigfor configurationCustomerIO.locationaccessor for the location platformNativeModuleBridge+ iOS SwiftFlutterPlugin)Optional dependency
Location is fully opt-in. Customers who don't need it pay no cost:
locationsubspec in Podfile (pod 'customer_io/location'). Uses a Swift compiler flag (-DCIO_LOCATION_ENABLED) set by the subspec — deterministic, no#if canImportambiguity.customerio_location_enabled=truetogradle.properties. Controls aBuildConfigflag that gates all location code at build time. When disabled, R8 eliminates dead code entirely.Note
Medium Risk
Adds a new cross-platform location module and wires it into SDK initialization/build configuration, which could affect initialization behavior and native builds when enabled; changes are gated behind explicit opt-in flags/subspecs.
Overview
Adds opt-in Location module support to the Flutter Customer.io plugin, exposing
CustomerIO.locationAPIs (setLastKnownLocation,requestLocationUpdate) and new config types (LocationConfig,LocationTrackingMode) that are passed throughCustomerIOConfig.toMap().On Android, bumps the native SDK to
4.17.0and introduces acustomerio_location_enabledGradle property that generatesBuildConfig.CIO_LOCATION_ENABLEDand conditionally includes theio.customer.android:locationdependency and module wiring duringinitialize.On iOS, adds a
locationCocoaPods subspec that pullsCustomerIO/Locationand enables-DCIO_LOCATION_ENABLED, plus a newCustomerIOLocationchannel handler and conditional initialization to attach the location module only when configured.Written by Cursor Bugbot for commit f4ead00. This will update automatically on new commits. Configure here.