mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
no message
This commit is contained in:
parent
14aa94d2d6
commit
08cf916a83
@ -720,10 +720,20 @@ public func channelInfoController(account: Account, peerId: PeerId) -> ViewContr
|
|||||||
presentControllerImpl?(channelVisibilityController(account: account, peerId: peerId, mode: .generic), ViewControllerPresentationArguments(presentationAnimation: ViewControllerPresentationAnimation.modalSheet))
|
presentControllerImpl?(channelVisibilityController(account: account, peerId: peerId, mode: .generic), ViewControllerPresentationArguments(presentationAnimation: ViewControllerPresentationAnimation.modalSheet))
|
||||||
}, changeNotificationMuteSettings: {
|
}, changeNotificationMuteSettings: {
|
||||||
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
||||||
let controller = notificationMuteSettingsController(presentationData: presentationData, updateSettings: { value in
|
actionsDisposable.add((account.postbox.preferencesView(keys: [PreferencesKeys.globalNotifications]) |> take(1) |> deliverOnMainQueue).start(next: { view in
|
||||||
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
|
||||||
})
|
let viewSettings: GlobalNotificationSettingsSet
|
||||||
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
if let settings = view.values[PreferencesKeys.globalNotifications] as? GlobalNotificationSettings {
|
||||||
|
viewSettings = settings.effective
|
||||||
|
} else {
|
||||||
|
viewSettings = GlobalNotificationSettingsSet.defaultSettings
|
||||||
|
}
|
||||||
|
|
||||||
|
let controller = notificationMuteSettingsController(presentationData: presentationData, notificationSettings: viewSettings.privateChats, updateSettings: { value in
|
||||||
|
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
||||||
|
})
|
||||||
|
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||||
|
}))
|
||||||
}, changeNotificationSoundSettings: {
|
}, changeNotificationSoundSettings: {
|
||||||
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
||||||
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
||||||
|
@ -769,13 +769,11 @@ private func groupInfoEntries(account: Account, presentationData: PresentationDa
|
|||||||
|
|
||||||
let peerNotificationSettings: TelegramPeerNotificationSettings = (view.notificationSettings as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
let peerNotificationSettings: TelegramPeerNotificationSettings = (view.notificationSettings as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
||||||
let notificationsText: String
|
let notificationsText: String
|
||||||
switch peerNotificationSettings.muteState {
|
|
||||||
case .default:
|
if case .muted = peerNotificationSettings.muteState {
|
||||||
notificationsText = presentationData.strings.UserInfo_NotificationsDefault
|
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
||||||
case .muted:
|
} else {
|
||||||
notificationsText = presentationData.strings.UserInfo_NotificationsDisabled
|
notificationsText = presentationData.strings.UserInfo_NotificationsEnabled
|
||||||
case .unmuted:
|
|
||||||
notificationsText = presentationData.strings.UserInfo_NotificationsEnabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let editingState = state.editingState {
|
if let editingState = state.editingState {
|
||||||
@ -1281,10 +1279,20 @@ public func groupInfoController(account: Account, peerId: PeerId) -> ViewControl
|
|||||||
presentControllerImpl?(controller, presentationArguments)
|
presentControllerImpl?(controller, presentationArguments)
|
||||||
}, changeNotificationMuteSettings: {
|
}, changeNotificationMuteSettings: {
|
||||||
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
||||||
let controller = notificationMuteSettingsController(presentationData: presentationData, updateSettings: { value in
|
actionsDisposable.add((account.postbox.preferencesView(keys: [PreferencesKeys.globalNotifications]) |> take(1) |> deliverOnMainQueue).start(next: { view in
|
||||||
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
|
||||||
})
|
let viewSettings: GlobalNotificationSettingsSet
|
||||||
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
if let settings = view.values[PreferencesKeys.globalNotifications] as? GlobalNotificationSettings {
|
||||||
|
viewSettings = settings.effective
|
||||||
|
} else {
|
||||||
|
viewSettings = GlobalNotificationSettingsSet.defaultSettings
|
||||||
|
}
|
||||||
|
|
||||||
|
let controller = notificationMuteSettingsController(presentationData: presentationData, notificationSettings: viewSettings.privateChats, updateSettings: { value in
|
||||||
|
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
||||||
|
})
|
||||||
|
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||||
|
}))
|
||||||
}, changeNotificationSoundSettings: {
|
}, changeNotificationSoundSettings: {
|
||||||
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
||||||
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
||||||
|
@ -290,6 +290,10 @@ private func notificationsExceptionEntries(presentationData: PresentationData, s
|
|||||||
let soundName = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: value.settings.messageSound)
|
let soundName = localizedPeerNotificationSoundString(strings: presentationData.strings, sound: value.settings.messageSound)
|
||||||
title += (title.isEmpty ? presentationData.strings.Notification_Exceptions_Sound(soundName).0 : ", \(presentationData.strings.Notification_Exceptions_Sound(soundName).0)")
|
title += (title.isEmpty ? presentationData.strings.Notification_Exceptions_Sound(soundName).0 : ", \(presentationData.strings.Notification_Exceptions_Sound(soundName).0)")
|
||||||
}
|
}
|
||||||
|
if value.peer.displayTitle == "Vyezd Family" {
|
||||||
|
var bp:Int = 0
|
||||||
|
bp += 1
|
||||||
|
}
|
||||||
entries.append(.peer(index: index, peer: value.peer, theme: presentationData.theme, strings: presentationData.strings, dateFormat: presentationData.dateTimeFormat, description: title, notificationSettings: value.settings, revealed: state.revealedPeerId == value.peer.id, editing: state.editing))
|
entries.append(.peer(index: index, peer: value.peer, theme: presentationData.theme, strings: presentationData.strings, dateFormat: presentationData.dateTimeFormat, description: title, notificationSettings: value.settings, revealed: state.revealedPeerId == value.peer.id, editing: state.editing))
|
||||||
index += 1
|
index += 1
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Display
|
import Display
|
||||||
|
import TelegramCore
|
||||||
|
import Postbox
|
||||||
|
|
||||||
private enum NotificationMuteOption {
|
private enum NotificationMuteOption {
|
||||||
case `default`
|
case `default`
|
||||||
@ -8,7 +10,9 @@ private enum NotificationMuteOption {
|
|||||||
case disable
|
case disable
|
||||||
}
|
}
|
||||||
|
|
||||||
func notificationMuteSettingsController(presentationData: PresentationData, updateSettings: @escaping (Int32?) -> Void) -> ViewController {
|
func notificationMuteSettingsController(presentationData: PresentationData, notificationSettings: MessageNotificationSettings, updateSettings: @escaping (Int32?) -> Void) -> ViewController {
|
||||||
|
|
||||||
|
|
||||||
let controller = ActionSheetController(presentationTheme: presentationData.theme)
|
let controller = ActionSheetController(presentationTheme: presentationData.theme)
|
||||||
let dismissAction: () -> Void = { [weak controller] in
|
let dismissAction: () -> Void = { [weak controller] in
|
||||||
controller?.dismissAnimated()
|
controller?.dismissAnimated()
|
||||||
@ -31,7 +35,7 @@ func notificationMuteSettingsController(presentationData: PresentationData, upda
|
|||||||
}
|
}
|
||||||
|
|
||||||
let options: [NotificationMuteOption] = [
|
let options: [NotificationMuteOption] = [
|
||||||
.default,
|
// .default,
|
||||||
.enable,
|
.enable,
|
||||||
.interval(1 * 60 * 60),
|
.interval(1 * 60 * 60),
|
||||||
.interval(8 * 60 * 60),
|
.interval(8 * 60 * 60),
|
||||||
@ -51,7 +55,11 @@ func notificationMuteSettingsController(presentationData: PresentationData, upda
|
|||||||
case .enable:
|
case .enable:
|
||||||
item = ActionSheetButtonItem(title: presentationData.strings.UserInfo_NotificationsEnable, action: {
|
item = ActionSheetButtonItem(title: presentationData.strings.UserInfo_NotificationsEnable, action: {
|
||||||
dismissAction()
|
dismissAction()
|
||||||
notificationAction(0)
|
if notificationSettings.enabled {
|
||||||
|
notificationAction(nil)
|
||||||
|
} else {
|
||||||
|
notificationAction(0)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
case let .interval(value):
|
case let .interval(value):
|
||||||
item = ActionSheetButtonItem(title: muteForIntervalString(strings: presentationData.strings, value: value), action: {
|
item = ActionSheetButtonItem(title: muteForIntervalString(strings: presentationData.strings, value: value), action: {
|
||||||
@ -61,7 +69,11 @@ func notificationMuteSettingsController(presentationData: PresentationData, upda
|
|||||||
case .disable:
|
case .disable:
|
||||||
item = ActionSheetButtonItem(title: presentationData.strings.UserInfo_NotificationsDisable, action: {
|
item = ActionSheetButtonItem(title: presentationData.strings.UserInfo_NotificationsDisable, action: {
|
||||||
dismissAction()
|
dismissAction()
|
||||||
notificationAction(Int32.max)
|
if !notificationSettings.enabled {
|
||||||
|
notificationAction(nil)
|
||||||
|
} else {
|
||||||
|
notificationAction(Int32.max)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
items.append(item)
|
items.append(item)
|
||||||
|
@ -860,10 +860,21 @@ public func userInfoController(account: Account, peerId: PeerId, mode: UserInfoC
|
|||||||
startSecretChatImpl?()
|
startSecretChatImpl?()
|
||||||
}, changeNotificationMuteSettings: {
|
}, changeNotificationMuteSettings: {
|
||||||
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
let presentationData = account.telegramApplicationContext.currentPresentationData.with { $0 }
|
||||||
let controller = notificationMuteSettingsController(presentationData: presentationData, updateSettings: { value in
|
actionsDisposable.add((account.postbox.preferencesView(keys: [PreferencesKeys.globalNotifications]) |> take(1) |> deliverOnMainQueue).start(next: { view in
|
||||||
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
|
||||||
})
|
let viewSettings: GlobalNotificationSettingsSet
|
||||||
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
if let settings = view.values[PreferencesKeys.globalNotifications] as? GlobalNotificationSettings {
|
||||||
|
viewSettings = settings.effective
|
||||||
|
} else {
|
||||||
|
viewSettings = GlobalNotificationSettingsSet.defaultSettings
|
||||||
|
}
|
||||||
|
|
||||||
|
let controller = notificationMuteSettingsController(presentationData: presentationData, notificationSettings: viewSettings.privateChats, updateSettings: { value in
|
||||||
|
changeMuteSettingsDisposable.set(updatePeerMuteSetting(account: account, peerId: peerId, muteInterval: value).start())
|
||||||
|
})
|
||||||
|
presentControllerImpl?(controller, ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
|
||||||
|
}))
|
||||||
|
|
||||||
}, changeNotificationSoundSettings: {
|
}, changeNotificationSoundSettings: {
|
||||||
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
let _ = (account.postbox.transaction { transaction -> (TelegramPeerNotificationSettings, GlobalNotificationSettings) in
|
||||||
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
let peerSettings: TelegramPeerNotificationSettings = (transaction.getPeerNotificationSettings(peerId) as? TelegramPeerNotificationSettings) ?? TelegramPeerNotificationSettings.defaultSettings
|
||||||
|
Loading…
x
Reference in New Issue
Block a user