Skip to content

Commit 27a2f38

Browse files
committed
Merge branch 'master' into gift-resale
# Conflicts: # submodules/TelegramUI/Sources/SharedAccountContext.swift
2 parents 62a3b0d + fc14d83 commit 27a2f38

File tree

62 files changed

+736
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+736
-308
lines changed

.vscode/settings.json

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,79 @@
11
{
22
"sweetpad.build.xcodeWorkspacePath": "Telegram/Telegram.xcodeproj/project.xcworkspace",
33
"lldb.library": "/Applications/Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A/LLDB",
4-
"lldb.launch.expressions": "native"
4+
"lldb.launch.expressions": "native",
5+
"files.associations": {
6+
"__bit_reference": "cpp",
7+
"__hash_table": "cpp",
8+
"__locale": "cpp",
9+
"__node_handle": "cpp",
10+
"__split_buffer": "cpp",
11+
"__threading_support": "cpp",
12+
"__tree": "cpp",
13+
"__verbose_abort": "cpp",
14+
"any": "cpp",
15+
"array": "cpp",
16+
"bitset": "cpp",
17+
"cctype": "cpp",
18+
"cfenv": "cpp",
19+
"charconv": "cpp",
20+
"cinttypes": "cpp",
21+
"clocale": "cpp",
22+
"cmath": "cpp",
23+
"codecvt": "cpp",
24+
"complex": "cpp",
25+
"condition_variable": "cpp",
26+
"csignal": "cpp",
27+
"cstdarg": "cpp",
28+
"cstddef": "cpp",
29+
"cstdint": "cpp",
30+
"cstdio": "cpp",
31+
"cstdlib": "cpp",
32+
"cstring": "cpp",
33+
"ctime": "cpp",
34+
"cwchar": "cpp",
35+
"cwctype": "cpp",
36+
"deque": "cpp",
37+
"execution": "cpp",
38+
"memory": "cpp",
39+
"forward_list": "cpp",
40+
"fstream": "cpp",
41+
"future": "cpp",
42+
"initializer_list": "cpp",
43+
"iomanip": "cpp",
44+
"ios": "cpp",
45+
"iosfwd": "cpp",
46+
"iostream": "cpp",
47+
"istream": "cpp",
48+
"limits": "cpp",
49+
"list": "cpp",
50+
"locale": "cpp",
51+
"map": "cpp",
52+
"mutex": "cpp",
53+
"new": "cpp",
54+
"optional": "cpp",
55+
"ostream": "cpp",
56+
"print": "cpp",
57+
"queue": "cpp",
58+
"ratio": "cpp",
59+
"regex": "cpp",
60+
"scoped_allocator": "cpp",
61+
"set": "cpp",
62+
"span": "cpp",
63+
"sstream": "cpp",
64+
"stack": "cpp",
65+
"stdexcept": "cpp",
66+
"streambuf": "cpp",
67+
"string": "cpp",
68+
"string_view": "cpp",
69+
"tuple": "cpp",
70+
"typeindex": "cpp",
71+
"typeinfo": "cpp",
72+
"unordered_map": "cpp",
73+
"unordered_set": "cpp",
74+
"valarray": "cpp",
75+
"variant": "cpp",
76+
"vector": "cpp",
77+
"algorithm": "cpp"
78+
}
579
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14182,3 +14182,9 @@ Sorry for the inconvenience.";
1418214182
"Call.IncomingGroupCallTitle.Multiple_any" = "{} and %d others";
1418314183

1418414184
"GroupCall.RevokeLinkText" = "Are you sure you want to revoke this link? Once you do, no one will be able to join the call using it.";
14185+
14186+
14187+
"SendInviteLink.TextCallsRestrictedOneUser" = "%@ does not accept calls.";
14188+
"SendInviteLink.TextCallsRestrictedMultipleUsers_1" = "{user_list}, and **%d** more person do not accept calls.";
14189+
"SendInviteLink.TextCallsRestrictedMultipleUsers_any" = "{user_list}, and **%d** more people do not accept calls.";
14190+
"SendInviteLink.TextCallsRestrictedSendInviteLink" = "You can try to send an invite link instead.";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -988,6 +988,11 @@ public enum OldChannelsControllerIntent {
988988
case upgrade
989989
}
990990

991+
public enum SendInviteLinkScreenSubject {
992+
case chat(peer: EnginePeer, link: String?)
993+
case groupCall(link: String)
994+
}
995+
991996
public protocol SharedAccountContext: AnyObject {
992997
var sharedContainerPath: String { get }
993998
var basePath: String { get }
@@ -1206,6 +1211,8 @@ public protocol SharedAccountContext: AnyObject {
12061211

12071212
func makeAccountFreezeInfoScreen(context: AccountContext) -> ViewController
12081213

1214+
func makeSendInviteLinkScreen(context: AccountContext, subject: SendInviteLinkScreenSubject, peers: [TelegramForbiddenInvitePeer], theme: PresentationTheme?) -> ViewController
1215+
12091216
func makeDebugSettingsController(context: AccountContext?) -> ViewController?
12101217

12111218
func openCreateGroupCallUI(context: AccountContext, peerIds: [EnginePeer.Id], parentController: ViewController)

submodules/CallListUI/Sources/CallListController.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -700,10 +700,6 @@ public final class CallListController: TelegramBaseController {
700700
guard case let .conferenceCall(conferenceCall) = action?.action else {
701701
return
702702
}
703-
if conferenceCall.duration != nil {
704-
self.context.sharedContext.openCreateGroupCallUI(context: self.context, peerIds: conferenceCall.otherParticipants, parentController: self)
705-
return
706-
}
707703

708704
if let currentGroupCallController = self.context.sharedContext as? VoiceChatController, case let .group(groupCall) = currentGroupCallController.call, let currentCallId = groupCall.callId, currentCallId == conferenceCall.callId {
709705
self.context.sharedContext.navigateToCurrentCall()

submodules/CallListUI/Sources/CallListControllerNode.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private func mappedInsertEntries(context: AccountContext, presentationData: Item
126126
case let .displayTabInfo(_, text):
127127
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: 0), directionHint: entry.directionHint)
128128
case .openNewCall:
129-
let item = ItemListPeerActionItem(presentationData: presentationData, style: showSettings ? .blocks : .plain, icon: PresentationResourcesRootController.callListCallIcon(presentationData.theme), title: presentationData.strings.CallList_NewCall, hasSeparator: false, sectionId: 1, height: .generic, noInsets: true, editing: false, action: {
129+
let item = ItemListPeerActionItem(presentationData: presentationData, style: showSettings ? .blocks : .plain, icon: PresentationResourcesRootController.callListCallIcon(presentationData.theme), title: presentationData.strings.CallList_NewCall, hasSeparator: false, sectionId: 1, height: .generic, noInsets: !showSettings, editing: false, action: {
130130
nodeInteraction.openNewCall()
131131
})
132132
return ListViewInsertItem(index: entry.index, previousIndex: entry.previousIndex, item: item, directionHint: entry.directionHint)
@@ -150,7 +150,7 @@ private func mappedUpdateEntries(context: AccountContext, presentationData: Item
150150
case let .displayTabInfo(_, text):
151151
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: ItemListTextItem(presentationData: presentationData, text: .plain(text), sectionId: 0), directionHint: entry.directionHint)
152152
case .openNewCall:
153-
let item = ItemListPeerActionItem(presentationData: presentationData, style: showSettings ? .blocks : .plain, icon: PresentationResourcesRootController.callListCallIcon(presentationData.theme), title: presentationData.strings.CallList_NewCall, hasSeparator: false, sectionId: 1, height: .generic, noInsets: true, editing: false, action: {
153+
let item = ItemListPeerActionItem(presentationData: presentationData, style: showSettings ? .blocks : .plain, icon: PresentationResourcesRootController.callListCallIcon(presentationData.theme), title: presentationData.strings.CallList_NewCall, hasSeparator: false, sectionId: 1, height: .generic, noInsets: !showSettings, editing: false, action: {
154154
nodeInteraction.openNewCall()
155155
})
156156
return ListViewUpdateItem(index: entry.index, previousIndex: entry.previousIndex, item: item, directionHint: entry.directionHint)
@@ -525,7 +525,7 @@ final class CallListControllerNode: ASDisplayNode {
525525
|> mapToQueue { (updateAndType, state, groupCalls, showCallsTab, currentGroupCallPeerId) -> Signal<CallListNodeListViewTransition, NoError> in
526526
let (update, type) = updateAndType
527527

528-
let processedView = CallListNodeView(originalView: update.view, filteredEntries: callListNodeEntriesForView(view: update.view, displayOpenNewCall: mode == .tab && type == .all, groupCalls: groupCalls, state: state, showSettings: showSettings, showCallsTab: showCallsTab, isRecentCalls: type == .all, currentGroupCallPeerId: currentGroupCallPeerId), presentationData: state.presentationData)
528+
let processedView = CallListNodeView(originalView: update.view, filteredEntries: callListNodeEntriesForView(view: update.view, displayOpenNewCall: type == .all, groupCalls: groupCalls, state: state, showSettings: showSettings, showCallsTab: showCallsTab, isRecentCalls: type == .all, currentGroupCallPeerId: currentGroupCallPeerId), presentationData: state.presentationData)
529529
let previous = previousView.swap(processedView)
530530
let previousType = previousType.swap(type)
531531

submodules/CallListUI/Sources/CallListNodeEntries.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ enum CallListNodeEntry: Comparable, Identifiable {
4444
case .openNewCall:
4545
switch rhs {
4646
case .displayTab, .displayTabInfo:
47-
return false
48-
default:
4947
return true
48+
default:
49+
return false
5050
}
5151
case let .groupCall(lhsPeerId, lhsTitle):
5252
switch rhs {
5353
case .displayTab, .displayTabInfo, .openNewCall:
54-
return false
54+
return true
5555
case let .groupCall(rhsPeerId, rhsTitle):
5656
if lhsTitle == rhsTitle {
5757
return lhsPeerId < rhsPeerId
@@ -64,7 +64,7 @@ enum CallListNodeEntry: Comparable, Identifiable {
6464
case let .hole(lhsIndex):
6565
switch rhs {
6666
case .displayTab, .displayTabInfo, .groupCall, .openNewCall:
67-
return false
67+
return true
6868
case let .hole(rhsIndex):
6969
return lhsIndex < rhsIndex
7070
case let .message(rhsIndex):
@@ -73,7 +73,7 @@ enum CallListNodeEntry: Comparable, Identifiable {
7373
case let .message(lhsIndex):
7474
switch rhs {
7575
case .displayTab, .displayTabInfo, .groupCall, .openNewCall:
76-
return false
76+
return true
7777
case let .hole(rhsIndex):
7878
return lhsIndex < rhsIndex
7979
case let .message(rhsIndex):

submodules/ChatListUI/Sources/Node/ChatListItemStrings.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -306,10 +306,8 @@ public func chatListItemStrings(strings: PresentationStrings, nameDisplayOrder:
306306

307307
if conferenceCall.flags.contains(.isMissed) {
308308
messageText = strings.Chat_CallMessage_DeclinedGroupCall
309-
} else if message.timestamp < currentTime - missedTimeout {
309+
} else if conferenceCall.duration == nil && message.timestamp < currentTime - missedTimeout {
310310
messageText = strings.Chat_CallMessage_MissedGroupCall
311-
} else if conferenceCall.duration != nil {
312-
messageText = strings.Chat_CallMessage_CancelledGroupCall
313311
} else {
314312
if incoming {
315313
messageText = strings.Chat_CallMessage_IncomingGroupCall

submodules/PeerInfoUI/Sources/ChannelAdminController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,7 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
12471247
}
12481248

12491249
if let adminPeer, case let .restricted(forbiddenPeer) = error {
1250-
let inviteScreen = SendInviteLinkScreen(context: context, peer: channelPeer, link: exportedInvitation?.link, peers: [forbiddenPeer ?? TelegramForbiddenInvitePeer(peer: adminPeer, canInviteWithPremium: false, premiumRequiredToContact: false)])
1250+
let inviteScreen = SendInviteLinkScreen(context: context, subject: .chat(peer: channelPeer, link: exportedInvitation?.link), peers: [forbiddenPeer ?? TelegramForbiddenInvitePeer(peer: adminPeer, canInviteWithPremium: false, premiumRequiredToContact: false)])
12511251
pushControllerImpl?(inviteScreen)
12521252

12531253
dismissImpl?()
@@ -1437,7 +1437,7 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
14371437
updateRightsDisposable.set((context.peerChannelMemberCategoriesContextsManager.updateMemberAdminRights(engine: context.engine, peerId: peerId, memberId: adminId, adminRights: TelegramChatAdminRights(rights: updateFlags), rank: updateRank) |> deliverOnMainQueue).start(error: { error in
14381438
if case let .addMemberError(addMemberError) = error, case let .restricted(forbiddenPeer) = addMemberError, let admin = adminPeer {
14391439
if let channelPeer {
1440-
let inviteScreen = SendInviteLinkScreen(context: context, peer: channelPeer, link: exportedInvitation?.link, peers: [forbiddenPeer ?? TelegramForbiddenInvitePeer(peer: admin, canInviteWithPremium: false, premiumRequiredToContact: false)])
1440+
let inviteScreen = SendInviteLinkScreen(context: context, subject: .chat(peer: channelPeer, link: exportedInvitation?.link), peers: [forbiddenPeer ?? TelegramForbiddenInvitePeer(peer: admin, canInviteWithPremium: false, premiumRequiredToContact: false)])
14411441
pushControllerImpl?(inviteScreen)
14421442

14431443
dismissImpl?()
@@ -1519,7 +1519,7 @@ public func channelAdminController(context: AccountContext, updatedPresentationD
15191519
)
15201520
|> deliverOnMainQueue).startStandalone(next: { exportedInvitation in
15211521
let _ = exportedInvitation
1522-
let inviteScreen = SendInviteLinkScreen(context: context, peer: .legacyGroup(group), link: exportedInvitation?.link, peers: [failedPeer])
1522+
let inviteScreen = SendInviteLinkScreen(context: context, subject: .chat(peer: .legacyGroup(group), link: exportedInvitation?.link), peers: [failedPeer])
15231523
pushControllerImpl?(inviteScreen)
15241524
})
15251525
} else {

submodules/PeerInfoUI/Sources/ChannelMembersController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ public func channelMembersController(context: AccountContext, updatedPresentatio
560560
if !failedPeers.isEmpty, let contactsController, let navigationController = contactsController.navigationController as? NavigationController {
561561
var viewControllers = navigationController.viewControllers
562562
if let index = viewControllers.firstIndex(where: { $0 === contactsController }) {
563-
let inviteScreen = SendInviteLinkScreen(context: context, peer: chatPeer, link: exportedInvitation?.link, peers: failedPeers)
563+
let inviteScreen = SendInviteLinkScreen(context: context, subject: .chat(peer: chatPeer, link: exportedInvitation?.link), peers: failedPeers)
564564
viewControllers.remove(at: index)
565565
viewControllers.append(inviteScreen)
566566
navigationController.setViewControllers(viewControllers, animated: true)

submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ private final class ConferenceCallE2EContextStateImpl: ConferenceCallE2EContextS
356356
return self.call.takeOutgoingBroadcastBlocks()
357357
}
358358

359-
func encrypt(message: Data, channelId: Int32) -> Data? {
360-
return self.call.encrypt(message, channelId: channelId)
359+
func encrypt(message: Data, channelId: Int32, plaintextPrefixLength: Int) -> Data? {
360+
return self.call.encrypt(message, channelId: channelId, plaintextPrefixLength: plaintextPrefixLength)
361361
}
362362

363363
func decrypt(message: Data, userId: Int64) -> Data? {
@@ -374,9 +374,9 @@ class OngoingGroupCallEncryptionContextImpl: OngoingGroupCallEncryptionContext {
374374
self.channelId = channelId
375375
}
376376

377-
func encrypt(message: Data) -> Data? {
377+
func encrypt(message: Data, plaintextPrefixLength: Int) -> Data? {
378378
let channelId = self.channelId
379-
return self.e2eCall.with({ $0.state?.encrypt(message: message, channelId: channelId) })
379+
return self.e2eCall.with({ $0.state?.encrypt(message: message, channelId: channelId, plaintextPrefixLength: plaintextPrefixLength) })
380380
}
381381

382382
func decrypt(message: Data, userId: Int64) -> Data? {
@@ -3620,14 +3620,24 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
36203620
let presentationData = self.accountContext.sharedContext.currentPresentationData.with({ $0 }).withUpdated(theme: defaultDarkColorPresentationTheme)
36213621

36223622
var errorText = presentationData.strings.Login_UnknownError
3623+
36233624
switch error {
36243625
case let .privacy(peer):
36253626
if let peer {
3626-
errorText = presentationData.strings.Call_PrivacyErrorMessage(peer.compactDisplayTitle).string
3627+
if let currentInviteLinks = self.currentInviteLinks {
3628+
let inviteLinkScreen = self.accountContext.sharedContext.makeSendInviteLinkScreen(context: self.accountContext, subject: .groupCall(link: currentInviteLinks.listenerLink), peers: [TelegramForbiddenInvitePeer(peer: peer, canInviteWithPremium: false, premiumRequiredToContact: false)], theme: defaultDarkColorPresentationTheme)
3629+
if let navigationController = self.accountContext.sharedContext.mainWindow?.viewController as? NavigationController {
3630+
navigationController.pushViewController(inviteLinkScreen)
3631+
}
3632+
return
3633+
} else {
3634+
errorText = presentationData.strings.Call_PrivacyErrorMessage(peer.compactDisplayTitle).string
3635+
}
36273636
}
36283637
default:
36293638
break
36303639
}
3640+
36313641
self.accountContext.sharedContext.mainWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: errorText, actions: [
36323642
TextAlertAction(type: .genericAction, title: presentationData.strings.Common_OK, action: {})
36333643
]), on: .root, blockInteraction: false, completion: {})
@@ -3752,6 +3762,8 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
37523762
}
37533763
}
37543764

3765+
public var currentInviteLinks: GroupCallInviteLinks?
3766+
37553767
private var currentMyAudioLevel: Float = 0.0
37563768
private var currentMyAudioLevelTimestamp: Double = 0.0
37573769
private var isSendingTyping: Bool = false

0 commit comments

Comments
 (0)