Group updates can be deleted

Removed some dead code re: NSCopy/Coding, since it seems unused.

// FREEBIE
pull/1/head
Michael Kirk 9 years ago
parent 07ab1bd931
commit 89df8ddb31

@ -2,11 +2,11 @@
// Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved. // Portions Copyright (c) 2016 Open Whisper Systems. All rights reserved.
#import "OWSMessageData.h" #import "OWSMessageData.h"
#import "TSMessageAdapter.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@class TSCall; @class TSCall;
@class TSInteraction;
typedef enum : NSUInteger { typedef enum : NSUInteger {
kCallOutgoing = 1, kCallOutgoing = 1,
@ -17,14 +17,15 @@ typedef enum : NSUInteger {
kGroupUpdate = 6 kGroupUpdate = 6
} CallStatus; } CallStatus;
@interface OWSCall : NSObject <OWSMessageData, NSCoding, NSCopying> @interface OWSCall : NSObject <OWSMessageData>
#pragma mark - Initialization #pragma mark - Initialization
- (instancetype)initWithCallRecord:(TSCall *)callRecord; - (instancetype)initWithCallRecord:(TSCall *)callRecord;
- (instancetype)initWithCallerId:(NSString *)callerId - (instancetype)initWithInteraction:(TSInteraction *)interaction
callerDisplayName:(NSString *)callerDisplayName callerId:(NSString *)senderId
callerDisplayName:(NSString *)senderDisplayName
date:(nullable NSDate *)date date:(nullable NSDate *)date
status:(CallStatus)status status:(CallStatus)status
displayString:(NSString *)detailString NS_DESIGNATED_INITIALIZER; displayString:(NSString *)detailString NS_DESIGNATED_INITIALIZER;

@ -36,7 +36,6 @@ NS_ASSUME_NONNULL_BEGIN
DDLogError(@"%@ Unexpected thread type: %@", self.tag, thread); DDLogError(@"%@ Unexpected thread type: %@", self.tag, thread);
} }
CallStatus status = 0; CallStatus status = 0;
switch (callRecord.callType) { switch (callRecord.callType) {
case RPRecentCallTypeOutgoing: case RPRecentCallTypeOutgoing:
@ -70,22 +69,16 @@ NS_ASSUME_NONNULL_BEGIN
break; break;
} }
self = [self initWithCallerId:contactThread.contactIdentifier return [self initWithInteraction:callRecord
callerId:contactThread.contactIdentifier
callerDisplayName:name callerDisplayName:name
date:callRecord.date date:callRecord.date
status:status status:status
displayString:detailString]; displayString:detailString];
if (!self) {
return self;
}
_interaction = callRecord;
return self;
} }
- (instancetype)initWithCallerId:(NSString *)senderId - (instancetype)initWithInteraction:(TSInteraction *)interaction
callerId:(NSString *)senderId
callerDisplayName:(NSString *)senderDisplayName callerDisplayName:(NSString *)senderDisplayName
date:(nullable NSDate *)date date:(nullable NSDate *)date
status:(CallStatus)status status:(CallStatus)status
@ -99,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
return self; return self;
} }
_interaction = interaction;
_senderId = [senderId copy]; _senderId = [senderId copy];
_senderDisplayName = [senderDisplayName copy]; _senderDisplayName = [senderDisplayName copy];
_date = [date copy]; _date = [date copy];
@ -184,42 +178,6 @@ NS_ASSUME_NONNULL_BEGIN
return NO; return NO;
} }
#pragma mark - NSCoding
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder
{
NSString *senderId = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(senderId))];
NSString *senderDisplayName = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(senderDisplayName))];
NSDate *date = [aDecoder decodeObjectForKey:NSStringFromSelector(@selector(date))];
CallStatus status = (CallStatus)[aDecoder decodeIntegerForKey:NSStringFromSelector(@selector(status))];
NSString *displayString = @""; // FIXME what should this be?
return [self initWithCallerId:senderId
callerDisplayName:senderDisplayName
date:date
status:status
displayString:displayString];
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:self.senderId forKey:NSStringFromSelector(@selector(senderId))];
[aCoder encodeObject:self.senderDisplayName forKey:NSStringFromSelector(@selector(senderDisplayName))];
[aCoder encodeObject:self.date forKey:NSStringFromSelector(@selector(date))];
[aCoder encodeDouble:self.status forKey:NSStringFromSelector(@selector(status))];
}
#pragma mark - NSCopying
- (instancetype)copyWithZone:(nullable NSZone *)zone
{
return [[[self class] allocWithZone:zone] initWithCallerId:self.senderId
callerDisplayName:self.senderDisplayName
date:self.date
status:self.status
displayString:self.detailString];
}
- (NSUInteger)messageHash - (NSUInteger)messageHash
{ {
return self.hash; return self.hash;

@ -186,7 +186,8 @@
} else if (adapter.infoMessageType == TSInfoMessageTypeGroupUpdate) { } else if (adapter.infoMessageType == TSInfoMessageTypeGroupUpdate) {
status = kGroupUpdate; status = kGroupUpdate;
} }
OWSCall *call = [[OWSCall alloc] initWithCallerId:@"" OWSCall *call = [[OWSCall alloc] initWithInteraction:interaction
callerId:@""
callerDisplayName:adapter.messageBody callerDisplayName:adapter.messageBody
date:nil date:nil
status:status status:status

Loading…
Cancel
Save