Merge branch 'charlesmchen/callStatusMessages'

pull/1/head
Matthew Chen 8 years ago
commit 84d988a013

@ -5,8 +5,8 @@ target 'Signal' do
pod 'SocketRocket', :git => 'https://github.com/facebook/SocketRocket.git'
pod 'AxolotlKit', git: 'https://github.com/WhisperSystems/SignalProtocolKit.git'
#pod 'AxolotlKit', path: '../SignalProtocolKit'
pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git'
#pod 'SignalServiceKit', path: '../SignalServiceKit'
#pod 'SignalServiceKit', git: 'https://github.com/WhisperSystems/SignalServiceKit.git'
pod 'SignalServiceKit', path: '../SignalServiceKit'
pod 'OpenSSL'
pod 'PastelogKit', '~> 1.3'
pod 'FFCircularProgressView', '~> 0.5'

@ -123,7 +123,7 @@ DEPENDENCIES:
- PastelogKit (~> 1.3)
- PureLayout
- SCWaveformView (~> 1.0)
- SignalServiceKit (from `https://github.com/WhisperSystems/SignalServiceKit.git`)
- SignalServiceKit (from `../SignalServiceKit`)
- SocketRocket (from `https://github.com/facebook/SocketRocket.git`)
- ZXingObjC
@ -131,7 +131,7 @@ EXTERNAL SOURCES:
AxolotlKit:
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit:
:git: https://github.com/WhisperSystems/SignalServiceKit.git
:path: ../SignalServiceKit
SocketRocket:
:git: https://github.com/facebook/SocketRocket.git
@ -139,9 +139,6 @@ CHECKOUT OPTIONS:
AxolotlKit:
:commit: 919d541d6b8a8802a94f943026b8f68394e2c0b8
:git: https://github.com/WhisperSystems/SignalProtocolKit.git
SignalServiceKit:
:commit: 4d055757de63762648471951bef4bc3d2b9476ed
:git: https://github.com/WhisperSystems/SignalServiceKit.git
SocketRocket:
:commit: 41b57bb2fc292a814f758441a05243eb38457027
:git: https://github.com/facebook/SocketRocket.git
@ -172,6 +169,6 @@ SPEC CHECKSUMS:
YapDatabase: b1e43555a34a5298e23a045be96817a5ef0da58f
ZXingObjC: bf15b3814f7a105b6d99f47da2333c93a063650a
PODFILE CHECKSUM: 48dbf2fb380d626bb799a782dd41b6bf1e466506
PODFILE CHECKSUM: bc79f89ae559d9f61d1471a89fd44471609af69d
COCOAPODS: 1.0.1

@ -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>

@ -1,5 +1,6 @@
// Created by Dylan Bourgeois on 20/11/14.
// Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSMessageData.h"
@ -12,9 +13,11 @@ typedef enum : NSUInteger {
kCallOutgoing = 1,
kCallIncoming = 2,
kCallMissed = 3,
kGroupUpdateJoin = 4,
kGroupUpdateLeft = 5,
kGroupUpdate = 6
kCallOutgoingIncomplete = 4,
kCallIncomingIncomplete = 5,
kGroupUpdateJoin = 6,
kGroupUpdateLeft = 7,
kGroupUpdate = 8,
} CallStatus;
@interface OWSCall : NSObject <OWSMessageData>

@ -1,5 +1,6 @@
// Created by Dylan Bourgeois on 20/11/14.
// Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved.
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
//
#import "OWSCall.h"
#import "TSCall.h"
@ -41,12 +42,18 @@ NS_ASSUME_NONNULL_BEGIN
case RPRecentCallTypeOutgoing:
status = kCallOutgoing;
break;
case RPRecentCallTypeOutgoingIncomplete:
status = kCallOutgoingIncomplete;
break;
case RPRecentCallTypeMissed:
status = kCallMissed;
break;
case RPRecentCallTypeIncoming:
status = kCallIncoming;
break;
case RPRecentCallTypeIncomingIncomplete:
status = kCallIncomingIncomplete;
break;
default:
status = kCallIncoming;
break;
@ -61,9 +68,15 @@ NS_ASSUME_NONNULL_BEGIN
case kCallIncoming:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_RECEIVED_CALL", nil), name];
break;
case kCallIncomingIncomplete:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_THEY_TRIED_TO_CALL_YOU", nil), name];
break;
case kCallOutgoing:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_YOU_CALLED", nil), name];
break;
case kCallOutgoingIncomplete:
detailString = [NSString stringWithFormat:NSLocalizedString(@"MSGVIEW_YOU_TRIED_TO_CALL", nil), name];
break;
default:
detailString = @"";
break;

