implemented mediaRecordingTooltip

This commit is contained in:
levochkaa 2025-05-04 20:44:06 +04:00
parent fbae7f359e
commit 5e47a80abb
4 changed files with 15 additions and 1 deletions

View File

@ -97,6 +97,7 @@ private enum SGBoolSetting: String {
case hideChannelBottomButton case hideChannelBottomButton
case confirmCalls case confirmCalls
case swipeForVideoPIP case swipeForVideoPIP
case mediaRecordingTooltip
} }
private enum SGOneFromManySetting: String { private enum SGOneFromManySetting: String {
@ -255,6 +256,7 @@ private func SGControllerEntries(presentationData: PresentationData, callListSet
id.increment(10000) id.increment(10000)
entries.append(.header(id: id.count, section: .other, text: presentationData.strings.Appearance_Other.uppercased(), badge: nil)) entries.append(.header(id: id.count, section: .other, text: presentationData.strings.Appearance_Other.uppercased(), badge: nil))
entries.append(.toggle(id: id.count, section: .other, settingName: .mediaRecordingTooltip, value: SGSimpleSettings.shared.mediaRecordingTooltip, text: i18n("Settings.mediaRecordingTooltip", lang), enabled: true))
entries.append(.toggle(id: id.count, section: .other, settingName: .swipeForVideoPIP, value: SGSimpleSettings.shared.videoPIPSwipeDirection == SGSimpleSettings.VideoPIPSwipeDirection.up.rawValue, text: i18n("Settings.swipeForVideoPIP", lang), enabled: true)) entries.append(.toggle(id: id.count, section: .other, settingName: .swipeForVideoPIP, value: SGSimpleSettings.shared.videoPIPSwipeDirection == SGSimpleSettings.VideoPIPSwipeDirection.up.rawValue, text: i18n("Settings.swipeForVideoPIP", lang), enabled: true))
entries.append(.notice(id: id.count, section: .other, text: i18n("Settings.swipeForVideoPIP.Notice", lang))) entries.append(.notice(id: id.count, section: .other, text: i18n("Settings.swipeForVideoPIP.Notice", lang)))
entries.append(.toggle(id: id.count, section: .other, settingName: .hideChannelBottomButton, value: !SGSimpleSettings.shared.hideChannelBottomButton, text: i18n("Settings.showChannelBottomButton", lang), enabled: true)) entries.append(.toggle(id: id.count, section: .other, settingName: .hideChannelBottomButton, value: !SGSimpleSettings.shared.hideChannelBottomButton, text: i18n("Settings.showChannelBottomButton", lang), enabled: true))
@ -473,6 +475,8 @@ public func sgSettingsController(context: AccountContext/*, focusOnItemTag: Int?
SGSimpleSettings.shared.confirmCalls = value SGSimpleSettings.shared.confirmCalls = value
case .swipeForVideoPIP: case .swipeForVideoPIP:
SGSimpleSettings.shared.videoPIPSwipeDirection = value ? SGSimpleSettings.VideoPIPSwipeDirection.up.rawValue : SGSimpleSettings.VideoPIPSwipeDirection.none.rawValue SGSimpleSettings.shared.videoPIPSwipeDirection = value ? SGSimpleSettings.VideoPIPSwipeDirection.up.rawValue : SGSimpleSettings.VideoPIPSwipeDirection.none.rawValue
case .mediaRecordingTooltip:
SGSimpleSettings.shared.mediaRecordingTooltip = value
} }
}, updateSliderValue: { setting, value in }, updateSliderValue: { setting, value in
switch (setting) { switch (setting) {

View File

@ -132,6 +132,7 @@ public class SGSimpleSettings {
case status case status
case dismissedSGSuggestions case dismissedSGSuggestions
case duckyAppIconAvailable case duckyAppIconAvailable
case mediaRecordingTooltip
} }
public enum DownloadSpeedBoostValues: String, CaseIterable { public enum DownloadSpeedBoostValues: String, CaseIterable {
@ -246,7 +247,8 @@ public class SGSimpleSettings {
Keys.inputToolbar.rawValue: false, Keys.inputToolbar.rawValue: false,
Keys.primaryUserId.rawValue: "", Keys.primaryUserId.rawValue: "",
Keys.dismissedSGSuggestions.rawValue: [], Keys.dismissedSGSuggestions.rawValue: [],
Keys.duckyAppIconAvailable.rawValue: true Keys.duckyAppIconAvailable.rawValue: true,
Keys.mediaRecordingTooltip.rawValue: true,
] ]
public static let groupDefaultValues: [String: Any] = [ public static let groupDefaultValues: [String: Any] = [
@ -463,6 +465,9 @@ public class SGSimpleSettings {
@UserDefault(key: Keys.duckyAppIconAvailable.rawValue) @UserDefault(key: Keys.duckyAppIconAvailable.rawValue)
public var duckyAppIconAvailable: Bool public var duckyAppIconAvailable: Bool
@UserDefault(key: Keys.mediaRecordingTooltip.rawValue)
public var mediaRecordingTooltip: Bool
} }
extension SGSimpleSettings { extension SGSimpleSettings {

View File

@ -155,6 +155,8 @@
"Settings.swipeForVideoPIP" = "Video PIP with Swipe"; "Settings.swipeForVideoPIP" = "Video PIP with Swipe";
"Settings.swipeForVideoPIP.Notice" = "If enabled, swiping video will open it in Picture-in-Picture mode."; "Settings.swipeForVideoPIP.Notice" = "If enabled, swiping video will open it in Picture-in-Picture mode.";
"Settings.mediaRecordingTooltip" = "Media Recording Tooltip";
"SessionBackup.Title" = "Accounts Backup"; "SessionBackup.Title" = "Accounts Backup";
"SessionBackup.Sessions.Title" = "Sessions"; "SessionBackup.Sessions.Title" = "Sessions";
"SessionBackup.Actions.Backup" = "Backup to Keychain"; "SessionBackup.Actions.Backup" = "Backup to Keychain";

View File

@ -10401,6 +10401,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
} }
func displayMediaRecordingTooltip() { func displayMediaRecordingTooltip() {
// MARK: Swiftgram
guard SGSimpleSettings.shared.mediaRecordingTooltip else { return }
guard let peer = self.presentationInterfaceState.renderedPeer?.peer else { guard let peer = self.presentationInterfaceState.renderedPeer?.peer else {
return return
} }