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 mobile context communication #196

Merged
merged 2 commits into from
Nov 15, 2023
Merged

feat: add mobile context communication #196

merged 2 commits into from
Nov 15, 2023

Conversation

spaenleh
Copy link
Member

This PR adds the ability for apps to work on mobile.

Things we had to change:

  • The mobile app embeds apps in a WebView but does not provide the same postMessage APIs. We can hoverer rely on using the window.parent.postMessage as the mobile app will alias window.parent to window.ReactNativeWebView and the postMessage method behaves the same.
  • All future communications are not made using a port but they continue using the window.parent as there is no real need to "isolate" from other iframes in the native context.
  • add a mobile key to the LocalContext that is set to true when the app is embedded in mobile. This could allow the interface to adapt and display a better UI for larger touch targets. This is also used to choose the communication strategy (as stated above).

TLDR:

  1. added a new CommunicationChannel abstraction that allows to use the apps on mobile
  2. Apps will need to be updated with this new version of the query-client to work on mobile

@spaenleh spaenleh self-assigned this Nov 14, 2023
@spaenleh spaenleh added the feature New feature or request label Nov 14, 2023
src/hooks/postMessage.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@pyphilia pyphilia left a comment

Choose a reason for hiding this comment

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

LGTM 💯

src/hooks/postMessage.ts Outdated Show resolved Hide resolved
@spaenleh spaenleh merged commit 645b37d into main Nov 15, 2023
2 checks passed
@spaenleh spaenleh deleted the mobile-context branch December 4, 2023 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request v3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants