Skip to content

Commit 9235a6c

Browse files
authored
[Fix] toggle overlay (#1143)
* init fix toggle overlay * update hp/overlay to alpha build * fix codecheck * prettier * update hp overlay * update ext provider and overlay
1 parent ac374ca commit 9235a6c

File tree

7 files changed

+38
-42
lines changed

7 files changed

+38
-42
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"@hyperplay/check-disk-space": "^3.5.2",
172172
"@hyperplay/quests-ui": "^0.0.28",
173173
"@hyperplay/ui": "^1.8.8",
174-
"@hyperplay/utils": "^0.2.4",
174+
"@hyperplay/utils": "^0.3.3",
175175
"@mantine/carousel": "^7.12.0",
176176
"@mantine/core": "^7.12.0",
177177
"@mantine/dropzone": "^7.12.0",
@@ -364,9 +364,9 @@
364364
},
365365
"optionalDependencies": {
366366
"@hyperplay/extension-importer": "^0.0.4",
367-
"@hyperplay/extension-provider": "^0.0.7",
367+
"@hyperplay/extension-provider": "^0.0.8",
368368
"@hyperplay/mock-backend": "^0.0.1",
369-
"@hyperplay/overlay": "^0.0.6",
369+
"@hyperplay/overlay": "^0.0.7",
370370
"@hyperplay/providers": "^0.0.6",
371371
"@hyperplay/proxy-server": "^0.0.11"
372372
},

