Voice Chat UI fixes

This commit is contained in:
Ilya Laktyushin 2020-11-29 16:40:52 +04:00
parent df5e9c7cd3
commit d94f541205
7 changed files with 4491 additions and 4443 deletions

View File

@ -2278,6 +2278,19 @@ Unused sets are archived when you add more.";
"Call.Minutes_any" = "%@ minutes"; "Call.Minutes_any" = "%@ minutes";
"Call.Minutes_many" = "%@ minutes"; "Call.Minutes_many" = "%@ minutes";
"Call.Minutes_0" = "%@ minutes"; "Call.Minutes_0" = "%@ minutes";
"Call.Hours_1" = "%@ hour";
"Call.Hours_2" = "%@ hours";
"Call.Hours_3_10" = "%@ hours";
"Call.Hours_any" = "%@ hours";
"Call.Hours_many" = "%@ hours";
"Call.Hours_0" = "%@ hours";
"Call.Days_1" = "%@ day";
"Call.Days_2" = "%@ days";
"Call.Days_3_10" = "%@ days";
"Call.Days_any" = "%@ days";
"Call.Days_many" = "%@ days";
"Call.Days_0" = "%@ days";
"Call.ShortSeconds_1" = "%@ sec"; "Call.ShortSeconds_1" = "%@ sec";
"Call.ShortSeconds_2" = "%@ sec"; "Call.ShortSeconds_2" = "%@ sec";
@ -5938,3 +5951,20 @@ Sorry for the inconvenience.";
"Notification.VoiceChatInvitation" = "%1$@ invited %2$@ to the voice chat"; "Notification.VoiceChatInvitation" = "%1$@ invited %2$@ to the voice chat";
"Notification.VoiceChatInvitationByYou" = "You invited %1$@ to the voice chat"; "Notification.VoiceChatInvitationByYou" = "You invited %1$@ to the voice chat";
"Notification.VoiceChatInvitationForYou" = "%1$@ invited you to the voice chat"; "Notification.VoiceChatInvitationForYou" = "%1$@ invited you to the voice chat";
"Notification.VoiceChatStarted" = "Voice chat started";
"Notification.VoiceChatEnded" = "Voice chat ended (%@)";
"VoiceChat.Panel.TapToJoin" = "Tap to join";
"VoiceChat.Panel.Members_0" = "%@ members";
"VoiceChat.Panel.Members_1" = "%@ member";
"VoiceChat.Panel.Members_2" = "%@ members";
"VoiceChat.Panel.Members_3_10" = "%@ members";
"VoiceChat.Panel.Members_many" = "%@ members";
"VoiceChat.Panel.Members_any" = "%@ members";
"VoiceChat.Panel.MembersSpeaking_0" = "%@ members speaking";
"VoiceChat.Panel.MembersSpeaking_1" = "%@ member speaking";
"VoiceChat.Panel.MembersSpeaking_2" = "%@ members speaking";
"VoiceChat.Panel.MembersSpeaking_3_10" = "%@ members speaking";
"VoiceChat.Panel.MembersSpeaking_many" = "%@ members speaking";
"VoiceChat.Panel.MembersSpeaking_any" = "%@ members speaking";

View File

