Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add visionOS support #2644

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

okwasniewski
Copy link

@okwasniewski okwasniewski commented Dec 19, 2023

This PR adds visionOS support.

I've refactored some parts of the code to take the currently presented scene by wrapping built-in utility RCTKeyWindow() to work in async scenarios.

Testing

  1. npx @callstack/react-native-visionos init App
  2. Add react-native-iap
  3. Check out if it works

Demo

CleanShot.2024-03-05.at.09.53.42.mp4


@interface RCT_EXTERN_MODULE (RNIapIosSk2, NSObject)

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isAvailable){
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"15.0")) {
if (@available(iOS 15.0, *)) {
Copy link
Author

Choose a reason for hiding this comment

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

I've refactored this to use @available the SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO was returning "1.0" for visionOS and @available is universal.

Source: https://roadfiresoftware.com/2014/01/the-right-way-to-check-the-ios-version-in-an-app/

@okwasniewski
Copy link
Author

Build is failing because CI needs a newer Xcode version

@matthargett
Copy link

@hyochan can @okwasniewski get some permissions to help work out the CI issue, so this PR can be made to pass CI? His similar visionOS work has been merged in gesture-handler, reanimated, screens, and numerous other projects. It would be great to get IAP support into a release of our react-native-visionos apps soon without the need for local patches :D

@okwasniewski okwasniewski force-pushed the feat/visionOS branch 3 times, most recently from 4cffadb to e728c7e Compare March 4, 2024 14:20
@okwasniewski okwasniewski marked this pull request as ready for review March 5, 2024 08:55
@okwasniewski
Copy link
Author

Hey @hyochan, I've fixed the CI and the PR is now ready for review. Let me know if I can help you in any way to get this merged

ios/RNIapIosSk2.swift Outdated Show resolved Hide resolved
.github/workflows/ci-example-ios.yml Show resolved Hide resolved
@matthargett
Copy link

@TheRogue76 was there anything else needed for this to be merged? I'm excited to remove our local patch-package and let other RNV apps start to monetize :)

@TheRogue76
Copy link

@TheRogue76 was there anything else needed for this to be merged? I'm excited to remove our local patch-package and let other RNV apps start to monetize :)

I am not a maintainer of RN IAP, simply an open-source contributor who used this repo at one point and had it marked as watched. I just double-checked the PR. I do not have access to the repo to merge or block the PRs. As far as I see, the PR is perfectly fine.

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.

None yet

3 participants