|  |  | @ -609,12 +609,7 @@ private class SignalCallData: NSObject { | 
			
		
	
		
		
			
				
					
					|  |  |  |     public func handleMissedCall(_ call: SignalCall) { |  |  |  |     public func handleMissedCall(_ call: SignalCall) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         AssertIsOnMainThread() |  |  |  |         AssertIsOnMainThread() | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         // Insert missed call record |  |  |  |         if call.callRecord == nil { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         if let callRecord = call.callRecord { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if callRecord.callType == RPRecentCallTypeIncoming { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 callRecord.updateCallType(RPRecentCallTypeIncomingMissed) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             // MJK TODO remove this timestamp param |  |  |  |             // MJK TODO remove this timestamp param | 
			
		
	
		
		
			
				
					
					|  |  |  |             call.callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), |  |  |  |             call.callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), | 
			
		
	
		
		
			
				
					
					|  |  |  |                                      withCallNumber: call.thread.contactIdentifier(), |  |  |  |                                      withCallNumber: call.thread.contactIdentifier(), | 
			
		
	
	
		
		
			
				
					|  |  | @ -622,10 +617,27 @@ private class SignalCallData: NSObject { | 
			
		
	
		
		
			
				
					
					|  |  |  |                                      in: call.thread) |  |  |  |                                      in: call.thread) | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         assert(call.callRecord != nil) |  |  |  |         guard let callRecord = call.callRecord else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         call.callRecord?.save() |  |  |  |             handleFailedCall(failedCall: call, error: .assertionError(description: "callRecord was unexpectedly nil")) | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         self.callUIAdapter.reportMissedCall(call) |  |  |  |         switch callRecord.callType { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingMissed: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callRecord.save() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callUIAdapter.reportMissedCall(call) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingIncomplete, RPRecentCallTypeIncoming: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callRecord.updateCallType(RPRecentCallTypeIncomingMissed) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callUIAdapter.reportMissedCall(call) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeOutgoingIncomplete: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callRecord.updateCallType(RPRecentCallTypeOutgoingMissed) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity, RPRecentCallTypeIncomingDeclined, RPRecentCallTypeOutgoingMissed, RPRecentCallTypeOutgoing: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             owsFailDebug("unexpected RPRecentCallType: \(callRecord.callType)") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callRecord.save() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         default: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             callRecord.save() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             owsFailDebug("unknown RPRecentCallType: \(callRecord.callType)") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
	
		
		
			
				
					|  |  | @ -670,6 +682,9 @@ private class SignalCallData: NSObject { | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         call.state = .remoteBusy |  |  |  |         call.state = .remoteBusy | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         assert(call.callRecord != nil) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         call.callRecord?.updateCallType(RPRecentCallTypeOutgoingMissed) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         callUIAdapter.remoteBusy(call) |  |  |  |         callUIAdapter.remoteBusy(call) | 
			
		
	
		
		
			
				
					
					|  |  |  |         terminateCall() |  |  |  |         terminateCall() | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -1921,3 +1936,29 @@ private class SignalCallData: NSObject { | 
			
		
	
		
		
			
				
					
					|  |  |  |         handleFailedCall(failedCall: call, error: CallError.messageSendFailure(underlyingError: error)) |  |  |  |         handleFailedCall(failedCall: call, error: CallError.messageSendFailure(underlyingError: error)) | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | extension RPRecentCallType: CustomStringConvertible { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public var description: String { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         switch self { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncoming: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeIncoming" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeOutgoing: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeOutgoing" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingMissed: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeIncomingMissed" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeOutgoingIncomplete: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeOutgoingIncomplete" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingIncomplete: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeIncomingIncomplete" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeIncomingMissedBecauseOfChangedIdentity" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeIncomingDeclined: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeIncomingDeclined" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         case RPRecentCallTypeOutgoingMissed: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeOutgoingMissed" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         default: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             owsFailDebug("unexpected RPRecentCallType: \(self)") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return "RPRecentCallTypeUnknown" | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |