mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-04-27 02:14:45 +00:00
Add settings to toggle between share and bookmark button
This commit is contained in:
parent
44dbd379ba
commit
d065ae6aa8
4 changed files with 156 additions and 12 deletions
|
@ -203,6 +203,11 @@ struct DisplaySettingsView: View {
|
||||||
Text(buttonStyle.description).tag(buttonStyle)
|
Text(buttonStyle.description).tag(buttonStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Picker("settings.display.status.action-secondary", selection: $theme.statusActionSecondary) {
|
||||||
|
ForEach(Theme.StatusActionSecondary.allCases, id: \.rawValue) { action in
|
||||||
|
Text(action.description).tag(action)
|
||||||
|
}
|
||||||
|
}
|
||||||
Picker("settings.display.status.media-style", selection: $theme.statusDisplayStyle) {
|
Picker("settings.display.status.media-style", selection: $theme.statusDisplayStyle) {
|
||||||
ForEach(Theme.StatusDisplayStyle.allCases, id: \.rawValue) { buttonStyle in
|
ForEach(Theme.StatusDisplayStyle.allCases, id: \.rawValue) { buttonStyle in
|
||||||
Text(buttonStyle.description).tag(buttonStyle)
|
Text(buttonStyle.description).tag(buttonStyle)
|
||||||
|
|
|
@ -44735,6 +44735,124 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"settings.display.status.action-secondary" : {
|
||||||
|
"localizations" : {
|
||||||
|
"be" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ca" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"de" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"en-GB" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"es" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"eu" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"it" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ja" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ko" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nb" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nl" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pl" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pt-BR" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tr" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"uk" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "needs_review",
|
||||||
|
"value" : "Secondary status action"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"settings.display.status.media-style" : {
|
"settings.display.status.media-style" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
"be" : {
|
"be" : {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import SwiftUI
|
||||||
case followSystemColorSchme
|
case followSystemColorSchme
|
||||||
case displayFullUsernameTimeline
|
case displayFullUsernameTimeline
|
||||||
case lineSpacing
|
case lineSpacing
|
||||||
|
case statusActionSecondary
|
||||||
}
|
}
|
||||||
|
|
||||||
@AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false
|
@AppStorage("is_previously_set") public var isThemePreviouslySet: Bool = false
|
||||||
|
@ -26,6 +27,7 @@ import SwiftUI
|
||||||
@AppStorage(ThemeKey.followSystemColorSchme.rawValue) public var followSystemColorScheme: Bool = true
|
@AppStorage(ThemeKey.followSystemColorSchme.rawValue) public var followSystemColorScheme: Bool = true
|
||||||
@AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = false
|
@AppStorage(ThemeKey.displayFullUsernameTimeline.rawValue) public var displayFullUsername: Bool = false
|
||||||
@AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2
|
@AppStorage(ThemeKey.lineSpacing.rawValue) public var lineSpacing: Double = 1.2
|
||||||
|
@AppStorage(ThemeKey.statusActionSecondary.rawValue) public var statusActionSecondary: StatusActionSecondary = .share
|
||||||
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
|
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1
|
||||||
@AppStorage("chosen_font") public var chosenFontData: Data?
|
@AppStorage("chosen_font") public var chosenFontData: Data?
|
||||||
|
|
||||||
|
@ -67,6 +69,19 @@ import SwiftUI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum StatusActionSecondary: String, CaseIterable {
|
||||||
|
case share, bookmark
|
||||||
|
|
||||||
|
public var description: LocalizedStringKey {
|
||||||
|
switch self {
|
||||||
|
case .share:
|
||||||
|
"status.action.share-title"
|
||||||
|
case .bookmark:
|
||||||
|
"status.action.bookmark"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public enum AvatarShape: String, CaseIterable {
|
public enum AvatarShape: String, CaseIterable {
|
||||||
case circle, rounded
|
case circle, rounded
|
||||||
|
@ -202,6 +217,12 @@ import SwiftUI
|
||||||
themeStorage.statusDisplayStyle = statusDisplayStyle
|
themeStorage.statusDisplayStyle = statusDisplayStyle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public var statusActionSecondary: StatusActionSecondary {
|
||||||
|
didSet {
|
||||||
|
themeStorage.statusActionSecondary = statusActionSecondary
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var followSystemColorScheme: Bool {
|
public var followSystemColorScheme: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
|
@ -254,6 +275,7 @@ import SwiftUI
|
||||||
lineSpacing = themeStorage.lineSpacing
|
lineSpacing = themeStorage.lineSpacing
|
||||||
fontSizeScale = themeStorage.fontSizeScale
|
fontSizeScale = themeStorage.fontSizeScale
|
||||||
chosenFontData = themeStorage.chosenFontData
|
chosenFontData = themeStorage.chosenFontData
|
||||||
|
statusActionSecondary = themeStorage.statusActionSecondary
|
||||||
selectedSet = storedSet
|
selectedSet = storedSet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,21 +21,20 @@ struct StatusRowActionsView: View {
|
||||||
func privateBoost() -> Bool {
|
func privateBoost() -> Bool {
|
||||||
viewModel.status.visibility == .priv && viewModel.status.account.id == currentAccount.account?.id
|
viewModel.status.visibility == .priv && viewModel.status.account.id == currentAccount.account?.id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actions: [Action] {
|
||||||
|
switch theme.statusActionSecondary {
|
||||||
|
case .share:
|
||||||
|
return [.respond, .boost, .favorite, .share, .menu]
|
||||||
|
case .bookmark:
|
||||||
|
return [.respond, .boost, .favorite, .bookmark, .menu]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
enum Action: CaseIterable {
|
enum Action {
|
||||||
case respond, boost, favorite, bookmark, share, menu
|
case respond, boost, favorite, bookmark, share, menu
|
||||||
|
|
||||||
// Have to implement this manually here due to compiler not implicitly
|
|
||||||
// inserting `nonisolated`, which leads to a warning:
|
|
||||||
//
|
|
||||||
// Main actor-isolated static property 'allCases' cannot be used to
|
|
||||||
// satisfy nonisolated protocol requirement
|
|
||||||
//
|
|
||||||
public nonisolated static var allCases: [StatusRowActionsView.Action] {
|
|
||||||
[.respond, .boost, .favorite, .share, .menu]
|
|
||||||
}
|
|
||||||
|
|
||||||
func image(dataController: StatusDataController, privateBoost: Bool = false) -> Image {
|
func image(dataController: StatusDataController, privateBoost: Bool = false) -> Image {
|
||||||
switch self {
|
switch self {
|
||||||
case .respond:
|
case .respond:
|
||||||
|
@ -128,7 +127,7 @@ struct StatusRowActionsView: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 12) {
|
VStack(spacing: 12) {
|
||||||
HStack {
|
HStack {
|
||||||
ForEach(Action.allCases, id: \.self) { action in
|
ForEach(actions, id: \.self) { action in
|
||||||
if action == .share {
|
if action == .share {
|
||||||
if let urlString = viewModel.finalStatus.url,
|
if let urlString = viewModel.finalStatus.url,
|
||||||
let url = URL(string: urlString)
|
let url = URL(string: urlString)
|
||||||
|
|
Loading…
Reference in a new issue