Various fixes

This commit is contained in:
Ilya Laktyushin 2025-09-25 17:06:35 +04:00
parent 934ed73331
commit 6976839bfc
3 changed files with 55 additions and 36 deletions

View File

@ -520,9 +520,10 @@ final class VideoChatMicButtonComponent: Component {
var titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) * 0.5), y: size.height + 16.0), size: titleSize) var titleFrame = CGRect(origin: CGPoint(x: floor((size.width - titleSize.width) * 0.5), y: size.height + 16.0), size: titleSize)
if component.isCompact { if component.isCompact {
titleFrame.origin.y -= 11.0 titleFrame.origin.y -= 11.0
} } else {
if subtitleText != nil { if subtitleText != nil {
titleFrame.origin.y -= 5.0 titleFrame.origin.y -= 5.0
}
} }
if let titleView = self.title.view { if let titleView = self.title.view {
if titleView.superview == nil { if titleView.superview == nil {

View File

@ -3065,7 +3065,7 @@ final class VideoChatScreenComponent: Component {
transition.setBounds(view: microphoneButtonView, bounds: CGRect(origin: CGPoint(), size: microphoneButtonFrame.size)) transition.setBounds(view: microphoneButtonView, bounds: CGRect(origin: CGPoint(), size: microphoneButtonFrame.size))
} }
let videoButtonContent: VideoChatActionButtonComponent.Content let videoButtonContent: VideoChatActionButtonComponent.Content?
let videoControlButtonContent: VideoChatActionButtonComponent.Content let videoControlButtonContent: VideoChatActionButtonComponent.Content
var buttonAudio: VideoChatActionButtonComponent.Content.Audio = .speaker var buttonAudio: VideoChatActionButtonComponent.Content.Audio = .speaker
@ -3097,7 +3097,7 @@ final class VideoChatScreenComponent: Component {
} }
if let callState = self.callState, let muteState = callState.muteState, !muteState.canUnmute { if let callState = self.callState, let muteState = callState.muteState, !muteState.canUnmute {
videoButtonContent = .audio(audio: buttonAudio, isEnabled: buttonIsEnabled) videoButtonContent = nil
videoControlButtonContent = .audio(audio: buttonAudio, isEnabled: buttonIsEnabled) videoControlButtonContent = .audio(audio: buttonAudio, isEnabled: buttonIsEnabled)
} else { } else {
let isVideoActive = self.callState?.isMyVideoActive ?? false let isVideoActive = self.callState?.isMyVideoActive ?? false
@ -3109,38 +3109,45 @@ final class VideoChatScreenComponent: Component {
} }
} }
let _ = self.videoButton.update( if let videoButtonContent {
transition: transition, let _ = self.videoButton.update(
component: AnyComponent(PlainButtonComponent( transition: transition,
content: AnyComponent(VideoChatActionButtonComponent( component: AnyComponent(PlainButtonComponent(
strings: environment.strings, content: AnyComponent(VideoChatActionButtonComponent(
content: videoButtonContent, strings: environment.strings,
microphoneState: actionButtonMicrophoneState, content: videoButtonContent,
isCollapsed: areButtonsActuallyCollapsed || buttonsOnTheSide microphoneState: actionButtonMicrophoneState,
isCollapsed: areButtonsActuallyCollapsed || buttonsOnTheSide
)),
effectAlignment: .center,
action: { [weak self] in
guard let self else {
return
}
if let callState = self.callState, let muteState = callState.muteState, !muteState.canUnmute {
self.onAudioRoutePressed()
} else {
self.onCameraPressed()
}
},
animateAlpha: false
)), )),
effectAlignment: .center, environment: {},
action: { [weak self] in containerSize: CGSize(width: actionButtonDiameter, height: actionButtonDiameter)
guard let self else { )
return if let videoButtonView = self.videoButton.view {
} if videoButtonView.superview == nil {
if let callState = self.callState, let muteState = callState.muteState, !muteState.canUnmute { self.containerView.addSubview(videoButtonView)
self.onAudioRoutePressed() }
} else { transition.setPosition(view: videoButtonView, position: secondActionButtonFrame.center)
self.onCameraPressed() transition.setBounds(view: videoButtonView, bounds: CGRect(origin: CGPoint(), size: secondActionButtonFrame.size))
}
},
animateAlpha: false
)),
environment: {},
containerSize: CGSize(width: actionButtonDiameter, height: actionButtonDiameter)
)
if let videoButtonView = self.videoButton.view {
if videoButtonView.superview == nil {
self.containerView.addSubview(videoButtonView)
} }
transition.setPosition(view: videoButtonView, position: secondActionButtonFrame.center) } else if let videoButtonView = self.videoButton.view {
transition.setBounds(view: videoButtonView, bounds: CGRect(origin: CGPoint(), size: secondActionButtonFrame.size)) let transition = ComponentTransition(animation: .curve(duration: 0.25, curve: .easeInOut))
transition.animateScale(view: videoButtonView, from: 1.0, to: 0.01)
transition.animateAlpha(view: videoButtonView, from: 1.0, to: 0.0, completion: { _ in
videoButtonView.removeFromSuperview()
})
} }
let _ = self.speakerButton.update( let _ = self.speakerButton.update(

View File

@ -1501,6 +1501,17 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
} }
if let note = cachedData.note, !note.text.isEmpty { if let note = cachedData.note, !note.text.isEmpty {
var entities = note.entities
if !context.isPremium {
entities = entities.filter { entity in
switch entity.type {
case .Url, .TextUrl:
return false
default:
return true
}
}
}
items[currentPeerInfoSection]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.PeerInfo_Notes, rightLabel: presentationData.strings.PeerInfo_NotesInfo, text: note.text, entities: note.entities, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, linkItemAction: bioLinkAction, button: nil, contextAction: noteContextAction, requestLayout: { animated in items[currentPeerInfoSection]!.append(PeerInfoScreenLabeledValueItem(id: 0, label: presentationData.strings.PeerInfo_Notes, rightLabel: presentationData.strings.PeerInfo_NotesInfo, text: note.text, entities: note.entities, textColor: .primary, textBehavior: .multiLine(maxLines: 100, enabledEntities: []), action: nil, linkItemAction: bioLinkAction, button: nil, contextAction: noteContextAction, requestLayout: { animated in
interaction.requestLayout(animated) interaction.requestLayout(animated)
})) }))
@ -4577,7 +4588,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
let noteUpdateSignal: Signal<Never, ContactUpdateError> let noteUpdateSignal: Signal<Never, ContactUpdateError>
if noteUpdated, let note { if noteUpdated, let note {
let entities = generateChatInputTextEntities(note) let entities = generateTextEntities(note.string, enabledTypes: [.mention, .hashtag, .allUrl], currentEntities: generateChatInputTextEntities(note))
noteUpdateSignal = context.engine.contacts.updateContactNote(peerId: peer.id, text: note.string, entities: entities) noteUpdateSignal = context.engine.contacts.updateContactNote(peerId: peer.id, text: note.string, entities: entities)
|> mapError { _ -> ContactUpdateError in |> mapError { _ -> ContactUpdateError in
return .generic return .generic