Theme - Display an optional picture in Help/About view specified by an URL (config entry ui/theme_about_picture_url)

This commit is contained in:
Christophe Deschamps 2025-10-02 11:42:57 +02:00
parent 888b75a2d4
commit 9beadaadd9
2 changed files with 27 additions and 1 deletions

View file

@ -188,6 +188,12 @@ class CorePreferences {
}
}
static var themeAboutPictureUrl: String? {
get {
return Config.get().getString(section: "ui", key: "theme_about_picture_url", defaultString: nil)
}
}
static var darkModeAllowed: Bool {
return Config.get().getBool(section: "ui", key: "dark_mode_allowed", defaultValue: true)
}

View file

@ -77,11 +77,31 @@ struct HelpFragment: View {
ScrollView {
VStack(spacing: 0) {
VStack(spacing: 20) {
if let urlString = CorePreferences.themeAboutPictureUrl,
let url = URL(string: urlString) {
AsyncImage(url: url) { phase in
switch phase {
case .empty:
ProgressView()
.frame(maxWidth: .infinity, minHeight: 100, maxHeight: 100)
case .success(let image):
image
.resizable()
.scaledToFit()
.frame(maxWidth: .infinity, maxHeight: 100, alignment: .center)
case .failure:
EmptyView()
@unknown default:
EmptyView()
}
}
} else {
EmptyView()
}
Text("help_about_title")
.default_text_style_800(styleSize: 16)
.frame(maxWidth: .infinity, alignment: .leading)
.padding(.bottom, 5)
Button {
if let url = URL(string: NSLocalizedString("website_user_guide_url", comment: "")) {
UIApplication.shared.open(url)