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
accountsSection
generalSection
otherSections
}
.scrollContentBackground(.hidden)
.background(theme.secondaryBackgroundColor)
@ -91,6 +92,12 @@ struct SettingsTabs: View {
NavigationLink(destination: remoteLocalTimelinesView) {
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 {
Picker(selection: $preferences.preferredBrowser) {
ForEach(PreferredBrowser.allCases, id: \.rawValue) { browser in
@ -105,6 +112,9 @@ struct SettingsTabs: View {
Label("settings.general.browser", systemImage: "network")
}
}
Toggle(isOn: $preferences.isOpenAIEnabled) {
Label("settings.other.hide-openai", systemImage: "faxmachine")
}
}
.listRowBackground(theme.primaryBackgroundColor)
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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