mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Display timer on outgoing call view
This commit is contained in:
parent
be80f0d342
commit
95449cc7c5
2 changed files with 11 additions and 3 deletions
|
|
@ -43,7 +43,7 @@ import linphonesw
|
|||
|
||||
var callData: CallData? = nil {
|
||||
didSet {
|
||||
duration.call = callData?.call
|
||||
duration.call = callData?.call.dir == .Incoming ? callData?.call : nil
|
||||
callData?.call.remoteAddress.map {
|
||||
avatar.fillFromAddress(address: $0)
|
||||
displayName.text = $0.addressBookEnhancedDisplayName()
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class CallTimer : StyledLabel {
|
|||
|
||||
var conference:Conference? = nil {
|
||||
didSet {
|
||||
if (self.call != nil) {
|
||||
if (self.conference != nil) {
|
||||
self.format()
|
||||
}
|
||||
}
|
||||
|
|
@ -51,8 +51,16 @@ class CallTimer : StyledLabel {
|
|||
formatter.unitsStyle = .positional
|
||||
formatter.allowedUnits = [.minute, .second ]
|
||||
formatter.zeroFormattingBehavior = [ .pad ]
|
||||
let startDate = Date()
|
||||
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in
|
||||
self.format()
|
||||
if (self.call != nil || self.conference != nil) {
|
||||
self.format()
|
||||
} else {
|
||||
let elapsedTime = Date().timeIntervalSince(startDate)
|
||||
self.formatter.string(from: elapsedTime).map {
|
||||
self.text = $0.hasPrefix("0:") ? "0" + $0 : $0
|
||||
}
|
||||
}
|
||||
}
|
||||
minWidth(min_width).done()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue