mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-18 06:44:46 -07:00
Include device support on listings
This commit is contained in:
parent
e054b29d64
commit
b9d05f5fa0
1 changed files with 26 additions and 6 deletions
|
|
@ -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'
|
||||||
|
|
@ -132,7 +133,13 @@ class BuildLists {
|
||||||
shouldHaveRelatedVideos ( app ) {
|
shouldHaveRelatedVideos ( app ) {
|
||||||
const appType = getAppType( app )
|
const appType = getAppType( app )
|
||||||
|
|
||||||
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 = () => {
|
||||||
|
|
@ -154,14 +161,14 @@ class BuildLists {
|
||||||
}
|
}
|
||||||
|
|
||||||
// From here we get and store bundles
|
// From here we get and store bundles
|
||||||
|
|
||||||
|
|
||||||
// Check if any bundles are already in memory
|
// Check if any bundles are already in memory
|
||||||
if ( this.bundles.length === 0 ) {
|
if ( this.bundles.length === 0 ) {
|
||||||
// console.log('Storing bundles to memory')
|
// console.log('Storing bundles to memory')
|
||||||
this.bundles = await fs.readJson('./static/app-bundles.json')
|
this.bundles = await fs.readJson('./static/app-bundles.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
// console.log('Getting bundles from memory')
|
// console.log('Getting bundles from memory')
|
||||||
return this.bundles
|
return this.bundles
|
||||||
}
|
}
|
||||||
|
|
@ -171,9 +178,9 @@ class BuildLists {
|
||||||
async findAppBundle ( needleBundleIdentifier ) {
|
async findAppBundle ( needleBundleIdentifier ) {
|
||||||
const bundles = await this.getSavedAppBundles()
|
const bundles = await this.getSavedAppBundles()
|
||||||
|
|
||||||
return bundles.find( ([
|
return bundles.find( ([
|
||||||
storedAppBundleIdentifier,
|
storedAppBundleIdentifier,
|
||||||
// versions
|
// versions
|
||||||
]) => storedAppBundleIdentifier === needleBundleIdentifier )
|
]) => storedAppBundleIdentifier === needleBundleIdentifier )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue