mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-10-31 22:28:58 +00:00
Show the pending-counter in any corners (#1638)
The pending-button can now be shown in any corner the user prefers. This is accomplished by allowing the user to move the counter left in addition to the already present option to move it down. Fixes #1637 Signed-off-by: Paul Schuetz <pa.schuetz@web.de>
This commit is contained in:
parent
20ecc49e31
commit
f68bc3e306
4 changed files with 57 additions and 15 deletions
|
@ -204,6 +204,7 @@ struct DisplaySettingsView: View {
|
||||||
}
|
}
|
||||||
Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton)
|
Toggle("settings.display.translate-button", isOn: $userPreferences.showTranslateButton)
|
||||||
Toggle("settings.display.pending-at-bottom", isOn: $userPreferences.pendingShownAtBottom)
|
Toggle("settings.display.pending-at-bottom", isOn: $userPreferences.pendingShownAtBottom)
|
||||||
|
Toggle("settings.display.pending-left", isOn: $userPreferences.pendingShownLeft)
|
||||||
}
|
}
|
||||||
.listRowBackground(theme.primaryBackgroundColor)
|
.listRowBackground(theme.primaryBackgroundColor)
|
||||||
}
|
}
|
||||||
|
|
|
@ -40435,6 +40435,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"settings.display.pending-left" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"de" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Ungelesene-Button am linken Rand anzeigen"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Show Pending Button on the Left"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"settings.display.restore" : {
|
"settings.display.restore" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"be" : {
|
"be" : {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import SwiftUI
|
||||||
@AppStorage("preferred_browser") public var preferredBrowser: PreferredBrowser = .inAppSafari
|
@AppStorage("preferred_browser") public var preferredBrowser: PreferredBrowser = .inAppSafari
|
||||||
@AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true
|
@AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true
|
||||||
@AppStorage("show_pending_at_bottom") public var pendingShownAtBottom: Bool = false
|
@AppStorage("show_pending_at_bottom") public var pendingShownAtBottom: Bool = false
|
||||||
|
@AppStorage("show_pending_left") public var pendingShownLeft: Bool = false
|
||||||
@AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true
|
@AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true
|
||||||
|
|
||||||
@AppStorage("recently_used_languages") public var recentlyUsedLanguages: [String] = []
|
@AppStorage("recently_used_languages") public var recentlyUsedLanguages: [String] = []
|
||||||
|
@ -80,6 +81,31 @@ import SwiftUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var pendingShownLeft: Bool {
|
||||||
|
didSet {
|
||||||
|
storage.pendingShownLeft = pendingShownLeft
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public var pendingLocation: Alignment {
|
||||||
|
get {
|
||||||
|
let fromLeft = Locale.current.language.characterDirection == .leftToRight ? pendingShownLeft : !pendingShownLeft
|
||||||
|
if pendingShownAtBottom {
|
||||||
|
if fromLeft {
|
||||||
|
return .bottomLeading
|
||||||
|
} else {
|
||||||
|
return .bottomTrailing
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if fromLeft {
|
||||||
|
return .topLeading
|
||||||
|
} else {
|
||||||
|
return .topTrailing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var isOpenAIEnabled: Bool {
|
public var isOpenAIEnabled: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
storage.isOpenAIEnabled = isOpenAIEnabled
|
storage.isOpenAIEnabled = isOpenAIEnabled
|
||||||
|
@ -430,5 +456,6 @@ import SwiftUI
|
||||||
collapseLongPosts = storage.collapseLongPosts
|
collapseLongPosts = storage.collapseLongPosts
|
||||||
shareButtonBehavior = storage.shareButtonBehavior
|
shareButtonBehavior = storage.shareButtonBehavior
|
||||||
pendingShownAtBottom = storage.pendingShownAtBottom
|
pendingShownAtBottom = storage.pendingShownAtBottom
|
||||||
|
pendingShownLeft = storage.pendingShownLeft
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ struct PendingStatusesObserverView: View {
|
||||||
@Environment(UserPreferences.self) private var preferences
|
@Environment(UserPreferences.self) private var preferences
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if observer.pendingStatusesCount > 0 {
|
if observer.pendingStatusesCount > 0 {
|
||||||
HStack(spacing: 6) {
|
|
||||||
Spacer()
|
|
||||||
Button {
|
Button {
|
||||||
observer.scrollToIndex?(observer.pendingStatusesCount)
|
observer.scrollToIndex?(observer.pendingStatusesCount)
|
||||||
} label: {
|
} label: {
|
||||||
|
@ -46,9 +44,8 @@ struct PendingStatusesObserverView: View {
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
.background(.thinMaterial)
|
.background(.thinMaterial)
|
||||||
.cornerRadius(8)
|
.cornerRadius(8)
|
||||||
}
|
|
||||||
.padding(12)
|
.padding(12)
|
||||||
.frame(maxHeight: .infinity, alignment: preferences.pendingShownAtBottom ? .bottom : .top)
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: preferences.pendingLocation)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue