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

ref: Use platformId global instead of calling into native layer getPlatform #199

Merged
merged 1 commit into from
Feb 18, 2021

Conversation

jennmueng
Copy link
Member

@jennmueng jennmueng commented Feb 17, 2021

Uses the window.cordova.platformId global that's present on Cordova instead of calling into our native bridge and needing to await a promise to determine what platform it is being run on. This results in way cleaner code. Thus, this also removes the need to call into the native bridge (which we don't have a native module for, so it will throw an error that we catch) on browser and other platforms.

This platformId global has been there for 7 years or so, so it should be safe to use, but seems to not be documented anywhere.

This PR refactors how the native bridge checks whether the native SDK, native transport, and native scope sync is ready or not. We do this by storing which platform each feature is supported in the native wrapper: SUPPORTS_NATIVE_TRANSPORT, SUPPORTS_NATIVE_SCOPE_SYNC, SUPPORTS_NATIVE_SDK.

Tests on the native wrapper are also updated to reflect the changes here.

@jennmueng jennmueng requested review from bruno-garcia, HazAT and a team February 17, 2021 18:18
@jennmueng jennmueng added this to Waiting for Review in Mobile Platform Team Archived Feb 17, 2021
@jennmueng jennmueng changed the base branch from jenn/bump-ios to master February 17, 2021 18:21
Base automatically changed from master to main February 17, 2021 22:26
@jennmueng jennmueng merged commit 46fee41 into main Feb 18, 2021
Mobile Platform Team Archived automation moved this from Waiting for Review to Done Feb 18, 2021
@lucas-zimerman lucas-zimerman deleted the jenn/platformId branch September 15, 2022 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants