Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
307 commits
Select commit Hold shift + click to select a range
0345901
- Bug fixes and minor improvements.
Aug 11, 2020
c1ba210
- Bug fixes and minor improvements.
Aug 12, 2020
eb60f9c
- Bug fixes and minor improvements.
Aug 12, 2020
2eba383
- Bug fixes and minor improvements.
Aug 12, 2020
18afdc6
- Bug fixes and minor improvements.
Aug 13, 2020
5308d60
- Bug fixes and minor improvements.
Aug 13, 2020
e449e1c
- Bug fixes and minor improvements.
Aug 13, 2020
9e070f5
- Bug fixes and minor improvements.
Aug 13, 2020
1f6df2b
- Bug fixes and minor improvements.
Aug 14, 2020
1ceb1b0
- Bug fixes and minor improvements.
Aug 14, 2020
08a09b4
- Bug fixes and minor improvements.
Aug 14, 2020
71d4523
- Bug fixes and minor improvements.
Aug 14, 2020
b0ff96b
- Bug fixes and minor improvements.
Aug 14, 2020
93f0df2
- Bug fixes and minor improvements.
Aug 14, 2020
e4b55c4
Merge branch 'beta' into release
Aug 14, 2020
5b4ebfb
Merge branch 'release' into appstore
Aug 14, 2020
c63d1a3
- Bug fixes and minor improvements.
Aug 17, 2020
2c2a8fe
- Bug fixes and minor improvements.
Aug 18, 2020
6db2db7
- Bug fixes and minor improvements.
Aug 18, 2020
88d1b8d
- Bug fixes and minor improvements.
Aug 18, 2020
946aaeb
- Bug fixes and minor improvements.
Aug 18, 2020
b77a170
temp
Aug 18, 2020
06b219e
no message
Aug 21, 2020
eec4547
- Bug fixes and minor improvements.
Aug 25, 2020
1c858f1
- Migration from xcode 10.3 to 11.3 because of swift bugs.
Aug 27, 2020
e742ddc
- Bug fixes and minor improvements.
Aug 27, 2020
fb45afd
- Bug fixes and minor improvements.
Aug 27, 2020
0e83dec
- Bug fixes and minor improvements.
Aug 27, 2020
8ef82a9
- Bug fixes and minor improvements.
Aug 27, 2020
95c68eb
- Bug fixes and minor improvements.
Aug 27, 2020
bc4a57d
- Bug fixes and minor improvements.
Aug 27, 2020
59fde1f
- Bug fixes and minor improvements.
Aug 27, 2020
b5a61cf
- Bug fixes and minor improvements.
Aug 27, 2020
da2626b
- Bug fixes and minor improvements.
Aug 28, 2020
14a840d
- Bug fixes and minor improvements.
Aug 28, 2020
f30d4c5
- Bug fixes and minor improvements.
Aug 28, 2020
605069e
- Bug fixes and minor improvements.
Aug 28, 2020
b9ea51a
- Bug fixes and minor improvements.
Aug 28, 2020
477d74d
- Bug fixes and minor improvements.
Aug 28, 2020
5c1f5c9
- Bug fixes and minor improvements.
Aug 28, 2020
6540aec
- Bug fixes and minor improvements.
Aug 29, 2020
ea593f3
no message
Aug 30, 2020
76881d4
- Bug fixes and minor improvements.
Aug 30, 2020
6b52cfe
no message
Aug 31, 2020
2ae6d5b
reply thread
Sep 1, 2020
5a0388d
- Bug fixes and minor improvements.
Sep 1, 2020
ad28594
no message
Sep 1, 2020
ec94b72
- Bug fixes and minor improvements.
Sep 1, 2020
cfdf027
comments
Sep 3, 2020
4f5b944
- Bug fixes and minor improvements.
Sep 3, 2020
20ee737
no message
Sep 3, 2020
d3edb24
no message
Sep 3, 2020
ad3a60c
no message
Sep 3, 2020
5a0610a
- Bug fixes and minor improvements.
Sep 4, 2020
10ba666
no message
Sep 4, 2020
38149e4
- Bug fixes and minor improvements.
Sep 4, 2020
5233452
- Bug fixes and minor improvements.
Sep 4, 2020
e754cbe
- release fixes
Sep 4, 2020
5510af8
no message
Sep 6, 2020
321878c
- Bug fixes and minor improvements.
Sep 6, 2020
3bbec02
- Bug fixes and minor improvements.
Sep 6, 2020
562b58d
- Bug fixes and minor improvements.
Sep 7, 2020
e341c48
no message
Sep 11, 2020
567ad4a
Merge branch 'beta' into dev
Sep 13, 2020
de32c6b
no message
Sep 13, 2020
d9c9cd0
no message
Sep 14, 2020
b28ae37
no message
Sep 15, 2020
2734d6a
- Bug fixes and minor improvements.
Sep 18, 2020
2f0aa93
- Bug fixes and minor improvements.
Sep 18, 2020
e0fe37d
- Bug fixes and minor improvements.
Sep 18, 2020
96fcf7e
- Bug fixes and minor improvements.
Sep 23, 2020
e73aaef
- Bug fixes and minor improvements.
Sep 25, 2020
aad3eab
- Bug fixes and minor improvements.
Sep 25, 2020
a162f7b
- Bug fixes and minor improvements.
Sep 25, 2020
0e8332e
- Bug fixes and minor improvements.
Sep 28, 2020
cc2cc46
no message
Sep 29, 2020
4ac8621
- Bug fixes and minor improvements.
Sep 29, 2020
aefedf6
- Bug fixes and minor improvements.
Sep 29, 2020
54448ce
- Bug fixes and minor improvements.
Sep 30, 2020
d8b19ee
- Bug fixes and minor improvements.
Sep 30, 2020
860cb7c
- Bug fixes and minor improvements.
Sep 30, 2020
2b67766
- Bug fixes and minor improvements.
Sep 30, 2020
8744aa8
- Bug fixes and minor improvements.
Sep 30, 2020
2693962
- Bug fixes and minor improvements.
Sep 30, 2020
f92333a
no message
Sep 30, 2020
f77e6e6
- Bug fixes and minor improvements.
Sep 30, 2020
68b3a58
no message
Sep 30, 2020
f3a9632
no message
Oct 2, 2020
882173f
- Bug fixes and minor improvements.
Oct 2, 2020
9ee678c
- Bug fixes and minor improvements.
Oct 2, 2020
e637fd1
- Bug fixes and minor improvements.
Oct 2, 2020
b73c5cf
- Bug fixes and minor improvements.
Oct 2, 2020
459308c
- Bug fixes and minor improvements.
Oct 5, 2020
8f6a173
- Bug fixes and minor improvements.
Oct 5, 2020
755ce13
- Call Settings
Oct 6, 2020
851633c
- Call Settings
Oct 7, 2020
b610bc5
no message
Oct 7, 2020
13b3f9f
no message
Oct 7, 2020
5157cfb
no message
Oct 17, 2020
fd7700a
- Bug fixes and minor improvements.
Oct 18, 2020
45a826a
- Bug fixes and minor improvements.
Oct 18, 2020
36896ad
- Bug fixes and minor improvements.
Oct 19, 2020
71e813c
- Bug fixes and minor improvements.
Oct 19, 2020
00aa7ca
no message
Oct 20, 2020
083f3e1
- Bug fixes and minor improvements.
Oct 21, 2020
1c0bdaf
- Bug fixes and minor improvements.
Oct 22, 2020
7ef5e47
- Bug fixes and minor improvements.
Oct 22, 2020
cc3ae1d
- Bug fixes and minor improvements.- Bug fixes and minor improvements.
Oct 23, 2020
2f31b1e
- Bug fixes and minor improvements.
Oct 23, 2020
a1a1e28
- Bug fixes and minor improvements.
Oct 25, 2020
0b1e6d1
- Bug fixes and minor improvements.
Oct 25, 2020
13f917e
• Rise and shine, Mr. Freeman. Rise and shine.
Oct 26, 2020
6409a56
• Rise and shine, Mr. Freeman. Rise and shine.
Oct 26, 2020
69a57e5
no message
Oct 27, 2020
4151173
no message
Oct 27, 2020
9effafa
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Oct 27, 2020
5c4cb58
• Rise and shine, Mr. Freeman. Rise and shine.
Oct 27, 2020
8fbc909
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Oct 27, 2020
75d8435
• Rise and shine, Mr. Freeman. Rise and shine.
Oct 27, 2020
e04422f
- Bug fixes and minor improvements.
Oct 27, 2020
41d0a13
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Oct 27, 2020
d0cdd31
- Bug fixes and minor improvements.
Oct 27, 2020
553a1c1
- Bug fixes and minor improvements.
Oct 28, 2020
9b37178
- Bug fixes and minor improvements.
Oct 28, 2020
ee285b2
- Bug fixes and minor improvements.
Oct 29, 2020
4690f78
- Bug fixes and minor improvements.
Oct 29, 2020
2e6bfd8
no message
Oct 30, 2020
b22de01
no message
Oct 30, 2020
89591ec
no message
Oct 30, 2020
f649d93
- Bug fixes and minor improvements.
Oct 30, 2020
7594929
no message
Oct 30, 2020
1412e28
no message
Oct 30, 2020
b566640
no message
Oct 30, 2020
d397d73
- Bug fixes and minor improvements.
Oct 30, 2020
76f6269
- Bug fixes and minor improvements.
Oct 30, 2020
7f45630
- Bug fixes and minor improvements.
Oct 31, 2020
0d901b9
- Bug fixes and minor improvements.
Oct 31, 2020
b399161
- Bug fixes and minor improvements.
Oct 31, 2020
0f8fd79
• Rise and shine, Mr. Freeman. Rise and shine.
Nov 2, 2020
54c49c9
no message
Nov 3, 2020
d20d20d
voice call bug fixes
Nov 3, 2020
ffea161
no message
Nov 5, 2020
8c0c82c
no message
Nov 5, 2020
2f6aade
- Bug fixes and minor improvements.
Nov 5, 2020
1834ddf
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Nov 6, 2020
79a8ef8
- Bug fixes and minor improvements.
Nov 6, 2020
c334462
no message
Nov 6, 2020
2fc4b22
- Bug fixes and minor improvements.
Nov 6, 2020
8397687
- Bug fixes and minor improvements.
Nov 6, 2020
47e4818
- Bug fixes and minor improvements.
Nov 6, 2020
2ce6069
no message
Nov 6, 2020
8867585
- Bug fixes and minor improvements.
Nov 7, 2020
d5b85df
Merge branch 'beta' into appstore
Nov 7, 2020
7afca9b
- Bug fixes and minor improvements.
Nov 9, 2020
12ac075
- Bug fixes and minor improvements.
Nov 9, 2020
8cf8c6b
Merge branch 'beta' into release
Nov 9, 2020
b57a36f
no message
Nov 9, 2020
e7e9dfe
- messages editing improvements.
Nov 10, 2020
3cc3b05
- small design update of profiles
Nov 11, 2020
70f3a0a
no message
Nov 11, 2020
d502141
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Nov 11, 2020
beadfde
- Bug fixes and minor improvements.
Nov 11, 2020
85c6ed0
- Bug fixes and minor improvements.
Nov 11, 2020
7190aef
- small design update of profiles
Nov 12, 2020
b6748d6
- small design update of profiles
Nov 12, 2020
c1f78a5
- small design update of profiles
Nov 12, 2020
e2927f0
fixes
Nov 13, 2020
7aff2bb
fixed IV crash
Nov 15, 2020
6bcc8bb
fixed IV crash
Nov 15, 2020
f169af9
fixes
Nov 15, 2020
133972f
new icon
Nov 16, 2020
cf936ba
no message
Nov 16, 2020
6cccf6e
no message
Nov 16, 2020
12a6fbe
no message
Nov 16, 2020
85d1e4c
no message
Nov 17, 2020
bdf0b3b
no message
Nov 17, 2020
e23b6c2
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Nov 17, 2020
98b7ac1
no message
Nov 17, 2020
8a6c4b2
no message
Nov 17, 2020
f9bcb7f
Merge branch 'beta' into alpha
Nov 17, 2020
5b06481
no message
Nov 17, 2020
20cb230
no message
Nov 17, 2020
92a7653
no message
Nov 17, 2020
83a6337
no message
Nov 18, 2020
62a0c0d
no message
Nov 18, 2020
82f69a2
no message
Nov 18, 2020
213d70b
no message
Nov 18, 2020
2b0cf18
sdk11
Nov 18, 2020
ed2b93b
sdk11
Nov 18, 2020
6b190f3
no message
Nov 18, 2020
5614fb5
no message
Nov 18, 2020
0d2a6f5
Merge branch 'release' into beta
Nov 18, 2020
1e164ac
no message
Nov 18, 2020
bca4c42
Merge branch 'release' into appstore
Nov 18, 2020
46636a7
arm
Nov 20, 2020
3717a24
no message
Nov 21, 2020
4ae0b79
no message
Nov 21, 2020
0abde09
Revert "no message"
Nov 21, 2020
7d223d2
include appcenter to main repository
Nov 21, 2020
a4838e9
no message
Nov 21, 2020
36bd6d1
update submodules
Nov 21, 2020
e2be00f
no message
Nov 21, 2020
2d288bb
no message
Nov 21, 2020
fc50670
Merge branch 'beta' into arm
Nov 21, 2020
d898952
no message
Nov 21, 2020
3ee55a2
no message
Nov 21, 2020
2b68515
Merge branch 'arm' into beta
Nov 21, 2020
a9424b8
arm support
Nov 21, 2020
c4c85e0
arm support
Nov 21, 2020
f498d2c
no message
Nov 21, 2020
09f08ea
no message
Nov 21, 2020
c0128c9
Merge branch 'beta' of gitlab.com:overtake/telegrammacos into beta
Nov 21, 2020
469d114
arm support
Nov 21, 2020
3bc7892
arm support
Nov 21, 2020
4a44f0c
arm support
Nov 21, 2020
9788450
ffmpeg-4.3
Nov 22, 2020
eaa9087
no message
Nov 22, 2020
47a9890
no message
Nov 22, 2020
d22307b
ffmpeg-4.4
Nov 22, 2020
a4e8d1e
ffmpeg-4.1
Nov 22, 2020
d146085
no message
Nov 22, 2020
3d1b623
ffmpeg-4.1
Nov 22, 2020
406abf7
temp
Nov 22, 2020
f26f4ae
no message
Nov 25, 2020
1d4214a
no message
Nov 25, 2020
58df7bb
no message
Nov 26, 2020
c71da79
Merge branch 'beta' into group-calls
Nov 26, 2020
644a2bb
no message
Nov 26, 2020
0835518
no message
Nov 27, 2020
44a239d
no message
Nov 28, 2020
63ed669
fix voices
Nov 28, 2020
bf0131a
no message
Nov 28, 2020
1d16421
no message
Nov 28, 2020
014295c
Merge branch 'beta' into release
Nov 28, 2020
e86632f
no message
Nov 28, 2020
dfcaa34
no message
Nov 28, 2020
5ef6d64
Merge branch 'release' into appstore
Nov 28, 2020
434a36b
no message
Nov 28, 2020
41def28
no message
Nov 28, 2020
3aabece
Merge branch 'beta' into release
Nov 28, 2020
e1e9984
no message
Nov 28, 2020
8c5eda7
Merge branch 'release' into appstore
Nov 28, 2020
a953a2a
no message
Nov 29, 2020
80281f9
no message
Nov 29, 2020
bcfa91f
no message
Nov 29, 2020
dde9647
no message
Nov 29, 2020
caa1fc5
no message
Nov 29, 2020
3ec417a
Merge branch 'release' into group-calls
Nov 30, 2020
05bfa18
no message
Dec 2, 2020
82ede87
no message
Dec 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
- Bug fixes and minor improvements.
  • Loading branch information
overtake committed Aug 13, 2020
commit 5308d60c1934be44a1abc25fad4c0881690bd820
6 changes: 3 additions & 3 deletions Telegram-Mac/CallNavigationHeaderView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CallNavigationHeaderView: NavigationHeaderView {
private var statusTimer: SwiftSignalKit.Timer?


var status: CallControllerStatusValue = .text("") {
var status: CallControllerStatusValue = .text("", nil) {
didSet {
if self.status != oldValue {
self.statusTimer?.invalidate()
Expand All @@ -52,9 +52,9 @@ class CallNavigationHeaderView: NavigationHeaderView {
private func updateStatus() {
var statusText: String = ""
switch self.status {
case let .text(text):
case let .text(text, _):
statusText = text
case let .timer(referenceTime):
case let .timer(referenceTime, _):
let duration = Int32(CFAbsoluteTimeGetCurrent() - referenceTime)
let durationString: String
if duration > 60 * 60 {
Expand Down
41 changes: 41 additions & 0 deletions Telegram-Mac/CallReceptionControl.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// CallReceptionControl.swift
// Telegram
//
// Created by Mikhail Filimonov on 13/08/2020.
// Copyright © 2020 Telegram. All rights reserved.
//

import Cocoa
import TGUIKit

class CallReceptionControl: View {

var reception: Int32 = 4 {
didSet {
self.needsDisplay = true
}
}

override func draw(_ layer: CALayer, in context: CGContext) {
super.draw(layer, in: context)

context.setFillColor(NSColor.white.cgColor)

let width: CGFloat = 3.0
let spacing: CGFloat = 2.0

for i in 0 ..< 4 {
let height = 4.0 + 2.0 * CGFloat(i)
let rect = CGRect(x: bounds.minX + CGFloat(i) * (width + spacing), y: frame.height - height, width: width, height: height)

if i >= reception {
context.setAlpha(0.4)
}
let path = NSBezierPath(roundedRect: rect, xRadius: 0.5, yRadius: 0.5)
context.addPath(path.cgPath)
context.fillPath()
}
}

}
114 changes: 114 additions & 0 deletions Telegram-Mac/CallStatusView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
//
// CallStatusView.swift
// Telegram
//
// Created by Mikhail Filimonov on 13/08/2020.
// Copyright © 2020 Telegram. All rights reserved.
//

import Cocoa
import TGUIKit
import SwiftSignalKit

enum CallControllerStatusValue: Equatable {
case text(String, Int32?)
case timer(Double, Int32?)
}


class CallStatusView: View {


private var statusTimer: SwiftSignalKit.Timer?

var status: CallControllerStatusValue = .text("", nil) {
didSet {
if self.status != oldValue {
self.statusTimer?.invalidate()
if case .timer = self.status {
self.statusTimer = SwiftSignalKit.Timer(timeout: 0.5, repeat: true, completion: { [weak self] in
self?.updateStatus()
}, queue: Queue.mainQueue())
self.statusTimer?.start()
self.updateStatus()
} else {
self.updateStatus()
}
}
}
}

private let statusTextView:NSTextField = NSTextField()
private let receptionView = CallReceptionControl(frame: NSMakeRect(0, 0, 24, 10))
required init(frame frameRect: NSRect) {
super.init(frame: frameRect)

statusTextView.font = .normal(18)
statusTextView.drawsBackground = false
statusTextView.backgroundColor = .random
statusTextView.textColor = nightAccentPalette.text
statusTextView.isSelectable = false
statusTextView.isEditable = false
statusTextView.isBordered = false
statusTextView.focusRingType = .none

addSubview(statusTextView)
addSubview(receptionView)
}

override func layout() {
super.layout()
if receptionView.isHidden {
statusTextView.center()
} else {
receptionView.centerY(x: 0)
statusTextView.centerY(x: receptionView.frame.maxX)
}

}

func sizeThatFits(_ size: NSSize) -> NSSize {
let textSize = statusTextView.sizeThatFits(size)
statusTextView.setFrameSize(textSize)
return NSMakeSize(max(textSize.width, 60) + 28, size.height)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}


deinit {
statusTimer?.invalidate()
}

func updateStatus() {
var statusText: String = ""
switch self.status {
case let .text(text, reception):
statusText = text
if let reception = reception {
self.receptionView.reception = reception
}
self.receptionView.isHidden = reception == nil
case let .timer(referenceTime, reception):
let duration = Int32(CFAbsoluteTimeGetCurrent() - referenceTime)
let durationString: String
if duration > 60 * 60 {
durationString = String(format: "%02d:%02d:%02d", arguments: [duration / 3600, (duration / 60) % 60, duration % 60])
} else {
durationString = String(format: "%02d:%02d", arguments: [(duration / 60) % 60, duration % 60])
}
statusText = durationString
if let reception = reception {
self.receptionView.reception = reception
}
self.receptionView.isHidden = reception == nil
}
statusTextView.stringValue = statusText
statusTextView.sizeToFit()
statusTextView.alignment = .center
needsLayout = true
}

}
70 changes: 13 additions & 57 deletions Telegram-Mac/CallWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -657,28 +657,8 @@ private class PhoneCallWindowView : View {

let muteControl:ImageButton = ImageButton()
private var textNameView: NSTextField = NSTextField()

private var statusTimer: SwiftSignalKit.Timer?

var status: CallControllerStatusValue = .text("") {
didSet {
if self.status != oldValue {
self.statusTimer?.invalidate()
if case .timer = self.status {
self.statusTimer = SwiftSignalKit.Timer(timeout: 0.5, repeat: true, completion: { [weak self] in
self?.updateStatus()
}, queue: Queue.mainQueue())
self.statusTimer?.start()
self.updateStatus()
} else {
self.updateStatus()
}
}
}
}


private var statusTextView:NSTextField = NSTextField()

private var statusView: CallStatusView = CallStatusView(frame: .zero)

private let secureTextView:TextView = TextView()

Expand Down Expand Up @@ -735,7 +715,7 @@ private class PhoneCallWindowView : View {


self.addSubview(textNameView)
self.addSubview(statusTextView)
self.addSubview(statusView)


controls.addSubview(acceptControl)
Expand All @@ -753,14 +733,7 @@ private class PhoneCallWindowView : View {
textNameView.alignment = .center
textNameView.cell?.truncatesLastVisibleLine = true
textNameView.lineBreakMode = .byTruncatingTail
statusTextView.font = .normal(18)
statusTextView.drawsBackground = false
statusTextView.backgroundColor = .clear
statusTextView.textColor = nightAccentPalette.text
statusTextView.isSelectable = false
statusTextView.isEditable = false
statusTextView.isBordered = false
statusTextView.focusRingType = .none


imageView.setFrameSize(frameRect.size.width, frameRect.size.height)

Expand Down Expand Up @@ -826,6 +799,9 @@ private class PhoneCallWindowView : View {
size.height > (window.frame.height - 40) {
return
}
if size.width < 50 || size.height < 50 {
return
}
self.outgoingVideoView.updateFrame(CGRect(origin: point, size: size), animated: false)

} else {
Expand Down Expand Up @@ -910,10 +886,10 @@ private class PhoneCallWindowView : View {

textNameView.setFrameSize(NSMakeSize(controls.frame.width - 40, 36))
textNameView.centerX(y: 50)
statusTextView.setFrameSize(statusTextView.sizeThatFits(NSMakeSize(controls.frame.width - 40, 25)))
statusTextView.centerX(y: textNameView.frame.maxY + 4)
statusView.setFrameSize(statusView.sizeThatFits(NSMakeSize(controls.frame.width - 40, 25)))
statusView.centerX(y: textNameView.frame.maxY + 4)

secureTextView.centerX(y: statusTextView.frame.maxY + 4)
secureTextView.centerX(y: statusView.frame.maxY + 4)

let controlsSize = NSMakeSize(frame.width, 220)
controls.frame = NSMakeRect(0, frame.height - controlsSize.height, controlsSize.width, controlsSize.height)
Expand Down Expand Up @@ -1045,25 +1021,6 @@ private class PhoneCallWindowView : View {
needsLayout = true
}

func updateStatus() {
var statusText: String = ""
switch self.status {
case let .text(text):
statusText = text
case let .timer(referenceTime):
let duration = Int32(CFAbsoluteTimeGetCurrent() - referenceTime)
let durationString: String
if duration > 60 * 60 {
durationString = String(format: "%02d:%02d:%02d", arguments: [duration / 3600, (duration / 60) % 60, duration % 60])
} else {
durationString = String(format: "%02d:%02d", arguments: [(duration / 60) % 60, duration % 60])
}
statusText = durationString
}
statusTextView.stringValue = statusText
statusTextView.alignment = .center
needsLayout = true
}

func updateControlsVisibility() {
if let state = state {
Expand All @@ -1073,7 +1030,7 @@ private class PhoneCallWindowView : View {
self.controls.change(opacity: self.mouseInside() ? 1.0 : 0.0)
self.textNameView._change(opacity: self.mouseInside() ? 1.0 : 0.0)
self.secureTextView._change(opacity: self.mouseInside() ? 1.0 : 0.0)
self.statusTextView._change(opacity: self.mouseInside() ? 1.0 : 0.0)
self.statusView._change(opacity: self.mouseInside() ? 1.0 : 0.0)

for tooltip in tooltips {
tooltip.change(opacity: self.mouseInside() ? 1.0 : 0.0)
Expand All @@ -1084,7 +1041,7 @@ private class PhoneCallWindowView : View {
self.controls.change(opacity: 1.0)
self.textNameView._change(opacity: 1.0)
self.secureTextView._change(opacity: 1.0)
self.statusTextView._change(opacity: 1.0)
self.statusView._change(opacity: 1.0)

for tooltip in tooltips {
tooltip.change(opacity: 1.0)
Expand Down Expand Up @@ -1112,7 +1069,7 @@ private class PhoneCallWindowView : View {
self.b_Mute.updateEnabled(state.muteIsAvailable, animated: animated)

self.state = state
self.status = state.state.statusText(accountPeer, state.videoState)
self.statusView.status = state.state.statusText(accountPeer, state.videoState)

switch state.state {
case let .active(_, _, visual):
Expand Down Expand Up @@ -1448,7 +1405,6 @@ private class PhoneCallWindowView : View {

deinit {
fetching.dispose()
statusTimer?.invalidate()
}
}

Expand Down
2 changes: 1 addition & 1 deletion Telegram-Mac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>204149</string>
<string>204161</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.social-networking</string>
<key>LSFileQuarantineEnabled</key>
Expand Down
30 changes: 13 additions & 17 deletions Telegram-Mac/PCallSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,53 +25,49 @@ enum CallTone {
}


enum CallControllerStatusValue: Equatable {
case text(String)
case timer(Double)
}


extension CallState.State {
func statusText(_ accountPeer: Peer?, _ videoState: CallState.VideoState) -> CallControllerStatusValue {
let statusValue: CallControllerStatusValue
switch self {
case .waiting, .connecting:
statusValue = .text(L10n.callStatusConnecting)
statusValue = .text(L10n.callStatusConnecting, nil)
case let .requesting(ringing):
if ringing {
statusValue = .text(L10n.callStatusRinging)
statusValue = .text(L10n.callStatusRinging, nil)
} else {
statusValue = .text(L10n.callStatusRequesting)
statusValue = .text(L10n.callStatusRequesting, nil)
}
case .terminating:
statusValue = .text(L10n.callStatusEnded)
statusValue = .text(L10n.callStatusEnded, nil)
case let .terminated(_, reason, _):
if let reason = reason {
switch reason {
case let .ended(type):
switch type {
case .busy:
statusValue = .text(L10n.callStatusBusy)
statusValue = .text(L10n.callStatusBusy, nil)
case .hungUp, .missed:
statusValue = .text(L10n.callStatusEnded)
statusValue = .text(L10n.callStatusEnded, nil)
}
case .error:
statusValue = .text(L10n.callStatusFailed)
statusValue = .text(L10n.callStatusFailed, nil)
}
} else {
statusValue = .text(L10n.callStatusEnded)
statusValue = .text(L10n.callStatusEnded, nil)
}
case .ringing:
if let accountPeer = accountPeer {
statusValue = .text(L10n.callStatusCallingAccount(accountPeer.addressName ?? accountPeer.compactDisplayTitle))
statusValue = .text(L10n.callStatusCallingAccount(accountPeer.addressName ?? accountPeer.compactDisplayTitle), nil)
} else {
statusValue = .text(L10n.callStatusCalling)
statusValue = .text(L10n.callStatusCalling, nil)
}
case .active(let timestamp, _, _), .reconnecting(let timestamp, _, _):
case .active(let timestamp, let reception, _), .reconnecting(let timestamp, let reception, _):
if case .reconnecting = self {
statusValue = .text(L10n.callStatusConnecting)
statusValue = .text(L10n.callStatusConnecting, reception)
} else {
statusValue = .timer(timestamp)
statusValue = .timer(timestamp, reception)
}
}
return statusValue
Expand Down
Loading