From 1f9f066fa938a9e82b7a316643c810ba919809f4 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 3 Jul 2017 13:50:56 -0500 Subject: [PATCH] print call record when declining a call // FREEBIE --- Podfile.lock | 2 +- Signal/src/call/CallService.swift | 13 ++++++++++--- Signal/translations/en.lproj/Localizable.strings | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index fc14b1f7d..9011bcf10 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -134,7 +134,7 @@ CHECKOUT OPTIONS: :commit: 521686c112bbae7a762f85d52b1e41eeb1760772 :git: https://github.com/WhisperSystems/JSQMessagesViewController.git SignalServiceKit: - :commit: 04ef06ce95d553116d6b53984f0dcf9429ab78f4 + :commit: 1fc5f7728613b7cc3f498d4e0fcccc5f8389b0a1 :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 877ac7438be3ad0b45ef5ca3969574e4b97112bf diff --git a/Signal/src/call/CallService.swift b/Signal/src/call/CallService.swift index fef8800e3..3e0cff8be 100644 --- a/Signal/src/call/CallService.swift +++ b/Signal/src/call/CallService.swift @@ -733,7 +733,7 @@ protocol CallServiceObserver: class { } /** - * User chose to answer call referrred to by call `localId`. Used by the Callee only. + * User chose to answer call referred to by call `localId`. Used by the Callee only. * * Used by notification actions which can't serialize a call object. */ @@ -758,7 +758,7 @@ protocol CallServiceObserver: class { } /** - * User chose to answer call referrred to by call `localId`. Used by the Callee only. + * User chose to answer call referred to by call `localId`. Used by the Callee only. */ public func handleAnswerCall(_ call: SignalCall) { AssertIsOnMainThread() @@ -857,7 +857,14 @@ protocol CallServiceObserver: class { Logger.info("\(TAG) in \(#function): \(call.identifiersForLogs).") - // TODO make call record. + if let callRecord = call.callRecord { + assertionFailure("Not expecting callrecord to already be set") + callRecord.updateCallType(RPRecentCallTypeIncomingDeclined) + } else { + let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.remotePhoneNumber, callType: RPRecentCallTypeIncomingDeclined, in: call.thread) + callRecord.save() + call.callRecord = callRecord + } // Currently we just handle this as a hangup. But we could offer more descriptive action. e.g. DataChannel message handleLocalHungupCall(call) diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 06db3f997..d0348ee66 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -643,6 +643,9 @@ /* notification body */ "INCOMING_CALL_FROM" = "Incoming call from %@"; +/* info message recorded in conversation history when local user declined a call */ +"INCOMING_DECLINED_CALL" = "You declined a call"; + /* No comment provided by engineer. */ "INCOMING_INCOMPLETE_CALL" = "Incomplete incoming call from";