@ -231,9 +231,9 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
if previousData?.groupCall !== data.groupCall { if previousData?.groupCall !== data.groupCall {
let membersText: String let membersText: String
if data.participantCount == 0 { if data.participantCount == 0 {
membersText = self.strings.PeopleNearby_NoMembers membersText = self.strings.VoiceChat_Panel_TapToJoin
} else { } else {
membersText = self.strings.Conversation_StatusMembers(Int32(data.participantCount)) membersText = self.strings.VoiceChat_Panel_Members(Int32(data.participantCount))
} }
self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { $0.peer }, animated: false) self.avatarsContent = self.avatarsContext.update(peers: data.topParticipants.map { $0.peer }, animated: false)
@ -253,18 +253,13 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
let membersText: String let membersText: String
let membersTextIsActive: Bool let membersTextIsActive: Bool
if summaryState.numberOfActiveSpeakers != 0 { if summaryState.numberOfActiveSpeakers != 0 {
//TODO:localize membersText = strongSelf.strings.VoiceChat_Panel_MembersSpeaking(Int32(summaryState.numberOfActiveSpeakers))
if summaryState.numberOfActiveSpeakers == 1 {
membersText = "1 member speaking"
} else {
membersText = "\(summaryState.numberOfActiveSpeakers) members speaking"
}
membersTextIsActive = true membersTextIsActive = true
} else { } else {
if summaryState.participantCount == 0 { if summaryState.participantCount == 0 {
membersText = strongSelf.strings.PeopleNearby_NoMembers membersText = strongSelf.strings.VoiceChat_Panel_TapToJoin
} else { } else {
membersText = strongSelf.strings.Conversation_StatusMembers(Int32(summaryState.participantCount)) membersText = strongSelf.strings.VoiceChat_Panel_Members(Int32(summaryState.participantCount))
} }
membersTextIsActive = false membersTextIsActive = false
} }
@ -290,18 +285,13 @@ public final class GroupCallNavigationAccessoryPanel: ASDisplayNode {
let membersText: String let membersText: String
let membersTextIsActive: Bool let membersTextIsActive: Bool
if data.numberOfActiveSpeakers != 0 { if data.numberOfActiveSpeakers != 0 {
//TODO:localize membersText = self.strings.VoiceChat_Panel_MembersSpeaking(Int32(data.numberOfActiveSpeakers))
if data.numberOfActiveSpeakers == 1 {
membersText = "1 member speaking"
} else {
membersText = "\(data.numberOfActiveSpeakers) members speaking"
}
membersTextIsActive = true membersTextIsActive = true
} else { } else {
if data.participantCount == 0 { if data.participantCount == 0 {
membersText = self.strings.PeopleNearby_NoMembers membersText = self.strings.VoiceChat_Panel_TapToJoin
} else { } else {
membersText = self.strings.Conversation_StatusMembers(Int32(data.participantCount)) membersText = self.strings.VoiceChat_Panel_Members(Int32(data.participantCount))
} }
membersTextIsActive = false membersTextIsActive = false
} }

View File

@ -694,7 +694,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
self?._canBeRemoved.set(.single(true)) self?._canBeRemoved.set(.single(true))
})) }))
} }
} else if case .requesting = self.internalState { } else if case .requesting = self.internalState {
self.callContext?.stop() self.callContext?.stop()
self.callContext = nil self.callContext = nil
self.requestDisposable.set(nil) self.requestDisposable.set(nil)

View File

@ -88,7 +88,11 @@ public func unmuteIntervalString(strings: PresentationStrings, value: Int32) ->
public func callDurationString(strings: PresentationStrings, value: Int32) -> String { public func callDurationString(strings: PresentationStrings, value: Int32) -> String {
if value < 60 { if value < 60 {
return strings.Call_Seconds(max(1, value)) return strings.Call_Seconds(max(1, value))
} else { } else if value < 60 * 60 {
return strings.Call_Minutes(max(1, value / 60)) return strings.Call_Minutes(max(1, value / 60))
} else if value < 60 * 60 * 24 {
return strings.Call_Hours(max(1, value / (60 * 60)))
} else {
return strings.Call_Days(max(1, value / (60 * 60 * 24)))
} }
} }

View File

@ -405,12 +405,11 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
} }
attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor) attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor)
case let .groupPhoneCall(_, _, duration): case let .groupPhoneCall(_, _, duration):
//TODO:localize
let titleString: String let titleString: String
if let duration = duration { if let duration = duration {
titleString = "Voice chat ended (\(duration)s)" titleString = strings.Notification_VoiceChatEnded(callDurationString(strings: strings, value: duration)).0
} else { } else {
titleString = "Voice chat started" titleString = strings.Notification_VoiceChatStarted
} }
attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor) attributedString = NSAttributedString(string: titleString, font: titleFont, textColor: primaryTextColor)
case let .customText(text, entities): case let .customText(text, entities):