feat!: migrate to Capacitor v8 #407
Open
+1,326
−1,689
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.
This PR updates the plugin to support Capacitor v8. The migration follows the official Capacitor v8 plugin upgrade guide.
This update addresses build issues on Android and specifically fixes compilation errors on iOS introduced by the stricter Swift Package Manager (SPM) integration in Capacitor v8.
Key Changes
📱 iOS (Swift & SPM)
The transition to Capacitor v8 and its default usage of Swift Package Manager required several adjustments in
CameraPreviewPlugin.swiftandCameraController.swift:rejectvsresolve):call.reject()is not reliably exposed or callable in the same way as CocoaPods.call.reject("message")with a state-based resolution pattern:call.resolve(["success": false, "error": "message"]). This ensures the plugin compiles and behaves consistently across toolchains.getInt,getString) are retrieved. Capacitor v8 accessors now enforce strict non-optional returns in certain contexts.call.options["key"]or provided explicit default values where appropriate to prevent runtime crashes and build errors.UIApplication.shared.statusBarOrientation(iOS 13+) with modernUIWindowScenelogic to correctly determine interface orientation.📦 Dependencies (NPM)
@capacitor/core,@capacitor/android, and@capacitor/iosto^8.0.0.package.jsoncontains specificoverridesfor ESLint versions. To respect your current configuration and avoid altering the repository's architecture or linting rules, I utilizednpm install --forceto resolve the peer dependency graph. You may want to review theoverridessection in a future maintenance update to align it with the newer TypeScript/ESLint ecosystem, but for now, I have left it as is to minimize friction.This PR has been tested locally on both Android and iOS.
However, since this plugin interacts with system-level settings and behavior can vary
between devices and OS versions, it is strongly recommended that the original maintainer
also tests these changes in their own environment before approving and releasing.
No breaking changes are introduced beyond the already required Capacitor 8 migration.