Skip to content

Commit 66db6ff

Browse files
working
1 parent ca7c0c7 commit 66db6ff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/libs/blueos.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
type Service,
1414
NoPathInBlueOsErrorName,
1515
} from '@/types/blueos'
16-
import { JoystickMapSuggestionGroupsFromExtension } from '@/types/joystick'
16+
import { JoystickMapSuggestionsFromExtension } from '@/types/joystick'
1717
import { ExternalWidgetSetupInfo } from '@/types/widgets'
1818

1919
const defaultTimeout = 10000
@@ -131,7 +131,7 @@ export const getJoystickSuggestionsFromBlueOS = async (
131131
vehicleAddress: string
132132
): Promise<JoystickMapSuggestionsFromExtension[]> => {
133133
const services = await getServicesFromBlueOS(vehicleAddress)
134-
const suggestionGroupsMap = new Map<string, JoystickMapSuggestionGroupsFromExtension>()
134+
const suggestionsMap = new Map<string, JoystickMapSuggestionsFromExtension>()
135135

136136
await Promise.all(
137137
services.map(async (service) => {
@@ -140,9 +140,12 @@ export const getJoystickSuggestionsFromBlueOS = async (
140140
if (extraJson !== null && extraJson.joystickSuggestions) {
141141
const extensionName = service.metadata?.sanitizedName || 'Unknown Extension'
142142

143-
suggestionGroupsMap.set(extensionName, {
143+
// Flatten all suggestion groups into a single suggestions array
144+
const suggestions = extraJson.joystickSuggestions.flatMap((group) => group.buttonMappingSuggestions)
145+
146+
suggestionsMap.set(extensionName, {
144147
extensionName,
145-
suggestionGroups: extraJson.joystickSuggestions,
148+
suggestions,
146149
})
147150
}
148151
} catch (error) {
@@ -153,7 +156,7 @@ export const getJoystickSuggestionsFromBlueOS = async (
153156
})
154157
)
155158

156-
return Array.from(suggestionGroupsMap.values())
159+
return Array.from(suggestionsMap.values())
157160
}
158161

159162
export const setBagOfHoldingOnVehicle = async (

0 commit comments

Comments
 (0)