Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions App/Features/Setting/AppSetting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,28 @@ import SharedLib

final class AppSetting: ObservableObject {
@Published var webFontSizePercent: Double
@Published var theme: Theme

private var cancellable = Set<AnyCancellable>()

init() {
webFontSizePercent = WallabagUserDefaults.webFontSizePercent
theme = Theme(rawValue: WallabagUserDefaults.theme) ?? .auto

$webFontSizePercent
.sink(receiveValue: updateWebFontSizePercent)
.store(in: &cancellable)

$theme
.sink(receiveValue: updateTheme)
.store(in: &cancellable)
}

private func updateWebFontSizePercent(_ value: Double) {
WallabagUserDefaults.webFontSizePercent = value
}

private func updateTheme(_ value: Theme) {
WallabagUserDefaults.theme = value.rawValue
}
}
9 changes: 9 additions & 0 deletions App/Features/Setting/SettingView.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Factory
import SharedLib
import SwiftUI

Expand All @@ -7,9 +8,17 @@ struct SettingView: View {
@AppStorage("badge") var badge: Bool = true
@AppStorage("defaultMode") var defaultMode: String = RetrieveMode.allArticles.rawValue
@AppStorage("itemPerPageDuringSync") var itemPerPageDuringSync: Int = 50
@ObservedObject var appSetting: AppSetting = Container.shared.appSetting()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, use EnvironmentObject instead ObservedObject

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - I'm new to iOS dev so am still getting the hang of things. I've pushed an update with that change.


var body: some View {
Form {
Section("Appearance") {
Picker("Theme", selection: $appSetting.theme) {
ForEach(Theme.allCases) { theme in
Text(theme.name).tag(theme)
}
}
}
Section("Entries list") {
Toggle("Show image in list", isOn: $showImageInList)
Picker("Default mode", selection: $defaultMode) {
Expand Down
25 changes: 25 additions & 0 deletions App/Lib/Theme.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import SwiftUI

enum Theme: String, CaseIterable, Identifiable {
case auto
case light
case dark

var id: String { rawValue }

var colorScheme: ColorScheme? {
switch self {
case .auto: return nil
case .light: return .light
case .dark: return .dark
}
}

var name: LocalizedStringKey {
switch self {
case .auto: return "Auto"
case .light: return "Light"
case .dark: return "Dark"
}
}
}
7 changes: 7 additions & 0 deletions App/Resources/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "المظهر";
"Theme" = "السمة";
"Auto" = "تلقائي";
"Light" = "فاتح";
"Dark" = "داكن";
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@

// Menu
"Menu" = "Nabídka";

// Theme
"Appearance" = "Vzhled";
"Theme" = "Motiv";
"Auto" = "Automaticky";
"Light" = "Světlý";
"Dark" = "Tmavý";
7 changes: 7 additions & 0 deletions App/Resources/da.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Udseende";
"Theme" = "Tema";
"Auto" = "Auto";
"Light" = "Lyst";
"Dark" = "Mørkt";
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@

//Player
"Select one entry" = "Eintrag auswählen";

// Theme
"Appearance" = "Erscheinungsbild";
"Theme" = "Design";
"Auto" = "Automatisch";
"Light" = "Hell";
"Dark" = "Dunkel";
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,10 @@

//Player
"Select one entry" = "Select one entry";

// Theme
"Appearance" = "Appearance";
"Theme" = "Theme";
"Auto" = "Auto";
"Light" = "Light";
"Dark" = "Dark";
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@




// Tip View
"This application is developed on free time" = "Esta aplicación se desarrolla en tiempo libre.";
"Logout" = "Desconectarse";
"Select one entry" = "Selecciona una entrada";

// Theme
"Appearance" = "Apariencia";
"Theme" = "Tema";
"Auto" = "Automático";
"Light" = "Claro";
"Dark" = "Oscuro";
"Setting" = "Configuración";
"About" = "Acerca de";

Expand Down
7 changes: 7 additions & 0 deletions App/Resources/fa.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "ظاهر";
"Theme" = "پوسته";
"Auto" = "خودکار";
"Light" = "روشن";
"Dark" = "تیره";
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@
"Order by id" = "Trier par id";
"Order by reading time" = "Trier par temps de lecture";
"Sorting" = "Tri";

// Theme
"Appearance" = "Apparence";
"Theme" = "Thème";
"Auto" = "Auto";
"Light" = "Clair";
"Dark" = "Sombre";
7 changes: 7 additions & 0 deletions App/Resources/gl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Aparencia";
"Theme" = "Tema";
"Auto" = "Auto";
"Light" = "Claro";
"Dark" = "Escuro";
7 changes: 7 additions & 0 deletions App/Resources/hi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "दिखावट";
"Theme" = "थीम";
"Auto" = "ऑटो";
"Light" = "हल्का";
"Dark" = "गहरा";
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@

//Player
"Select one entry" = "Odaberi unos";

// Theme
"Appearance" = "Izgled";
"Theme" = "Tema";
"Auto" = "Automatski";
"Light" = "Svijetlo";
"Dark" = "Tamno";
7 changes: 7 additions & 0 deletions App/Resources/hu.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Megjelenés";
"Theme" = "Téma";
"Auto" = "Automatikus";
"Light" = "Világos";
"Dark" = "Sötét";
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@

// Menu
"Menu" = "Menù";

// Theme
"Appearance" = "Aspetto";
"Theme" = "Tema";
"Auto" = "Automatico";
"Light" = "Chiaro";
"Dark" = "Scuro";
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@
"Loading..." = "読み込み中...";
"Don" = "寄付";
"Starred" = "スター";

// Theme
"Appearance" = "外観";
"Theme" = "テーマ";
"Auto" = "自動";
"Light" = "ライト";
"Dark" = "ダーク";
7 changes: 7 additions & 0 deletions App/Resources/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "모양";
"Theme" = "테마";
"Auto" = "자동";
"Light" = "라이트";
"Dark" = "다크";
7 changes: 7 additions & 0 deletions App/Resources/nb-NO.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Utseende";
"Theme" = "Tema";
"Auto" = "Auto";
"Light" = "Lyst";
"Dark" = "Mørkt";
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,10 @@
"Loading..." = "Laden...";
"But you can contribute financially by making a donation whenever you want to support the project." = "Maar u kunt ook financieel bijdragen door een donatie te doen u het project wilt steunen.";
"Entries" = "Items";

// Theme
"Appearance" = "Weergave";
"Theme" = "Thema";
"Auto" = "Automatisch";
"Light" = "Licht";
"Dark" = "Donker";
7 changes: 7 additions & 0 deletions App/Resources/oc.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Aparéncia";
"Theme" = "Tèma";
"Auto" = "Auto";
"Light" = "Clar";
"Dark" = "Escur";
7 changes: 7 additions & 0 deletions App/Resources/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Wygląd";
"Theme" = "Motyw";
"Auto" = "Automatyczny";
"Light" = "Jasny";
"Dark" = "Ciemny";
7 changes: 7 additions & 0 deletions App/Resources/pt.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Aparência";
"Theme" = "Tema";
"Auto" = "Automático";
"Light" = "Claro";
"Dark" = "Escuro";
7 changes: 7 additions & 0 deletions App/Resources/ro.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Aspect";
"Theme" = "Temă";
"Auto" = "Auto";
"Light" = "Luminos";
"Dark" = "Întunecat";
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,10 @@

// Search
"Search" = "Поиск";

// Theme
"Appearance" = "Оформление";
"Theme" = "Тема";
"Auto" = "Автоматически";
"Light" = "Светлая";
"Dark" = "Темная";
7 changes: 7 additions & 0 deletions App/Resources/sv.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Utseende";
"Theme" = "Tema";
"Auto" = "Auto";
"Light" = "Ljust";
"Dark" = "Mörkt";
7 changes: 7 additions & 0 deletions App/Resources/th.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "ลักษณะ";
"Theme" = "ธีม";
"Auto" = "อัตโนมัติ";
"Light" = "สว่าง";
"Dark" = "มืด";
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,10 @@

//Player
"Select one entry" = "Bir makale seçin";

// Theme
"Appearance" = "Görünüm";
"Theme" = "Tema";
"Auto" = "Otomatik";
"Light" = "Açık";
"Dark" = "Koyu";
7 changes: 7 additions & 0 deletions App/Resources/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

// Theme
"Appearance" = "Вигляд";
"Theme" = "Тема";
"Auto" = "Авто";
"Light" = "Світла";
"Dark" = "Темна";
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,10 @@

//Player
"Select one entry" = "选择一个条目";

// Theme
"Appearance" = "外观";
"Theme" = "主题";
"Auto" = "自动";
"Light" = "浅色";
"Dark" = "深色";
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,10 @@

// Menu
"Menu" = "菜單";

// Theme
"Appearance" = "外觀";
"Theme" = "主題";
"Auto" = "自動";
"Light" = "淺色";
"Dark" = "深色";
1 change: 1 addition & 0 deletions App/WallabagApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct WallabagApp: App {
.environment(errorHandler)
.environmentObject(appSetting)
.environment(\.managedObjectContext, coreData.viewContext)
.preferredColorScheme(appSetting.theme.colorScheme)
}
.onChange(of: scenePhase) { _, newScenePhase in
if newScenePhase == .active {
Expand Down
1 change: 0 additions & 1 deletion App/ar.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/da.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/fa.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/gl.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/hi.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/hu.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/ko.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/nb-NO.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/oc.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/pl.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/pt.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/ro.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/sv.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/th.lproj/Localizable.strings

This file was deleted.

1 change: 0 additions & 1 deletion App/uk.lproj/Localizable.strings

This file was deleted.

3 changes: 3 additions & 0 deletions SharedLib/Sources/SharedLib/Lib/WallabagUserDefaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ public enum WallabagUserDefaults {

@GeneralSetting("itemPerPageDuringSync", defaultValue: 50)
public static var itemPerPageDuringSync: Int

@GeneralSetting("theme", defaultValue: "auto")
public static var theme: String
}
Loading