startup method
This method initialises the app at startup
Implementation
void startup() {
// get reached level from local storage
if (this._localStorage.containsKey(_reachedLevelKey)) {
this._reachedLevel = int.parse(this._localStorage[_reachedLevelKey]);
}
this._activeLevel = this.getReachedLevel();
// (07/2020) Changed the flow because on iOS 13+ the permission for gyro sensor needs to be requested
RegExp isMobileRegEx = new RegExp(r"(iPad)|(iPhone)|(iPod)|(android)|(webOS)|(ipad)|(iphone)|(Android)");
if (!isMobileRegEx.hasMatch(window.navigator.userAgent)) {
// on desktop devices
this.showMessageNoSupportForGyro();
} else if ((window.innerHeight / window.screen.height) < 0.92) {
// shown if not started in fullscreen (0.92 because on iphone fs is not
// possible and with the notch it's even smaller)
this.showWelcomeScreenOnMobileDevices();
this.gyroAvailable = true;
} else {
// shown if already in fullscreen, e.g. web app
this.showLevelOverview();
this.gyroAvailable = true;
}
}