feat: use blurHash when loading list backgrounds
continuous-integration/drone/pr Build is failing Details

This commit is contained in:
kolaente 2021-12-12 22:31:51 +01:00
parent 356e01cd14
commit b5f693e230
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 9 additions and 2 deletions

View File

@ -20,7 +20,7 @@ export default class ListModel extends AbstractModel {
this.owner = new UserModel(this.owner)
if(typeof this.subscription !== 'undefined' && this.subscription !== null) {
if (typeof this.subscription !== 'undefined' && this.subscription !== null) {
this.subscription = new SubscriptionModel(this.subscription)
}
@ -44,6 +44,7 @@ export default class ListModel extends AbstractModel {
isFavorite: false,
subscription: null,
position: 0,
backgroundBlurHash: '',
created: null,
updated: null,

View File

@ -1,4 +1,5 @@
import {createStore} from 'vuex'
import {getBlobFromBlurHash} from '../helpers/getBlobFromBlurHash'
import {
BACKGROUND,
CURRENT_LIST,
@ -128,10 +129,15 @@ export const store = createStore({
) {
if (currentList.backgroundInformation) {
try {
const blurHash = await getBlobFromBlurHash(currentList.backgroundBlurHash)
if(blurHash) {
commit(BACKGROUND, window.URL.createObjectURL(blurHash))
}
const listService = new ListService()
const background = await listService.background(currentList)
commit(BACKGROUND, background)
} catch(e) {
} catch (e) {
console.error('Error getting background image for list', currentList.id, e)
}
}