diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index b995a98026..7663325f82 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -6914,5 +6914,12 @@ Sorry for the inconvenience."; "MemberRequests.RequestToJoinSentDescriptionGroup" = "You will be added to the group once it admins approve your request."; "MemberRequests.RequestToJoinSentDescriptionChannel" = "You will be added to the channel once it admins approve your request."; -"Notification.JoinedGroupByRequest" = "Your request to join the group was approved"; -"Notification.JoinedChannelByRequest" = "Your request to join the channel was approved"; +"Notification.JoinedGroupByRequestYou" = "Your request to join the group was approved"; +"Notification.JoinedGroupByRequest" = "%@ was accepted to the group chat"; + +"Notification.JoinedGroupByLinkYou" = "You joined the group via invite link"; + +"InviteLink.InviteLinkForwardTooltip.Chat.One" = "Invite link forwarded to **%@**"; +"InviteLink.InviteLinkForwardTooltip.TwoChats.One" = "Invite link forwarded to **%@** and **%@**"; +"InviteLink.InviteLinkForwardTooltip.ManyChats.One" = "Invite link forwarded to **%@** and %@ others"; +"InviteLink.InviteLinkForwardTooltip.SavedMessages.One" = "Invite link forwarded to **Saved Messages**"; diff --git a/submodules/DatePickerNode/Sources/DatePickerNode.swift b/submodules/DatePickerNode/Sources/DatePickerNode.swift index 6e9a596c78..49c79ab0d9 100644 --- a/submodules/DatePickerNode/Sources/DatePickerNode.swift +++ b/submodules/DatePickerNode/Sources/DatePickerNode.swift @@ -1119,8 +1119,10 @@ private final class TimePickerNode: ASDisplayNode { self.date = date self.selection = .none + let backgroundColor = theme.backgroundColor.mixedWith(theme.segmentedControlTheme.backgroundColor.withAlphaComponent(1.0), alpha: theme.segmentedControlTheme.backgroundColor.alpha) + self.backgroundNode = ASDisplayNode() - self.backgroundNode.backgroundColor = theme.segmentedControlTheme.backgroundColor + self.backgroundNode.backgroundColor = backgroundColor self.backgroundNode.cornerRadius = 9.0 self.borderNode = ASDisplayNode() @@ -1144,14 +1146,14 @@ private final class TimePickerNode: ASDisplayNode { self.inputNode = TimeInputNode() self.hoursTopMaskNode = ASDisplayNode() - self.hoursTopMaskNode.backgroundColor = theme.segmentedControlTheme.backgroundColor + self.hoursTopMaskNode.backgroundColor = backgroundColor self.hoursBottomMaskNode = ASDisplayNode() - self.hoursBottomMaskNode.backgroundColor = theme.segmentedControlTheme.backgroundColor + self.hoursBottomMaskNode.backgroundColor = backgroundColor self.minutesTopMaskNode = ASDisplayNode() - self.minutesTopMaskNode.backgroundColor = theme.segmentedControlTheme.backgroundColor + self.minutesTopMaskNode.backgroundColor = backgroundColor self.minutesBottomMaskNode = ASDisplayNode() - self.minutesBottomMaskNode.backgroundColor = theme.segmentedControlTheme.backgroundColor + self.minutesBottomMaskNode.backgroundColor = backgroundColor let isPM: Bool if let date = date { @@ -1225,10 +1227,12 @@ private final class TimePickerNode: ASDisplayNode { return "\(i)" } case .regular: - if i < 10 { + if i == 0 { + return "12" + } else if i < 10 { return "0\(i)" } else { - return "\(1 + i)" + return "\(i)" } } } @@ -1633,7 +1637,7 @@ private final class TimePickerNode: ASDisplayNode { } else if hours > 12 { h12Hours = hours - 12 } - self.hoursNode.selectRow(Int(h12Hours - 1), animated: false) + self.hoursNode.selectRow(Int(h12Hours), animated: false) self.minutesNode.selectRow(Int(minutes), animated: false) } } diff --git a/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift b/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift index c96d8e411e..fa3825f861 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkInviteController.swift @@ -4,6 +4,7 @@ import SwiftSignalKit import TelegramPresentationData import AppBundle import AsyncDisplayKit +import Postbox import TelegramCore import Display import AccountContext @@ -432,6 +433,46 @@ public final class InviteLinkInviteController: ViewController { } let updatedPresentationData = (strongSelf.presentationData, strongSelf.presentationDataPromise.get()) let shareController = ShareController(context: context, subject: .url(invite.link), updatedPresentationData: updatedPresentationData) + shareController.completed = { [weak self] peerIds in + if let strongSelf = self { + let _ = (strongSelf.context.account.postbox.transaction { transaction -> [Peer] in + var peers: [Peer] = [] + for peerId in peerIds { + if let peer = transaction.getPeer(peerId) { + peers.append(peer) + } + } + return peers + } |> deliverOnMainQueue).start(next: { [weak self] peers in + if let strongSelf = self { + let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } + + let text: String + var savedMessages = false + if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId { + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_SavedMessages_One + savedMessages = true + } else { + if peers.count == 1, let peer = peers.first { + let peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_Chat_One(peerName).string + } else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last { + let firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + let secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string + } else if let peer = peers.first { + let peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string + } else { + text = "" + } + } + + strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .window(.root)) + } + }) + } + } shareController.actionCompleted = { [weak self] in if let strongSelf = self { let presentationData = context.sharedContext.currentPresentationData.with { $0 } diff --git a/submodules/InviteLinksUI/Sources/InviteLinkListController.swift b/submodules/InviteLinksUI/Sources/InviteLinkListController.swift index d67da60464..b408548374 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkListController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkListController.swift @@ -3,6 +3,7 @@ import UIKit import AsyncDisplayKit import Display import SwiftSignalKit +import Postbox import TelegramCore import TelegramPresentationData import TelegramUIPreferences @@ -426,6 +427,42 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio let arguments = InviteLinkListControllerArguments(context: context, shareMainLink: { invite in let shareController = ShareController(context: context, subject: .url(invite.link), updatedPresentationData: updatedPresentationData) + shareController.completed = { peerIds in + let _ = (context.account.postbox.transaction { transaction -> [Peer] in + var peers: [Peer] = [] + for peerId in peerIds { + if let peer = transaction.getPeer(peerId) { + peers.append(peer) + } + } + return peers + } |> deliverOnMainQueue).start(next: { peers in + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + + let text: String + var savedMessages = false + if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId { + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_SavedMessages_One + savedMessages = true + } else { + if peers.count == 1, let peer = peers.first { + let peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_Chat_One(peerName).string + } else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last { + let firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + let secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string + } else if let peer = peers.first { + let peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string + } else { + text = "" + } + } + + presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), nil) + }) + } shareController.actionCompleted = { let presentationData = context.sharedContext.currentPresentationData.with { $0 } presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) @@ -591,6 +628,42 @@ public func inviteLinkListController(context: AccountContext, updatedPresentatio f(.default) let shareController = ShareController(context: context, subject: .url(invite.link), updatedPresentationData: updatedPresentationData) + shareController.completed = { peerIds in + let _ = (context.account.postbox.transaction { transaction -> [Peer] in + var peers: [Peer] = [] + for peerId in peerIds { + if let peer = transaction.getPeer(peerId) { + peers.append(peer) + } + } + return peers + } |> deliverOnMainQueue).start(next: { peers in + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + + let text: String + var savedMessages = false + if peerIds.count == 1, let peerId = peerIds.first, peerId == context.account.peerId { + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_SavedMessages_One + savedMessages = true + } else { + if peers.count == 1, let peer = peers.first { + let peerName = peer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_Chat_One(peerName).string + } else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last { + let firstPeerName = firstPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + let secondPeerName = secondPeer.id == context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string + } else if let peer = peers.first { + let peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string + } else { + text = "" + } + } + + presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), nil) + }) + } shareController.actionCompleted = { let presentationData = context.sharedContext.currentPresentationData.with { $0 } presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) diff --git a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift index 488637cacb..6eced106c6 100644 --- a/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift +++ b/submodules/InviteLinksUI/Sources/InviteLinkViewController.swift @@ -4,6 +4,7 @@ import SwiftSignalKit import TelegramPresentationData import AppBundle import AsyncDisplayKit +import Postbox import TelegramCore import Display import AccountContext @@ -446,6 +447,46 @@ public final class InviteLinkViewController: ViewController { self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root)) }, shareLink: { [weak self] invite in let shareController = ShareController(context: context, subject: .url(invite.link)) + shareController.completed = { [weak self] peerIds in + if let strongSelf = self { + let _ = (strongSelf.context.account.postbox.transaction { transaction -> [Peer] in + var peers: [Peer] = [] + for peerId in peerIds { + if let peer = transaction.getPeer(peerId) { + peers.append(peer) + } + } + return peers + } |> deliverOnMainQueue).start(next: { [weak self] peers in + if let strongSelf = self { + let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 } + + let text: String + var savedMessages = false + if peerIds.count == 1, let peerId = peerIds.first, peerId == strongSelf.context.account.peerId { + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_SavedMessages_One + savedMessages = true + } else { + if peers.count == 1, let peer = peers.first { + let peerName = peer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_Chat_One(peerName).string + } else if peers.count == 2, let firstPeer = peers.first, let secondPeer = peers.last { + let firstPeerName = firstPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(firstPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + let secondPeerName = secondPeer.id == strongSelf.context.account.peerId ? presentationData.strings.DialogList_SavedMessages : EnginePeer(secondPeer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_TwoChats_One(firstPeerName, secondPeerName).string + } else if let peer = peers.first { + let peerName = EnginePeer(peer).displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder) + text = presentationData.strings.InviteLink_InviteLinkForwardTooltip_ManyChats_One(peerName, "\(peers.count - 1)").string + } else { + text = "" + } + } + + strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .forward(savedMessages: savedMessages, text: text), elevatedLayout: false, animateInAsReplacement: true, action: { _ in return false }), in: .window(.root)) + } + }) + } + } shareController.actionCompleted = { [weak self] in let presentationData = context.sharedContext.currentPresentationData.with { $0 } self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root)) diff --git a/submodules/InviteLinksUI/Sources/InviteRequestsController.swift b/submodules/InviteLinksUI/Sources/InviteRequestsController.swift index e8c5b16980..f6827a8dbe 100644 --- a/submodules/InviteLinksUI/Sources/InviteRequestsController.swift +++ b/submodules/InviteLinksUI/Sources/InviteRequestsController.swift @@ -176,8 +176,22 @@ public func inviteRequestsController(context: AccountContext, updatedPresentatio }, approveRequest: { peer in importersContext.update(peer.id, action: .approve) - let presentationData = context.sharedContext.currentPresentationData.with { $0 } - presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .invitedToVoiceChat(context: context, peer: peer, text: presentationData.strings.MemberRequests_UserAddedToChannel(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) + let _ = (context.engine.data.get( + TelegramEngine.EngineData.Item.Peer.Peer(id: peerId) + ) + |> deliverOnMainQueue).start(next: { peer in + guard let peer = peer else { + return + } + let presentationData = context.sharedContext.currentPresentationData.with { $0 } + let string: String + if case let .channel(channel) = peer, case .broadcast = channel.info { + string = presentationData.strings.MemberRequests_UserAddedToChannel(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string + } else { + string = presentationData.strings.MemberRequests_UserAddedToGroup(peer.displayTitle(strings: presentationData.strings, displayOrder: presentationData.nameDisplayOrder)).string + } + presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .invitedToVoiceChat(context: context, peer: peer, text: string), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil) + }) }, denyRequest: { peer in importersContext.update(peer.id, action: .deny) }, peerContextAction: { peer, node, gesture in diff --git a/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewController.swift b/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewController.swift index d151d46ff7..c6dadf4a31 100644 --- a/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewController.swift +++ b/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewController.swift @@ -158,7 +158,11 @@ public final class JoinLinkPreviewController: ViewController { case .tooMuchUsers: strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.Conversation_UsersTooMuchError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root)) case .requestSent: - break + if strongSelf.isRequest { + strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .info(text: strongSelf.isGroup ? strongSelf.presentationData.strings.MemberRequests_RequestToJoinSentDescriptionGroup : strongSelf.presentationData.strings.MemberRequests_RequestToJoinSentDescriptionChannel ), elevatedLayout: true, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root)) + } + case .flood: + strongSelf.present(textAlertController(context: strongSelf.context, title: nil, text: strongSelf.presentationData.strings.TwoStepAuth_FloodError, actions: [TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: {})]), in: .window(.root)) case .generic: break } diff --git a/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewControllerNode.swift b/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewControllerNode.swift index a2e544bceb..197f9bfa32 100644 --- a/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewControllerNode.swift +++ b/submodules/JoinLinkPreviewUI/Sources/JoinLinkPreviewControllerNode.swift @@ -273,7 +273,7 @@ final class JoinLinkPreviewControllerNode: ViewControllerTracingNode, UIScrollVi transition.updateFrame(node: self.contentBackgroundNode, frame: CGRect(origin: CGPoint(), size: backgroundFrame.size)) let cancelSize = CGSize(width: 44.0, height: 44.0) - let cancelFrame = CGRect(origin: CGPoint(x: backgroundFrame.width - cancelSize.width - 3.0, y: backgroundFrame.minY + 6.0), size: cancelSize) + let cancelFrame = CGRect(origin: CGPoint(x: backgroundFrame.maxX - cancelSize.width - 3.0, y: backgroundFrame.minY + 6.0), size: cancelSize) transition.updateFrame(node: self.cancelButton, frame: cancelFrame) if let animateContentNodeOffsetFromBackgroundOffset = self.animateContentNodeOffsetFromBackgroundOffset { @@ -337,8 +337,8 @@ final class JoinLinkPreviewControllerNode: ViewControllerTracingNode, UIScrollVi let offset = self.bounds.size.height - self.contentBackgroundNode.frame.minY let dimPosition = self.dimNode.layer.position - self.dimNode.layer.animatePosition(from: dimPosition, to: CGPoint(x: dimPosition.x, y: dimPosition.y - offset), duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false) - self.layer.animateBoundsOriginYAdditive(from: 0.0, to: -offset, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring, removeOnCompletion: false, completion: { _ in + self.dimNode.layer.animatePosition(from: dimPosition, to: CGPoint(x: dimPosition.x, y: dimPosition.y - offset), duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false) + self.layer.animateBoundsOriginYAdditive(from: 0.0, to: -offset, duration: 0.3, timingFunction: CAMediaTimingFunctionName.easeInEaseOut.rawValue, removeOnCompletion: false, completion: { _ in offsetCompleted = true internalCompletion() }) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift index 4b8dd9984f..6001129a9b 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift @@ -9,6 +9,7 @@ public enum JoinLinkError { case tooMuchJoined case tooMuchUsers case requestSent + case flood } func apiUpdatesGroups(_ updates: Api.Updates) -> [Api.Chat] { @@ -38,7 +39,7 @@ public enum ExternalJoiningChatState { } func _internal_joinChatInteractively(with hash: String, account: Account) -> Signal { - return account.network.request(Api.functions.messages.importChatInvite(hash: hash)) + return account.network.request(Api.functions.messages.importChatInvite(hash: hash), automaticFloodWait: false) |> mapError { error -> JoinLinkError in switch error.errorDescription { case "CHANNELS_TOO_MUCH": @@ -48,7 +49,11 @@ func _internal_joinChatInteractively(with hash: String, account: Account) -> Sig case "INVITE_REQUEST_SENT": return .requestSent default: - return .generic + if error.description.hasPrefix("FLOOD_WAIT") { + return .flood + } else { + return .generic + } } } |> mapToSignal { updates -> Signal in diff --git a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift index c15f022315..40819ded3c 100644 --- a/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift +++ b/submodules/TelegramPresentationData/Sources/DefaultDayPresentationTheme.swift @@ -764,7 +764,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio inputBorderColor: UIColor(rgb: 0xe4e4e6), inputPlaceholderColor: UIColor(rgb: 0x8e8d92), inputTextColor: UIColor(rgb: 0x000000), - inputClearButtonColor: UIColor(rgb: 0xbcbcc0), + inputClearButtonColor: UIColor(rgb: 0x9e9ea1), checkContentColor: UIColor(rgb: 0xffffff) ) diff --git a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift index 2ca54b5883..63201b4144 100644 --- a/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift +++ b/submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift @@ -256,9 +256,19 @@ public func universalServiceMessageString(presentationData: (PresentationTheme, attributedString = addAttributesToStringWithRanges(strings.Message_PinnedGenericMessage(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])) } case .joinedByLink: - attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])) + if message.author?.id == accountPeerId { + attributedString = NSAttributedString(string: strings.Notification_JoinedGroupByLinkYou, font: titleFont, textColor: primaryTextColor) + } else { + attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByLink(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, message.author?.id)])) + } case .joinedByRequest: - attributedString = NSAttributedString(string: isChannel ? strings.Notification_JoinedChannelByRequest : strings.Notification_JoinedGroupByRequest, font: titleFont, textColor: primaryTextColor) + if message.author?.id == accountPeerId { + attributedString = NSAttributedString(string: strings.Notification_JoinedGroupByRequestYou, font: titleFont, textColor: primaryTextColor) + } else if let peerId = message.author?.id { + attributedString = addAttributesToStringWithRanges(strings.Notification_JoinedGroupByRequest(authorName)._tuple, body: bodyAttributes, argumentAttributes: peerMentionsAttributes(primaryTextColor: primaryTextColor, peerIds: [(0, peerId)])) + } else { + attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor) + } case .channelMigratedFromGroup, .groupMigratedToChannel: attributedString = NSAttributedString(string: "", font: titleFont, textColor: primaryTextColor) case let .messageAutoremoveTimeoutUpdated(timeout):