Skip to content

Commit c7269fa

Browse files
author
Isaac
committed
Conference updates
1 parent 77bfc86 commit c7269fa

File tree

20 files changed

+216
-127
lines changed

20 files changed

+216
-127
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14182,3 +14182,8 @@ 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.";

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,11 @@ public enum OldChannelsControllerIntent {
985985
case upgrade
986986
}
987987

988+
public enum SendInviteLinkScreenSubject {
989+
case chat(peer: EnginePeer, link: String?)
990+
case groupCall(link: String)
991+
}
992+
988993
public protocol SharedAccountContext: AnyObject {
989994
var sharedContainerPath: String { get }
990995
var basePath: String { get }
@@ -1201,6 +1206,8 @@ public protocol SharedAccountContext: AnyObject {
12011206

12021207
func makeAccountFreezeInfoScreen(context: AccountContext) -> ViewController
12031208

1209+
func makeSendInviteLinkScreen(context: AccountContext, subject: SendInviteLinkScreenSubject, peers: [TelegramForbiddenInvitePeer], theme: PresentationTheme?) -> ViewController
1210+
12041211
func makeDebugSettingsController(context: AccountContext?) -> ViewController?
12051212

12061213
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: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

submodules/TelegramCallsUI/Sources/VideoChatScreen.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,6 +1530,9 @@ final class VideoChatScreenComponent: Component {
15301530
return
15311531
}
15321532
self.inviteLinks = value
1533+
if case let .group(groupCall) = self.currentCall, let groupCall = groupCall as? PresentationGroupCallImpl {
1534+
groupCall.currentInviteLinks = value
1535+
}
15331536
})
15341537

15351538
self.reconnectedAsEventsDisposable?.dispose()

0 commit comments

Comments
 (0)