From e90b079e8a8c2dd3502f16f575caec44e65d888a Mon Sep 17 00:00:00 2001 From: overtake <> Date: Mon, 22 Oct 2018 16:26:53 +0400 Subject: [PATCH] no message --- TelegramUI/NotificationExceptions.swift | 17 ++++++++++++++++- TelegramUI/PresentationStrings.swift | 2 ++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/TelegramUI/NotificationExceptions.swift b/TelegramUI/NotificationExceptions.swift index ea469d975f..f1a7ac00a9 100644 --- a/TelegramUI/NotificationExceptions.swift +++ b/TelegramUI/NotificationExceptions.swift @@ -439,6 +439,12 @@ public func notificationExceptionsController(account: Account, mode: Notificatio }) presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet)) actionSheet?.dismissAnimated() + }), + ActionSheetButtonItem(title: presentationData.strings.Notifications_ExceptionsResetToDefaults, color: .destructive, action: { [weak actionSheet] in + + updatePeerNotificationInterval(peerId, nil) + updatePeerSound(peerId, .default) + actionSheet?.dismissAnimated() }) ]), ActionSheetItemGroup(items: [ ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in @@ -505,6 +511,15 @@ public func notificationExceptionsController(account: Account, mode: Notificatio actionSheet?.dismissAnimated() })) + if settings.muteState != .default || settings.messageSound != .default { + items.append(ActionSheetButtonItem(title: presentationData.strings.Notifications_ExceptionsResetToDefaults, color: .destructive, action: { [weak actionSheet] in + + updatePeerNotificationInterval(peerId, nil) + updatePeerSound(peerId, .default) + actionSheet?.dismissAnimated() + })) + } + actionSheet.setItemGroups([ActionSheetItemGroup(items: items), ActionSheetItemGroup(items: [ ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, color: .accent, action: { [weak actionSheet] in actionSheet?.dismissAnimated() @@ -544,7 +559,7 @@ public func notificationExceptionsController(account: Account, mode: Notificatio let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(presentationData.strings.Notifications_ExceptionsTitle), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: nil) - let listState = ItemListNodeState(entries: notificationsExceptionEntries(presentationData: presentationData, peers: peers, state: state), style: .plain, searchItem: nil) + let listState = ItemListNodeState(entries: notificationsExceptionEntries(presentationData: presentationData, peers: peers, state: state), style: .blocks, searchItem: nil) return (controllerState, (listState, arguments)) } diff --git a/TelegramUI/PresentationStrings.swift b/TelegramUI/PresentationStrings.swift index a54e67e116..29159f5331 100644 --- a/TelegramUI/PresentationStrings.swift +++ b/TelegramUI/PresentationStrings.swift @@ -1533,6 +1533,7 @@ public final class PresentationStrings { } public let Conversation_ClearPrivateHistory: String public let Conversation_ContextMenuShare: String + public let Notifications_ExceptionsResetToDefaults: String public let Notifications_ExceptionsNone: String private let _Time_MonthOfYear_m6: String private let _Time_MonthOfYear_m6_r: [(Int, NSRange)] @@ -6574,6 +6575,7 @@ public final class PresentationStrings { self._LOCKED_MESSAGE_r = extractArgumentRanges(self._LOCKED_MESSAGE) self.Conversation_ClearPrivateHistory = getValue(dict, "Conversation.ClearPrivateHistory") self.Conversation_ContextMenuShare = getValue(dict, "Conversation.ContextMenuShare") + self.Notifications_ExceptionsResetToDefaults = getValue(dict, "Notifications.ExceptionsResetToDefaults") self.Notifications_ExceptionsNone = getValue(dict, "Notifications.ExceptionsNone") self._Time_MonthOfYear_m6 = getValue(dict, "Time.MonthOfYear_m6") self._Time_MonthOfYear_m6_r = extractArgumentRanges(self._Time_MonthOfYear_m6)