feat: add autoplay switch
This commit is contained in:
@@ -24,6 +24,7 @@ class LocalStorageService {
|
||||
private quickZap: boolean = false
|
||||
private accountFeedInfoMap: Record<string, TFeedInfo | undefined> = {}
|
||||
private mediaUploadService: string = DEFAULT_NIP_96_SERVICE
|
||||
private autoplay: boolean = true
|
||||
|
||||
constructor() {
|
||||
if (!LocalStorageService.instance) {
|
||||
@@ -89,6 +90,8 @@ class LocalStorageService {
|
||||
this.mediaUploadService =
|
||||
window.localStorage.getItem(StorageKey.MEDIA_UPLOAD_SERVICE) ?? DEFAULT_NIP_96_SERVICE
|
||||
|
||||
this.autoplay = window.localStorage.getItem(StorageKey.AUTOPLAY) !== 'false'
|
||||
|
||||
// Clean up deprecated data
|
||||
window.localStorage.removeItem(StorageKey.ACCOUNT_PROFILE_EVENT_MAP)
|
||||
window.localStorage.removeItem(StorageKey.ACCOUNT_FOLLOW_LIST_EVENT_MAP)
|
||||
@@ -235,6 +238,15 @@ class LocalStorageService {
|
||||
this.mediaUploadService = service
|
||||
window.localStorage.setItem(StorageKey.MEDIA_UPLOAD_SERVICE, service)
|
||||
}
|
||||
|
||||
getAutoplay() {
|
||||
return this.autoplay
|
||||
}
|
||||
|
||||
setAutoplay(autoplay: boolean) {
|
||||
this.autoplay = autoplay
|
||||
window.localStorage.setItem(StorageKey.AUTOPLAY, autoplay.toString())
|
||||
}
|
||||
}
|
||||
|
||||
const instance = new LocalStorageService()
|
||||
|
||||
Reference in New Issue
Block a user