@ -285,8 +285,9 @@ protocol CallServiceObserver: class {
sendIceUpdatesImmediately = false
pendingIceUpdateMessages = []
let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.remotePhoneNumber, callType: RPRecentCallTypeOutgoing, in: thread)
let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.remotePhoneNumber, callType: RPRecentCallTypeOutgoingIncomplete, in: thread)
callRecord.save()
call.callRecord = callRecord
guard self.peerConnectionClient == nil else {
let errorDescription = "\(TAG) peerconnection was unexpectedly already set."
@ -387,12 +388,21 @@ protocol CallServiceObserver: class {
*/
public func handleMissedCall(_ call: SignalCall, thread: TSContactThread) {
AssertIsOnMainThread()
// Insert missed call record
let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(),
withCallNumber: thread.contactIdentifier(),
callType: RPRecentCallTypeMissed,
in: thread)
callRecord.save()
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)
}
assert(call.callRecord != nil)
call.callRecord?.save()
self.callUIAdapter.reportMissedCall(call)
}
@ -715,8 +725,9 @@ protocol CallServiceObserver: class {
return
}
let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.remotePhoneNumber, callType: RPRecentCallTypeIncoming, in: thread)
let callRecord = TSCall(timestamp: NSDate.ows_millisecondTimeStamp(), withCallNumber: call.remotePhoneNumber, callType: RPRecentCallTypeIncomingIncomplete, in: thread)
callRecord.save()
call.callRecord = callRecord
let message = DataChannelMessage.forConnected(callId: call.signalingId)
peerConnectionClient.sendDataChannelMessage(data: message.asData())

@ -49,6 +49,15 @@ protocol CallObserver: class {
// Distinguishes between calls locally, e.g. in CallKit
let localId: UUID
var callRecord: TSCall? {
didSet {
AssertIsOnMainThread()
assert(oldValue == nil)
updateCallRecordType()
}
}
var hasLocalVideo = false {
didSet {
AssertIsOnMainThread()
@ -73,6 +82,8 @@ protocol CallObserver: class {
connectedDate = nil
}
updateCallRecordType()
for observer in observers {
observer.value?.stateDidChange(call: self, state: state)
}
@ -152,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 {

@ -376,6 +376,9 @@
/* notification body */
"INCOMING_CALL_FROM" = "Incoming call from %@";
/* No comment provided by engineer. */
"INCOMING_INCOMPLETE_CALL" = "Incomplete incoming call from";
/* Text for button at the top of the contact picker */
"INVITE_FRIENDS_CONTACT_TABLE_BUTTON" = "Invite Friends to Signal";
@ -471,9 +474,15 @@
/* No comment provided by engineer. */
"MSGVIEW_RECEIVED_CALL" = "You received a call from %@.";
/* No comment provided by engineer. */
"MSGVIEW_THEY_TRIED_TO_CALL_YOU" = "%@ tried to call you.";
/* No comment provided by engineer. */
"MSGVIEW_YOU_CALLED" = "You called %@.";
/* No comment provided by engineer. */
"MSGVIEW_YOU_TRIED_TO_CALL" = "You tried to call %@.";
/* No comment provided by engineer. */
"MULTIDEVICE_PAIRING_MAX_DESC" = "You can not pair any more devices.";
@ -558,6 +567,9 @@
/* No comment provided by engineer. */
"OUTGOING_CALL" = "Outgoing call";
/* No comment provided by engineer. */
"OUTGOING_INCOMPLETE_CALL" = "Incomplete outgoing call";
/* Alert body when verifying with {{contact name}} */
"PRIVACY_VERIFICATION_FAILED_I_HAVE_WRONG_KEY_FOR_THEM" = "This doesn't look like your safety number with %@. Are you verifying the correct contact?";

Loading…
Cancel
Save