mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Various Improvements
This commit is contained in:
@@ -354,7 +354,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
return entries
|
||||
}
|
||||
|
||||
public func channelBannedMemberController(context: AccountContext, peerId: PeerId, memberId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatBannedRights?) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController {
|
||||
public func channelBannedMemberController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: PeerId, memberId: PeerId, initialParticipant: ChannelParticipant?, updated: @escaping (TelegramChatBannedRights?) -> Void, upgradedToSupergroup: @escaping (PeerId, @escaping () -> Void) -> Void) -> ViewController {
|
||||
let initialState = ChannelBannedMemberControllerState(referenceTimestamp: Int32(Date().timeIntervalSince1970), updatedFlags: nil, updatedTimeout: nil, updating: false)
|
||||
let statePromise = ValuePromise(initialState, ignoreRepeated: true)
|
||||
let stateValue = Atomic(value: initialState)
|
||||
@@ -426,7 +426,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
guard let defaultBannedRights = channel.defaultBannedRights else {
|
||||
return
|
||||
}
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
|
||||
let text: String
|
||||
if channel.hasPermission(.banMembers) {
|
||||
if defaultBannedRights.flags.contains(right) {
|
||||
@@ -440,7 +440,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
presentControllerImpl?(textAlertController(context: context, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
||||
})
|
||||
}, openTimeout: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
|
||||
let actionSheet = ActionSheetController(presentationData: presentationData)
|
||||
let intervals: [Int32] = [
|
||||
1 * 60 * 60 * 24,
|
||||
@@ -478,7 +478,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
])])
|
||||
presentControllerImpl?(actionSheet, nil)
|
||||
}, delete: {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
|
||||
let actionSheet = ActionSheetController(presentationData: presentationData)
|
||||
var items: [ActionSheetItem] = []
|
||||
items.append(ActionSheetButtonItem(title: presentationData.strings.GroupPermission_Delete, color: .destructive, font: .default, enabled: true, action: { [weak actionSheet] in
|
||||
@@ -512,7 +512,8 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
|
||||
let canEdit = true
|
||||
|
||||
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), combinedView)
|
||||
let presentationData = updatedPresentationData?.signal ?? context.sharedContext.presentationData
|
||||
let signal = combineLatest(presentationData, statePromise.get(), combinedView)
|
||||
|> deliverOnMainQueue
|
||||
|> map { presentationData, state, combinedView -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||
let channelView = combinedView.views[.peer(peerId: peerId, components: .all)] as! PeerView
|
||||
@@ -682,7 +683,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
|
||||
}, completed: {
|
||||
if previousRights == nil {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(OverlayStatusController(theme: presentationData.theme, type: .genericSuccess(presentationData.strings.GroupPermission_AddSuccess, false)), nil)
|
||||
}
|
||||
updated(cleanResolvedRights.flags.isEmpty ? nil : cleanResolvedRights)
|
||||
@@ -691,7 +692,7 @@ public func channelBannedMemberController(context: AccountContext, peerId: PeerI
|
||||
}
|
||||
}
|
||||
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
let presentationData = updatedPresentationData?.initial ?? context.sharedContext.currentPresentationData.with { $0 }
|
||||
let actionSheet = ActionSheetController(presentationData: presentationData)
|
||||
var items: [ActionSheetItem] = []
|
||||
items.append(ActionSheetTextItem(title: presentationData.strings.GroupPermission_ApplyAlertText(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string))
|
||||
|
||||
Reference in New Issue
Block a user