(metadata, displayName = null)
| 282 | } |
| 283 | |
| 284 | export async function setMetadata(metadata, displayName = null) { |
| 285 | /* |
| 286 | * Set the user metadata to the local storage |
| 287 | * @param metadata [Object]: metadata |
| 288 | */ |
| 289 | if (!metadata) { |
| 290 | return; |
| 291 | } |
| 292 | if (displayName === null) { |
| 293 | displayName = await getDisplayName(); |
| 294 | } |
| 295 | if (!displayName) { |
| 296 | return; |
| 297 | } |
| 298 | |
| 299 | const persistedMetadata = {...metadata}; |
| 300 | delete persistedMetadata.latestYear; |
| 301 | await writeCacheValue(metadataCacheKey(displayName), persistedMetadata); |
| 302 | } |
| 303 | |
| 304 | export async function getDisplayName(isRefresh = false, {priority = FOREGROUND_PRIORITY} = {}) { |
| 305 | return loadCachedValue({ |
no test coverage detected