Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Swiftgram/SGSettingsUI/Sources/SGSettingsController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private enum SGBoolSetting: String {
case disableGalleryCamera
case disableGalleryCameraPreview
case disableSendAsButton
case disableAIChatButton
case disableSnapDeletionEffect
case stickerTimestamp
case hideRecordingButton
Expand Down Expand Up @@ -314,6 +315,7 @@ private func SGControllerEntries(presentationData: PresentationData, callListSet
entries.append(.toggle(id: id.count, section: .other, settingName: .hideRecordingButton, value: !SGSimpleSettings.shared.hideRecordingButton, text: i18n("Settings.RecordingButton", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableSnapDeletionEffect, value: !SGSimpleSettings.shared.disableSnapDeletionEffect, text: i18n("Settings.SnapDeletionEffect", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableSendAsButton, value: !SGSimpleSettings.shared.disableSendAsButton, text: i18n("Settings.SendAsButton", lang, strings.Conversation_SendMesageAs), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableAIChatButton, value: !SGSimpleSettings.shared.disableAIChatButton, text: i18n("Settings.AIChatButton", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableGalleryCamera, value: !SGSimpleSettings.shared.disableGalleryCamera, text: i18n("Settings.GalleryCamera", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableGalleryCameraPreview, value: !SGSimpleSettings.shared.disableGalleryCameraPreview, text: i18n("Settings.GalleryCameraPreview", lang), enabled: !SGSimpleSettings.shared.disableGalleryCamera))
entries.append(.toggle(id: id.count, section: .other, settingName: .disableScrollToNextChannel, value: !SGSimpleSettings.shared.disableScrollToNextChannel, text: i18n("Settings.PullToNextChannel", lang), enabled: true))
Expand Down Expand Up @@ -448,6 +450,8 @@ public func sgSettingsController(context: AccountContext/*, focusOnItemTag: Int?
SGSimpleSettings.shared.disableGalleryCameraPreview = !value
case .disableSendAsButton:
SGSimpleSettings.shared.disableSendAsButton = !value
case .disableAIChatButton:
SGSimpleSettings.shared.disableAIChatButton = !value
case .disableSnapDeletionEffect:
SGSimpleSettings.shared.disableSnapDeletionEffect = !value
case .contextShowReport:
Expand Down
5 changes: 5 additions & 0 deletions Swiftgram/SGSimpleSettings/Sources/SimpleSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public class SGSimpleSettings {
case disableGalleryCamera
case disableGalleryCameraPreview
case disableSendAsButton
case disableAIChatButton
case disableSnapDeletionEffect
case stickerSize
case stickerTimestamp
Expand Down Expand Up @@ -289,6 +290,7 @@ public class SGSimpleSettings {
Keys.disableGalleryCamera.rawValue: false,
Keys.disableGalleryCameraPreview.rawValue: false,
Keys.disableSendAsButton.rawValue: false,
Keys.disableAIChatButton.rawValue: false,
Keys.disableSnapDeletionEffect.rawValue: false,
Keys.stickerSize.rawValue: 100,
Keys.stickerTimestamp.rawValue: true,
Expand Down Expand Up @@ -464,6 +466,9 @@ public class SGSimpleSettings {
@UserDefault(key: Keys.disableSendAsButton.rawValue)
public var disableSendAsButton: Bool

@UserDefault(key: Keys.disableAIChatButton.rawValue)
public var disableAIChatButton: Bool

@UserDefault(key: Keys.disableSnapDeletionEffect.rawValue)
public var disableSnapDeletionEffect: Bool

Expand Down
1 change: 1 addition & 0 deletions Swiftgram/SGStrings/Strings/en.lproj/SGLocalizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"Settings.GalleryCameraPreview" = "Camera Preview in Gallery";
/* "Send Message As..." button */
"Settings.SendAsButton" = "\"%@\" Button";
"Settings.AIChatButton" = "AI Rewrite Button";
"Settings.SnapDeletionEffect" = "Message Deletion Effects";

"Settings.Stickers.Size" = "SIZE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3578,7 +3578,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
var isAIButtonVisible = false
var attachmentPillHeight: CGFloat = 40.0
let inputHasNonWhitespaceText = !(self.richTextInputNode?.inputContentIsEmptyWhitespaceTrimmed ?? true)
if self.isAIEnabled, inputHasNonWhitespaceText, let node = self.richTextInputNode {
if self.isAIEnabled && !SGSimpleSettings.shared.disableAIChatButton, inputHasNonWhitespaceText, let node = self.richTextInputNode {
let threeLineHeight = self.threeLineFieldHeight(forWidth: baseWidth, node: node, metrics: metrics, bottomInset: bottomInset, textFieldInsets: textFieldInsets)
if textInputHeight >= threeLineHeight - 0.5 {
isAIButtonVisible = true
Expand All @@ -3600,7 +3600,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
}

// AI button in the TOP 40x40 slot of the capsule (fades in with the 3-line rule).
if self.isAIEnabled {
if self.isAIEnabled && !SGSimpleSettings.shared.disableAIChatButton {
let aiButton: (button: HighlightTrackingButton, icon: UIImageView)
if let current = self.attachmentAIButton {
aiButton = current
Expand Down