Hello.
This is my first app using Capacitor, so please be gentle
.
I am using the @capacitor/screen-orientation plugin to force my app into portrait mode. This works great on Android devices and iPhones (iOS). Sadly, after hours of debugging, I discovered that it was this plugin that breaks the app on iPads. This is due to Apple apparently having removed the API to force orientation on iPadOS. I had no idea and it would appear most of the internet doesnât either. This causes the app to fail running any JavaScript after it opens.
Having the plugin present doesnât seem to cause an issue until you come to use it so I can live with it being installed, but it would be nice to have conditions on these two JavaScript lines so they are not run on iPads:
import { ScreenOrientation } from â@capacitor/screen-orientationâ;
await ScreenOrientation.lock({orientation: âportraitâ});
Is it possible to do this? Have device/OS conditions inside the JavaScript? I am currently using Capacitor 7.4.2 if that makes any difference.
Thank you for any help or advice you can provide.