Skip to content

Commit 82abccf

Browse files
committed
Merge remote-tracking branch 'origin/master' into beta
2 parents 84e87a9 + 0b6dcd3 commit 82abccf

26 files changed

Lines changed: 484 additions & 130 deletions

File tree

‎Telegram/Telegram-iOS/en.lproj/Localizable.strings‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5303,6 +5303,8 @@ Sorry for the inconvenience.";
53035303

53045304
"PeerInfo.BioExpand" = "more";
53055305
"PeerInfo.HiddenCommunityStatus" = "Hidden • %@";
5306+
"PeerInfo.Community_1" = "Community with %@ chat";
5307+
"PeerInfo.Community_any" = "Community with %@ chats";
53065308
"PeerInfo.Community.RemoveBot" = "Remove Bot from Community";
53075309
"PeerInfo.Community.AddBot" = "Add Bot to a Community";
53085310
"PeerInfo.Community.BotInfo" = "Make your bot part of a community with multiple related chats";
@@ -16430,6 +16432,7 @@ Error: %8$@";
1643016432
"Community.View.SectionVisible" = "CHATS YOU CAN VIEW";
1643116433
"Community.View.SectionRequestable" = "CHATS YOU CAN REQUEST TO JOIN";
1643216434
"Community.View.SectionHidden" = "HIDDEN CHATS";
16435+
"Community.View.HiddenChatToast" = "You can't join or view this chat until an admin invites you.";
1643316436
"Community.View.PendingRequests" = "Pending Requests";
1643416437
"Community.View.PendingRequestHeader" = "PENDING REQUEST";
1643516438
"Community.View.ShowAsOneChat" = "Show as One Chat";
@@ -16440,6 +16443,8 @@ Error: %8$@";
1644016443
"Community.View.ChatsLimitReached" = "Sorry, this community has reached the maximum number of chats.";
1644116444
"Community.Request.UnknownRequester" = "Someone";
1644216445
"Community.Request.RequesterSuggestsGroup" = "%@ suggests this group:";
16446+
"Community.Request.RequesterSuggestsChannel" = "%@ suggests this channel:";
16447+
"Community.Request.RequesterSuggestsBot" = "%@ suggests this bot:";
1644316448
"Community.Request.PrivateStatus" = "visible only to its members";
1644416449
"Community.Request.Decline" = "Decline";
1644516450
"Community.Request.Add" = "Add";
@@ -16514,13 +16519,23 @@ Error: %8$@";
1651416519
"Community.Add.VisibilityHiddenInfo" = "Only invited members and community admins will see this chat.";
1651516520
"Community.Add.ActionAddToCommunity" = "Add to Community";
1651616521

16522+
"Community.Add.Confirm.TextGroup" = "If this group is approved by a community admin, its members will be able to join or request to join other chats in the community.";
16523+
"Community.Add.Confirm.TextChannel" = "If this channel is approved by a community admin, its subscribers will be able to join or request to join other chats in the community.";
16524+
"Community.Add.Confirm.TextBot" = "If this bot is approved by a community admin, community members will be able to see and use it.";
16525+
"Community.Add.Confirm.Add" = "Add";
16526+
16527+
"Community.AddChat.Title" = "Add a Chat";
16528+
"Community.AddChat.Description" = "Select a chat to add to this community";
16529+
1651716530
"Community.Chat.JoinToView" = "You need to join this group to view its messages.";
1651816531
"Community.PrivateChat.Info" = "This group is invite-only.\nOnly its members can view it.";
1651916532
"Community.PrivateChat.MessageOwner" = "Message Group Owner";
16533+
"Community.CommunityAdded.View" = "View";
1652016534

1652116535
"Privacy.GroupsAndChannels.InviteToCommunityError" = "Sorry, you cannot add %@ to the community because of %@'s privacy settings.";
1652216536

