radarlabs / radar-sdk-js

Web JavaScript SDK for Radar, the leading geofencing and location tracking platform
https://radar.com
Apache License 2.0
42 stars 11 forks source link

SDK initialization throws in Android Instagram webview #140

Open kincaidoneil opened 10 months ago

kincaidoneil commented 10 months ago

In my testing, navigator.permissions is undefined in the Instagram webview on Android (Chrome 119 UA/Android 14/Pixel 8).

In this scenario, the initializing the SDK throws an error: https://github.com/radarlabs/radar-sdk-js/blob/14dd21248c8c4b3ed7073082c1d598978d25ac42/src/navigator.ts#L111-L113

Could this set the authorization to NOT_DETERMINED instead of throwing?

kochis commented 10 months ago

Hi @kincaidoneil,

Thanks for opening the issue. I agree, I think that makes sense to treat a missing navigator or permissions as NOT_DETERMINED. We'll try and work these changes into a future release (can leave this issue open for the meantime).

The resulting error also should not affect the actual initialization of the SDK, as the call to get permissions should be happening asynchronously, but let me know if you're seeing otherwise.