fix(apple): add watchOS platform compatibility#81
Conversation
- Use #if os(iOS) || os(tvOS) instead of canImport(UIKit) for UIWindowScene - Use #if os(iOS) for presentCodeRedemptionSheet (iOS-only API) - Use #if os(iOS) || os(tvOS) || os(visionOS) for UIApplication.open - Add watchOS 9.0 to @available for getAppTransactionIOS (requires AppTransaction) - Add tvOS 16.0 to @available annotations for consistency Fixes watchOS build errors caused by UIKit APIs not available on watchOS. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 WalkthroughWalkthroughThe PR extends Apple package platform support to tvOS and watchOS by updating availability annotations and platform detection logic. Release workflows are updated to support a "current" version option that skips version bumping when redeploying without code changes. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @hyochan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses and resolves watchOS build errors that were introduced by a previous merge, significantly enhancing the library's overall platform compatibility. It refactors conditional compilation logic to utilize more precise Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively addresses watchOS build errors by replacing broad canImport checks with more specific os() conditions. The changes correctly handle platform-specific API availability for UIWindowScene, presentCodeRedemptionSheet, and UIApplication.open. Additionally, the @available attributes have been updated to include watchOS and ensure consistency across platforms. I have one suggestion to include visionOS in a platform check to further improve compatibility.
- Add 'current' to version choice options for both Apple and Google workflows - Skip version bump/commit when 'current' is selected - Allow tag reuse in Google workflow when using 'current' mode - Enables easy retry after partial deployment failures Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/release-google.yml (1)
350-355:⚠️ Potential issue | 🟡 Minor
gh release createwill fail if the release already exists during a retry.Unlike the Apple workflow (lines 297–303) which checks
gh release viewbefore creating, the Google workflow unconditionally callsgh release create. Incurrentmode (retrying a partial deployment), the GitHub release may already exist from a previous run, causing this step to fail.Suggested fix: guard release creation like the Apple workflow
- gh release create "google-$VERSION" \ - $ARTIFACTS \ - --title "Google $VERSION" \ - --latest \ - --notes-file /tmp/release-notes.md + if gh release view "google-$VERSION" >/dev/null 2>&1; then + echo "ℹ️ Release google-$VERSION already exists. Skipping creation." + else + gh release create "google-$VERSION" \ + $ARTIFACTS \ + --title "Google $VERSION" \ + --latest \ + --notes-file /tmp/release-notes.md + fi
🧹 Nitpick comments (2)
packages/apple/Sources/OpenIapModule.swift (1)
344-376: Consider includingvisionOSin the UIWindowScene branch.
UIWindowSceneis available on visionOS, so#if os(iOS) || os(tvOS)excludes visionOS from theconfirmIn:purchase flow. visionOS will fall through to the#elsebranch (plainproduct.purchase(options:)), which works but skips the enhanced confirmation UI.If this is intentional to keep the PR scoped to the watchOS fix, that's fine — but it may be worth a follow-up.
Optional: include visionOS
- `#if` os(iOS) || os(tvOS) - // iOS/tvOS: Use UIWindowScene (not available on watchOS) + `#if` os(iOS) || os(tvOS) || os(visionOS) + // iOS/tvOS/visionOS: Use UIWindowScene (not available on watchOS)packages/apple/Sources/OpenIapModule+ObjC.swift (1)
627-651: Note:#if !os(tvOS)doesn't exclude watchOS for the ObjC bridge.The compile-time guard at line 627 excludes tvOS but still compiles
presentCodeRedemptionSheetIOSWithCompletionon watchOS. This is safe because the underlyingpresentCodeRedemptionSheetIOS()(inOpenIapModule.swiftline 1070) has#if os(iOS)and throws.featureNotSupportedon non-iOS platforms at runtime. Consider tightening this to#if os(iOS)or#if !os(tvOS) && !os(watchOS)for compile-time clarity.
Add visionOS to the platform conditional for UIWindowScene usage since visionOS also supports UIWindowScene and purchase(confirmIn:). Addresses PR review comment from gemini-code-assist. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## Summary - Sync with OpenIAP apple 1.3.15 - Includes watchOS platform compatibility fixes - iOS 15 compatibility for priceFormatStyle API ## Related - OpenIAP PR: hyodotdev/openiap#81 - OpenIAP Release: https://cocoapods.org/pods/openiap ## Changes - Update openiap-versions.json (apple: 1.3.14 → 1.3.15) ## Test Plan - [x] `bun run lint:ci` passes - [x] `bun run test` passes (221 tests) 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated Apple package version to 1.3.15. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
## Summary - Sync with OpenIAP apple 1.3.15 - Includes watchOS platform compatibility fixes - iOS 15 compatibility for priceFormatStyle API - visionOS support for UIWindowScene ## Related - OpenIAP PR: hyodotdev/openiap#81 - OpenIAP Release: https://cocoapods.org/pods/openiap ## Changes - Update openiap-versions.json (apple: 1.3.14 → 1.3.15) - NitroIap.podspec automatically uses new version ## Test Plan - [x] `yarn typecheck` passes - [x] `yarn test` passes (244 tests) - [x] Pre-commit checks passed 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated Apple component version to 1.3.15. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Summary
#if os(iOS) || os(tvOS)instead ofcanImport(UIKit)for UIWindowScene (not available on watchOS)#if os(iOS)forpresentCodeRedemptionSheet(iOS-only API)#if os(iOS) || os(tvOS) || os(visionOS)forUIApplication.open(not available on watchOS/macOS)watchOS 9.0to@availableforgetAppTransactionIOS(AppTransaction requires watchOS 9.0+)tvOS 16.0to@availableannotations for consistencyFixes watchOS build errors that occurred after merging #80.
Test plan
pod lib lint openiap.podspec --allow-warnings🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements