From 90b85c0605064d07a41ac0508a8a88e303c45851 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Wed, 8 Feb 2017 15:51:53 -0500 Subject: [PATCH] Improve the call status messages in conversation view. // FREEBIE --- src/Messages/TSCall.h | 5 +++++ src/Messages/TSCall.m | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/Messages/TSCall.h b/src/Messages/TSCall.h index 8ccef0362..2ea46fd81 100644 --- a/src/Messages/TSCall.h +++ b/src/Messages/TSCall.h @@ -13,6 +13,9 @@ typedef enum { RPRecentCallTypeIncoming = 1, RPRecentCallTypeOutgoing, RPRecentCallTypeMissed, + // These call types are used until the call connects. + RPRecentCallTypeOutgoingIncomplete, + RPRecentCallTypeIncomingIncomplete, } RPRecentCallType; @interface TSCall : TSInteraction @@ -26,6 +29,8 @@ typedef enum { - (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER; +- (void)updateCallType:(RPRecentCallType)callType; + @end NS_ASSUME_NONNULL_END diff --git a/src/Messages/TSCall.m b/src/Messages/TSCall.m index d3f3631c7..293be8baa 100644 --- a/src/Messages/TSCall.m +++ b/src/Messages/TSCall.m @@ -68,6 +68,10 @@ NSUInteger TSCallCurrentSchemaVersion = 1; return NSLocalizedString(@"OUTGOING_CALL", @""); case RPRecentCallTypeMissed: return NSLocalizedString(@"MISSED_CALL", @""); + case RPRecentCallTypeOutgoingIncomplete: + return NSLocalizedString(@"OUTGOING_INCOMPLETE_CALL", @""); + case RPRecentCallTypeIncomingIncomplete: + return NSLocalizedString(@"INCOMING_INCOMPLETE_CALL", @""); } } @@ -91,6 +95,20 @@ NSUInteger TSCallCurrentSchemaVersion = 1; }]; } +#pragma mark - Methods + +- (void)updateCallType:(RPRecentCallType)callType +{ + _callType = callType; + + [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) { + [self saveWithTransaction:transaction]; + + // redraw any thread-related unread count UI. + [self touchThreadWithTransaction:transaction]; + }]; +} + #pragma mark - Logging + (NSString *)tag