mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +01:00
[PM-5879] Remove backgroundWindow
reference used for determing system theme preference in Safari (#7859)
* [PM-5879] Removing `backgroundWindow` reference used for determing system theme preference in Safari * [PM-5879] Removing `backgroundWindow` reference used for determing system theme preference in Safari * [PM-5879] Reworking factory logic within ThemingService factory
This commit is contained in:
parent
16c5fe65ca
commit
8e3a723908
@ -305,9 +305,6 @@ export default class MainBackground {
|
|||||||
stateEventRunnerService: StateEventRunnerService;
|
stateEventRunnerService: StateEventRunnerService;
|
||||||
ssoLoginService: SsoLoginServiceAbstraction;
|
ssoLoginService: SsoLoginServiceAbstraction;
|
||||||
|
|
||||||
// Passed to the popup for Safari to workaround issues with theming, downloading, etc.
|
|
||||||
backgroundWindow = window;
|
|
||||||
|
|
||||||
onUpdatedRan: boolean;
|
onUpdatedRan: boolean;
|
||||||
onReplacedRan: boolean;
|
onReplacedRan: boolean;
|
||||||
loginToAutoFill: CipherView = null;
|
loginToAutoFill: CipherView = null;
|
||||||
|
@ -509,13 +509,15 @@ function getBgService<T>(service: keyof MainBackground) {
|
|||||||
stateService: StateServiceAbstraction,
|
stateService: StateServiceAbstraction,
|
||||||
platformUtilsService: PlatformUtilsService,
|
platformUtilsService: PlatformUtilsService,
|
||||||
) => {
|
) => {
|
||||||
return new ThemingService(
|
// Safari doesn't properly handle the (prefers-color-scheme) media query in the popup window, it always returns light.
|
||||||
stateService,
|
// In Safari, we have to use the background page instead, which comes with limitations like not dynamically changing the extension theme when the system theme is changed.
|
||||||
// Safari doesn't properly handle the (prefers-color-scheme) media query in the popup window, it always returns light.
|
let windowContext = window;
|
||||||
// In Safari we have to use the background page instead, which comes with limitations like not dynamically changing the extension theme when the system theme is changed.
|
const backgroundWindow = BrowserApi.getBackgroundPage();
|
||||||
platformUtilsService.isSafari() ? getBgService<Window>("backgroundWindow")() : window,
|
if (platformUtilsService.isSafari() && backgroundWindow) {
|
||||||
document,
|
windowContext = backgroundWindow;
|
||||||
);
|
}
|
||||||
|
|
||||||
|
return new ThemingService(stateService, windowContext, document);
|
||||||
},
|
},
|
||||||
deps: [StateServiceAbstraction, PlatformUtilsService],
|
deps: [StateServiceAbstraction, PlatformUtilsService],
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user