Settings: Add a button to hide OpenAI button in the composer

This commit is contained in:
Thomas Ricouard 2023-01-23 20:45:18 +01:00
parent 7664b97a31
commit 8fe6eddead
9 changed files with 28 additions and 3 deletions

View file

@ -27,6 +27,7 @@ struct SettingsTabs: View {
appSection appSection
accountsSection accountsSection
generalSection generalSection
otherSections
} }
.scrollContentBackground(.hidden) .scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor) .background(theme.secondaryBackgroundColor)
@ -91,6 +92,12 @@ struct SettingsTabs: View {
NavigationLink(destination: remoteLocalTimelinesView) { NavigationLink(destination: remoteLocalTimelinesView) {
Label("settings.general.remote-timelines", systemImage: "dot.radiowaves.right") Label("settings.general.remote-timelines", systemImage: "dot.radiowaves.right")
} }
}
.listRowBackground(theme.primaryBackgroundColor)
}
private var otherSections: some View {
Section("settings.section.other") {
if !ProcessInfo.processInfo.isiOSAppOnMac { if !ProcessInfo.processInfo.isiOSAppOnMac {
Picker(selection: $preferences.preferredBrowser) { Picker(selection: $preferences.preferredBrowser) {
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
@ -105,6 +112,9 @@ struct SettingsTabs: View {
Label("settings.general.browser", systemImage: "network") Label("settings.general.browser", systemImage: "network")
} }
} }
Toggle(isOn: $preferences.isOpenAIEnabled) {
Label("settings.other.hide-openai", systemImage: "faxmachine")
}
} }
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
} }

View file

@ -100,6 +100,8 @@
"settings.timeline.add" = "Lokale Timeline hinzufügen"; "settings.timeline.add" = "Lokale Timeline hinzufügen";
"settings.title" = "Einstellungen"; "settings.title" = "Einstellungen";
"settings.rate" = "Bewerte Ice Cubes"; "settings.rate" = "Bewerte Ice Cubes";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Entdecken"; "tab.explore" = "Entdecken";

View file

@ -100,6 +100,8 @@
"settings.timeline.add" = "Add a local timeline"; "settings.timeline.add" = "Add a local timeline";
"settings.title" = "Settings"; "settings.title" = "Settings";
"settings.rate" = "Rate Ice Cubes"; "settings.rate" = "Rate Ice Cubes";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explore"; "tab.explore" = "Explore";

View file

@ -100,6 +100,8 @@
"settings.timeline.add" = "Añadir cronología local"; "settings.timeline.add" = "Añadir cronología local";
"settings.title" = "Ajustes"; "settings.title" = "Ajustes";
"settings.rate" = "Valora Ice Cubes"; "settings.rate" = "Valora Ice Cubes";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Explorar"; "tab.explore" = "Explorar";

View file

@ -100,6 +100,8 @@
"settings.timeline.add" = "Aggiungi una timeline locale"; "settings.timeline.add" = "Aggiungi una timeline locale";
"settings.title" = "Impostazioni"; "settings.title" = "Impostazioni";
"settings.rate" = "Valuta Ice Cubes"; "settings.rate" = "Valuta Ice Cubes";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Esplora"; "tab.explore" = "Esplora";

View file

@ -100,6 +100,8 @@
"settings.support.four.subtitle" = "Daarmee kan Ice Cubes nog een tijdje vooruit!"; "settings.support.four.subtitle" = "Daarmee kan Ice Cubes nog een tijdje vooruit!";
"settings.timeline.add" = "Een lokale tijdlijn toevoegen"; "settings.timeline.add" = "Een lokale tijdlijn toevoegen";
"settings.title" = "Instellingen"; "settings.title" = "Instellingen";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "Ontdekken"; "tab.explore" = "Ontdekken";

View file

@ -100,6 +100,8 @@
"settings.timeline.add" = "添加远程时间线"; "settings.timeline.add" = "添加远程时间线";
"settings.title" = "设置"; "settings.title" = "设置";
"settings.rate" = "给 Ice Cubes 评分"; "settings.rate" = "给 Ice Cubes 评分";
"settings.section.other" = "Other";
"settings.other.hide-openai" = "Enable 🤖 helper";
// MARK: Tabs // MARK: Tabs
"tab.explore" = "探索"; "tab.explore" = "探索";

View file

@ -15,6 +15,7 @@ public class UserPreferences: ObservableObject {
@AppStorage("draft_posts") public var draftsPosts: [String] = [] @AppStorage("draft_posts") public var draftsPosts: [String] = []
@AppStorage("font_size_scale") public var fontSizeScale: Double = 1 @AppStorage("font_size_scale") public var fontSizeScale: Double = 1
@AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true @AppStorage("show_translate_button_inline") public var showTranslateButton: Bool = true
@AppStorage("is_open_ai_enabled") public var isOpenAIEnabled: Bool = true
public var pushNotificationsCount: Int { public var pushNotificationsCount: Int {
get { get {

View file

@ -100,9 +100,11 @@ public struct StatusEditorView: View {
Text(viewModel.postingError ?? "") Text(viewModel.postingError ?? "")
}) })
.toolbar { .toolbar {
ToolbarItem(placement: .navigationBarTrailing) { if preferences.isOpenAIEnabled {
AIMenu ToolbarItem(placement: .navigationBarTrailing) {
.disabled(!viewModel.canPost) AIMenu
.disabled(!viewModel.canPost)
}
} }
ToolbarItem(placement: .navigationBarTrailing) { ToolbarItem(placement: .navigationBarTrailing) {
Button { Button {