fix: deep and universal links#139
Closed
thiagobrez wants to merge 11 commits intocallstack:mainfrom
thiagobrez:fix/deep-universal-linking
Closed
fix: deep and universal links#139thiagobrez wants to merge 11 commits intocallstack:mainfrom thiagobrez:fix/deep-universal-linking
thiagobrez wants to merge 11 commits intocallstack:mainfrom
thiagobrez:fix/deep-universal-linking
Conversation
fix: address issues with scale, ScrollView prop feat: move min_visionos_version_supported to Helpers feat: implement `visionos_hoverStyle` prop chore: update README.MD fix: refactor visionos_hoverStyle to take a string and new arch support docs: add link to rn-tester's README.md (#5) chore: change VisionOS to visionOS (#13) chore: use `min_supported_versions` for third-party-podspecs (#18) chore: remove not necessary ifs TARGET_OS_VISION, minimise code diff (#22) feat: add visionos support add warning when using InputAccessoryView update platform naming fix: remove keyboard listerners and mark as unsupported (#25) * fix: remove keyboard listerners and mark as unsupported * chore: replace warn with warnOnce feat: support building visionOS with dynamic frameworks enabled (#28) chore: sync Podfile.lock with upstream, remove unnecessary #endif feat: add visionOS as separate target to fix iOS tests (#31) * feat: add visionOS as separate target to fix iOS tests * fix: disable multiple windows support * feat: add visionOS App Icon * fix: creating Release build Update README.md (#36) * Update README.md * fix: update README link * feat: add caution section * fix: bring back info about Hermes Add platform guidelines to README (#37) * Add platform guidelines to README * fix: link to docs Rename react-native package to @callstack/react-native-visionos (#35) * rename react-native package to @callstack/react-native-visionos * fix typo * Make JS and TS tests independent of react-native package name * change name in template * replace more refs in e2e tests * revert tests changes * disable js e2e tests for visionos * bring back react-native for other platforms compat * ci: run js, no e2e js Fix codegen issues for RNTester after renaming package (#40) feat: make hermes build for visionOS (#26) * [WIP] feat: make hermes build for visionOS * feat: point to callstack/hermes-visionos fork, update README * fix: remove USE_HERMES from project.pbxproj feat: align unnecessary compiler conditionals (#51) chore: sync Podfile.lock feat: implement OOT release script (#43) * feat: implement OOT release script * docs: add readme on Release process * fix: remove header file Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * add reference --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com> feat: add visionOS template (#34) * Update CLI to v12.1.1 * feat: implement visionos react-native template * feat: modify template look * feat: add `@callstack/out-of-tree-platforms` to metro config * fix: metro config * feat: update supported platforms --------- Co-authored-by: szymonrybczak <szymon.rybczak@gmail.com> task(StatusBar component): show warn when using StatusBar (#49) * task(StatusBar component): show warn when using StatusBar * pr suggestions docs: update CMake instructions (#55) Fix iOS native tests (#58) * fix: remove unnecessary libevent.podspec * fix: make OCMock build for visionOS fix: remove unnecessary YogaKit pod (#61) feat: add warning while building Hermes that at least CMake 3.28.0 is required (#63) fix: RCTAlertController transparent background override added cornerRadius for hover style (#66) * added corner radius for hover style * fix: implement proper handling for old arch, reformat code --------- Co-authored-by: Oskar Kwaśniewski <oskarkwasniewski@icloud.com> chore: sync Podfile.lock fix: don't warn users about the Keyboard API (#71) feat: implement visionos cli commands (#64) fix: use isVision instead of isVisionOS (#76) fix: release build bundle (#74) fix: remove duplicated isVision key (#78) fix: change resolver option name (#79) fix: RCTDeviceInfo UIApplicationDidChangeStatusBarOrientationNotification method fix: update README.md with corrected capitalization (#84) fix: upstream sync ifdefs fix: providing unsupported value to hoverStyle crashed the app (#88) fix: pointer events (#114) fix: hoverEffect for bridgeless mode (#92) refactor: remove unused RCTForegroundWindow (#94) fix: properly retrieve window when clicking DevMenu action (#95) sync with upstream chore: sync Podfile.lock docs: add how is it different from iOS version section (#91) docs: move to documentation website (#119) Update README.md (#121) * Update README.md * Update README.md Co-authored-by: Kacper Rożniata <56474758+krozniata@users.noreply.github.com> --------- Co-authored-by: Kacper Rożniata <56474758+krozniata@users.noreply.github.com> Update getting started link in Readme. (#123) Co-authored-by: christinamartinez <christina.martinez@faithlife.com> chore: remove hover effect & add cursor: pointer (#122) * chore: remove hover effect * fix: set cursor pointer by default, update tests * feat(iOS): Implement cursor style prop --------- Co-authored-by: Saad Najmi <sanajmi@microsoft.com> chore: resync with upstream fix: change versio of @callstack/out-of-tree-platforms feat: make SwiftUI React Native entry point (#68) * feat: add Swift entrypoint [wip] add module maps to some RN modules to allow for swift c++ imports feat: implement RCTReactController and RCTSwiftUIAppDelegate feat: introduce new method to RCTAppDelegate * feat: modify template to use SwiftUI * fix: dimensions, use RCTMainWindow() * fix: fallback to DarkMode on visionOS * fix: use KeyWindow() in RCTPerfMonitor feat: update docs (#80) * feat: update docs * Update README.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update README.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update README.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update README.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> * Update README.md Co-authored-by: Michał Pierzchała <thymikee@gmail.com> --------- Co-authored-by: Michał Pierzchała <thymikee@gmail.com> feat: add UIApplicationSceneManifest to template Create custom resolver and utils package for out-of-tree platforms (#32) * rename react-native package to @callstack/react-native-visionos * wip: metro setup for other platform * fix(flow): add .ios.visionos as support platform * fix some flow errors * fix flow * revert Platform.select change * revert KeyboardAvoidingView change * fix type * change kBundlePath to ios.visionos * fix: remove redundant isVisionOS * use custom resolver options to read platform for OOT * fix types * remove formatting * add/remove platform checks * document variant behavior * use visionOS Keyboard mock * use visionOS KeyboardAvoidingView mock * use visionOS InputAccessoryView mock * test: add test for metroPlatformResolver * move implementation to user space * create out-of-tree-platforms package and bring back resolver options * revert flow changes * revert sourceExts changes * update links * add comments * fix visionos typo * adjust lockfile * revert loadMetroConfig change * remove podfile lock * revert scripts changes Fix build step for `@callstack/out-of-tree-platforms` (#46) * feat: setup @callstack/out-of-tree-platforms to build properly * feat: add build packages step to `oot-release.js` script * chore: format package.json fix(#48) local build of @callstack/out-of-tree-platforms (#50)
feat: use Xcode beta globally feat: use callstack/hermes-visionos fork feat: test Hermes feat: reset cache keys fix: use callstack/hermes fix: use correct hermes source tarball fix: use never xcode version test only JSC fix: change Xcode version fix: use m1 executor feat: add cocoapods cache fix: remove hermes from cache keys fix: rbenv reset cache test: use 15.2 fix: run visionos CI on every PR (#62) chore: disable some of upstream pipelines (#33) * chore: disable some of upstream pipelines * tests: update snapshot for visionOS * chore: disable more jobs, fix isVisionOS * fix: Keyboard.js, adjust pipeline_selection.js * feat: run iOS tests every night chore: disable android tests (#39) fix: prevent from running the testAll.yml on main (#41) fix: ci on main (#44) fix: remove windows jobs (#126) * fix: remove windows jobs * fix: sync jobs.yml
fix: adjust oot-release script for stable releases (#85)
* feat: add multi-window support * feat: introduce WindowManager fix: RCTReactViewController properly check props to update fix: use clearColor instead of systemBackgroundColor for visionOS (#125)
thiagobrez
commented
Apr 8, 2024
Comment on lines
+92
to
+104
| // Deep Links | ||
| for (UIOpenURLContext *urlContext in connectionOptions.URLContexts) { | ||
| if (urlContext) { | ||
| postNotificationWithURL(urlContext.URL, self); | ||
| } | ||
| } | ||
|
|
||
| // Universal Links | ||
| for (NSUserActivity *userActivity in connectionOptions.userActivities) { | ||
| if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { | ||
| postNotificationWithURL(userActivity.webpageURL, self); | ||
| } | ||
| } |
Author
There was a problem hiding this comment.
This should work, but the problem lies deeper because connectionOptions will come empty in the first place, due to the root View being started without launchOptions
thiagobrez
commented
Apr 8, 2024
Comment on lines
+122
to
+128
| // Universal Links - called when the app was previously running or suspended | ||
| // Called from SwiftUI's onOpenURL(perform:) | ||
| + (BOOL)onOpenURL:(NSURL *)url | ||
| { | ||
| postNotificationWithURL(url, self); | ||
| return YES; | ||
| } |
Author
There was a problem hiding this comment.
This is meant to capture the Universal Links coming from the SwiftUI onOpenURL view modifier
There was a problem hiding this comment.
I think we don't need to support both ways as the UIWindowSceneDelegate also handles universal links according to this page: https://developer.apple.com/documentation/xcode/supporting-universal-links-in-your-app
There was a problem hiding this comment.
So we should choose one or another
|
Closed in favour of #140 |
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.
Summary:
Fixes #138
Deep and Universal Links currently do not work on RN visionOS. Since iOS 13, if the project has opted into Scenes, lifecycle events are now controlled by SceneDelegate instead of AppDelegate.
After this PR is merged, we also need docs showing how to implement them, since the React Native docs only apply to non-Scene apps.
This PR is intended to be worked on. Currently, this solution works for Deep and Universal links when the app is already running or in background. When launching the app (previously killed) via Deep or Universal Links,
Linking.getInitialUrl()will always returnnull, due tolaunchOptionsbeing initialized as an empty object inRCTReactViewController.The Apple Documentation indicates
scene(_ :continue:)for handling Universal Links when app is already running, but that only applies to UIKit-based apps. For SwiftUI, theonOpenURL(_:perform:)view modifier must be used.Final usage example for apps:
SceneDelegate.swift
App.swift
AppDelegate.swift
Changelog:
[IOS] [ADDED] - Added equivalent scene method
scene:willConnectTo:options:to handle Deep and Universal Links when app was previously NOT running[IOS] [ADDED] - Added equivalent scene method
scene:openURLContexts:to handle Deep Links when app was previously in background or suspended[IOS] [ADDED] - Added equivalent scene method
onOpenURLto handle Universal Links when app was previously in background or suspendedTest Plan:
rntester://) with app previously killed, fetch initial URL viaLinking.getInitialURL()rntester://) with app previously running or suspended, fetch incoming url viaLinking.addEventListener('url', callback)Linking.getInitialURL()Linking.addEventListener('url', callback)