Remove unused code

This commit is contained in:
nielsandriesse 2021-05-05 12:13:48 +10:00
parent 8512691f2b
commit a098ba7125
21 changed files with 4 additions and 513 deletions

View File

@ -378,8 +378,6 @@
C32C5D19256DD493003C73A2 /* OWSLinkPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBA8255A581500E217F9 /* OWSLinkPreview.swift */; };
C32C5D23256DD4C0003C73A2 /* Mention.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA7E255A57FB00E217F9 /* Mention.swift */; };
C32C5D24256DD4C0003C73A2 /* MentionsManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA81255A57FC00E217F9 /* MentionsManager.swift */; };
C32C5D2E256DD4EA003C73A2 /* TSUnreadIndicatorInteraction.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF2C1255B6DA6007E1867 /* TSUnreadIndicatorInteraction.m */; };
C32C5D37256DD4ED003C73A2 /* TSUnreadIndicatorInteraction.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF2BE255B6DA6007E1867 /* TSUnreadIndicatorInteraction.h */; settings = {ATTRIBUTES = (Public, ); }; };
C32C5D83256DD5B6003C73A2 /* SSKKeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBBC255A581600E217F9 /* SSKKeychainStorage.swift */; };
C32C5D9C256DD6DC003C73A2 /* OWSOutgoingReceiptManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB6F255A580F00E217F9 /* OWSOutgoingReceiptManager.m */; };
C32C5DA5256DD6E5003C73A2 /* OWSOutgoingReceiptManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDABD255A580100E217F9 /* OWSOutgoingReceiptManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -405,9 +403,6 @@
C32C5EEE256DF54E003C73A2 /* TSDatabaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB46255A580C00E217F9 /* TSDatabaseView.m */; };
C32C5EF7256DF567003C73A2 /* TSDatabaseView.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB2C255A580A00E217F9 /* TSDatabaseView.h */; settings = {ATTRIBUTES = (Public, ); }; };
C32C5F11256DF79A003C73A2 /* SSKIncrementingIdFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB32255A580A00E217F9 /* SSKIncrementingIdFinder.swift */; };
C32C5F1A256DFCAD003C73A2 /* TSErrorMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAE7255A580500E217F9 /* TSErrorMessage.m */; };
C32C5F23256DFCC0003C73A2 /* TSErrorMessage_privateConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB5D255A580E00E217F9 /* TSErrorMessage_privateConstructor.h */; settings = {ATTRIBUTES = (Public, ); }; };
C32C5F34256DFCC4003C73A2 /* TSErrorMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBB0255A581500E217F9 /* TSErrorMessage.h */; settings = {ATTRIBUTES = (Public, ); }; };
C32C5FA1256DFED5003C73A2 /* NSArray+Functional.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAB8255A580100E217F9 /* NSArray+Functional.m */; };
C32C5FAA256DFED9003C73A2 /* NSArray+Functional.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB5C255A580E00E217F9 /* NSArray+Functional.h */; settings = {ATTRIBUTES = (Public, ); }; };
C32C5FBB256E0206003C73A2 /* OWSBackgroundTask.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDC1B255A581F00E217F9 /* OWSBackgroundTask.m */; };
@ -1362,7 +1357,6 @@
C33FDAE1255A580400E217F9 /* OWSReadTracking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSReadTracking.h; sourceTree = "<group>"; };
C33FDAE4255A580400E217F9 /* TSAttachmentStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAttachmentStream.h; sourceTree = "<group>"; };
C33FDAE6255A580400E217F9 /* TSInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSInteraction.h; sourceTree = "<group>"; };
C33FDAE7255A580500E217F9 /* TSErrorMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSErrorMessage.m; sourceTree = "<group>"; };
C33FDAE8255A580500E217F9 /* OWSMessageUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMessageUtils.h; sourceTree = "<group>"; };
C33FDAEA255A580500E217F9 /* OWSBackupFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackupFragment.h; sourceTree = "<group>"; };
C33FDAEC255A580500E217F9 /* SignalRecipient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalRecipient.h; sourceTree = "<group>"; };
@ -1413,7 +1407,6 @@
C33FDB59255A580E00E217F9 /* OWSFailedAttachmentDownloadsJob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSFailedAttachmentDownloadsJob.m; sourceTree = "<group>"; };
C33FDB5B255A580E00E217F9 /* YapDatabaseTransaction+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YapDatabaseTransaction+OWS.m"; sourceTree = "<group>"; };
C33FDB5C255A580E00E217F9 /* NSArray+Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+Functional.h"; sourceTree = "<group>"; };
C33FDB5D255A580E00E217F9 /* TSErrorMessage_privateConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSErrorMessage_privateConstructor.h; sourceTree = "<group>"; };
C33FDB5F255A580E00E217F9 /* YapDatabaseConnection+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YapDatabaseConnection+OWS.h"; sourceTree = "<group>"; };
C33FDB60255A580E00E217F9 /* TSMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSMessage.m; sourceTree = "<group>"; };
C33FDB67255A580F00E217F9 /* OWSMediaGalleryFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMediaGalleryFinder.h; sourceTree = "<group>"; };
@ -1448,7 +1441,6 @@
C33FDBA9255A581500E217F9 /* OWSIdentityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSIdentityManager.m; sourceTree = "<group>"; };
C33FDBAB255A581500E217F9 /* OWSFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSFileSystem.h; sourceTree = "<group>"; };
C33FDBAE255A581500E217F9 /* SignalAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalAccount.h; sourceTree = "<group>"; };
C33FDBB0255A581500E217F9 /* TSErrorMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSErrorMessage.h; sourceTree = "<group>"; };
C33FDBB4255A581600E217F9 /* NSURLSessionDataTask+StatusCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURLSessionDataTask+StatusCode.m"; sourceTree = "<group>"; };
C33FDBB6255A581600E217F9 /* DataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DataSource.m; sourceTree = "<group>"; };
C33FDBB7255A581600E217F9 /* SignalRecipient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalRecipient.m; sourceTree = "<group>"; };
@ -1559,8 +1551,6 @@
C38EF2A4255B6D93007E1867 /* ProfilePictureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProfilePictureView.swift; path = "SignalUtilitiesKit/Profile Pictures/ProfilePictureView.swift"; sourceTree = SOURCE_ROOT; };
C38EF2B1255B6D9C007E1867 /* UIViewController+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIViewController+Utilities.swift"; path = "SignalUtilitiesKit/Utilities/UIViewController+Utilities.swift"; sourceTree = SOURCE_ROOT; };
C38EF2B2255B6D9C007E1867 /* UIView+Utilities.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIView+Utilities.swift"; path = "SignalUtilitiesKit/Utilities/UIView+Utilities.swift"; sourceTree = SOURCE_ROOT; };
C38EF2BE255B6DA6007E1867 /* TSUnreadIndicatorInteraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TSUnreadIndicatorInteraction.h; path = "SessionMessagingKit/Sending & Receiving/Read Tracking/TSUnreadIndicatorInteraction.h"; sourceTree = SOURCE_ROOT; };
C38EF2C1255B6DA6007E1867 /* TSUnreadIndicatorInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TSUnreadIndicatorInteraction.m; path = "SessionMessagingKit/Sending & Receiving/Read Tracking/TSUnreadIndicatorInteraction.m"; sourceTree = SOURCE_ROOT; };
C38EF2CF255B6DAE007E1867 /* OWSProfileManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSProfileManager.m; path = "SignalUtilitiesKit/To Do/OWSProfileManager.m"; sourceTree = SOURCE_ROOT; };
C38EF2D1255B6DAF007E1867 /* OWSUserProfile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSUserProfile.m; path = "SessionMessagingKit/To Do/OWSUserProfile.m"; sourceTree = SOURCE_ROOT; };
C38EF2D2255B6DAF007E1867 /* OWSProfileManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSProfileManager.h; path = "SignalUtilitiesKit/To Do/OWSProfileManager.h"; sourceTree = SOURCE_ROOT; };
@ -2548,9 +2538,6 @@
C32C5A99256DBDC1003C73A2 /* Signal */ = {
isa = PBXGroup;
children = (
C33FDB5D255A580E00E217F9 /* TSErrorMessage_privateConstructor.h */,
C33FDBB0255A581500E217F9 /* TSErrorMessage.h */,
C33FDAE7255A580500E217F9 /* TSErrorMessage.m */,
C33FDB9C255A581300E217F9 /* TSIncomingMessage.h */,
C33FDA97255A57FE00E217F9 /* TSIncomingMessage.m */,
C3B7845C25649DA600ADB2E7 /* TSIncomingMessage+Conversion.swift */,
@ -2576,8 +2563,6 @@
C33FDB1D255A580900E217F9 /* OWSReadReceiptManager.h */,
C33FDA71255A57FA00E217F9 /* OWSReadReceiptManager.m */,
C33FDAE1255A580400E217F9 /* OWSReadTracking.h */,
C38EF2BE255B6DA6007E1867 /* TSUnreadIndicatorInteraction.h */,
C38EF2C1255B6DA6007E1867 /* TSUnreadIndicatorInteraction.m */,
);
path = "Read Tracking";
sourceTree = "<group>";
@ -3706,7 +3691,6 @@
C32C5EE5256DF506003C73A2 /* YapDatabaseConnection+OWS.h in Headers */,
C32C5AAF256DBE8F003C73A2 /* TSMessage.h in Headers */,
C32C5B8D256DC565003C73A2 /* SSKEnvironment.h in Headers */,
C32C5F34256DFCC4003C73A2 /* TSErrorMessage.h in Headers */,
C32C59C6256DB41F003C73A2 /* TSGroupThread.h in Headers */,
C3C2A6F425539DE700C340D1 /* SessionMessagingKit.h in Headers */,
C32C59C2256DB41F003C73A2 /* TSContactThread.h in Headers */,
@ -3723,7 +3707,6 @@
C32C5AB3256DBE8F003C73A2 /* TSInteraction.h in Headers */,
C32C5DA5256DD6E5003C73A2 /* OWSOutgoingReceiptManager.h in Headers */,
C32C5B0A256DC076003C73A2 /* OWSDisappearingMessagesConfiguration.h in Headers */,
C32C5D37256DD4ED003C73A2 /* TSUnreadIndicatorInteraction.h in Headers */,
C32C5ADF256DBFAA003C73A2 /* OWSReadTracking.h in Headers */,
C3D9E486256775D20040E4F3 /* TSAttachmentPointer.h in Headers */,
C32C5EF7256DF567003C73A2 /* TSDatabaseView.h in Headers */,
@ -3736,7 +3719,6 @@
B8856D72256F1421001CE70E /* OWSWindowManager.h in Headers */,
B8AE761425ABFBB9001A84D2 /* GeneralUtilities.h in Headers */,
C32C5B6B256DC357003C73A2 /* OWSDisappearingConfigurationUpdateInfoMessage.h in Headers */,
C32C5F23256DFCC0003C73A2 /* TSErrorMessage_privateConstructor.h in Headers */,
C32C5BBA256DC7E3003C73A2 /* ProfileManagerProtocol.h in Headers */,
C3A3A193256E20D4004D228D /* SignalRecipient.h in Headers */,
B8856CF7256F105E001CE70E /* OWSAudioPlayer.h in Headers */,
@ -4774,7 +4756,6 @@
C32C5A02256DB658003C73A2 /* MessageSender+Convenience.swift in Sources */,
B8566C6C256F60F50045A0B9 /* OWSUserProfile.m in Sources */,
B8D0A25925E367AC00C1835E /* Notification+MessageReceiver.swift in Sources */,
C32C5D2E256DD4EA003C73A2 /* TSUnreadIndicatorInteraction.m in Sources */,
C32C599E256DB02B003C73A2 /* TypingIndicators.swift in Sources */,
C3DB66CC260AF1F3001EFC55 /* OpenGroupAPIV2+ObjC.swift in Sources */,
C32C5BEF256DC8EE003C73A2 /* OWSDisappearingMessagesJob.m in Sources */,
@ -4822,7 +4803,6 @@
C32C5C88256DD0D2003C73A2 /* Storage+Messaging.swift in Sources */,
C32C59C7256DB41F003C73A2 /* TSThread.m in Sources */,
C300A5B22554AF9800555489 /* VisibleMessage+Profile.swift in Sources */,
C32C5F1A256DFCAD003C73A2 /* TSErrorMessage.m in Sources */,
C32C5A75256DBBCF003C73A2 /* TSAttachmentPointer+Conversion.swift in Sources */,
C32C5AF8256DC051003C73A2 /* OWSDisappearingMessagesConfiguration.m in Sources */,
C32C5EBA256DE130003C73A2 /* OWSQuotedReplyModel.m in Sources */,

View File

@ -451,7 +451,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
case OWSInteractionType_Offer:
case OWSInteractionType_TypingIndicator:
return;
case OWSInteractionType_Error:
case OWSInteractionType_Info:
case OWSInteractionType_Call:
self.systemMessageText = [self systemMessageTextWithTransaction:transaction];
@ -651,10 +650,6 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
OWSAssertDebug(transaction);
switch (self.interaction.interactionType) {
case OWSInteractionType_Error: {
TSErrorMessage *errorMessage = (TSErrorMessage *)self.interaction;
return [errorMessage previewTextWithTransaction:transaction];
}
case OWSInteractionType_Info: {
TSInfoMessage *infoMessage = (TSInfoMessage *)self.interaction;
return [infoMessage previewTextWithTransaction:transaction];

View File

@ -1005,7 +1005,6 @@ NS_ASSUME_NONNULL_BEGIN
case OWSInteractionType_IncomingMessage:
case OWSInteractionType_OutgoingMessage:
return interaction;
case OWSInteractionType_Error:
case OWSInteractionType_Info:
break;
case OWSInteractionType_Call:
@ -1134,7 +1133,6 @@ NS_ASSUME_NONNULL_BEGIN
break;
case OWSInteractionType_IncomingMessage:
case OWSInteractionType_OutgoingMessage:
case OWSInteractionType_Error:
case OWSInteractionType_Info:
case OWSInteractionType_Call:
canShowDate = YES;

View File

@ -75,7 +75,6 @@
#import <SessionMessagingKit/TSAttachmentPointer.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SessionMessagingKit/TSContactThread.h>
#import <SessionMessagingKit/TSErrorMessage.h>
#import <SessionMessagingKit/TSGroupThread.h>
#import <SessionMessagingKit/TSIncomingMessage.h>
#import <SessionMessagingKit/TSInfoMessage.h>

View File

@ -255,50 +255,6 @@ public class NotificationPresenter: NSObject, NotificationsProtocol {
}
}
public func notifyUser(for errorMessage: TSErrorMessage, thread: TSThread, transaction: YapDatabaseReadWriteTransaction) {
let notificationTitle: String?
switch self.previewType {
case .namePreview, .nameNoPreview:
notificationTitle = thread.name()
case .noNameNoPreview:
notificationTitle = nil
}
let notificationBody = errorMessage.previewText(with: transaction)
guard let threadId = thread.uniqueId else {
owsFailDebug("threadId was unexpectedly nil")
return
}
let userInfo = [
AppNotificationUserInfoKey.threadId: threadId
]
transaction.addCompletionQueue(DispatchQueue.main) {
let sound = self.requestSound(thread: thread)
self.adaptee.notify(category: .errorMessage,
title: notificationTitle,
body: notificationBody,
userInfo: userInfo,
sound: sound)
}
}
public func notifyUser(forThreadlessErrorMessage errorMessage: TSErrorMessage, transaction: YapDatabaseReadWriteTransaction) {
let notificationBody = errorMessage.previewText(with: transaction)
transaction.addCompletionQueue(DispatchQueue.main) {
let sound = self.checkIfShouldPlaySound() ? OWSSounds.globalNotificationSound() : nil
self.adaptee.notify(category: .threadlessErrorMessage,
title: nil,
body: notificationBody,
userInfo: [:],
sound: sound)
}
}
@objc
public func cancelNotifications(threadId: String) {
self.adaptee.cancelNotifications(threadId: threadId)

View File

@ -1,76 +0,0 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import <SessionMessagingKit/OWSReadTracking.h>
#import <SessionMessagingKit/TSMessage.h>
NS_ASSUME_NONNULL_BEGIN
@class SNProtoEnvelope;
typedef NS_ENUM(int32_t, TSErrorMessageType) {
TSErrorMessageNoSession,
// DEPRECATED: We no longer create TSErrorMessageWrongTrustedIdentityKey, but
// persisted legacy messages could exist indefinitly.
TSErrorMessageWrongTrustedIdentityKey,
TSErrorMessageInvalidKeyException,
// unused
TSErrorMessageMissingKeyId,
TSErrorMessageInvalidMessage,
// unused
TSErrorMessageDuplicateMessage,
TSErrorMessageInvalidVersion,
TSErrorMessageNonBlockingIdentityChange,
TSErrorMessageUnknownContactBlockOffer,
TSErrorMessageGroupCreationFailed,
};
@interface TSErrorMessage : TSMessage <OWSReadTracking>
- (instancetype)initMessageWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt
quotedMessage:(nullable TSQuotedMessage *)quotedMessage
contactShare:(nullable OWSContact *)contact
linkPreview:(nullable OWSLinkPreview *)linkPreview NS_UNAVAILABLE;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
messageBody:(nullable NSString *)body
attachmentIds:(NSArray<NSString *> *)attachmentIds
expiresInSeconds:(uint32_t)expiresInSeconds
expireStartedAt:(uint64_t)expireStartedAt NS_UNAVAILABLE;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType
recipientId:(nullable NSString *)recipientId NS_DESIGNATED_INITIALIZER;
+ (instancetype)corruptedMessageWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (instancetype)corruptedMessageInUnknownThread;
+ (instancetype)invalidVersionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (instancetype)invalidKeyExceptionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (instancetype)missingSessionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
+ (instancetype)nonblockingIdentityChangeInThread:(TSThread *)thread recipientId:(NSString *)recipientId;
@property (nonatomic, readonly) TSErrorMessageType errorType;
@property (nullable, nonatomic, readonly) NSString *recipientId;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,219 +0,0 @@
//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
#import "TSErrorMessage.h"
#import "SSKEnvironment.h"
#import "TSContactThread.h"
#import "TSErrorMessage_privateConstructor.h"
#import <SignalCoreKit/NSDate+OWS.h>
#import <YapDatabase/YapDatabaseConnection.h>
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
NSUInteger TSErrorMessageSchemaVersion = 1;
@interface TSErrorMessage ()
@property (nonatomic, getter=wasRead) BOOL read;
@property (nonatomic, readonly) NSUInteger errorMessageSchemaVersion;
@end
#pragma mark -
@implementation TSErrorMessage
- (nullable instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (!self) {
return self;
}
if (self.errorMessageSchemaVersion < 1) {
_read = YES;
}
_errorMessageSchemaVersion = TSErrorMessageSchemaVersion;
if (self.isDynamicInteraction) {
self.read = YES;
}
return self;
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType
recipientId:(nullable NSString *)recipientId
{
self = [super initMessageWithTimestamp:timestamp
inThread:thread
messageBody:nil
attachmentIds:@[]
expiresInSeconds:0
expireStartedAt:0
quotedMessage:nil
linkPreview:nil];
if (!self) {
return self;
}
_errorType = errorMessageType;
_recipientId = recipientId;
_errorMessageSchemaVersion = TSErrorMessageSchemaVersion;
if (self.isDynamicInteraction) {
self.read = YES;
}
return self;
}
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType
{
return [self initWithTimestamp:timestamp inThread:thread failedMessageType:errorMessageType recipientId:nil];
}
- (instancetype)initWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
failedMessageType:(TSErrorMessageType)errorMessageType
{
NSString *source = envelope.source;
TSContactThread *contactThread =
[TSContactThread getOrCreateThreadWithContactSessionID:source transaction:transaction];
// Legit usage of senderTimestamp. We don't actually currently surface it in the UI, but it serves as
// a reference to the envelope which we failed to process.
return [self initWithTimestamp:envelope.timestamp inThread:contactThread failedMessageType:errorMessageType];
}
- (OWSInteractionType)interactionType
{
return OWSInteractionType_Error;
}
- (NSString *)previewTextWithTransaction:(YapDatabaseReadTransaction *)transaction
{
switch (_errorType) {
case TSErrorMessageNoSession:
return NSLocalizedString(@"ERROR_MESSAGE_NO_SESSION", @"");
case TSErrorMessageInvalidMessage:
return NSLocalizedString(@"ERROR_MESSAGE_INVALID_MESSAGE", @"");
case TSErrorMessageInvalidVersion:
return NSLocalizedString(@"ERROR_MESSAGE_INVALID_VERSION", @"");
case TSErrorMessageDuplicateMessage:
return NSLocalizedString(@"ERROR_MESSAGE_DUPLICATE_MESSAGE", @"");
case TSErrorMessageInvalidKeyException:
return NSLocalizedString(@"ERROR_MESSAGE_INVALID_KEY_EXCEPTION", @"");
case TSErrorMessageWrongTrustedIdentityKey:
return NSLocalizedString(@"ERROR_MESSAGE_WRONG_TRUSTED_IDENTITY_KEY", @"");
case TSErrorMessageNonBlockingIdentityChange: {
if (self.recipientId) {
NSString *messageFormat = NSLocalizedString(@"ERROR_MESSAGE_NON_BLOCKING_IDENTITY_CHANGE_FORMAT",
@"Shown when signal users safety numbers changed, embeds the user's {{name or phone number}}");
return [NSString stringWithFormat:messageFormat, self.recipientId];
} else {
// recipientId will be nil for legacy errors
return NSLocalizedString(
@"ERROR_MESSAGE_NON_BLOCKING_IDENTITY_CHANGE", @"Shown when signal users safety numbers changed");
}
break;
}
case TSErrorMessageUnknownContactBlockOffer:
return NSLocalizedString(@"UNKNOWN_CONTACT_BLOCK_OFFER",
@"Message shown in conversation view that offers to block an unknown user.");
case TSErrorMessageGroupCreationFailed:
return NSLocalizedString(@"GROUP_CREATION_FAILED",
@"Message shown in conversation view that indicates there were issues with group creation.");
default:
return NSLocalizedString(@"ERROR_MESSAGE_UNKNOWN_ERROR", @"");
break;
}
}
+ (instancetype)corruptedMessageWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
return [[self alloc] initWithEnvelope:envelope
withTransaction:transaction
failedMessageType:TSErrorMessageInvalidMessage];
}
+ (instancetype)corruptedMessageInUnknownThread
{
// MJK TODO - Seems like we could safely remove this timestamp
return [[self alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:nil
failedMessageType:TSErrorMessageInvalidMessage];
}
+ (instancetype)invalidVersionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
return [[self alloc] initWithEnvelope:envelope
withTransaction:transaction
failedMessageType:TSErrorMessageInvalidVersion];
}
+ (instancetype)invalidKeyExceptionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
return [[self alloc] initWithEnvelope:envelope
withTransaction:transaction
failedMessageType:TSErrorMessageInvalidKeyException];
}
+ (instancetype)missingSessionWithEnvelope:(SNProtoEnvelope *)envelope
withTransaction:(YapDatabaseReadWriteTransaction *)transaction
{
return
[[self alloc] initWithEnvelope:envelope withTransaction:transaction failedMessageType:TSErrorMessageNoSession];
}
+ (instancetype)nonblockingIdentityChangeInThread:(TSThread *)thread recipientId:(NSString *)recipientId
{
// MJK TODO - should be safe to remove this senderTimestamp
return [[self alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
inThread:thread
failedMessageType:TSErrorMessageNonBlockingIdentityChange
recipientId:recipientId];
}
#pragma mark - OWSReadTracking
- (uint64_t)expireStartedAt
{
return 0;
}
- (BOOL)shouldAffectUnreadCounts
{
return NO;
}
- (void)markAsReadAtTimestamp:(uint64_t)readTimestamp
sendReadReceipt:(BOOL)sendReadReceipt
transaction:(YapDatabaseReadWriteTransaction *)transaction
{
if (_read) {
return;
}
_read = YES;
[self saveWithTransaction:transaction];
// Ignore sendReadReceipt - it doesn't apply to error messages.
}
@end
NS_ASSUME_NONNULL_END

View File

@ -1,19 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <SessionMessagingKit/TSErrorMessage.h>
NS_ASSUME_NONNULL_BEGIN
@interface TSErrorMessage ()
- (instancetype)initWithTimestamp:(uint64_t)timestamp
inThread:(nullable TSThread *)thread
failedMessageType:(TSErrorMessageType)errorMessageType NS_DESIGNATED_INITIALIZER;
@property (atomic, nullable) NSData *envelopeData;
@end
NS_ASSUME_NONNULL_END

View File

@ -12,7 +12,6 @@ typedef NS_ENUM(NSInteger, OWSInteractionType) {
OWSInteractionType_Unknown,
OWSInteractionType_IncomingMessage,
OWSInteractionType_OutgoingMessage,
OWSInteractionType_Error,
OWSInteractionType_Call,
OWSInteractionType_Info,
OWSInteractionType_Offer,

View File

@ -20,8 +20,6 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
return @"OWSInteractionType_IncomingMessage";
case OWSInteractionType_OutgoingMessage:
return @"OWSInteractionType_OutgoingMessage";
case OWSInteractionType_Error:
return @"OWSInteractionType_Error";
case OWSInteractionType_Call:
return @"OWSInteractionType_Call";
case OWSInteractionType_Info:

View File

@ -42,8 +42,6 @@ FOUNDATION_EXPORT const unsigned char SessionMessagingKitVersionString[];
#import <SessionMessagingKit/TSContactThread.h>
#import <SessionMessagingKit/TSDatabaseSecondaryIndexes.h>
#import <SessionMessagingKit/TSDatabaseView.h>
#import <SessionMessagingKit/TSErrorMessage.h>
#import <SessionMessagingKit/TSErrorMessage_privateConstructor.h>
#import <SessionMessagingKit/TSGroupModel.h>
#import <SessionMessagingKit/TSGroupThread.h>
#import <SessionMessagingKit/TSIncomingMessage.h>
@ -52,6 +50,5 @@ FOUNDATION_EXPORT const unsigned char SessionMessagingKitVersionString[];
#import <SessionMessagingKit/TSOutgoingMessage.h>
#import <SessionMessagingKit/TSQuotedMessage.h>
#import <SessionMessagingKit/TSThread.h>
#import <SessionMessagingKit/TSUnreadIndicatorInteraction.h>
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>

View File

@ -20,13 +20,6 @@ NS_ASSUME_NONNULL_BEGIN
inThread:(TSThread *)thread
transaction:(YapDatabaseReadTransaction *)transaction;
- (void)notifyUserForErrorMessage:(TSErrorMessage *)error
thread:(TSThread *)thread
transaction:(YapDatabaseReadWriteTransaction *)transaction;
- (void)notifyUserForThreadlessErrorMessage:(TSErrorMessage *)error
transaction:(YapDatabaseReadWriteTransaction *)transaction;
- (void)clearAllNotifications;
@end

View File

@ -16,22 +16,6 @@ NS_ASSUME_NONNULL_BEGIN
extern NSString *const kIncomingMessageMarkedAsReadNotification;
// There are four kinds of read receipts:
//
// * Read receipts that this client sends to linked
// devices to inform them that a message has been read.
// * Read receipts that this client receives from linked
// devices that inform this client that a message has been read.
// * These read receipts are saved so that they can be applied
// if they arrive before the corresponding message.
// * Read receipts that this client sends to other users
// to inform them that a message has been read.
// * Read receipts that this client receives from other users
// that inform this client that a message has been read.
// * These read receipts are saved so that they can be applied
// if they arrive before the corresponding message.
//
// This manager is responsible for handling and emitting all four kinds.
@interface OWSReadReceiptManager : NSObject
- (instancetype)init NS_UNAVAILABLE;
@ -48,9 +32,6 @@ extern NSString *const kIncomingMessageMarkedAsReadNotification;
sentTimestamps:(NSArray<NSNumber *> *)sentTimestamps
readTimestamp:(uint64_t)readTimestamp;
- (void)applyEarlyReadReceiptsForOutgoingMessageFromLinkedDevice:(TSOutgoingMessage *)message
transaction:(YapDatabaseReadWriteTransaction *)transaction;
#pragma mark - Locally Read
// This method cues this manager:

View File

@ -23,7 +23,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, readonly) uint64_t sortId;
@property (nonatomic, readonly) NSString *uniqueThreadId;
- (BOOL)shouldAffectUnreadCounts;
/**

View File

@ -1,16 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import <SessionMessagingKit/TSInteraction.h>
NS_ASSUME_NONNULL_BEGIN
// This class is vestigial.
__attribute__((deprecated)) @interface TSUnreadIndicatorInteraction : TSInteraction
- (instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
@end
NS_ASSUME_NONNULL_END

View File

@ -1,38 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "TSUnreadIndicatorInteraction.h"
NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-implementations"
@implementation TSUnreadIndicatorInteraction
#pragma clang diagnostic pop
- (instancetype)initWithCoder:(NSCoder *)coder
{
return [super initWithCoder:coder];
}
- (BOOL)shouldUseReceiptDateForSorting
{
// Use the timestamp, not the "received at" timestamp to sort,
// since we're creating these interactions after the fact and back-dating them.
return NO;
}
- (BOOL)isDynamicInteraction
{
return YES;
}
- (OWSInteractionType)interactionType
{
return OWSInteractionType_Unknown;
}
@end
NS_ASSUME_NONNULL_END

View File

@ -5,7 +5,8 @@
import Foundation
@objc(OWSTypingIndicators)
public protocol TypingIndicators: class {
public protocol TypingIndicators : AnyObject {
@objc
func didStartTypingOutgoingInput(inThread thread: TSThread)
@ -43,7 +44,7 @@ public protocol TypingIndicators: class {
// MARK: -
@objc(OWSTypingIndicatorsImpl)
public class TypingIndicatorsImpl: NSObject, TypingIndicators {
public class TypingIndicatorsImpl : NSObject, TypingIndicators {
@objc
public static let typingIndicatorStateDidChange = Notification.Name("typingIndicatorStateDidChange")

View File

@ -316,15 +316,6 @@ BOOL IsNoteToSelfEnabled(void)
return NO;
}
if ([interaction isKindOfClass:[TSErrorMessage class]]) {
TSErrorMessage *errorMessage = (TSErrorMessage *)interaction;
if (errorMessage.errorType == TSErrorMessageNonBlockingIdentityChange) {
// Otherwise all group threads with the recipient will percolate to the top of the inbox, even though
// there was no meaningful interaction.
return NO;
}
}
return YES;
}

View File

@ -14,7 +14,6 @@
#import "SSKEnvironment.h"
#import "TSAccountManager.h"
#import "TSContactThread.h"
#import "TSErrorMessage.h"
#import "TSGroupThread.h"
#import "TSMessage.h"
#import "YapDatabaseConnection+OWS.h"

View File

@ -9,14 +9,6 @@ public class NoopNotificationsManager: NSObject, NotificationsProtocol {
owsFailDebug("")
}
public func notifyUser(for error: TSErrorMessage, thread: TSThread, transaction: YapDatabaseReadWriteTransaction) {
Logger.warn("skipping notification for: \(error.description)")
}
public func notifyUser(forThreadlessErrorMessage error: TSErrorMessage, transaction: YapDatabaseReadWriteTransaction) {
Logger.warn("skipping notification for: \(error.description)")
}
public func clearAllNotifications() {
Logger.warn("clearAllNotifications")
}

View File

@ -5,7 +5,6 @@
#import "ThreadUtil.h"
#import "OWSQuotedReplyModel.h"
#import "OWSUnreadIndicator.h"
#import "TSUnreadIndicatorInteraction.h"
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SessionMessagingKit/SSKEnvironment.h>
#import <SessionMessagingKit/OWSBlockingManager.h>
@ -82,24 +81,6 @@ NS_ASSUME_NONNULL_BEGIN
ThreadDynamicInteractions *result = [ThreadDynamicInteractions new];
[dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
// Find any "dynamic" interactions and safety number changes.
//
// We use different views for performance reasons.
NSMutableArray<TSInteraction *> *nonBlockingSafetyNumberChanges = [NSMutableArray new];
[[TSDatabaseView threadSpecialMessagesDatabaseView:transaction]
enumerateKeysAndObjectsInGroup:thread.uniqueId
usingBlock:^(
NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop) {
if ([object isKindOfClass:[TSErrorMessage class]]) {
TSErrorMessage *errorMessage = (TSErrorMessage *)object;
OWSAssertDebug(
errorMessage.errorType == TSErrorMessageNonBlockingIdentityChange);
[nonBlockingSafetyNumberChanges addObject:errorMessage];
} else {
OWSFailDebug(@"Unexpected dynamic interaction type: %@", [object class]);
}
}];
// Determine if there are "unread" messages in this conversation.
// If we've been passed a firstUnseenInteractionTimestampParameter,
// just use that value in order to preserve continuity of the
@ -122,7 +103,7 @@ NS_ASSUME_NONNULL_BEGIN
thread:thread
transaction:transaction
maxRangeSize:maxRangeSize
nonBlockingSafetyNumberChanges:nonBlockingSafetyNumberChanges
nonBlockingSafetyNumberChanges:@[]
hideUnreadMessagesIndicator:hideUnreadMessagesIndicator
firstUnseenSortId:firstUnseenSortId];