mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Various improvements
This commit is contained in:
parent
e53af6f87d
commit
cd3c27fcc2
@ -14412,3 +14412,9 @@ Sorry for the inconvenience.";
|
|||||||
"Stars.SendMessage.AdjustmentAction" = "OK";
|
"Stars.SendMessage.AdjustmentAction" = "OK";
|
||||||
|
|
||||||
"Stars.SendMessage.PriceFree" = "Free";
|
"Stars.SendMessage.PriceFree" = "Free";
|
||||||
|
|
||||||
|
"Undo.DeletedMonoforum" = "Removed from your chat list.";
|
||||||
|
|
||||||
|
"Monoforum.DeleteTopic.Title" = "Delete %@";
|
||||||
|
"Channel.RemoveFeeAlert.Text" = "Are you sure you want to allow **%@** to message your channel for free?";
|
||||||
|
"StarsBalance.ChannelBalance" = "Your channel balance is %@";
|
||||||
|
@ -5928,7 +5928,9 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
|||||||
self.chatListDisplayNode.effectiveContainerNode.currentItemNode.setCurrentRemovingItemId(nil)
|
self.chatListDisplayNode.effectiveContainerNode.currentItemNode.setCurrentRemovingItemId(nil)
|
||||||
let statusText: String
|
let statusText: String
|
||||||
if case let .channel(channel) = chatPeer {
|
if case let .channel(channel) = chatPeer {
|
||||||
if deleteGloballyIfPossible {
|
if channel.isMonoForum {
|
||||||
|
statusText = self.presentationData.strings.Undo_DeletedMonoforum
|
||||||
|
} else if deleteGloballyIfPossible {
|
||||||
if case .broadcast = channel.info {
|
if case .broadcast = channel.info {
|
||||||
statusText = self.presentationData.strings.Undo_DeletedChannel
|
statusText = self.presentationData.strings.Undo_DeletedChannel
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,6 +22,7 @@ final class MutablePeerView: MutablePostboxView {
|
|||||||
let components: PeerViewComponents
|
let components: PeerViewComponents
|
||||||
var notificationSettings: PeerNotificationSettings?
|
var notificationSettings: PeerNotificationSettings?
|
||||||
var cachedData: CachedPeerData?
|
var cachedData: CachedPeerData?
|
||||||
|
var associatedCachedData: [PeerId: CachedPeerData] = [:]
|
||||||
var peers: [PeerId: Peer] = [:]
|
var peers: [PeerId: Peer] = [:]
|
||||||
var peerPresences: [PeerId: PeerPresence] = [:]
|
var peerPresences: [PeerId: PeerPresence] = [:]
|
||||||
var messages: [MessageId: Message] = [:]
|
var messages: [MessageId: Message] = [:]
|
||||||
@ -101,6 +102,10 @@ final class MutablePeerView: MutablePostboxView {
|
|||||||
} else {
|
} else {
|
||||||
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
|
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let cachedData = postbox.cachedPeerDataTable.get(associatedPeerId) {
|
||||||
|
self.associatedCachedData[associatedPeerId] = cachedData
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
|
self.notificationSettings = postbox.peerNotificationSettingsTable.getEffective(peerId)
|
||||||
}
|
}
|
||||||
@ -279,9 +284,35 @@ final class MutablePeerView: MutablePostboxView {
|
|||||||
updated = true
|
updated = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if self.notificationSettings != nil {
|
|
||||||
self.notificationSettings = nil
|
if let associatedPeerId = peer.associatedPeerId {
|
||||||
updated = true
|
if let value = updatedCachedPeerData[associatedPeerId] {
|
||||||
|
if let current = self.associatedCachedData[associatedPeerId] {
|
||||||
|
if !current.isEqual(to: value) {
|
||||||
|
self.associatedCachedData[associatedPeerId] = value
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self.associatedCachedData[associatedPeerId] = value
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if !self.associatedCachedData.isEmpty {
|
||||||
|
self.associatedCachedData.removeAll()
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if self.notificationSettings != nil {
|
||||||
|
self.notificationSettings = nil
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if !self.associatedCachedData.isEmpty {
|
||||||
|
self.associatedCachedData.removeAll()
|
||||||
|
updated = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let replaceContactPeerIds = replaceContactPeerIds {
|
if let replaceContactPeerIds = replaceContactPeerIds {
|
||||||
@ -377,6 +408,7 @@ public final class PeerView: PostboxView {
|
|||||||
public let groupId: PeerGroupId?
|
public let groupId: PeerGroupId?
|
||||||
public let storyStats: PeerStoryStats?
|
public let storyStats: PeerStoryStats?
|
||||||
public let memberStoryStats: [PeerId: PeerStoryStats]
|
public let memberStoryStats: [PeerId: PeerStoryStats]
|
||||||
|
public let associatedCachedData: [PeerId: CachedPeerData]
|
||||||
|
|
||||||
init(_ mutableView: MutablePeerView) {
|
init(_ mutableView: MutablePeerView) {
|
||||||
self.peerId = mutableView.peerId
|
self.peerId = mutableView.peerId
|
||||||
@ -390,5 +422,6 @@ public final class PeerView: PostboxView {
|
|||||||
self.groupId = mutableView.groupId
|
self.groupId = mutableView.groupId
|
||||||
self.storyStats = mutableView.storyStats
|
self.storyStats = mutableView.storyStats
|
||||||
self.memberStoryStats = mutableView.memberStoryStats
|
self.memberStoryStats = mutableView.memberStoryStats
|
||||||
|
self.associatedCachedData = mutableView.associatedCachedData
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,13 @@ public func _internal_recentlySearchedPeers(postbox: Postbox) -> Signal<[Recentl
|
|||||||
if let peerView = view.views[.peer(peerId: peerId, components: .all)] as? PeerView {
|
if let peerView = view.views[.peer(peerId: peerId, components: .all)] as? PeerView {
|
||||||
var presence: TelegramUserPresence?
|
var presence: TelegramUserPresence?
|
||||||
var unreadCount = unreadCounts[peerId] ?? 0
|
var unreadCount = unreadCounts[peerId] ?? 0
|
||||||
|
var subpeerSummary: RecentlySearchedPeerSubpeerSummary?
|
||||||
|
|
||||||
|
if let cachedData = peerView.cachedData as? CachedChannelData {
|
||||||
|
let count: Int32 = cachedData.participantsSummary.memberCount ?? 0
|
||||||
|
subpeerSummary = RecentlySearchedPeerSubpeerSummary(count: Int(count))
|
||||||
|
}
|
||||||
|
|
||||||
if let peer = peerView.peers[peerId] {
|
if let peer = peerView.peers[peerId] {
|
||||||
if peer is TelegramSecretChat, let associatedPeerId = peer.associatedPeerId {
|
if peer is TelegramSecretChat, let associatedPeerId = peer.associatedPeerId {
|
||||||
presence = peerView.peerPresences[associatedPeerId] as? TelegramUserPresence
|
presence = peerView.peerPresences[associatedPeerId] as? TelegramUserPresence
|
||||||
@ -91,6 +98,15 @@ public func _internal_recentlySearchedPeers(postbox: Postbox) -> Signal<[Recentl
|
|||||||
} else {
|
} else {
|
||||||
unreadCount = 0
|
unreadCount = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if channel.isMonoForum, let linkedMonoforumId = channel.linkedMonoforumId {
|
||||||
|
subpeerSummary = nil
|
||||||
|
|
||||||
|
if let cachedData = peerView.associatedCachedData[linkedMonoforumId] as? CachedChannelData {
|
||||||
|
let count: Int32 = cachedData.participantsSummary.memberCount ?? 0
|
||||||
|
subpeerSummary = RecentlySearchedPeerSubpeerSummary(count: Int(count))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let group = peer as? TelegramGroup, let migrationReference = group.migrationReference {
|
if let group = peer as? TelegramGroup, let migrationReference = group.migrationReference {
|
||||||
@ -98,12 +114,6 @@ public func _internal_recentlySearchedPeers(postbox: Postbox) -> Signal<[Recentl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var subpeerSummary: RecentlySearchedPeerSubpeerSummary?
|
|
||||||
if let cachedData = peerView.cachedData as? CachedChannelData {
|
|
||||||
let count: Int32 = cachedData.participantsSummary.memberCount ?? 0
|
|
||||||
subpeerSummary = RecentlySearchedPeerSubpeerSummary(count: Int(count))
|
|
||||||
}
|
|
||||||
|
|
||||||
result.append(RecentlySearchedPeer(peer: RenderedPeer(peerId: peerId, peers: SimpleDictionary(peerView.peers), associatedMedia: peerView.media), presence: presence, notificationSettings: peerView.notificationSettings as? TelegramPeerNotificationSettings, unreadCount: unreadCount, subpeerSummary: subpeerSummary))
|
result.append(RecentlySearchedPeer(peer: RenderedPeer(peerId: peerId, peers: SimpleDictionary(peerView.peers), associatedMedia: peerView.media), presence: presence, notificationSettings: peerView.notificationSettings as? TelegramPeerNotificationSettings, unreadCount: unreadCount, subpeerSummary: subpeerSummary))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -901,11 +901,10 @@ private final class AdminUserActionsSheetComponent: Component {
|
|||||||
switch component.mode {
|
switch component.mode {
|
||||||
case .monoforum:
|
case .monoforum:
|
||||||
if let peer = component.peers.first {
|
if let peer = component.peers.first {
|
||||||
titleString = "Delete \(EnginePeer(peer.peer).compactDisplayTitle)"
|
titleString = environment.strings.Monoforum_DeleteTopic_Title(EnginePeer(peer.peer).compactDisplayTitle).string
|
||||||
} else {
|
} else {
|
||||||
titleString = environment.strings.Common_Delete
|
titleString = environment.strings.Common_Delete
|
||||||
}
|
}
|
||||||
//TODO:localize
|
|
||||||
case let .chat(messageCount, deleteAllMessageCount, _):
|
case let .chat(messageCount, deleteAllMessageCount, _):
|
||||||
titleString = environment.strings.Chat_AdminActionSheet_DeleteTitle(Int32(messageCount))
|
titleString = environment.strings.Chat_AdminActionSheet_DeleteTitle(Int32(messageCount))
|
||||||
if let deleteAllMessageCount {
|
if let deleteAllMessageCount {
|
||||||
|
@ -516,8 +516,7 @@ public func chatMessageRemovePaymentAlertController(
|
|||||||
|
|
||||||
let text: String
|
let text: String
|
||||||
if let context, chatPeer.id != context.account.peerId {
|
if let context, chatPeer.id != context.account.peerId {
|
||||||
//TODO:localize
|
text = strings.Channel_RemoveFeeAlert_Text(peer.compactDisplayTitle).string
|
||||||
text = "Are you sure you want to allow **\(peer.compactDisplayTitle)** to message your channel for free?"
|
|
||||||
} else {
|
} else {
|
||||||
text = strings.Chat_PaidMessage_RemoveFee_Text(peer.compactDisplayTitle).string
|
text = strings.Chat_PaidMessage_RemoveFee_Text(peer.compactDisplayTitle).string
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ final class ForumModeComponent: Component {
|
|||||||
let size = CGSize(width: availableSize.width, height: 224.0)
|
let size = CGSize(width: availableSize.width, height: 224.0)
|
||||||
|
|
||||||
let sideInset = (size.width - 160.0 * 2.0) / 2.0
|
let sideInset = (size.width - 160.0 * 2.0) / 2.0
|
||||||
//TODO:localize
|
|
||||||
let tabsSize = self.tabs.update(
|
let tabsSize = self.tabs.update(
|
||||||
transition: transition,
|
transition: transition,
|
||||||
component: AnyComponent(
|
component: AnyComponent(
|
||||||
|
@ -130,8 +130,7 @@ public final class StarsBalanceOverlayComponent: Component {
|
|||||||
if component.peerId == component.context.account.peerId {
|
if component.peerId == component.context.account.peerId {
|
||||||
rawString = presentationData.strings.StarsBalance_YourBalance("**⭐️\(balance)**").string
|
rawString = presentationData.strings.StarsBalance_YourBalance("**⭐️\(balance)**").string
|
||||||
} else {
|
} else {
|
||||||
//TODO:localize
|
rawString = presentationData.strings.StarsBalance_ChannelBalance("**⭐️\(balance)**").string
|
||||||
rawString = "Your channel balance is **⭐️\(balance)**"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let attributedText = parseMarkdownIntoAttributedString(
|
let attributedText = parseMarkdownIntoAttributedString(
|
||||||
|
@ -1884,7 +1884,10 @@ extension ChatControllerImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
strongSelf.initialInterfaceState = (interfaceState, initialEditMessage)
|
strongSelf.initialInterfaceState = (interfaceState, initialEditMessage)
|
||||||
|
} else {
|
||||||
|
strongSelf.initialInterfaceState = (ChatInterfaceState(), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let readStateData = combinedInitialData.readStateData {
|
if let readStateData = combinedInitialData.readStateData {
|
||||||
if case let .peer(peerId) = chatLocation, let peerReadStateData = readStateData[peerId], let notificationSettings = peerReadStateData.notificationSettings {
|
if case let .peer(peerId) = chatLocation, let peerReadStateData = readStateData[peerId], let notificationSettings = peerReadStateData.notificationSettings {
|
||||||
|
|
||||||
|
@ -235,13 +235,25 @@ func inputPanelForChatPresentationIntefaceState(_ chatPresentationInterfaceState
|
|||||||
displayInputTextPanel = true
|
displayInputTextPanel = true
|
||||||
} else if chatPresentationInterfaceState.interfaceState.replyMessageSubject == nil {
|
} else if chatPresentationInterfaceState.interfaceState.replyMessageSubject == nil {
|
||||||
displayInputTextPanel = false
|
displayInputTextPanel = false
|
||||||
if let currentPanel = (currentPanel as? ChatRestrictedInputPanelNode) ?? (currentSecondaryPanel as? ChatRestrictedInputPanelNode) {
|
|
||||||
return (currentPanel, nil)
|
if !isMember {
|
||||||
|
if let currentPanel = (currentPanel as? ChatChannelSubscriberInputPanelNode) ?? (currentSecondaryPanel as? ChatChannelSubscriberInputPanelNode) {
|
||||||
|
return (currentPanel, nil)
|
||||||
|
} else {
|
||||||
|
let panel = ChatChannelSubscriberInputPanelNode()
|
||||||
|
panel.interfaceInteraction = interfaceInteraction
|
||||||
|
panel.context = context
|
||||||
|
return (panel, nil)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let panel = ChatRestrictedInputPanelNode()
|
if let currentPanel = (currentPanel as? ChatRestrictedInputPanelNode) ?? (currentSecondaryPanel as? ChatRestrictedInputPanelNode) {
|
||||||
panel.context = context
|
return (currentPanel, nil)
|
||||||
panel.interfaceInteraction = interfaceInteraction
|
} else {
|
||||||
return (panel, nil)
|
let panel = ChatRestrictedInputPanelNode()
|
||||||
|
panel.context = context
|
||||||
|
panel.interfaceInteraction = interfaceInteraction
|
||||||
|
return (panel, nil)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,6 +74,13 @@ func leftNavigationButtonForChatInterfaceState(_ presentationInterfaceState: Cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
func rightNavigationButtonForChatInterfaceState(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, strings: PresentationStrings, currentButton: ChatNavigationButton?, target: Any?, selector: Selector?, chatInfoNavigationButton: ChatNavigationButton?, moreInfoNavigationButton: ChatNavigationButton?) -> ChatNavigationButton? {
|
func rightNavigationButtonForChatInterfaceState(context: AccountContext, presentationInterfaceState: ChatPresentationInterfaceState, strings: PresentationStrings, currentButton: ChatNavigationButton?, target: Any?, selector: Selector?, chatInfoNavigationButton: ChatNavigationButton?, moreInfoNavigationButton: ChatNavigationButton?) -> ChatNavigationButton? {
|
||||||
|
var hasMessages = false
|
||||||
|
if let chatHistoryState = presentationInterfaceState.chatHistoryState {
|
||||||
|
if case .loaded(false, _) = chatHistoryState {
|
||||||
|
hasMessages = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if let _ = presentationInterfaceState.interfaceState.selectionState {
|
if let _ = presentationInterfaceState.interfaceState.selectionState {
|
||||||
if case .messageOptions = presentationInterfaceState.subject {
|
if case .messageOptions = presentationInterfaceState.subject {
|
||||||
return nil
|
return nil
|
||||||
@ -100,12 +107,18 @@ func rightNavigationButtonForChatInterfaceState(context: AccountContext, present
|
|||||||
}
|
}
|
||||||
|
|
||||||
if let channel = presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum, case .peer = presentationInterfaceState.chatLocation {
|
if let channel = presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum, case .peer = presentationInterfaceState.chatLocation {
|
||||||
if case .search(false) = currentButton?.action {
|
let displaySearch = hasMessages
|
||||||
return currentButton
|
|
||||||
|
if displaySearch {
|
||||||
|
if case .search(false) = currentButton?.action {
|
||||||
|
return currentButton
|
||||||
|
} else {
|
||||||
|
let buttonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(presentationInterfaceState.theme), style: .plain, target: target, action: selector)
|
||||||
|
buttonItem.accessibilityLabel = strings.Conversation_Search
|
||||||
|
return ChatNavigationButton(action: .search(hasTags: false), buttonItem: buttonItem)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
let buttonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationCompactSearchIcon(presentationInterfaceState.theme), style: .plain, target: target, action: selector)
|
return nil
|
||||||
buttonItem.accessibilityLabel = strings.Conversation_Search
|
|
||||||
return ChatNavigationButton(action: .search(hasTags: false), buttonItem: buttonItem)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,13 +132,6 @@ func rightNavigationButtonForChatInterfaceState(context: AccountContext, present
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasMessages = false
|
|
||||||
if let chatHistoryState = presentationInterfaceState.chatHistoryState {
|
|
||||||
if case .loaded(false, _) = chatHistoryState {
|
|
||||||
hasMessages = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if case .messageOptions = presentationInterfaceState.subject {
|
if case .messageOptions = presentationInterfaceState.subject {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user