Workaround for DISABLE_TRUEDEPTH_API flag#259
Open
olexale wants to merge 7 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses Issue #258 by making TrueDepth/face-tracking code opt-in under Swift Package Manager (Flutter 3.44+), ensuring apps that don’t use face tracking don’t accidentally ship TrueDepth symbols and get rejected in App Store review.
Changes:
- Switch Swift compilation gating from
!DISABLE_TRUEDEPTH_APItoENABLE_TRUEDEPTH_API(default now excludes face tracking). - Add SPM-side opt-in in
Package.swiftviaARKitFaceTrackingEnabled(Info.plist) orARKIT_FACE_TRACKING_ENABLED(env var), and document the setup in the README. - Bump version to
1.4.1and document the breaking change in the changelog; update the example iOS project to SPM-oriented setup.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new opt-in model and SPM/CocoaPods enablement steps. |
| pubspec.yaml | Version bump to 1.4.1. |
| ios/arkit_plugin/Sources/arkit_plugin/SwiftArkitPlugin+configurationCheck.swift | Gates face-tracking configuration checks behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/Serializers/AnchorSerializer.swift | Gates face-anchor serialization behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/GeometryBuilder.swift | Gates face-geometry creation behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/Geometries.swift | Gates face-geometry builder behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Initialization.swift | Gates face-tracking configuration initialization behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Handlers.swift | Gates face-geometry update handler behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Sources/arkit_plugin/ConfigurationBuilders/FaceTrackingConfigurationBuilder.swift | Gates face-tracking configuration builder behind ENABLE_TRUEDEPTH_API. |
| ios/arkit_plugin/Package.swift | Adds SPM-time flag definition based on Info.plist/env var detection. |
| example/ios/Runner/Info.plist | Adds ARKitFaceTrackingEnabled opt-in key for the example app. |
| example/ios/Runner.xcodeproj/project.pbxproj | Updates example project references away from CocoaPods and toward SPM artifacts. |
| example/ios/Podfile | Removes CocoaPods Podfile from the example. |
| example/ios/Flutter/Release.xcconfig | Makes Pods xcconfig include optional (#include?). |
| example/ios/Flutter/Debug.xcconfig | Makes Pods xcconfig include optional (#include?). |
| CHANGELOG.md | Adds 1.4.1 entry describing the breaking flag change. |
| .gitignore | Ignores example/ios/Package.swift. |
Comments suppressed due to low confidence (2)
ios/arkit_plugin/Sources/arkit_plugin/GeometryBuilders/GeometryBuilder.swift:40
- When ENABLE_TRUEDEPTH_API is not set (now the default), requesting an "ARKitFace" geometry falls into a silent
// errorpath and returns nil without any actionable diagnostic. Since this path is now common for misconfigured face-tracking apps, emit a clear assertion failure (debug) so developers immediately understand how to enable face tracking.
case "ARKitFace":
#if ENABLE_TRUEDEPTH_API
geometry = createFace(device)
#else
// error
#endif
ios/arkit_plugin/Sources/arkit_plugin/FlutterArkitView+Initialization.swift:116
- The error text still says "TRUEDEPTH_API disabled" but this PR switches to an opt-in model (ENABLE_TRUEDEPTH_API). Updating the message to point to the new enabling mechanisms (Swift flag / Info.plist key / env var) will make misconfiguration much easier to diagnose.
#if ENABLE_TRUEDEPTH_API
configuration = createFaceTrackingConfiguration(arguments)
#else
logPluginError("TRUEDEPTH_API disabled", toChannel: channel)
#endif
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| flutter_additional_ios_build_settings(target) | ||
| if target.name == 'arkit_plugin' | ||
| target.build_configurations.each do |config| | ||
| config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -DENABLE_TRUEDEPTH_API' |
|
|
||
| func onUpdateFaceGeometry(_ arguments: [String: Any]) { | ||
| #if !DISABLE_TRUEDEPTH_API | ||
| #if ENABLE_TRUEDEPTH_API |
Comment on lines
+1
to
+3
| name: arkit_plugin | ||
| description: Flutter Plugin for ARKit - Apple's augmented reality (AR) development platform for iOS mobile devices. | ||
| version: 1.4.0 | ||
| version: 1.4.1 |
Comment on lines
+138
to
+140
| target.build_configurations.each do |config| | ||
| config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -DENABLE_TRUEDEPTH_API' | ||
| end |
Comment on lines
137
to
141
| func onUpdateFaceGeometry(_ arguments: [String: Any]) { | ||
| #if !DISABLE_TRUEDEPTH_API | ||
| #if ENABLE_TRUEDEPTH_API | ||
| guard let name = arguments["name"] as? String, | ||
| let param = arguments["geometry"] as? [String: Any], | ||
| let fromAnchorId = param["fromAnchorId"] as? String |
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.
Fix #258