* chooseDefaultSource * When we haven't been told to use a specific background imagery, * this tries several options to pick an appropriate imagery to use.
()
| 413 | * this tries several options to pick an appropriate imagery to use. |
| 414 | */ |
| 415 | chooseDefaultSource() { |
| 416 | const context = this.context; |
| 417 | const storage = context.systems.storage; |
| 418 | |
| 419 | const available = this.visibleSources(); |
| 420 | const first = available[0]; |
| 421 | const best = available.find(s => s.best); |
| 422 | |
| 423 | // Consider previously chosen imagery unless it was 'none' |
| 424 | let previousID = storage.getItem('background-last-used') || 'none'; |
| 425 | const previous = (previousID !== 'none') && this.getSourceByID(previousID); |
| 426 | |
| 427 | return best || |
| 428 | previous || |
| 429 | this.getSourceByID('Bing') || |
| 430 | first || // maybe this is a custom Rapid that doesn't include Bing? |
| 431 | this.getSourceByID('none'); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | /** |
no test coverage detected