mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 14:53:35 +00:00
UI fixes
This commit is contained in:
parent
1270d99fc2
commit
13899c4d89
@ -308,7 +308,9 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
entries.append(.exceptionInfo(presentationData.theme, presentationData.strings.GroupPermission_AddedInfo(initialBannedBy.displayTitle, stringForRelativeSymbolicTimestamp(strings: presentationData.strings, relativeTimestamp: banInfo.timestamp, relativeTo: state.referenceTimestamp, dateTimeFormat: presentationData.dateTimeFormat)).0))
|
||||
entries.append(.delete(presentationData.theme, presentationData.strings.GroupPermission_Delete))
|
||||
}
|
||||
} else if let group = channelView.peers[channelView.peerId] as? TelegramGroup, let defaultBannedRights = group.defaultBannedRights, let member = memberView.peers[memberView.peerId] {
|
||||
} else if let group = channelView.peers[channelView.peerId] as? TelegramGroup, let member = memberView.peers[memberView.peerId] {
|
||||
let defaultBannedRightsFlags = group.defaultBannedRights?.flags ?? []
|
||||
|
||||
entries.append(.info(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, member, memberView.peerPresences[member.id] as? TelegramUserPresence))
|
||||
|
||||
let currentRightsFlags: TelegramChatBannedRightsFlags
|
||||
@ -317,7 +319,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
} else if let initialParticipant = initialParticipant, case let .member(_, _, _, maybeBanInfo) = initialParticipant, let banInfo = maybeBanInfo {
|
||||
currentRightsFlags = banInfo.rights.flags
|
||||
} else {
|
||||
currentRightsFlags = defaultBannedRights.flags
|
||||
currentRightsFlags = defaultBannedRightsFlags
|
||||
}
|
||||
|
||||
let currentTimeout: Int32
|
||||
@ -341,7 +343,7 @@ private func channelBannedMemberControllerEntries(presentationData: Presentation
|
||||
|
||||
var index = 0
|
||||
for right in allGroupPermissionList {
|
||||
let defaultEnabled = !defaultBannedRights.flags.contains(right)
|
||||
let defaultEnabled = !defaultBannedRightsFlags.contains(right)
|
||||
entries.append(.rightItem(presentationData.theme, index, stringForGroupPermission(strings: presentationData.strings, right: right), right, defaultEnabled && !currentRightsFlags.contains(right), defaultEnabled && !state.updating))
|
||||
index += 1
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ class ChatListControllerNode: ASDisplayNode {
|
||||
private var presentationData: PresentationData
|
||||
|
||||
private var chatListEmptyNode: ChatListEmptyNode?
|
||||
private var chatListEmptyIndicator: ActivityIndicator?
|
||||
let chatListNode: ChatListNode
|
||||
var navigationBar: NavigationBar?
|
||||
weak var controller: ChatListController?
|
||||
@ -59,7 +60,7 @@ class ChatListControllerNode: ASDisplayNode {
|
||||
return
|
||||
}
|
||||
switch isEmptyState {
|
||||
case let .empty(isLoading):
|
||||
case .empty(false):
|
||||
if strongSelf.chatListEmptyNode == nil {
|
||||
let chatListEmptyNode = ChatListEmptyNode(theme: strongSelf.presentationData.theme, strings: strongSelf.presentationData.strings)
|
||||
strongSelf.chatListEmptyNode = chatListEmptyNode
|
||||
@ -68,7 +69,7 @@ class ChatListControllerNode: ASDisplayNode {
|
||||
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationHeight, transition: .immediate)
|
||||
}
|
||||
}
|
||||
case .notEmpty:
|
||||
default:
|
||||
if let chatListEmptyNode = strongSelf.chatListEmptyNode {
|
||||
strongSelf.chatListEmptyNode = nil
|
||||
chatListEmptyNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak chatListEmptyNode] _ in
|
||||
@ -76,6 +77,22 @@ class ChatListControllerNode: ASDisplayNode {
|
||||
})
|
||||
}
|
||||
}
|
||||
switch isEmptyState {
|
||||
case .empty(true):
|
||||
if strongSelf.chatListEmptyIndicator == nil {
|
||||
let chatListEmptyIndicator = ActivityIndicator(type: .custom(strongSelf.presentationData.theme.list.itemAccentColor, 22.0, 1.0, false))
|
||||
strongSelf.chatListEmptyIndicator = chatListEmptyIndicator
|
||||
strongSelf.insertSubnode(chatListEmptyIndicator, belowSubnode: strongSelf.chatListNode)
|
||||
if let (layout, navigationHeight) = strongSelf.containerLayout {
|
||||
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationHeight, transition: .immediate)
|
||||
}
|
||||
}
|
||||
default:
|
||||
if let chatListEmptyIndicator = strongSelf.chatListEmptyIndicator {
|
||||
strongSelf.chatListEmptyIndicator = nil
|
||||
chatListEmptyIndicator.removeFromSupernode()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,6 +156,11 @@ class ChatListControllerNode: ASDisplayNode {
|
||||
chatListEmptyNode.updateLayout(size: emptySize, transition: transition)
|
||||
}
|
||||
|
||||
if let chatListEmptyIndicator = self.chatListEmptyIndicator {
|
||||
let indicatorSize = chatListEmptyIndicator.measure(CGSize(width: 100.0, height: 100.0))
|
||||
transition.updateFrame(node: chatListEmptyIndicator, frame: CGRect(origin: CGPoint(x: floor((layout.size.width - indicatorSize.width) / 2.0), y: updateSizeAndInsets.insets.top + floor((layout.size.height - updateSizeAndInsets.insets.top - updateSizeAndInsets.insets.bottom - indicatorSize.height) / 2.0)), size: indicatorSize))
|
||||
}
|
||||
|
||||
if let searchDisplayController = self.searchDisplayController {
|
||||
searchDisplayController.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: transition)
|
||||
}
|
||||
|
||||
@ -360,8 +360,14 @@ class ItemListPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
|
||||
switch item.text {
|
||||
case .presence:
|
||||
if let user = item.peer as? TelegramUser, user.botInfo != nil {
|
||||
statusAttributedString = NSAttributedString(string: item.strings.Bot_GenericBotStatus, font: statusFont, textColor: item.theme.list.itemSecondaryTextColor)
|
||||
if let user = item.peer as? TelegramUser, let botInfo = user.botInfo {
|
||||
let botStatus: String
|
||||
if botInfo.flags.contains(.hasAccessToChatHistory) {
|
||||
botStatus = item.strings.Bot_GroupStatusReadsHistory
|
||||
} else {
|
||||
botStatus = item.strings.Bot_GroupStatusDoesNotReadHistory
|
||||
}
|
||||
statusAttributedString = NSAttributedString(string: botStatus, font: statusFont, textColor: item.theme.list.itemSecondaryTextColor)
|
||||
} else if let presence = item.presence as? TelegramUserPresence {
|
||||
let timestamp = CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970
|
||||
let (string, activity) = stringAndActivityForUserPresence(strings: item.strings, dateTimeFormat: item.dateTimeFormat, presence: presence, relativeTo: Int32(timestamp))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user