Skip to content

Commit

Permalink
feat: Added logic for dev catalogue applications
Browse files Browse the repository at this point in the history
  • Loading branch information
mlyubimov committed Feb 21, 2024
1 parent 3a32f0d commit 48a15ee
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
10 changes: 10 additions & 0 deletions frontend/src/pages/InstalledApps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@
</q-card>
</div>
</template>
<template v-else-if="appsStore.flags.noApplicationsInstalled">
<div class="column items-center">
<q-card flat>
<q-card-section class="q-pa-none q-ma-md" align="center">
<q-icon name="mdi-alert-circle" color="primary" size="64px" />
<div class="text-h6 q-my-sm">You haven't installed any apps yet</div>
</q-card-section>
</q-card>
</div>
</template>
<template v-else>
<div v-if="updatableApps.length" style="width: 140px">
<template v-if="batch.totalCount">
Expand Down
24 changes: 22 additions & 2 deletions frontend/src/stores/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const useAppsStore = defineStore('apps', () => {
fetchEnd: false,
loadingCategories: true,
loadingInitial: true,
loadingInstalledApps: true
loadingInstalledApps: true,
noApplicationsInstalled: false
})

const flipperReady = computed(() => mainFlags.value.rpcActive && info.value !== null && info.value.doneReading)
Expand Down Expand Up @@ -230,6 +231,8 @@ export const useAppsStore = defineStore('apps', () => {
case 'Path':
app.path = value
break
case 'DevCatalog':
app.devCatalog = value
}
}
installed.push(app)
Expand Down Expand Up @@ -264,6 +267,20 @@ export const useAppsStore = defineStore('apps', () => {
})
} while (actualApps.length === params.limit)

if (!installed.length) {
flags.value.noApplicationsInstalled = true
flags.value.loadingInstalledApps = false
return
}

installed = installed.filter(installedApp => {
if (installedApp.devCatalog && mainFlags.value.catalogChannelProduction) {
return false
}

return true
})

// HACK: Bind the past action state to the new list
installed = installed.map(installedApp => {
const lastInstalledApp = installedApps.value.find(actualApp => actualApp.id === installedApp.id)
Expand Down Expand Up @@ -428,7 +445,10 @@ export const useAppsStore = defineStore('apps', () => {
}
const dataUri = await urlContentToDataUri(app.currentVersion.iconUri)
const base64Icon = dataUri.split(',')[1]
const manifestText = `Filetype: Flipper Application Installation Manifest\r\nVersion: 1\r\nFull Name: ${app.currentVersion.name}\r\nIcon: ${base64Icon}\r\nVersion Build API: ${info.value.firmware.api.major}.${info.value.firmware.api.minor}\r\nUID: ${app.id}\r\nVersion UID: ${app.currentVersion.id}\r\nPath: ${paths.appDir}/${app.alias}.fap`
let manifestText = `Filetype: Flipper Application Installation Manifest\r\nVersion: 1\r\nFull Name: ${app.currentVersion.name}\r\nIcon: ${base64Icon}\r\nVersion Build API: ${info.value.firmware.api.major}.${info.value.firmware.api.minor}\r\nUID: ${app.id}\r\nVersion UID: ${app.currentVersion.id}\r\nPath: ${paths.appDir}/${app.alias}.fap`
if (!mainFlags.value.catalogChannelProduction) {
manifestText = manifestText + '\r\nDevCatalog: true'
}
const manifestFile = new TextEncoder().encode(manifestText)
app.action.progress = 0.45
if (app.action.type === 'update') {
Expand Down

0 comments on commit 48a15ee

Please sign in to comment.