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.
#import "OWSMessageData.h"
#import "TSMessageAdapter.h"
NS_ASSUME_NONNULL_BEGIN
@class TSCall;
@class TSInteraction;
typedef enum : NSUInteger {
kCallOutgoing = 1,
@ -17,17 +17,18 @@ typedef enum : NSUInteger {
kGroupUpdate = 6
} CallStatus;
@interface OWSCall : NSObject <OWSMessageData, NSCoding, NSCopying>
@interface OWSCall : NSObject <OWSMessageData>
#pragma mark - Initialization
- (instancetype)initWithCallRecord:(TSCall *)callRecord;
- (instancetype)initWithCallerId:(NSString *)callerId
callerDisplayName:(NSString *)callerDisplayName
date:(nullable NSDate *)date
status:(CallStatus)status
displayString:(NSString *)detailString NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithInteraction:(TSInteraction *)interaction
callerId:(NSString *)senderId
callerDisplayName:(NSString *)senderDisplayName
date:(nullable NSDate *)date
status:(CallStatus)status
displayString:(NSString *)detailString NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;

@ -36,7 +36,6 @@ NS_ASSUME_NONNULL_BEGIN
DDLogError(@"%@ Unexpected thread type: %@", self.tag, thread);
}
CallStatus status = 0;
switch (callRecord.callType) {
case RPRecentCallTypeOutgoing:
@ -70,26 +69,20 @@ NS_ASSUME_NONNULL_BEGIN
break;
}
self = [self initWithCallerId:contactThread.contactIdentifier
callerDisplayName:name
date:callRecord.date
status:status
displayString:detailString];
if (!self) {
return self;
}
_interaction = callRecord;
return self;
return [self initWithInteraction:callRecord
callerId:contactThread.contactIdentifier
callerDisplayName:name
date:callRecord.date
status:status
displayString:detailString];
}
- (instancetype)initWithCallerId:(NSString *)senderId
callerDisplayName:(NSString *)senderDisplayName
date:(nullable NSDate *)date
status:(CallStatus)status
displayString:(NSString *)detailString
- (instancetype)initWithInteraction:(TSInteraction *)interaction
callerId:(NSString *)senderId
callerDisplayName:(NSString *)senderDisplayName
date:(nullable NSDate *)date
status:(CallStatus)status
displayString:(NSString *)detailString
{
NSParameterAssert(senderId != nil);
NSParameterAssert(senderDisplayName != nil);
@ -99,6 +92,7 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
_interaction = interaction;
_senderId = [senderId copy];
_senderDisplayName = [senderDisplayName copy];
_date = [date copy];
@ -184,42 +178,6 @@ NS_ASSUME_NONNULL_BEGIN
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
{
return self.hash;

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

Loading…
Cancel
Save