src/backend/main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ if (!gotTheLock) {
439439
// Someone tried to run a second instance, we should focus the overlay or the main window if no overlay is running.
440440
const hpOverlay = await getHpOverlay()
441441
if (hpOverlay?.overlayIsRunning()) {
442-
hpOverlay.toggleOverlay({ action: 'ON' })
442+
hpOverlay.toggleOverlay({ action: 'ON', actionCause: 'AUTOMATED' })
443443
} else {
444444
const mainWindow = getMainWindow()
445445
mainWindow?.show()
@@ -484,8 +484,8 @@ if (!gotTheLock) {
484484

485485
// keyboards with alt and no option key can be used with mac so register both
486486
const hpOverlay = await getHpOverlay()
487-
const toggle =
488-
hpOverlay?.toggleOverlay ??
487+
const toggle = () =>
488+
hpOverlay?.toggleOverlay({ action: 'TOGGLE', actionCause: 'HOTKEY' }) ??
489489
(() =>
490490
logInfo(
491491
'Cannot toggle overlay without @hyperplay/overlay package',
@@ -2069,9 +2069,9 @@ ipcMain.on('killOverlay', async () => {
20692069
hpOverlay?.closeOverlay()
20702070
})
20712071

2072-
ipcMain.on('toggleOverlay', async () => {
2072+
ipcMain.on('toggleOverlay', async (ev, ...args) => {
20732073
const hpOverlay = await getHpOverlay()
2074-
hpOverlay?.toggleOverlay()
2074+
hpOverlay?.toggleOverlay(...args)
20752075
})
20762076

20772077
ipcMain.handle('getHyperPlayListings', async () => {

src/backend/overlay/api.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
PROVIDERS,
33
OverlayRenderState,
44
OverlayMode,
5-
ToastKey
5+
ToastKey,
6+
HyperPlayAPI
67
} from '@hyperplay/utils'
78
import { Toast } from './types'
89
import { ipcRenderer } from 'electron'
@@ -102,4 +103,6 @@ export const lockPopup = (lock: boolean) => ipcRenderer.send('lockPopup', lock)
102103

103104
export const killOverlay = () => ipcRenderer.send('killOverlay')
104105

105-
export const toggleOverlay = () => ipcRenderer.send('toggleOverlay')
106+
export const toggleOverlay = (
107+
args: Parameters<HyperPlayAPI['toggleOverlay']>[0]
108+
) => ipcRenderer.send('toggleOverlay', args)

src/common/typedefs/ipcBridge.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ import {
5454
MetaMaskInitMethod,
5555
ImportableBrowser,
5656
MetaMaskImportOptions,
57-
ClientUpdateStatuses
57+
ClientUpdateStatuses,
58+
HyperPlayAPI
5859
} from '@hyperplay/utils'
5960

6061
/**
@@ -94,7 +95,7 @@ interface HyperPlaySyncIPCFunctions {
9495
toastCloseOnClick: (key: ToastKey) => void
9596
lockPopup: (lock: boolean) => void
9697
killOverlay: () => void
97-
toggleOverlay: () => void
98+
toggleOverlay: HyperPlayAPI['toggleOverlay']
9899
authConnected: () => void
99100
goToGamePage: (gameId: string, action: GamePageActions) => void
100101
authDisconnected: () => void

src/frontend/OverlayManager/Overlay/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const Overlay = observer(function ({
7474
</Button>
7575
<Button
7676
onClick={async () => {
77-
window.api.toggleOverlay()
77+
window.api.toggleOverlay({ action: 'OFF', actionCause: 'HOTKEY' })
7878
}}
7979
type="secondary"
8080
size="medium"

src/frontend/screens/Quests/components/QuestDetailsViewPlay/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ export const QuestDetailsViewPlayWrapper = observer(
233233
steamAccountLinked: false
234234
},
235235
playStreak: getPlaystreakArgsFromQuestData({
236+
// @ts-expect-error need to update quests-ui to match new hp/utils Quest type
236237
questMeta,
237238
questPlayStreakData
238239
})

yarn.lock

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,12 +1263,12 @@
12631263
fs-extra "^11.2.0"
12641264
graceful-fs "^4.2.11"
12651265

1266-
"@hyperplay/extension-provider@^0.0.7":
1267-
version "0.0.7"
1268-
resolved "https://registry.yarnpkg.com/@hyperplay/extension-provider/-/extension-provider-0.0.7.tgz#20d380ced3e1cac2f700143471d49b0ff6ed9e1c"
1269-
integrity sha512-BcI53hI9sC1vtup1cB0+7a5gL34lSq8INUOl/CY/F+4l4YG7IHQBZ9E6IEd76oO+kloxpVBggoe1DUwa+qyutA==
1266+
"@hyperplay/extension-provider@^0.0.8":
1267+
version "0.0.8"
1268+
resolved "https://registry.yarnpkg.com/@hyperplay/extension-provider/-/extension-provider-0.0.8.tgz#74c95ebd4bb7f148051960fb614bd6d5462119a5"
1269+
integrity sha512-/5UHQdjHhvPX2iAmnZ9xy6c+yx70VYSYjnE/iSKdyfrZpIkY2kFzTGzi38nZV1GZVoKjV2EDuzLImYt9eXxjSw==
12701270
dependencies:
1271-
"@hyperplay/utils" "^0.0.12"
1271+
"@hyperplay/utils" "^0.3.3"
12721272
fs-extra "^11.2.0"
12731273
graceful-fs "^4.2.11"
12741274
zod "^3.23.8"
@@ -1285,12 +1285,12 @@
12851285
express "^4.18.2"
12861286
stream-throttle "^0.1.3"
12871287

1288-
"@hyperplay/overlay@^0.0.6":
1289-
version "0.0.6"
1290-
resolved "https://registry.yarnpkg.com/@hyperplay/overlay/-/overlay-0.0.6.tgz#c25bc205917dfc0c17c9b95a525cea08960a3680"
1291-
integrity sha512-y9GON2QFoJybfElUhv8P9eDPwRXLyHzcCvr2GLPY685Yww8ryGlnpj8LevpLqirz71PqrR2p5P9wmUTybi9KMg==
1288+
"@hyperplay/overlay@^0.0.7":
1289+
version "0.0.7"
1290+
resolved "https://registry.yarnpkg.com/@hyperplay/overlay/-/overlay-0.0.7.tgz#d212accddc925cac7f11d626b4ba30a9058819f9"
1291+
integrity sha512-iIKdcFewYLh32aqwDPYxUQHJ5LCNTayhfYU/8ZhL4t8/PmjZtmzSKiBoMH/U+8S31m9kE4aoavMmHYX5xhkqtw==
12921292
dependencies:
1293-
"@hyperplay/utils" "^0.0.14"
1293+
"@hyperplay/utils" "^0.3.3"
12941294
mobx "^6.12.3"
12951295

12961296
"@hyperplay/providers@^0.0.6":
@@ -1329,31 +1329,17 @@
13291329
resolved "https://registry.yarnpkg.com/@hyperplay/ui/-/ui-1.8.8.tgz#35e833a3f9760fe0d74a539e32f9cc77a77cfa4c"
13301330
integrity sha512-UpSV2mbd1XLkZfh6YPiYCwj7ZEqz/Jk1aFym8YLrNmY70AjhVDMxBJmSxuy83iKWJbBeIZAxE5ZzAAU2fiZpFg==
13311331

1332-
"@hyperplay/utils@^0.0.12":
1333-
version "0.0.12"
1334-
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.0.12.tgz#4ce7a97268f862deae99363d2d8029ee80003cc0"
1335-
integrity sha512-EQ7i/OPlF8Se1DsLWvyrEf1Bv20wNnKpT7U+t6KolDudolhAnMNMvjnpcDc431ctWxpi9PZbYjNcwhkGdpo9ww==
1336-
dependencies:
1337-
bignumber.js "^9.1.2"
1338-
1339-
"@hyperplay/utils@^0.0.14":
1340-
version "0.0.14"
1341-
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.0.14.tgz#7420bdb67214c24086ed8463a9cabc30a7023192"
1342-
integrity sha512-eWn3jVTBBH2ki5+etZQs77hH4qVpphSINjBRW8AJ5oNtUXCqrPFS+eFimfUyzi+Kwl2/ef9lQ1QD3SEe/1BRZA==
1343-
dependencies:
1344-
bignumber.js "^9.1.2"
1345-
13461332
"@hyperplay/utils@^0.0.9":
13471333
version "0.0.9"
13481334
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.0.9.tgz#80836cfde5c4d63e41f5df809ae2e80314600c5a"
13491335
integrity sha512-gMAa6gdFXfLrJUjPAD2is06qNo4MHzpb6Cbzt4xfNd7wI9chOblQ+piwTI1oFWs44GgfacsMq6i5esNly3hELg==
13501336
dependencies:
13511337
bignumber.js "^9.1.2"
13521338

1353-
"@hyperplay/utils@^0.2.4":
1354-
version "0.2.6"
1355-
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.2.6.tgz#2862c690f4dbf7871c66631f29ce0561020ef8d7"
1356-
integrity sha512-9ldiOq7ioaEecHJaqKBbwo1594nMLUPQXjaeuupqWU88GJW1CNcbhJhi6p3H6v4eSsj5IWr5VkxGmAVyOKuBkg==
1339+
"@hyperplay/utils@^0.3.3":
1340+
version "0.3.3"
1341+
resolved "https://registry.yarnpkg.com/@hyperplay/utils/-/utils-0.3.3.tgz#9d594a29012ae5a172138878208d6d4edb6412f2"
1342+
integrity sha512-t8XB7oFWJU4S1ULxVBURt9BhpgaZAq5C131Ch5wShxuMTjxxGEhTAAcppsH+VYd7lwtp4se9myzhc6u21rUNgQ==
13571343
dependencies:
13581344
bignumber.js "^9.1.2"
13591345

@@ -10442,7 +10428,12 @@ mobx-react-lite@^4.0.7:
1044210428
dependencies:
1044310429
use-sync-external-store "^1.2.0"
1044410430

10445-
mobx@^6.12.3, mobx@^6.13.1:
10431+
mobx@^6.12.3:
10432+
version "6.13.5"
10433+
resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.13.5.tgz#957d9df88c7f8b4baa7c6f8bdcb6d68b432a6ed5"
10434+
integrity sha512-/HTWzW2s8J1Gqt+WmUj5Y0mddZk+LInejADc79NJadrWla3rHzmRHki/mnEUH1AvOmbNTZ1BRbKxr8DSgfdjMA==
10435+
10436+
mobx@^6.13.1:
1044610437
version "6.13.1"
1044710438
resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.13.1.tgz#76c41aa675199f75b84a257e4bec8ff839e33259"
1044810439
integrity sha512-ekLRxgjWJr8hVxj9ZKuClPwM/iHckx3euIJ3Np7zLVNtqJvfbbq7l370W/98C8EabdQ1pB5Jd3BbDWxJPNnaOg==

0 commit comments

Comments
 (0)