feat: Disable session lock when running in element-desktop (#30643)

* feat: Disable session lock when running in element-desktop

* feat: Use Platform abstractions over direct invocation for session lock.

* fix: Remove window.electron checks from session lock methods.

* docs: Remove extraneous doc comments.

* feat: Convert BasePlatform session methods to abstract methods.

* fix: Check for PlatformPeg instance in session lock.

* fix: Remove async marker from checkSessionLockFree
This commit is contained in:
Skye Elliot
2025-09-23 15:46:01 +01:00
committed by GitHub
parent ca3060af69
commit c8d937655b
6 changed files with 51 additions and 3 deletions

View File

@@ -508,4 +508,19 @@ export default abstract class BasePlatform {
* Begin update polling, if applicable
*/
public startUpdater(): void {}
/**
* Checks if the current session is lock-free, i.e., no other instance is holding the session lock.
* Platforms that support session locking should override this method.
* @returns {boolean} True if the session is lock-free, false otherwise.
*/
public abstract checkSessionLockFree(): boolean;
/**
* Attempts to acquire a session lock for this instance.
* If another instance is detected, calls the provided callback.
* Platforms that support session locking should override this method.
* @param _onNewInstance Callback to invoke if a new instance is detected.
* @returns {Promise<boolean>} True if the lock was acquired, false otherwise.
*/
public abstract getSessionLock(_onNewInstance: () => Promise<void>): Promise<boolean>;
}