Skip to content

Commit

Permalink
Merge pull request #459 from SUPLA/develop
Browse files Browse the repository at this point in the history
v24.12.01
  • Loading branch information
przemyslawzygmunt authored Dec 17, 2024
2 parents e6c4071 + 8f1d4ac commit 64af3f5
Show file tree
Hide file tree
Showing 121 changed files with 3,339 additions and 2,523 deletions.
98 changes: 35 additions & 63 deletions SUPLA.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions SUPLA/Core/Config/GlobalSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ protocol GlobalSettings: SharedCore.ApplicationPreferences {
var backgroundEntryTime: Double? { get set }
var nextProfileId: Int32 { get }
var nextServerId: Int32 { get }
var showEmGeneralIntroduction: Bool { get set }
var showEmHistoryIntroduction: Bool { get set }
}

class GlobalSettingsImpl: GlobalSettings {
Expand Down Expand Up @@ -220,6 +222,26 @@ class GlobalSettingsImpl: GlobalSettings {
}
}

private let emGeneralIntroductionKey = "em_general_introduction_key"
var showEmGeneralIntroduction: Bool {
get {
exists(emGeneralIntroductionKey).ifTrue { defaults.bool(forKey: emGeneralIntroductionKey) } ?? true
}
set {
defaults.set(newValue, forKey: emGeneralIntroductionKey)
}
}

private let emHistoryIntroductionKey = "em_history_introduction_key"
var showEmHistoryIntroduction: Bool {
get {
exists(emHistoryIntroductionKey).ifTrue { defaults.bool(forKey: emHistoryIntroductionKey) } ?? true
}
set {
defaults.set(newValue, forKey: emHistoryIntroductionKey)
}
}

private func exists(_ key: String) -> Bool {
defaults.object(forKey: key) != nil
}
Expand Down
14 changes: 8 additions & 6 deletions SUPLA/Core/SwiftUiComponents/Architecture/SuplaCore+Dialog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ extension SuplaCore.Dialog {
SwiftUI.Text(message)
.fontBodyMedium()
.multilineTextAlignment(.center)
.padding([.leading, .trailing], Distance.standard)
.padding([.leading, .trailing], Distance.default)

SuplaCore.Dialog.Divider()
.padding([.top], Distance.standard)
.padding([.top], Distance.default)

FilledButton(title: button, fullWidth: true) { onDismiss() }
.padding([.top, .bottom], Distance.small)
.padding([.leading, .trailing], Distance.standard)
.padding([.leading, .trailing], Distance.default)
}
}
}
Expand All @@ -191,11 +191,13 @@ extension SuplaCore.Dialog {

var body: some SwiftUI.View {
VStack(spacing: 0) {
Text.HeadlineSmall(text: title)
.padding([.leading, .top, .trailing, .bottom], Distance.standard)
Text(title)
.fontHeadlineSmall()
.multilineTextAlignment(.center)
.padding([.leading, .top, .trailing, .bottom], Distance.default)
Divider()
}
.padding([.bottom], Distance.standard)
.padding([.bottom], Distance.default)
}
}

Expand Down
6 changes: 4 additions & 2 deletions SUPLA/Core/SwiftUiComponents/Button/BorderedButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ struct BorderedButton: View {
var body: some View {
Button(action: action) {
if (fullWidth) {
Text.LabelLarge(text: title)
Text(title)
.fontLabelLarge()
.frame(maxWidth: .infinity)
} else {
Text.LabelLarge(text: title)
Text(title)
.fontLabelLarge()
}
}
.buttonStyle(BorderedButtonStyle())
Expand Down
6 changes: 4 additions & 2 deletions SUPLA/Core/SwiftUiComponents/Button/FilledButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ struct FilledButton: View {
var body: some View {
return Button(action: action) {
if (fullWidth) {
Text.LabelLarge(text: title)
Text(title)
.fontLabelLarge()
.frame(maxWidth: .infinity)
} else {
Text.LabelLarge(text: title)
Text(title)
.fontLabelLarge()
}
}
.buttonStyle(FilledButtonStyle(isEnabled: isEnabled))
Expand Down
11 changes: 7 additions & 4 deletions SUPLA/Core/SwiftUiComponents/Picker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,24 @@ extension SuplaCore {
Menu {
SwiftUI.Picker(selection: selected) {
ForEach(items) { item in
Text.BodyMedium(text: item.label).tag(item)
Text(item.label)
.fontBodyMedium()
.tag(item)
.padding([.top, .bottom], 4)
.padding([.leading, .trailing], Distance.standard)
.padding([.leading, .trailing], Distance.default)
}
} label: {}
} label: {
HStack {
Text.BodyMedium(text: selected.wrappedValue.label)
Text(selected.wrappedValue.label)
.fontBodyMedium()
Image(.Icons.arrowDown)
.resizable()
.frame(width: 16, height: 16)
.foregroundColor(Color.Supla.onBackground)
}
.padding([.top, .bottom], 4)
.padding([.leading, .trailing], Distance.standard)
.padding([.leading, .trailing], Distance.default)
}
.accentColor(Color.Supla.onBackground)
}
Expand Down
Loading

0 comments on commit 64af3f5

Please sign in to comment.