@@ -17,7 +17,7 @@ import {
17
17
getV2P_Settings ,
18
18
setV2P_Settings ,
19
19
} from '../services'
20
- import type { StorageItems , Topic } from '../types'
20
+ import type { Topic } from '../types'
21
21
import { escapeHTML , formatTimestamp , getStorage , isSameDay } from '../utils'
22
22
import { calculateLocalStorageSize , formatSizeUnits , isTabId } from './popup.helper'
23
23
import type { PopupStorageData , RemoteDataStore } from './popup.type'
@@ -68,8 +68,8 @@ function loadSettings() {
68
68
}
69
69
} )
70
70
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 ]
73
73
74
74
if ( api ) {
75
75
if ( api . pat ) {
@@ -233,12 +233,12 @@ function initTabs() {
233
233
}
234
234
235
235
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
+ } )
238
239
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 ]
242
242
243
243
if ( dailyInfo ?. lastCheckInTime ) {
244
244
if ( isSameDay ( dailyInfo . lastCheckInTime , Date . now ( ) ) ) {
@@ -261,8 +261,8 @@ function initTabs() {
261
261
}
262
262
263
263
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 ]
266
266
267
267
if ( api ?. pat ) {
268
268
const loaded = $tabContent . find ( '.list' ) . length > 0
0 commit comments