Respond to CR.

// FREEBIE
pull/1/head
Matthew Chen 8 years ago
parent 06a775b41a
commit dea37b422b

@ -25,7 +25,6 @@
#import <PastelogKit/Pastelog.h>
#import <PromiseKit/AnyPromise.h>
#import <SignalServiceKit/OWSDisappearingMessagesJob.h>
#import <SignalServiceKit/OWSDispatch.h>
#import <SignalServiceKit/OWSIncomingMessageReadObserver.h>
#import <SignalServiceKit/OWSMessageSender.h>
#import <SignalServiceKit/TSAccountManager.h>

@ -52,12 +52,6 @@ import Foundation
ensureIsEnabled(call: call)
}
internal func callRecordDidChange(call: SignalCall, callRecord: TSCall?) {
AssertIsOnMainThread()
// Do nothing.
}
private func ensureIsEnabled(call: SignalCall) {
// Auto-enable speakerphone when local video is enabled.
if call.hasLocalVideo {

@ -388,14 +388,17 @@ protocol CallServiceObserver: class {
*/
public func handleMissedCall(_ call: SignalCall, thread: TSContactThread) {
AssertIsOnMainThread()
// Insert missed call record
if call.callRecord == nil {
if let callRecord = call.callRecord {
if (callRecord.callType == RPRecentCallTypeIncoming) {
callRecord.updateCallType(RPRecentCallTypeMissed)
}
} else {
call.callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(),
withCallNumber: thread.contactIdentifier(),
callType: RPRecentCallTypeMissed,
in: thread)
} else if (call.callRecord!.callType == RPRecentCallTypeIncoming) {
call.callRecord!.updateCallType(RPRecentCallTypeMissed)
}
assert(call.callRecord != nil)
@ -1150,7 +1153,6 @@ protocol CallServiceObserver: class {
AssertIsOnMainThread()
Logger.info("\(self.TAG) \(#function): \(state)")
updateIsVideoEnabled()
updateCallRecordType(call: call)
}
internal func hasLocalVideoDidChange(call: SignalCall, hasLocalVideo: Bool) {
@ -1169,33 +1171,6 @@ protocol CallServiceObserver: class {
// Do nothing
}
internal func callRecordDidChange(call: SignalCall, callRecord: TSCall?) {
AssertIsOnMainThread()
updateCallRecordType(call: call)
}
internal func updateCallRecordType(call: SignalCall?) {
AssertIsOnMainThread()
guard call != nil else {
return
}
guard call!.callRecord != nil else {
return
}
// Mark incomplete calls as completed if call has connected.
if call!.state == .connected &&
call!.callRecord!.callType == RPRecentCallTypeOutgoingIncomplete {
call!.callRecord!.updateCallType(RPRecentCallTypeOutgoing)
}
if call!.state == .connected &&
call!.callRecord!.callType == RPRecentCallTypeIncomingIncomplete {
call!.callRecord!.updateCallType(RPRecentCallTypeIncoming)
}
}
// MARK: - Video
private func shouldHaveLocalVideoTrack() -> Bool {

@ -27,7 +27,6 @@ protocol CallObserver: class {
func hasLocalVideoDidChange(call: SignalCall, hasLocalVideo: Bool)
func muteDidChange(call: SignalCall, isMuted: Bool)
func speakerphoneDidChange(call: SignalCall, isEnabled: Bool)
func callRecordDidChange(call: SignalCall, callRecord: TSCall?)
}
/**
@ -55,9 +54,7 @@ protocol CallObserver: class {
AssertIsOnMainThread()
assert(oldValue == nil)
for observer in observers {
observer.value?.callRecordDidChange(call: self, callRecord: callRecord)
}
updateCallRecordType()
}
}
@ -85,6 +82,8 @@ protocol CallObserver: class {
connectedDate = nil
}
updateCallRecordType()
for observer in observers {
observer.value?.stateDidChange(call: self, state: state)
}
@ -164,6 +163,24 @@ protocol CallObserver: class {
observers = []
}
private func updateCallRecordType() {
AssertIsOnMainThread()
guard let callRecord = self.callRecord else {
return
}
// Mark incomplete calls as completed if call has connected.
if state == .connected &&
callRecord.callType == RPRecentCallTypeOutgoingIncomplete {
callRecord.updateCallType(RPRecentCallTypeOutgoing)
}
if state == .connected &&
callRecord.callType == RPRecentCallTypeIncomingIncomplete {
callRecord.updateCallType(RPRecentCallTypeIncoming)
}
}
// MARK: Equatable
static func == (lhs: SignalCall, rhs: SignalCall) -> Bool {

@ -733,12 +733,6 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R
self.updateCallUI(callState: call.state)
}
internal func callRecordDidChange(call: SignalCall, callRecord: TSCall?) {
AssertIsOnMainThread()
// Do nothing.
}
// MARK: - Video
internal func updateLocalVideoTrack(localVideoTrack: RTCVideoTrack?) {

Loading…
Cancel
Save