mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix call localization
This commit is contained in:
parent
46f604c98e
commit
91fa88a4e8
@ -10879,5 +10879,10 @@ Sorry for the inconvenience.";
|
||||
"Call.StatusEnded" = "Call Ended";
|
||||
"Call.StatusMissed" = "Call Missed";
|
||||
|
||||
"Call.WaitingStatusRequesting" = "Requesting";
|
||||
"Call.WaitingStatusRinging" = "Ringing";
|
||||
"Call.WaitingStatusConnecting" = "Connecting";
|
||||
"Call.WaitingStatusReconnecting" = "Reconnecting";
|
||||
|
||||
"Conversation.ContactAddContact" = "ADD";
|
||||
"Conversation.ContactMessage" = "MESSAGE";
|
||||
|
@ -2,6 +2,7 @@ import Foundation
|
||||
import UIKit
|
||||
import Display
|
||||
import ComponentFlow
|
||||
import TelegramPresentationData
|
||||
|
||||
private func addRoundedRectPath(context: CGContext, rect: CGRect, radius: CGFloat) {
|
||||
context.saveGState()
|
||||
@ -154,13 +155,28 @@ private final class SignalStrengthView: UIView {
|
||||
|
||||
final class StatusView: UIView {
|
||||
private struct LayoutState: Equatable {
|
||||
var strings: PresentationStrings
|
||||
var state: State
|
||||
var size: CGSize
|
||||
|
||||
init(state: State, size: CGSize) {
|
||||
init(strings: PresentationStrings, state: State, size: CGSize) {
|
||||
self.strings = strings
|
||||
self.state = state
|
||||
self.size = size
|
||||
}
|
||||
|
||||
static func ==(lhs: LayoutState, rhs: LayoutState) -> Bool {
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
if lhs.state != rhs.state {
|
||||
return false
|
||||
}
|
||||
if lhs.size != rhs.size {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
enum WaitingState {
|
||||
@ -241,12 +257,12 @@ final class StatusView: UIView {
|
||||
self.activeDurationTimer?.invalidate()
|
||||
}
|
||||
|
||||
func update(state: State, transition: Transition) -> CGSize {
|
||||
if let layoutState = self.layoutState, layoutState.state == state {
|
||||
func update(strings: PresentationStrings, state: State, transition: Transition) -> CGSize {
|
||||
if let layoutState = self.layoutState, layoutState.strings === strings, layoutState.state == state {
|
||||
return layoutState.size
|
||||
}
|
||||
let size = self.updateInternal(state: state, transition: transition)
|
||||
self.layoutState = LayoutState(state: state, size: size)
|
||||
let size = self.updateInternal(strings: strings, state: state, transition: transition)
|
||||
self.layoutState = LayoutState(strings: strings, state: state, size: size)
|
||||
|
||||
self.updateActiveDurationTimer()
|
||||
|
||||
@ -268,7 +284,7 @@ final class StatusView: UIView {
|
||||
self.activeDurationTimer = nil
|
||||
|
||||
if let layoutState = self.layoutState {
|
||||
let size = self.updateInternal(state: layoutState.state, transition: .immediate)
|
||||
let size = self.updateInternal(strings: layoutState.strings, state: layoutState.state, transition: .immediate)
|
||||
if layoutState.size != size {
|
||||
self.layoutState = nil
|
||||
self.requestLayout?()
|
||||
@ -286,7 +302,7 @@ final class StatusView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
private func updateInternal(state: State, transition: Transition) -> CGSize {
|
||||
private func updateInternal(strings: PresentationStrings, state: State, transition: Transition) -> CGSize {
|
||||
let textString: String
|
||||
var needsDots = false
|
||||
var monospacedDigits = false
|
||||
@ -297,13 +313,13 @@ final class StatusView: UIView {
|
||||
|
||||
switch waitingState {
|
||||
case .requesting:
|
||||
textString = "Requesting"
|
||||
textString = strings.Call_WaitingStatusRequesting
|
||||
case .ringing:
|
||||
textString = "Ringing"
|
||||
textString = strings.Call_WaitingStatusRinging
|
||||
case .connecting:
|
||||
textString = "Connecting"
|
||||
textString = strings.Call_WaitingStatusConnecting
|
||||
case .reconnecting:
|
||||
textString = "Reconnecting"
|
||||
textString = strings.Call_WaitingStatusReconnecting
|
||||
}
|
||||
case let .active(activeState):
|
||||
monospacedDigits = true
|
||||
|
@ -1298,7 +1298,7 @@ public final class PrivateCallScreen: OverlayMaskContainerView, AVPictureInPictu
|
||||
}
|
||||
}
|
||||
|
||||
let statusSize = self.statusView.update(state: statusState, transition: .immediate)
|
||||
let statusSize = self.statusView.update(strings: params.state.strings, state: statusState, transition: .immediate)
|
||||
|
||||
let titleY: CGFloat
|
||||
if currentAreControlsHidden {
|
||||
|
Loading…
x
Reference in New Issue
Block a user