Invoking GetPlatform on a browser logs an error "cordova is not defined" unnecessarily, and then returns an empty value. This might pollute error logs if your developers use a browser to test the app, or if you're distributing using PWA.
To fix, simply include an IF checking if IsCordovaDefined:
I would also remove the error handlers in this module, which follow the Error Hiding anti-pattern, and could be hiding other issues, although I haven't detected anything else so far.
I'm attaching the module with my suggested changes.
Leonardo,
This is super helpful having the same-ish issues with a PWA.
Hi @Leonardo Fernandes.First of all, thank you for your interest in our supported Common Plugin.We are going to have a closer look into this, and we'll get back to you once we have news to share.Best regards,Alexandre Jacinto
Hello @Leonardo Fernandes !
I just wanted to share a quick follow up that the team has taken a look at this suggestion and has implemented some changes to the common plugin. These changes will be made available in the next release of the common plugin.
Thanks!
Dallas James