Include device support on listings

This commit is contained in:
Sam Carlton 2022-04-27 19:11:53 -05:00
parent e054b29d64
commit b9d05f5fa0

View file

@ -9,6 +9,7 @@ import buildGamesList from './helpers/build-game-list.js'
import buildHomebrewList from './helpers/build-homebrew-list.js' import buildHomebrewList from './helpers/build-homebrew-list.js'
import buildVideoList from './helpers/build-video-list.js' import buildVideoList from './helpers/build-video-list.js'
import buildDeviceList from './helpers/build-device-list.js' import buildDeviceList from './helpers/build-device-list.js'
import { deviceSupportsApp } from './helpers/devices.js'
import { videosRelatedToApp } from './helpers/related.js' import { videosRelatedToApp } from './helpers/related.js'
import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js' import { buildVideoPayload, buildAppBenchmarkPayload } from './helpers/build-payload.js'
@ -135,6 +136,12 @@ class BuildLists {
return appType === 'app' || appType === 'formula' return appType === 'app' || appType === 'formula'
} }
shouldHaveDeviceSupport ( app ) {
const appType = getAppType( app )
return appType === 'app' || appType === 'formula' || appType === 'game'
}
getAllVideoAppsList = () => { getAllVideoAppsList = () => {
return new Set([ return new Set([
...this.lists.app, ...this.lists.app,
@ -287,6 +294,19 @@ class BuildLists {
listEntry.bundles = await this.getAppBundles( listEntry ) listEntry.bundles = await this.getAppBundles( listEntry )
} }
// Add device support
if ( this.shouldHaveDeviceSupport( listEntry ) ) {
listEntry.deviceSupport = this.lists[ 'device' ].map( device => {
const supportsApp = deviceSupportsApp( device, listEntry )
return {
...device,
emoji: supportsApp ? '✅' : '🚫',
ariaLabel: `${ listEntry.name } has ${ supportsApp ? '' : 'not' } been reported to work on ${ device.name }`
}
})
}
// console.log(`Saving endpoint "${endpoint}" to "${endpointPath}"`) // console.log(`Saving endpoint "${endpoint}" to "${endpointPath}"`)
// Ensure the directory exists // Ensure the directory exists