@ -273,8 +273,8 @@ protocol CallServiceObserver: class {
let errorDescription = " \( TAG ) call was unexpectedly already set. "
Logger . error ( errorDescription )
call . state = . localFailure
OWSProdError ( " call_service_call_already_set " , file : #file , function : #function , line : #line )
return Promise ( error : . assertionError ( errorDescription ) )
OWSProdError ( OWSAnalyticsEvents . call_service_call_already_set ( ) , file : #file , function : #function , line : #line )
return Promise ( error : CallError . assertionError ( description : errorDescription ) )
}
self . call = call
@ -297,7 +297,7 @@ protocol CallServiceObserver: class {
let errorDescription = " \( self . TAG ) peerconnection was unexpectedly already set. "
Logger . error ( errorDescription )
OWSProdError ( " call_service_peer_connection_already_set " , file : #file , function : #function , line : #line )
throw . assertionError ( errorDescription )
throw CallError . assertionError ( description : errorDescription )
}
let useTurnOnly = Environment . getCurrent ( ) . preferences . doCallsHideIPAddress ( )
@ -374,7 +374,7 @@ protocol CallServiceObserver: class {
guard let fulfillReadyToSendIceUpdatesPromise = self . fulfillReadyToSendIceUpdatesPromise else {
OWSProdError ( " call_service_missing_fulfill_ready_to_send_ice_updates_promise " , file : #file , function : #function , line : #line )
self . handleFailedCall ( failedCall : call , error : . assertionError ( " failed to create fulfillReadyToSendIceUpdatesPromise " ) )
self . handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " failed to create fulfillReadyToSendIceUpdatesPromise " ) )
return
}
@ -413,7 +413,7 @@ protocol CallServiceObserver: class {
guard let peerConnectionClient = self . peerConnectionClient else {
OWSProdError ( " call_service_peer_connection_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " peerConnectionClient was unexpectedly nil in \( #function ) " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " peerConnectionClient was unexpectedly nil in \( #function ) " ) )
return
}
@ -702,7 +702,7 @@ protocol CallServiceObserver: class {
guard let call = self . call else {
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
self . handleFailedCurrentCall ( error : . assertionError ( " ignoring local ice candidate, since there is no current call. " ) )
self . handleFailedCurrentCall ( error : CallError . assertionError ( description : " ignoring local ice candidate, since there is no current call. " ) )
return
}
@ -718,7 +718,7 @@ protocol CallServiceObserver: class {
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// f a i l t h e c u r r e n t c a l l .
OWSProdError ( " call_service_call_unexpectedly_idle " , file : #file , function : #function , line : #line )
self . handleFailedCurrentCall ( error : . assertionError ( " ignoring local ice candidate, since call is now idle. " ) )
self . handleFailedCurrentCall ( error : CallError . assertionError ( description : " ignoring local ice candidate, since call is now idle. " ) )
return
}
@ -755,7 +755,7 @@ protocol CallServiceObserver: class {
// T h i s w i l l o n l y b e c a l l e d f o r t h e c u r r e n t p e e r C o n n e c t i o n C l i e n t , s o
// f a i l t h e c u r r e n t c a l l .
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) ignoring \( #function ) since there is no current call. " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) ignoring \( #function ) since there is no current call. " ) )
return
}
@ -825,7 +825,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) call was unexpectedly nil in \( #function ) " )
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) call was unexpectedly nil in \( #function ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) call was unexpectedly nil in \( #function ) " ) )
return
}
@ -833,7 +833,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
OWSProdError ( " call_service_call_id_mismatch " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " ) )
return
}
@ -850,7 +850,7 @@ protocol CallServiceObserver: class {
guard let currentCall = self . call else {
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) ignoring \( #function ) since there is no current call " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) ignoring \( #function ) since there is no current call " ) )
return
}
@ -863,7 +863,7 @@ protocol CallServiceObserver: class {
guard let peerConnectionClient = self . peerConnectionClient else {
OWSProdError ( " call_service_peer_connection_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) missing peerconnection client in \( #function ) " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) missing peerconnection client in \( #function ) " ) )
return
}
@ -889,7 +889,7 @@ protocol CallServiceObserver: class {
guard let peerConnectionClient = self . peerConnectionClient else {
OWSProdError ( " call_service_peer_connection_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) peerConnectionClient unexpectedly nil in \( #function ) " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) peerConnectionClient unexpectedly nil in \( #function ) " ) )
return
}
@ -920,7 +920,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) call was unexpectedly nil in \( #function ) " )
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) call was unexpectedly nil in \( #function ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) call was unexpectedly nil in \( #function ) " ) )
return
}
@ -928,7 +928,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " )
OWSProdError ( " call_service_call_id_mismatch " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) callLocalId: \( localId ) doesn't match current calls: \( call . localId ) " ) )
return
}
@ -968,19 +968,19 @@ protocol CallServiceObserver: class {
guard let currentCall = self . call else {
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) ignoring \( #function ) since there is no current call " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) ignoring \( #function ) since there is no current call " ) )
return
}
guard call = = currentCall else {
OWSProdError ( " call_service_call_mismatch " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) ignoring \( #function ) for call other than current call " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) ignoring \( #function ) for call other than current call " ) )
return
}
guard let peerConnectionClient = self . peerConnectionClient else {
OWSProdError ( " call_service_peer_connection_missing " , file : #file , function : #function , line : #line )
handleFailedCall ( failedCall : call , error : . assertionError ( " \( TAG ) missing peerconnection client in \( #function ) " ) )
handleFailedCall ( failedCall : call , error : CallError . assertionError ( description : " \( TAG ) missing peerconnection client in \( #function ) " ) )
return
}
@ -1021,7 +1021,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) call was unexpectedly nil in \( #function ) " )
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) call unexpectedly nil in \( #function ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) call unexpectedly nil in \( #function ) " ) )
return
}
@ -1076,7 +1076,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) call was unexpectedly nil in \( #function ) " )
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) call unexpectedly nil in \( #function ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) call unexpectedly nil in \( #function ) " ) )
return
}
@ -1115,7 +1115,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) received data message, but there is no current call. Ignoring. " )
OWSProdError ( " call_service_call_missing " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) received data message, but there is no current call. Ignoring. " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) received data message, but there is no current call. Ignoring. " ) )
return
}
@ -1128,7 +1128,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) received connected message for call with id: \( connected . id ) but current call has id: \( call . signalingId ) " )
OWSProdError ( " call_service_call_id_mismatch " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) received connected message for call with id: \( connected . id ) but current call has id: \( call . signalingId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) received connected message for call with id: \( connected . id ) but current call has id: \( call . signalingId ) " ) )
return
}
@ -1144,7 +1144,7 @@ protocol CallServiceObserver: class {
// T h i s s h o u l d n e v e r h a p p e n ; r e t u r n t o a k n o w n g o o d s t a t e .
owsFail ( " \( TAG ) received hangup message for call with id: \( hangup . id ) but current call has id: \( call . signalingId ) " )
OWSProdError ( " call_service_call_id_mismatch " , file : #file , function : #function , line : #line )
handleFailedCurrentCall ( error : . assertionError ( " \( TAG ) received hangup message for call with id: \( hangup . id ) but current call has id: \( call . signalingId ) " ) )
handleFailedCurrentCall ( error : CallError . assertionError ( description : " \( TAG ) received hangup message for call with id: \( hangup . id ) but current call has id: \( call . signalingId ) " ) )
return
}
@ -1252,7 +1252,7 @@ protocol CallServiceObserver: class {
guard let readyToSendIceUpdatesPromise = self . readyToSendIceUpdatesPromise else {
OWSProdError ( " call_service_could_not_create_ready_to_send_ice_updates_promise " , file : #file , function : #function , line : #line )
return Promise ( error : . assertionError ( " failed to create readyToSendIceUpdatesPromise " ) )
return Promise ( error : CallError . assertionError ( description : " failed to create readyToSendIceUpdatesPromise " ) )
}
return readyToSendIceUpdatesPromise
@ -1296,7 +1296,7 @@ protocol CallServiceObserver: class {
guard let peerConnectionClientPromise = self . peerConnectionClientPromise else {
OWSProdError ( " call_service_could_not_create_peer_connection_client_promise " , file : #file , function : #function , line : #line )
return Promise ( error : . assertionError ( " failed to create peerConnectionClientPromise " ) )
return Promise ( error : CallError . assertionError ( description : " failed to create peerConnectionClientPromise " ) )
}
return peerConnectionClientPromise
@ -1375,7 +1375,7 @@ protocol CallServiceObserver: class {
public func handleFailedCall ( failedCall : SignalCall ? , error : CallError ) {
AssertIsOnMainThread ( )
if case . assertionError ( let description ) = error {
if case CallError . assertionError ( description : let description ) = error {
owsFail ( description )
}