feat: use blurHash when loading list backgrounds
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
356e01cd14
commit
b5f693e230
|
@ -20,7 +20,7 @@ export default class ListModel extends AbstractModel {
|
||||||
|
|
||||||
this.owner = new UserModel(this.owner)
|
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)
|
this.subscription = new SubscriptionModel(this.subscription)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ export default class ListModel extends AbstractModel {
|
||||||
isFavorite: false,
|
isFavorite: false,
|
||||||
subscription: null,
|
subscription: null,
|
||||||
position: 0,
|
position: 0,
|
||||||
|
backgroundBlurHash: '',
|
||||||
|
|
||||||
created: null,
|
created: null,
|
||||||
updated: null,
|
updated: null,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import {createStore} from 'vuex'
|
import {createStore} from 'vuex'
|
||||||
|
import {getBlobFromBlurHash} from '../helpers/getBlobFromBlurHash'
|
||||||
import {
|
import {
|
||||||
BACKGROUND,
|
BACKGROUND,
|
||||||
CURRENT_LIST,
|
CURRENT_LIST,
|
||||||
|
@ -128,10 +129,15 @@ export const store = createStore({
|
||||||
) {
|
) {
|
||||||
if (currentList.backgroundInformation) {
|
if (currentList.backgroundInformation) {
|
||||||
try {
|
try {
|
||||||
|
const blurHash = await getBlobFromBlurHash(currentList.backgroundBlurHash)
|
||||||
|
if(blurHash) {
|
||||||
|
commit(BACKGROUND, window.URL.createObjectURL(blurHash))
|
||||||
|
}
|
||||||
|
|
||||||
const listService = new ListService()
|
const listService = new ListService()
|
||||||
const background = await listService.background(currentList)
|
const background = await listService.background(currentList)
|
||||||
commit(BACKGROUND, background)
|
commit(BACKGROUND, background)
|
||||||
} catch(e) {
|
} catch (e) {
|
||||||
console.error('Error getting background image for list', currentList.id, e)
|
console.error('Error getting background image for list', currentList.id, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue