} */
- initialize() {
- document.documentElement.classList.add("p-" + this.getId());
- return Promise.resolve();
+ /**
+ * Should return if this platform supports ads at all
+ */
+ getSupportsAds() {
+ return false;
+ }
+
+ /**
+ * Attempt to restart the app
+ */
+ performRestart() {
+ logger.log(this, "Performing restart");
+ window.location.reload();
+ }
+
+ initializeAchievementProvider() {
+ return this.app.achievementProvider.initialize().catch(err => {
+ logger.error("Failed to initialize achievement provider, disabling:", err);
+
+ this.app.achievementProvider = new NoAchievementProvider(this.app);
+ });
+ }
+
+ initializeDlcStatus() {
+ logger.log("Checking DLC ownership ...");
+ // @todo: Don't hardcode the app id
+ return ipcRenderer.invoke("steam:check-app-ownership", 1625400).then(
+ res => {
+ logger.log("Got DLC ownership:", res);
+ this.dlcs.puzzle = Boolean(res);
+ },
+ err => {
+ logger.error("Failed to get DLC ownership:", err);
+ }
+ );
+ }
+
+ /**
+ * Returns the UI scale, called on every resize
+ * @returns {number} */
+ getUiScale() {
+ if (IS_MOBILE) {
+ return 1;
+ }
+
+ const avgDims = Math.min(this.app.screenWidth, this.app.screenHeight);
+ return clamp((avgDims / 1000.0) * 1.9, 0.1, 10);
+ }
+
+ /**
+ * Returns whether this platform supports a toggleable fullscreen
+ */
+ getSupportsFullscreen() {
+ return true;
+ }
+
+ /**
+ * Should set the apps fullscreen state to the desired state
+ * @param {boolean} flag
+ */
+ setFullscreen(flag) {
+ ipcRenderer.send("set-fullscreen", flag);
+ }
+
+ getSupportsAppExit() {
+ return true;
+ }
+ /**
+ * Attempts to quit the app
+ */
+ exitApp() {
+ logger.log(this, "Sending app exit signal");
+ ipcRenderer.send("exit-app");
+ }
+
+ /**
+ * Whether this platform supports a keyboard
+ */
+ getSupportsKeyboard() {
+ return true;
}
/**
@@ -61,67 +167,4 @@ export class PlatformWrapperInterface {
getScreenScale() {
return Math.min(window.innerWidth, window.innerHeight) / 1024.0;
}
-
- /**
- * Should return if this platform supports ads at all
- */
- getSupportsAds() {
- return false;
- }
-
- /**
- * Attempt to open an external url
- * @param {string} url
- * @param {boolean=} force Whether to always open the url even if not allowed
- * @abstract
- */
- openExternalLink(url, force = false) {
- abstract;
- }
-
- /**
- * Attempt to restart the app
- * @abstract
- */
- performRestart() {
- abstract;
- }
-
- /**
- * Returns whether this platform supports a toggleable fullscreen
- */
- getSupportsFullscreen() {
- return false;
- }
-
- /**
- * Should set the apps fullscreen state to the desired state
- * @param {boolean} flag
- * @abstract
- */
- setFullscreen(flag) {
- abstract;
- }
-
- /**
- * Returns whether this platform supports quitting the app
- */
- getSupportsAppExit() {
- return false;
- }
-
- /**
- * Attempts to quit the app
- * @abstract
- */
- exitApp() {
- abstract;
- }
-
- /**
- * Whether this platform supports a keyboard
- */
- getSupportsKeyboard() {
- return !IS_MOBILE;
- }
}
diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js
index e31dab9e..b454c163 100644
--- a/src/js/profile/application_settings.js
+++ b/src/js/profile/application_settings.js
@@ -189,7 +189,7 @@ function initializeSettings() {
},
/**
* @param {Application} app
- */ app => G_IS_STANDALONE
+ */ app => true
),
new BoolSetting(
@@ -288,7 +288,7 @@ function initializeSettings() {
class SettingsStorage {
constructor() {
this.uiScale = "regular";
- this.fullscreen = G_IS_STANDALONE;
+ this.fullscreen = true;
this.soundVolume = 1.0;
this.musicVolume = 1.0;
diff --git a/src/js/states/main_menu.js b/src/js/states/main_menu.js
index 14c23577..0ec4dcab 100644
--- a/src/js/states/main_menu.js
+++ b/src/js/states/main_menu.js
@@ -16,7 +16,6 @@ import {
} from "../core/utils";
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
import { MODS } from "../mods/modloader";
-import { PlatformWrapperImplElectron } from "../platform/electron/wrapper";
import { Savegame } from "../savegame/savegame";
import { T } from "../translations";
diff --git a/src/js/states/mods.js b/src/js/states/mods.js
index 80bcb4b5..2cb41109 100644
--- a/src/js/states/mods.js
+++ b/src/js/states/mods.js
@@ -13,7 +13,7 @@ export class ModsState extends TextualGameState {
}
get modsSupported() {
- return G_IS_STANDALONE || G_IS_DEV;
+ return true;
}
internalGetFullHtml() {
@@ -23,15 +23,11 @@ export class ModsState extends TextualGameState {
${
- this.modsSupported && MODS.mods.length > 0
+ MODS.mods.length > 0
? ``
: ""
}
- ${
- this.modsSupported
- ? ``
- : ""
- }
+
`;
@@ -45,18 +41,6 @@ export class ModsState extends TextualGameState {
}
getMainContentHTML() {
- if (!this.modsSupported) {
- return `
-
-
-
${T.mods.noModSupport}
-
-
-
-
- `;
- }
-
if (MODS.mods.length === 0) {
return `
@@ -121,10 +105,6 @@ export class ModsState extends TextualGameState {
}
openModsFolder() {
- if (!G_IS_STANDALONE) {
- this.dialogs.showWarning(T.global.error, T.mods.folderOnlyStandalone);
- return;
- }
ipcRenderer.invoke("open-mods-folder");
}
diff --git a/src/js/states/preload.js b/src/js/states/preload.js
index 5b170dfd..872477f0 100644
--- a/src/js/states/preload.js
+++ b/src/js/states/preload.js
@@ -5,7 +5,6 @@ import { createLogger } from "../core/logging";
import { getLogoSprite, timeoutPromise } from "../core/utils";
import { getRandomHint } from "../game/hints";
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
-import { PlatformWrapperImplBrowser } from "../platform/browser/wrapper";
import { autoDetectLanguageId, T, updateApplicationLanguage } from "../translations";
const logger = createLogger("state/preload");
@@ -74,27 +73,6 @@ export class PreloadState extends GameState {
.then(() => this.setStatus("Creating platform wrapper", 3))
.then(() => this.app.platformWrapper.initialize())
- .then(() => this.setStatus("Initializing local storage", 6))
- .then(() => {
- const wrapper = this.app.platformWrapper;
- if (wrapper instanceof PlatformWrapperImplBrowser) {
- try {
- window.localStorage.setItem("local_storage_test", "1");
- window.localStorage.removeItem("local_storage_test");
- } catch (ex) {
- logger.error("Failed to read/write local storage:", ex);
- return new Promise(() => {
- alert(
- "Your brower does not support thirdparty cookies or you have disabled it in your security settings.\n\n" +
- "In Chrome this setting is called 'Block third-party cookies and site data'.\n\n" +
- "Please allow third party cookies and then reload the page."
- );
- // Never return
- });
- }
- }
- })
-
.then(() => this.setStatus("Creating storage", 9))
.then(() => {
return this.app.storage.initialize();
@@ -172,10 +150,6 @@ export class PreloadState extends GameState {
return;
}
- if (!G_IS_STANDALONE) {
- return;
- }
-
return this.app.storage
.readFileAsync("lastversion.bin")
.catch(err => {
diff --git a/src/tsconfig.json b/src/tsconfig.json
index aad7a9f4..6a61addc 100644
--- a/src/tsconfig.json
+++ b/src/tsconfig.json
@@ -1,19 +1,24 @@
{
- "extends": ["@tsconfig/strictest/tsconfig"],
- "include": ["./js/**/*"],
+ "extends": [
+ "@tsconfig/strictest/tsconfig"
+ ],
+ "include": [
+ "./js/**/*"
+ ],
"compilerOptions": {
"allowJs": true,
"module": "es2022",
"moduleResolution": "bundler",
"noEmit": true,
-
+ "target": "ES2022",
/* JSX Compilation */
"paths": {
- "@/*": ["./js/*"]
+ "@/*": [
+ "./js/*"
+ ]
},
"jsx": "react-jsx",
"jsxImportSource": "@",
-
// remove when comfortable
"exactOptionalPropertyTypes": false,
"noImplicitAny": false,
@@ -23,6 +28,6 @@
"noUncheckedIndexedAccess": false,
"strictNullChecks": false,
// eslint warns for this
- "noUnusedLocals": true
+ "noUnusedLocals": true,
}
-}
+}
\ No newline at end of file