mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
19741bfd47
@ -1277,9 +1277,9 @@ public final class GroupCallParticipantsContext {
|
||||
private let resetInviteLinksDisposable = MetaDisposable()
|
||||
private let updateShouldBeRecordingDisposable = MetaDisposable()
|
||||
|
||||
private var localVideoIsMuted: Bool = true
|
||||
private var localIsVideoPaused: Bool = true
|
||||
|
||||
private var localVideoIsMuted: Bool? = nil
|
||||
private var localIsVideoPaused: Bool? = nil
|
||||
private var localIsPresentationPaused: Bool? = nil
|
||||
public struct ServiceState {
|
||||
fileprivate var nextActivityRank: Int = 0
|
||||
}
|
||||
@ -1877,12 +1877,13 @@ public final class GroupCallParticipantsContext {
|
||||
}))
|
||||
}
|
||||
|
||||
public func updateVideoState(peerId: PeerId, isVideoMuted: Bool, isVideoPaused: Bool) {
|
||||
if self.localVideoIsMuted == isVideoMuted && self.localIsVideoPaused == isVideoPaused {
|
||||
public func updateVideoState(peerId: PeerId, isVideoMuted: Bool?, isVideoPaused: Bool?, isPresentationPaused: Bool?) {
|
||||
if self.localVideoIsMuted == isVideoMuted && self.localIsVideoPaused == isVideoPaused && self.localIsPresentationPaused == isPresentationPaused {
|
||||
return
|
||||
}
|
||||
self.localVideoIsMuted = isVideoMuted
|
||||
self.localIsVideoPaused = isVideoPaused
|
||||
self.localIsPresentationPaused = isPresentationPaused
|
||||
|
||||
let disposable = MetaDisposable()
|
||||
|
||||
@ -1900,16 +1901,24 @@ public final class GroupCallParticipantsContext {
|
||||
var flags: Int32 = 0
|
||||
var videoMuted: Api.Bool?
|
||||
|
||||
videoMuted = isVideoMuted ? .boolTrue : .boolFalse
|
||||
flags |= 1 << 3
|
||||
if let isVideoMuted = isVideoMuted {
|
||||
videoMuted = isVideoMuted ? .boolTrue : .boolFalse
|
||||
flags |= 1 << 3
|
||||
}
|
||||
|
||||
var videoPaused: Api.Bool?
|
||||
if !isVideoMuted {
|
||||
if isVideoMuted != nil, let isVideoPaused = isVideoPaused {
|
||||
videoPaused = isVideoPaused ? .boolTrue : .boolFalse
|
||||
flags |= 1 << 4
|
||||
}
|
||||
var presentationPaused: Api.Bool?
|
||||
|
||||
return account.network.request(Api.functions.phone.editGroupCallParticipant(flags: flags, call: .inputGroupCall(id: id, accessHash: accessHash), participant: inputPeer, muted: nil, volume: nil, raiseHand: nil, videoStopped: videoMuted, videoPaused: videoPaused, presentationPaused: nil))
|
||||
if let isPresentationPaused = isPresentationPaused {
|
||||
presentationPaused = isPresentationPaused ? .boolTrue : .boolFalse
|
||||
flags |= 1 << 5
|
||||
}
|
||||
|
||||
return account.network.request(Api.functions.phone.editGroupCallParticipant(flags: flags, call: .inputGroupCall(id: id, accessHash: accessHash), participant: inputPeer, muted: nil, volume: nil, raiseHand: nil, videoStopped: videoMuted, videoPaused: videoPaused, presentationPaused: presentationPaused))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.Updates?, NoError> in
|
||||
return .single(nil)
|
||||
|
@ -640,8 +640,8 @@ final class SharedApplicationContext {
|
||||
}, getAvailableAlternateIcons: {
|
||||
if #available(iOS 10.3, *) {
|
||||
var icons = [PresentationAppIcon(name: "Blue", imageName: "BlueIcon", isDefault: buildConfig.isAppStoreBuild),
|
||||
PresentationAppIcon(name: "New1", imageName: "New1_180x180"),
|
||||
PresentationAppIcon(name: "New2", imageName: "New2_180x180"),
|
||||
PresentationAppIcon(name: "New1", imageName: "New1_180x180"),
|
||||
PresentationAppIcon(name: "Black", imageName: "BlackIcon"),
|
||||
PresentationAppIcon(name: "BlueClassic", imageName: "BlueClassicIcon"),
|
||||
PresentationAppIcon(name: "BlackClassic", imageName: "BlackClassicIcon"),
|
||||
|
@ -73,7 +73,7 @@ class ChatMessageShareButton: HighlightableButtonNode {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func update(presentationData: ChatPresentationData, chatLocation: ChatLocation, subject: ChatControllerSubject?, message: Message, account: Account) -> CGSize {
|
||||
func update(presentationData: ChatPresentationData, chatLocation: ChatLocation, subject: ChatControllerSubject?, message: Message, account: Account, disableComments: Bool = false) -> CGSize {
|
||||
var isReplies = false
|
||||
var replyCount = 0
|
||||
if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
|
||||
@ -89,13 +89,15 @@ class ChatMessageShareButton: HighlightableButtonNode {
|
||||
replyCount = 0
|
||||
isReplies = false
|
||||
}
|
||||
if disableComments {
|
||||
replyCount = 0
|
||||
isReplies = false
|
||||
}
|
||||
|
||||
if self.theme !== presentationData.theme.theme || self.isReplies != isReplies {
|
||||
self.theme = presentationData.theme.theme
|
||||
self.isReplies = isReplies
|
||||
|
||||
let graphics = PresentationResourcesChat.additionalGraphics(presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper, bubbleCorners: presentationData.chatBubbleCorners)
|
||||
|
||||
var updatedIconImage: UIImage?
|
||||
if case .pinnedMessages = subject {
|
||||
updatedIconImage = PresentationResourcesChat.chatFreeNavigateButtonIcon(presentationData.theme.theme, wallpaper: presentationData.theme.wallpaper)
|
||||
|
@ -2719,7 +2719,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
let currentBackgroundFrame = strongSelf.backgroundNode.frame
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account)
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: true)
|
||||
shareButtonNode.frame = CGRect(origin: CGPoint(x: currentBackgroundFrame.maxX + 8.0, y: currentBackgroundFrame.maxY - buttonSize.width - 1.0), size: buttonSize)
|
||||
}
|
||||
} else {
|
||||
@ -2729,7 +2729,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
strongSelf.messageAccessibilityArea.frame = backgroundFrame
|
||||
if let shareButtonNode = strongSelf.shareButtonNode {
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account)
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: true)
|
||||
shareButtonNode.frame = CGRect(origin: CGPoint(x: backgroundFrame.maxX + 8.0, y: backgroundFrame.maxY - buttonSize.width - 1.0), size: buttonSize)
|
||||
}
|
||||
|
||||
@ -2924,7 +2924,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
self.messageAccessibilityArea.frame = backgroundFrame
|
||||
|
||||
if let item = self.item, let shareButtonNode = self.shareButtonNode {
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account)
|
||||
let buttonSize = shareButtonNode.update(presentationData: item.presentationData, chatLocation: item.chatLocation, subject: item.associatedData.subject, message: item.message, account: item.context.account, disableComments: true)
|
||||
shareButtonNode.frame = CGRect(origin: CGPoint(x: backgroundFrame.maxX + 8.0, y: backgroundFrame.maxY - buttonSize.width - 1.0), size: buttonSize)
|
||||
}
|
||||
|
||||
|
@ -122,6 +122,7 @@ typedef NS_ENUM(int32_t, OngoingCallDataSavingWebrtc) {
|
||||
- (void)makeOutgoingVideoView:(bool)requestClone completion:(void (^_Nonnull)(UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable, UIView<OngoingCallThreadLocalContextWebrtcVideoView> * _Nullable))completion;
|
||||
|
||||
- (void)setOnFatalError:(dispatch_block_t _Nullable)onError;
|
||||
- (void)setOnPause:(void (^ _Nullable)(bool))onPause;
|
||||
- (void)setOnIsActiveUpdated:(void (^_Nonnull)(bool))onIsActiveUpdated;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
|
@ -324,6 +324,13 @@ tgcalls::VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(tgcalls:
|
||||
#endif
|
||||
}
|
||||
|
||||
-(void)setOnPause:(void (^)(bool))onPause {
|
||||
#if TARGET_OS_IOS
|
||||
#else
|
||||
_interface->setOnPause(onPause);
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)setOnIsActiveUpdated:(void (^)(bool))onIsActiveUpdated {
|
||||
_interface->setOnIsActiveUpdated([onIsActiveUpdated](bool isActive) {
|
||||
if (onIsActiveUpdated) {
|
||||
@ -354,7 +361,9 @@ tgcalls::VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(tgcalls:
|
||||
if (requestClone) {
|
||||
cloneRenderer = [[VideoSampleBufferView alloc] initWithFrame:CGRectZero];
|
||||
cloneRenderer.videoContentMode = UIViewContentModeScaleAspectFill;
|
||||
#ifdef WEBRTC_IOS
|
||||
[remoteRenderer setCloneTarget:cloneRenderer];
|
||||
#endif
|
||||
}
|
||||
|
||||
completion(remoteRenderer, cloneRenderer);
|
||||
@ -367,10 +376,10 @@ tgcalls::VideoCaptureInterfaceObject *GetVideoCaptureAssumingSameThread(tgcalls:
|
||||
cloneRenderer = [[VideoMetalView alloc] initWithFrame:CGRectZero];
|
||||
#ifdef WEBRTC_IOS
|
||||
cloneRenderer.videoContentMode = UIViewContentModeScaleToFill;
|
||||
[remoteRenderer setClone:cloneRenderer];
|
||||
#else
|
||||
cloneRenderer.videoContentMode = kCAGravityResizeAspectFill;
|
||||
#endif
|
||||
[remoteRenderer setClone:cloneRenderer];
|
||||
}
|
||||
|
||||
std::shared_ptr<rtc::VideoSinkInterface<webrtc::VideoFrame>> sink = [remoteRenderer getSink];
|
||||
|
Loading…
x
Reference in New Issue
Block a user