diff options
| author | TrainDoctor <traindoctor@protonmail.com> | 2022-09-01 13:46:49 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-01 13:46:49 -0700 |
| commit | eb439574becb9a82c283d513a98440d7c8efbafe (patch) | |
| tree | b2c0b16065f31cb2123c17622a6fe42a71cebf08 /frontend/src/components/DeckyState.tsx | |
| parent | 16a6e9b6a929dea4ad4607368e4e0c515ed15b61 (diff) | |
| download | decky-loader-eb439574becb9a82c283d513a98440d7c8efbafe.tar.gz decky-loader-eb439574becb9a82c283d513a98440d7c8efbafe.zip | |
Addition of proper branch slection (#168)
* This is a bit better, but branch selection still isn't working -_-
* I'm the king of oversight
* Selecting different branch checks for updates
* Stable doesn't detect old versions, which indicates it doesn't work
* Start adding deckyState for plugin updating
* Few tweaks
* Disable nightly selection
* Update decky-frontend-lib and move useSetting set setting to async
Diffstat (limited to 'frontend/src/components/DeckyState.tsx')
| -rw-r--r-- | frontend/src/components/DeckyState.tsx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/frontend/src/components/DeckyState.tsx b/frontend/src/components/DeckyState.tsx index 386880e9..283fb118 100644 --- a/frontend/src/components/DeckyState.tsx +++ b/frontend/src/components/DeckyState.tsx @@ -2,6 +2,7 @@ import { FC, createContext, useContext, useEffect, useState } from 'react'; import { Plugin } from '../plugin'; import { PluginUpdateMapping } from '../store'; +import { VerInfo } from '../updater'; interface PublicDeckyState { plugins: Plugin[]; @@ -9,6 +10,7 @@ interface PublicDeckyState { updates: PluginUpdateMapping | null; hasLoaderUpdate?: boolean; isLoaderUpdating: boolean; + versionInfo: VerInfo | null; } export class DeckyState { @@ -17,6 +19,7 @@ export class DeckyState { private _updates: PluginUpdateMapping | null = null; private _hasLoaderUpdate: boolean = false; private _isLoaderUpdating: boolean = false; + private _versionInfo: VerInfo | null = null; public eventBus = new EventTarget(); @@ -27,9 +30,15 @@ export class DeckyState { updates: this._updates, hasLoaderUpdate: this._hasLoaderUpdate, isLoaderUpdating: this._isLoaderUpdating, + versionInfo: this._versionInfo, }; } + setVersionInfo(versionInfo: VerInfo) { + this._versionInfo = versionInfo; + this.notifyUpdate(); + } + setPlugins(plugins: Plugin[]) { this._plugins = plugins; this.notifyUpdate(); @@ -66,6 +75,7 @@ export class DeckyState { } interface DeckyStateContext extends PublicDeckyState { + setVersionInfo(versionInfo: VerInfo): void; setIsLoaderUpdating(hasUpdate: boolean): void; setActivePlugin(name: string): void; closeActivePlugin(): void; @@ -93,12 +103,13 @@ export const DeckyStateContextProvider: FC<Props> = ({ children, deckyState }) = }, []); const setIsLoaderUpdating = (hasUpdate: boolean) => deckyState.setIsLoaderUpdating(hasUpdate); + const setVersionInfo = (versionInfo: VerInfo) => deckyState.setVersionInfo(versionInfo); const setActivePlugin = (name: string) => deckyState.setActivePlugin(name); const closeActivePlugin = () => deckyState.closeActivePlugin(); return ( <DeckyStateContext.Provider - value={{ ...publicDeckyState, setIsLoaderUpdating, setActivePlugin, closeActivePlugin }} + value={{ ...publicDeckyState, setIsLoaderUpdating, setVersionInfo, setActivePlugin, closeActivePlugin }} > {children} </DeckyStateContext.Provider> |