1652316537
"Notification.CommunityAddedGroup" = "%1$@ added this group to %2$@ community";
16538+
"Notification.CommunityAddedGroupUnknown" = "This group was added to %1$@ community";
1652416539
"Notification.CommunityAddedGroupYou" = "You added this group to %1$@ community";
1652516540
"Notification.CommunityRemovedGroup" = "%1$@ removed this group from a community";
1652616541
"Notification.CommunityRemovedGroupYou" = "You removed this group from a community";
@@ -16543,6 +16558,15 @@ Error: %8$@";
1654316558

1654416559
"Attachment.Article" = "Article";
1654516560
"RichText.AddMediaTitle" = "Add Media";
16561+
"RichText.RemoveFormattingTitle" = "Remove Formatting?";
16562+
"RichText.RemoveFormattingText" = "This message includes rich formatting, which requires Telegram Premium.";
16563+
"RichText.SubscribeToPremium" = "Subscribe to Premium";
16564+
"RichText.SendWithoutFormatting" = "Send Without Formatting";
16565+
"RichText.LinkTitle" = "Link";
16566+
"RichText.LinkText" = "Set a URL for the selected text";
16567+
"RichText.LinkSet" = "Set";
16568+
"RichText.LinkRemove" = "Remove";
16569+
"RichText.PremiumToastText" = "Sending a message with this formatting will require [Telegram Premium]().";
1654616570
"RichText.TableMenu.Alignment" = "Alignment";
1654716571
"RichText.FormulaAdd" = "Add Formula";
1654816572
"RichText.FormulaEdit" = "Edit Formula";

