From 393b31d489dfced0e5f5be34d8161e05f4505b2f Mon Sep 17 00:00:00 2001 From: Torsten Bergmann Date: Thu, 6 Jul 2023 00:22:58 +0200 Subject: [PATCH] Use theme from session and user info --- src/Boot-Web-Core/BTSession.class.st | 6 ++++++ src/Boot-Web-Core/BTUserInfo.class.st | 6 ++++++ src/Boot-Web-UI/BTComponent.class.st | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Boot-Web-Core/BTSession.class.st b/src/Boot-Web-Core/BTSession.class.st index a949bb5..48fd984 100644 --- a/src/Boot-Web-Core/BTSession.class.st +++ b/src/Boot-Web-Core/BTSession.class.st @@ -34,3 +34,9 @@ BTSession >> logout [ userInfo := nil ] + +{ #category : #accessing } +BTSession >> userInfo [ + + ^ userInfo +] diff --git a/src/Boot-Web-Core/BTUserInfo.class.st b/src/Boot-Web-Core/BTUserInfo.class.st index 2430c21..51a830d 100644 --- a/src/Boot-Web-Core/BTUserInfo.class.st +++ b/src/Boot-Web-Core/BTUserInfo.class.st @@ -25,6 +25,12 @@ BTUserInfo >> initialize [ self setLightTheme ] +{ #category : #testing } +BTUserInfo >> isDarkThemeSet [ + + ^ theme = #dark +] + { #category : #testing } BTUserInfo >> isLightThemeSet [ diff --git a/src/Boot-Web-UI/BTComponent.class.st b/src/Boot-Web-UI/BTComponent.class.st index ba3d879..7358788 100644 --- a/src/Boot-Web-UI/BTComponent.class.st +++ b/src/Boot-Web-UI/BTComponent.class.st @@ -55,5 +55,5 @@ BTComponent class >> systemIconName [ { #category : #testing } BTComponent >> isDarkTheme [ - ^ false + ^ self session userInfo ifNil: [ false ] ifNotNil: [:userInfo | userInfo isDarkThemeSet ] ]