@@ -17,7 +17,7 @@ import {
1717 getV2P_Settings ,
1818 setV2P_Settings ,
1919} from '../services'
20- import type { StorageItems , Topic } from '../types'
20+ import type { Topic } from '../types'
2121import { escapeHTML , formatTimestamp , getStorage , isSameDay } from '../utils'
2222import { calculateLocalStorageSize , formatSizeUnits , isTabId } from './popup.helper'
2323import type { PopupStorageData , RemoteDataStore } from './popup.type'
@@ -68,8 +68,8 @@ function loadSettings() {
6868 }
6969 } )
7070
71- chrome . storage . sync . get ( StorageKey . API , ( result : StorageItems ) => {
72- const api = result [ StorageKey . API ]
71+ void getStorage ( ) . then ( ( storage ) => {
72+ const api = storage [ StorageKey . API ]
7373
7474 if ( api ) {
7575 if ( api . pat ) {
@@ -233,12 +233,12 @@ function initTabs() {
233233 }
234234
235235 if ( tabId === TabId . Feature ) {
236- chrome . storage . sync . get ( StorageKey . Daily , ( result : StorageItems ) => {
237- const dailyInfo = result [ StorageKey . Daily ]
236+ const $checkIn = $ ( '.feature-check-in' ) . on ( 'click' , ( ) => {
237+ window . open ( `${ V2EX . Origin } /mission/daily` )
238+ } )
238239
239- const $checkIn = $ ( '.feature-check-in' ) . on ( 'click' , ( ) => {
240- window . open ( `${ V2EX . Origin } /mission/daily` )
241- } )
240+ void getStorage ( ) . then ( ( storage ) => {
241+ const dailyInfo = storage [ StorageKey . Daily ]
242242
243243 if ( dailyInfo ?. lastCheckInTime ) {
244244 if ( isSameDay ( dailyInfo . lastCheckInTime , Date . now ( ) ) ) {
@@ -261,8 +261,8 @@ function initTabs() {
261261 }
262262
263263 if ( tabId === TabId . Message ) {
264- chrome . storage . sync . get ( StorageKey . API , ( result : StorageItems ) => {
265- const api = result [ StorageKey . API ]
264+ void getStorage ( ) . then ( ( storage ) => {
265+ const api = storage [ StorageKey . API ]
266266
267267 if ( api ?. pat ) {
268268 const loaded = $tabContent . find ( '.list' ) . length > 0
0 commit comments