diff --git a/submodules/TelegramCallsUI/Sources/CallController.swift b/submodules/TelegramCallsUI/Sources/CallController.swift index 64281e9645..6f47d375ab 100644 --- a/submodules/TelegramCallsUI/Sources/CallController.swift +++ b/submodules/TelegramCallsUI/Sources/CallController.swift @@ -187,7 +187,9 @@ public final class CallController: ViewController { if port.type == .bluetooth { var image = UIImage(bundleImageName: "Call/CallBluetoothButton") let portName = port.name.lowercased() - if portName.contains("airpods pro") { + if portName.contains("airpods max") { + image = UIImage(bundleImageName: "Call/CallAirpodsMaxButton") + } else if portName.contains("airpods pro") { image = UIImage(bundleImageName: "Call/CallAirpodsProButton") } else if portName.contains("airpods") { image = UIImage(bundleImageName: "Call/CallAirpodsButton") diff --git a/submodules/TelegramCallsUI/Sources/CallControllerButton.swift b/submodules/TelegramCallsUI/Sources/CallControllerButton.swift index 2f80b15fc1..28bdc66a40 100644 --- a/submodules/TelegramCallsUI/Sources/CallControllerButton.swift +++ b/submodules/TelegramCallsUI/Sources/CallControllerButton.swift @@ -37,6 +37,7 @@ final class CallControllerButtonItemNode: HighlightTrackingButtonNode { case speaker case airpods case airpodsPro + case airpodsMax case headphones case accept case end @@ -232,6 +233,8 @@ final class CallControllerButtonItemNode: HighlightTrackingButtonNode { image = generateTintedImage(image: UIImage(bundleImageName: "Call/CallAirpodsButton"), color: imageColor) case .airpodsPro: image = generateTintedImage(image: UIImage(bundleImageName: "Call/CallAirpodsProButton"), color: imageColor) + case .airpodsMax: + image = generateTintedImage(image: UIImage(bundleImageName: "Call/CallAirpodsMaxButton"), color: imageColor) case .headphones: image = generateTintedImage(image: UIImage(bundleImageName: "Call/CallHeadphonesButton"), color: imageColor) case .accept: diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index ed38917dec..5619b8498e 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -953,6 +953,8 @@ public final class VoiceChatController: ViewController { self.actionButton = VoiceChatActionButton() if self.isScheduling { + self.cameraButton.alpha = 0.0 + self.cameraButton.isUserInteractionEnabled = false self.audioButton.alpha = 0.0 self.audioButton.isUserInteractionEnabled = false self.leaveButton.alpha = 0.0 @@ -2111,7 +2113,7 @@ public final class VoiceChatController: ViewController { strongSelf.updateFloatingHeaderOffset(offset: strongSelf.currentContentOffset ?? 0.0, transition: .animated(duration: 0.3, curve: .easeInOut)) } } - if false, let (peerId, _) = minimalVisiblePeerid { + if let (peerId, _) = minimalVisiblePeerid { var index = 0 for item in strongSelf.currentEntries { if case let .peer(entry) = item, entry.peer.id == peerId { @@ -2159,7 +2161,7 @@ public final class VoiceChatController: ViewController { strongSelf.updateFloatingHeaderOffset(offset: strongSelf.currentContentOffset ?? 0.0, transition: .animated(duration: 0.3, curve: .easeInOut)) } } - if false, let (peerId, _) = minimalVisiblePeerid { + if let (peerId, _) = minimalVisiblePeerid { var index = 0 for item in strongSelf.currentEntries { if case let .peer(entry) = item, entry.peer.id == peerId { @@ -2249,7 +2251,6 @@ public final class VoiceChatController: ViewController { } let avatarSize = CGSize(width: 28.0, height: 28.0) - return combineLatest(self.displayAsPeersPromise.get(), self.context.account.postbox.loadedPeerWithId(self.call.peerId), self.inviteLinksPromise.get()) |> take(1) |> deliverOnMainQueue @@ -2411,8 +2412,6 @@ public final class VoiceChatController: ViewController { strongSelf.controller?.present(alertController, in: .window(.root)) }))) } - - return items } } @@ -2601,18 +2600,15 @@ public final class VoiceChatController: ViewController { let minute = components.minute ?? 0 components.minute = 0 let roundedToHourDate = calendar.date(from: components)! - components.hour = 0 + let roundedToMidnightDate = calendar.date(from: components)! - let nextTwoHourDate = calendar.date(byAdding: .hour, value: minute > 30 ? 4 : 3, to: roundedToHourDate) - let maxDate = calendar.date(byAdding: .day, value: 8, to: roundedToMidnightDate) - + if let date = calendar.date(byAdding: .day, value: 365, to: currentDate) { self.pickerView?.maximumDate = date } - if let next1MinDate = next1MinDate, let nextTwoHourDate = nextTwoHourDate { self.pickerView?.minimumDate = next1MinDate self.pickerView?.maximumDate = maxDate @@ -3140,8 +3136,7 @@ public final class VoiceChatController: ViewController { guard availableOutputs.count >= 2 else { return } - let hasMute = false - + if availableOutputs.count == 2 { for output in availableOutputs { if output != currentOutput { @@ -3153,9 +3148,6 @@ public final class VoiceChatController: ViewController { let actionSheet = ActionSheetController(presentationData: self.presentationData.withUpdated(theme: self.darkTheme)) var items: [ActionSheetItem] = [] for output in availableOutputs { - if hasMute, case .builtin = output { - continue - } let title: String var icon: UIImage? switch output { @@ -3171,7 +3163,9 @@ public final class VoiceChatController: ViewController { if port.type == .bluetooth { var image = UIImage(bundleImageName: "Call/CallBluetoothButton") let portName = port.name.lowercased() - if portName.contains("airpods pro") { + if portName.contains("airpods max") { + image = UIImage(bundleImageName: "Call/CallAirpodsMaxButton") + } else if portName.contains("airpods pro") { image = UIImage(bundleImageName: "Call/CallAirpodsProButton") } else if portName.contains("airpods") { image = UIImage(bundleImageName: "Call/CallAirpodsButton") @@ -3204,18 +3198,6 @@ public final class VoiceChatController: ViewController { }) self.controller?.present(controller, in: .window(.root)) } - return; - let controller = voiceChatCameraPreviewController(sharedContext: self.context.sharedContext, account: self.context.account, forceTheme: self.darkTheme, title: self.presentationData.strings.VoiceChat_VideoPreviewTitle, text: self.presentationData.strings.VoiceChat_VideoPreviewDescription, apply: { [weak self] in - guard let strongSelf = self else { - return - } - if strongSelf.call.isVideo { - strongSelf.call.disableVideo() - } else { - strongSelf.call.requestVideo() - } - }) - self.controller?.present(controller, in: .window(.root)) } @objc private func switchCameraPressed() { @@ -3682,6 +3664,8 @@ public final class VoiceChatController: ViewController { size.width = floor(min(size.width, size.height) * 0.5) } + let isScheduled = self.isScheduling || self.callState?.scheduleTimestamp != nil + var previousIsLandscape = false if let previousLayout = previousLayout, case .compact = previousLayout.metrics.widthClass, previousLayout.size.width > previousLayout.size.height { previousIsLandscape = true @@ -3855,7 +3839,7 @@ public final class VoiceChatController: ViewController { let forthButtonFrame: CGRect let leftButtonFrame: CGRect - if self.mainVideoContainerNode == nil { + if self.mainVideoContainerNode == nil || isScheduled { leftButtonFrame = CGRect(origin: CGPoint(x: sideButtonOrigin, y: floor((self.effectiveBottomAreaHeight - sideButtonSize.height) / 2.0)), size: sideButtonSize) } else { leftButtonFrame = CGRect(origin: CGPoint(x: sideButtonOrigin, y: floor((self.effectiveBottomAreaHeight - sideButtonSize.height - upperButtonDistance - cameraButtonSize.height) / 2.0) + upperButtonDistance + cameraButtonSize.height), size: sideButtonSize) @@ -4106,6 +4090,8 @@ public final class VoiceChatController: ViewController { if let callState = self.callState { if callState.scheduleTimestamp != nil && self.listNode.alpha > 0.0 { self.timerNode.isHidden = false + self.cameraButton.alpha = 0.0 + self.cameraButton.isUserInteractionEnabled = false self.listNode.alpha = 0.0 self.listNode.isUserInteractionEnabled = false self.backgroundNode.backgroundColor = panelBackgroundColor diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift index 3366dd3ce6..b4ea1ad777 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatParticipantItem.swift @@ -905,7 +905,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode { titleColor = UIColor(rgb: 0xffffff, alpha: 0.65) } else if case .tile = item.style { switch item.text { - case let .text(_, textColor): + case let .text(_, _, textColor): switch textColor { case .generic: titleColor = item.presentationData.theme.list.itemPrimaryTextColor @@ -977,7 +977,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode { } else { statusAttributedString = NSAttributedString(string: item.presentationData.strings.LastSeen_Offline, font: statusFont, textColor: item.presentationData.theme.list.itemSecondaryTextColor) } - case let .text(text, textColor): + case let .text(text, textIcon, textColor): var textColorValue: UIColor switch textColor { case .generic: @@ -999,7 +999,7 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode { break } - if let expandedText = item.expandedText, case let .text(text, textColor) = expandedText { + if let expandedText = item.expandedText, case let .text(text, _, textColor) = expandedText { let textColorValue: UIColor switch textColor { case .generic: @@ -1086,9 +1086,9 @@ class VoiceChatParticipantItemNode: ItemListRevealOptionsItemNode { var animateStatusTransitionFromUp: Bool? if let currentItem = currentItem { - if case .presence = currentItem.text, case let .text(_, newColor) = item.text { + if case .presence = currentItem.text, case let .text(_, _, newColor) = item.text { animateStatusTransitionFromUp = newColor == .constructive - } else if case let .text(_, currentColor) = currentItem.text, case let .text(_, newColor) = item.text, currentColor != newColor { + } else if case let .text(_, _, currentColor) = currentItem.text, case let .text(_, _, newColor) = item.text, currentColor != newColor { animateStatusTransitionFromUp = newColor == .constructive } else if case .text = currentItem.text, case .presence = item.text { animateStatusTransitionFromUp = false diff --git a/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/Contents.json new file mode 100644 index 0000000000..360b4f2588 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "airpods-b515@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/airpods-b515@3x.png b/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/airpods-b515@3x.png new file mode 100644 index 0000000000..cf735b34c9 Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Call/CallAirpodsMaxButton.imageset/airpods-b515@3x.png differ diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 66b1a1a16e..2daa5baa46 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1219,7 +1219,7 @@ func chatAvailableMessageActionsImpl(postbox: Postbox, accountPeerId: PeerId, me if canDeleteGlobally { optionsMap[id]!.insert(.deleteGlobally) } - if user.botInfo != nil && !user.id.isReplies && !isAction { + if user.botInfo != nil && message.flags.contains(.Incoming) && !user.id.isReplies && !isAction { optionsMap[id]!.insert(.report) } } else if let _ = peer as? TelegramSecretChat { diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift index 0e4be25a38..06a7d7a2e2 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoData.swift @@ -876,7 +876,9 @@ func availableActionsForMemberOfPeer(accountPeerId: PeerId, peer: Peer?, member: } else if member.id != accountPeerId { if let channel = peer as? TelegramChannel { if channel.flags.contains(.isCreator) { - result.insert(.restrict) + if !channel.flags.contains(.isGigagroup) { + result.insert(.restrict) + } result.insert(.promote) } else { switch member { @@ -887,13 +889,15 @@ func availableActionsForMemberOfPeer(accountPeerId: PeerId, peer: Peer?, member: case let .member(member): if let adminInfo = member.adminInfo { if adminInfo.promotedBy == accountPeerId { - result.insert(.restrict) + if !channel.flags.contains(.isGigagroup) { + result.insert(.restrict) + } if channel.hasPermission(.addAdmins) { result.insert(.promote) } } } else { - if channel.hasPermission(.banMembers) { + if channel.hasPermission(.banMembers) && !channel.flags.contains(.isGigagroup) { result.insert(.restrict) } if channel.hasPermission(.addAdmins) { diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index a3d111b8f5..671fedd79e 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -265,7 +265,7 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } else { return nil } - } else if let value = Int(pathComponents[1]) { + } else if let value = Int32(pathComponents[1]) { var threadId: Int32? var commentId: Int32? if let queryItems = components.queryItems { @@ -286,11 +286,11 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } if let threadId = threadId { - return .peerName(peerName, .replyThread(threadId, Int32(value))) + return .peerName(peerName, .replyThread(threadId, value)) } else if let commentId = commentId { - return .peerName(peerName, .replyThread(Int32(value), commentId)) + return .peerName(peerName, .replyThread(value, commentId)) } else { - return .peerName(peerName, .channelMessage(Int32(value))) + return .peerName(peerName, .channelMessage(value)) } } else { return nil