‎submodules/AccountContext/Sources/AccountContext.swift‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,7 @@ public protocol SharedAccountContext: AnyObject {
14401440
func makeProxySettingsController(context: AccountContext) -> ViewController
14411441
func makeLocalizationListController(context: AccountContext) -> ViewController
14421442
func makeCreateGroupController(context: AccountContext, peerIds: [EnginePeer.Id], initialTitle: String?, mode: CreateGroupMode, completion: ((EnginePeer.Id, @escaping () -> Void) -> Void)?) -> ViewController
1443+
func makeCreateChannelController(context: AccountContext, completion: @escaping (EnginePeer.Id, @escaping () -> Void) -> Void) -> ViewController
14431444
func makeChatRecentActionsController(context: AccountContext, peer: EnginePeer, adminPeerId: EnginePeer.Id?, starsState: StarsRevenueStats?) -> ViewController
14441445
func makePrivacyAndSecurityController(context: AccountContext) -> ViewController
14451446
func makeBioPrivacyController(context: AccountContext, settings: Promise<AccountPrivacySettings?>, present: @escaping (ViewController) -> Void)
@@ -1584,7 +1585,8 @@ public protocol SharedAccountContext: AnyObject {
15841585
func makeAccountFreezeInfoScreen(context: AccountContext) -> ViewController
15851586
func makeSendInviteLinkScreen(context: AccountContext, subject: SendInviteLinkScreenSubject, peers: [TelegramForbiddenInvitePeer], theme: PresentationTheme?) -> ViewController
15861587
func makeCommunitiesScreen(context: AccountContext, peerId: EnginePeer.Id?) -> ViewController
1587-
func makeCommunityAddScreen(context: AccountContext, communityId: EnginePeer.Id, peerId: EnginePeer.Id, completed: @escaping () -> Void) -> ViewController
1588+
func makeCommunityAddScreen(context: AccountContext, communityId: EnginePeer.Id, peerId: EnginePeer.Id, completed: @escaping (Bool) -> Void) -> ViewController
1589+
func makeCommunityAddScreen(context: AccountContext, communityId: EnginePeer.Id, peerId: EnginePeer.Id, requiresConfirmation: Bool, completed: @escaping (Bool) -> Void) -> ViewController
15881590
func makeCommunityAddScreen(context: AccountContext, peerId: EnginePeer.Id, initialVisibility: Bool, completed: @escaping (Bool) -> Void) -> ViewController
15891591
func makeCommunityEditScreen(context: AccountContext, communityId: EnginePeer.Id) -> ViewController
15901592
func makeCommunityEditScreen(context: AccountContext, mode: CommunityEditScreenMode, completed: @escaping () -> Void) -> ViewController

‎submodules/AttachmentUI/Sources/AttachmentPanel.swift‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,11 +2525,12 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
25252525
self.updateViews(transition: .immediate)
25262526

25272527
let glassPanelHeight: CGFloat = 62.0
2528+
let shouldCollapseTabRow = buttons.count == 1 || hideButtons
25282529
var bounds = CGRect(origin: CGPoint(), size: CGSize(width: layout.size.width, height: topAccessoryHeight + self.buttonSize.height + insets.bottom))
25292530
// With a single tab the button chips are removed entirely (see updateViews), so the button row is
2530-
// dead space: collapse it. When there's a media-accessory panel the bar shrinks to just that panel;
2531-
// with no accessory (topAccessoryHeight == 0) the whole panel collapses to zero.
2532-
if buttons.count == 1 || hideButtons {
2531+
// dead space. Keep its layout height while an action button is visible, since the action button uses
2532+
// that space even though the tab row itself remains hidden.
2533+
if shouldCollapseTabRow && !isAnyButtonVisible {
25332534
bounds.size.height -= self.buttonSize.height
25342535
}
25352536
var mediaAccessoryPanelFrame: CGRect?
@@ -2577,7 +2578,7 @@ final class AttachmentPanel: ASDisplayNode, ASScrollViewDelegate, ASGestureRecog
25772578

25782579
let basePanelHeight = isSelecting ? max(0.0, visualTextPanelHeight - 11.0) : glassPanelHeight
25792580
var panelSize = CGSize(width: isSelecting ? textPanelWidth : buttonsPanelWidth, height: basePanelHeight + topAccessoryHeight)
2580-
if !isSelecting && (buttons.count == 1 || hideButtons) {
2581+
if !isSelecting && shouldCollapseTabRow {
25812582
// Collapse the empty button row to the accessory height (zero when there's no accessory panel),
25822583
// so a single-tab picker doesn't render an empty glass bar.
25832584
panelSize.height = topAccessoryHeight

‎submodules/ChatListUI/Sources/ChatListSearchListPaneNode.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ public enum ChatListSearchEntry: Comparable, Identifiable {
960960
} else if case .apps = key {
961961
headerType = .text(strings.ChatList_Search_SectionApps, AnyHashable("apps"))
962962
} else {
963-
if filter.contains(.onlyGroups) {
963+
if communityId != nil || filter.contains(.onlyGroups) {
964964
headerType = .chats
965965
} else {
966966
if let _ = requestPeerType {

‎submodules/ChatListUI/Sources/Node/ChatListItem.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4217,8 +4217,8 @@ public class ChatListItemNode: ItemListRevealOptionsItemNode {
42174217
strongSelf.communityAvatarShadowNode.image = generateTintedImage(image: shadowImage, color: theme.titleColor.withAlphaComponent(0.9))
42184218

42194219
let aspectRatio = shadowImage.size.width / shadowImage.size.height
4220-
let shadowSize = CGSize(width: floor(avatarFrame.width * aspectRatio * 0.9), height: floor(avatarFrame.width * 0.93))
4221-
transition.updatePosition(node: strongSelf.communityAvatarShadowNode, position: CGPoint(x: avatarFrame.width * 0.5 + avatarScaleOffset - 10.0, y: avatarFrame.height * 0.5))
4220+
let shadowSize = CGSize(width: floor(avatarFrame.width * aspectRatio * 0.84), height: floor(avatarFrame.width * 0.97))
4221+
transition.updatePosition(node: strongSelf.communityAvatarShadowNode, position: CGPoint(x: avatarFrame.width * 0.5 + avatarScaleOffset - 12.0 + UIScreenPixel, y: avatarFrame.height * 0.5))
42224222
transition.updateBounds(node: strongSelf.communityAvatarShadowNode, bounds: CGRect(origin: CGPoint(), size: shadowSize))
42234223
transition.updateTransformScale(node: strongSelf.communityAvatarShadowNode, scale: avatarScale)
42244224
} else {

‎submodules/ItemListAvatarAndNameInfoItem/Sources/ItemListAvatarAndNameItem.swift‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -938,8 +938,13 @@ public class ItemListAvatarAndNameInfoItemNode: ListViewItemNode, ItemListItemNo
938938
strongSelf.addSubnode(strongSelf.inputFirstClearButton!)
939939
}
940940

941-
strongSelf.inputSeparator?.frame = CGRect(origin: CGPoint(x: params.leftInset + 100.0, y: 64.0), size: CGSize(width: params.width - params.leftInset - 100.0 - separatorRightInset, height: separatorHeight))
942-
strongSelf.inputFirstField?.frame = CGRect(origin: CGPoint(x: params.leftInset + 111.0, y: 28.0), size: CGSize(width: params.width - params.leftInset - params.rightInset - 111.0 - 36.0, height: 35.0))
941+
let inputFieldHeight: CGFloat = 35.0
942+
let inputFieldFrame = CGRect(
943+
origin: CGPoint(x: params.leftInset + 111.0, y: floorToScreenPixels((contentSize.height - inputFieldHeight) * 0.5)),
944+
size: CGSize(width: params.width - params.leftInset - params.rightInset - 111.0 - 36.0, height: inputFieldHeight)
945+
)
946+
strongSelf.inputSeparator?.frame = CGRect(origin: CGPoint(x: params.leftInset + 100.0, y: floor(inputFieldFrame.maxY + 1.0)), size: CGSize(width: params.width - params.leftInset - 100.0 - separatorRightInset, height: separatorHeight))
947+
strongSelf.inputFirstField?.frame = inputFieldFrame
943948

944949
if let image = strongSelf.inputFirstClearButton?.image(for: []), let inputFieldFrame = strongSelf.inputFirstField?.frame {
945950
strongSelf.inputFirstClearButton?.frame = CGRect(origin: CGPoint(x: inputFieldFrame.maxX, y: inputFieldFrame.minY + floor((inputFieldFrame.size.height - image.size.height) / 2.0) - 1.0 + UIScreenPixel), size: image.size)

‎submodules/TelegramCore/Sources/TelegramEngine/Messages/SearchMessages.swift‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,10 @@ func _internal_searchMessages(account: Account, location: SearchMessagesLocation
537537
}
538538
|> mapToSignal { (nextRate, lowerBound, inputPeer, inputCommunity) in
539539
var flags = flags
540+
var folderId = folderId
540541
if inputCommunity != nil {
542+
flags = 0
543+
folderId = nil
541544
flags |= (1 << 4)
542545
}
543546
return account.network.request(Api.functions.messages.searchGlobal(flags: flags, folderId: folderId, community: inputCommunity, q: query, filter: filter, minDate: minDate ?? 0, maxDate: maxDate ?? (Int32.max - 1), offsetRate: nextRate, offsetPeer: inputPeer, offsetId: lowerBound?.id.id ?? 0, limit: limit), automaticFloodWait: false)

‎submodules/TelegramCore/Sources/TelegramEngine/Peers/AddressNames.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ func _internal_adminedPublicChannels(account: Account, scope: AdminedPublicChann
591591
if case let .channel(channelData) = chat {
592592
let participantsCount = channelData.participantsCount
593593
subscriberCounts[chat.peerId] = participantsCount.flatMap(Int.init)
594+
} else if case let .chat(chatData) = chat {
595+
subscriberCounts[chat.peerId] = Int(chatData.participantsCount)
594596
}
595597
}
596598
case let .chatsSlice(chatsSliceData):

‎submodules/TelegramStringFormatting/Sources/ServiceMessageStrings.swift‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,12 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
19351935
let stringWithRanges = strings.Notification_CommunityRemovedGroup(peerName)._tuple
19361936
attributedString = NSAttributedString(attributedString: addAttributesToStringWithRanges(stringWithRanges, body: bodyAttributes, argumentAttributes: attributes))
19371937
} else {
1938-
let rawText = strings.Notification_CommunityAddedGroup(peerName, communityName).string
1938+
let rawText: String
1939+
if message.author?.id.namespace != Namespaces.Peer.CloudUser {
1940+
rawText = strings.Notification_CommunityAddedGroupUnknown(communityName).string
1941+
} else {
1942+
rawText = strings.Notification_CommunityAddedGroup(peerName, communityName).string
1943+
}
19391944
attributedString = NSAttributedString(string: rawText, font: titleFont, textColor: primaryTextColor)
19401945
}
19411946
}

‎submodules/TelegramUI/Components/Chat/ChatMessageCommunityChangedBubbleContentNode/Sources/ChatMessageCommunityChangedBubbleContentNode.swift‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,11 @@ public class ChatMessageCommunityChangedBubbleContentNode: ChatMessageBubbleCont
141141
if item.message.author?.id == item.context.account.peerId {
142142
text = item.presentationData.strings.Notification_CommunityAddedGroupYou("**\(community?.title ?? "")**").string
143143
} else {
144-
text = item.presentationData.strings.Notification_CommunityAddedGroup("**\(authorName)**","**\(community?.title ?? "")**").string
144+
if item.message.author?.id.namespace != Namespaces.Peer.CloudUser {
145+
text = item.presentationData.strings.Notification_CommunityAddedGroupUnknown("**\(community?.title ?? "")**").string
146+
} else {
147+
text = item.presentationData.strings.Notification_CommunityAddedGroup("**\(authorName)**", "**\(community?.title ?? "")**").string
148+
}
145149
}
146150
} else {
147151
text = item.presentationData.strings.Notification_CommunityAddedChannel("**\(community?.title ?? "")**").string
@@ -158,7 +162,7 @@ public class ChatMessageCommunityChangedBubbleContentNode: ChatMessageBubbleCont
158162

159163
let (subtitleLayout, subtitleApply) = makeSubtitleLayout(TextNodeLayoutArguments(attributedString: attributedText, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: CGSize(width: width - 32.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
160164

161-
let (buttonTitleLayout, buttonTitleApply) = makeButtonTitleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: "View", font: Font.semibold(15.0), textColor: primaryTextColor, paragraphAlignment: .center), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: width - 32.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
165+
let (buttonTitleLayout, buttonTitleApply) = makeButtonTitleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.presentationData.strings.Community_CommunityAdded_View, font: Font.semibold(15.0), textColor: primaryTextColor, paragraphAlignment: .center), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: width - 32.0, height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets()))
162166

163167
let backgroundSize = CGSize(width: width, height: subtitleLayout.size.height + 165.0)
164168

@@ -183,7 +187,7 @@ public class ChatMessageCommunityChangedBubbleContentNode: ChatMessageBubbleCont
183187

184188
let aspectRatio = shadowImage.size.width / shadowImage.size.height
185189
let shadowSize = CGSize(width: imageSize.width * aspectRatio, height: imageSize.width)
186-
strongSelf.avatarShadowNode.frame = shadowSize.centered(around: avatarFrame.center).offsetBy(dx: -12.0, dy: 0.0)
190+
strongSelf.avatarShadowNode.frame = shadowSize.centered(around: avatarFrame.center).offsetBy(dx: -11.0, dy: 0.0)
187191
} else {
188192
strongSelf.avatarShadowNode.isHidden = true
189193
}

0 commit comments

Comments
 (0)