diff --git a/Signal/src/AppDelegate.m b/Signal/src/AppDelegate.m index c16ab5e6b..88d06dc68 100644 --- a/Signal/src/AppDelegate.m +++ b/Signal/src/AppDelegate.m @@ -805,7 +805,7 @@ static BOOL isInternalTestVersion = NO; NSDate *lastProfilePictureUpload = (NSDate *)[userDefaults objectForKey:@"lastProfilePictureUpload"]; if (lastProfilePictureUpload != nil && [now timeIntervalSinceDate:lastProfilePictureUpload] > 14 * 24 * 60 * 60) { OWSProfileManager *profileManager = OWSProfileManager.sharedManager; - NSString *displayName = [profileManager profileNameForRecipientId:userHexEncodedPublicKey]; + NSString *displayName = [profileManager profileNameForRecipientWithID:userHexEncodedPublicKey]; UIImage *profilePicture = [profileManager profileAvatarForRecipientId:userHexEncodedPublicKey]; [profileManager updateLocalProfileName:displayName avatarImage:profilePicture success:^{ // Do nothing; the user defaults flag is updated in LokiFileServerAPI diff --git a/Signal/src/Loki/View Controllers/SettingsVC.swift b/Signal/src/Loki/View Controllers/SettingsVC.swift index eb1c3f77a..d60f29a3b 100644 --- a/Signal/src/Loki/View Controllers/SettingsVC.swift +++ b/Signal/src/Loki/View Controllers/SettingsVC.swift @@ -80,7 +80,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { profilePictureView.hexEncodedPublicKey = userHexEncodedPublicKey profilePictureView.update() // Set up display name label - displayNameLabel.text = OWSProfileManager.shared().profileName(forRecipientId: userHexEncodedPublicKey) + displayNameLabel.text = OWSProfileManager.shared().profileNameForRecipient(withID: userHexEncodedPublicKey) // Set up display name container let displayNameContainer = UIView() displayNameContainer.addSubview(displayNameLabel) @@ -259,7 +259,7 @@ final class SettingsVC : BaseVC, AvatarViewHelperDelegate { } private func updateProfile(isUpdatingDisplayName: Bool, isUpdatingProfilePicture: Bool) { - let displayName = displayNameToBeUploaded ?? OWSProfileManager.shared().profileName(forRecipientId: userHexEncodedPublicKey) + let displayName = displayNameToBeUploaded ?? OWSProfileManager.shared().profileNameForRecipient(withID: userHexEncodedPublicKey) let profilePicture = profilePictureToBeUploaded ?? OWSProfileManager.shared().profileAvatar(forRecipientId: userHexEncodedPublicKey) ModalActivityIndicatorViewController.present(fromViewController: navigationController!, canCancel: false) { [weak self] modalActivityIndicator in OWSProfileManager.shared().updateLocalProfileName(displayName, avatarImage: profilePicture, success: { diff --git a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m index ccf65fe16..c372b8925 100644 --- a/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m +++ b/Signal/src/ViewControllers/AppSettings/AppSettingsViewController.m @@ -347,7 +347,7 @@ [nameView autoPinLeadingToTrailingEdgeOfView:avatarView offset:16.f]; UILabel *titleLabel = [UILabel new]; - NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager profileNameForRecipientId:hexEncodedPublicKey]; + NSString *_Nullable localProfileName = [OWSProfileManager.sharedManager profileNameForRecipientWithID:hexEncodedPublicKey]; if (localProfileName.length > 0) { titleLabel.text = localProfileName; titleLabel.textColor = [Theme primaryColor]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index bee6ec9d0..d48ec1709 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2105,7 +2105,7 @@ typedef enum : NSUInteger { [alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { uint64_t messageID = 0; if ([conversationViewItem.interaction isKindOfClass:TSMessage.class]) { - messageID = ((TSMessage *)conversationViewItem.interaction).groupChatServerID; + messageID = ((TSMessage *)conversationViewItem.interaction).openGroupServerMessageID; } [LKPublicChatAPI reportMessageWithID:messageID inChannel:1 onServer:@"https://chat.getsession.org"]; }]]; diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m index 0dd09d203..40b35170e 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewItem.m @@ -1185,7 +1185,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) // Make sure it's a public chat message TSMessage *message = (TSMessage *)self.interaction; - if (!message.isGroupChatMessage) return; + if (!message.isOpenGroupMessage) return; __block LKPublicChat *publicChat; [self.primaryStorage.dbReadConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { @@ -1195,7 +1195,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) // Delete the message BOOL isSentByUser = (interationType == OWSInteractionType_OutgoingMessage); - [[LKPublicChatAPI deleteMessageWithID:message.groupChatServerID forGroup:publicChat.channel onServer:publicChat.server isSentByUser:isSentByUser].catch(^(NSError *error) { + [[LKPublicChatAPI deleteMessageWithID:message.openGroupServerMessageID forGroup:publicChat.channel onServer:publicChat.server isSentByUser:isSentByUser].catch(^(NSError *error) { // Roll back [self.interaction save]; }) retainUntilComplete]; @@ -1260,7 +1260,7 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType) // Make sure it's a public chat message TSMessage *message = (TSMessage *)self.interaction; - if (!message.isGroupChatMessage) return false; + if (!message.isOpenGroupMessage) return false; // Ensure we have the details needed to contact the server __block LKPublicChat *publicChat; diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index 4fa5e6efa..75b6369e8 100644 --- a/Signal/translations/en.lproj/Localizable.strings +++ b/Signal/translations/en.lproj/Localizable.strings @@ -2822,3 +2822,4 @@ "Push Notifications" = "Push Notifications"; "Confirm" = "Confirm"; "Skip" = "Skip"; +"Link Previews" = "Link Previews"; diff --git a/SignalMessaging/Views/ContactCellView.m b/SignalMessaging/Views/ContactCellView.m index bb2185ab4..a78a4922e 100644 --- a/SignalMessaging/Views/ContactCellView.m +++ b/SignalMessaging/Views/ContactCellView.m @@ -188,13 +188,6 @@ const CGFloat kContactCellAvatarTextMargin = 12; threadName = NSLocalizedString(@"NOTE_TO_SELF", @"Label for 1:1 conversation with yourself."); } -// NSAttributedString *attributedText = -// [[NSAttributedString alloc] initWithString:threadName -// attributes:@{ -// NSForegroundColorAttributeName : [Theme primaryColor], -// }]; -// self.nameLabel.attributedText = attributedText; - if ([thread isKindOfClass:[TSContactThread class]]) { self.recipientId = thread.contactIdentifier; diff --git a/SignalMessaging/Views/ContactsViewHelper.m b/SignalMessaging/Views/ContactsViewHelper.m index 5cd7dbc14..4181abb0b 100644 --- a/SignalMessaging/Views/ContactsViewHelper.m +++ b/SignalMessaging/Views/ContactsViewHelper.m @@ -59,10 +59,7 @@ NS_ASSUME_NONNULL_BEGIN _contactsManager = Environment.shared.contactsManager; _profileManager = [OWSProfileManager sharedManager]; - // We don't want to notify the delegate in the `updateContacts`. -// self.shouldNotifyDelegateOfUpdatedContacts = YES; [self updateContacts]; - self.shouldNotifyDelegateOfUpdatedContacts = NO; [self observeNotifications]; @@ -432,7 +429,7 @@ NS_ASSUME_NONNULL_BEGIN [CNLabeledValue labeledValueWithLabel:CNLabelPhoneNumberMain value:phoneNumber]; newContact.phoneNumbers = @[ labeledPhoneNumber ]; - newContact.givenName = [self.profileManager profileNameForRecipientId:recipientId]; + newContact.givenName = [self.profileManager profileNameForRecipientWithID:recipientId]; contactViewController = [CNContactViewController viewControllerForNewContact:newContact]; } diff --git a/SignalMessaging/Views/OWSNavigationBar.swift b/SignalMessaging/Views/OWSNavigationBar.swift index 77a704112..6933403e0 100644 --- a/SignalMessaging/Views/OWSNavigationBar.swift +++ b/SignalMessaging/Views/OWSNavigationBar.swift @@ -118,10 +118,6 @@ public class OWSNavigationBar: UINavigationBar { // remove hairline below bar. self.shadowImage = UIImage() - - // On iOS11, despite inserting the blur at 0, other views are later inserted into the navbar behind the blur, - // so we have to set a zindex to avoid obscuring navbar title/buttons. -// blurEffectView.layer.zPosition = -1 } } diff --git a/SignalMessaging/attachments/SignalAttachment.swift b/SignalMessaging/attachments/SignalAttachment.swift index dd07dd546..e58b84847 100644 --- a/SignalMessaging/attachments/SignalAttachment.swift +++ b/SignalMessaging/attachments/SignalAttachment.swift @@ -806,8 +806,6 @@ public class SignalAttachment: NSObject { var maxSizeRect = CGRect.zero maxSizeRect.size = CGSize(width: maxSize, height: maxSize) let newSize = AVMakeRect(aspectRatio: scrSize, insideRect: maxSizeRect).size -// assert(newSize.width <= maxSize) -// assert(newSize.height <= maxSize) let colorSpace = CGColorSpaceCreateDeviceRGB() let bitmapInfo: CGBitmapInfo = [ diff --git a/SignalMessaging/contacts/OWSContactsManager.m b/SignalMessaging/contacts/OWSContactsManager.m index 300c9e425..dfcdf7481 100644 --- a/SignalMessaging/contacts/OWSContactsManager.m +++ b/SignalMessaging/contacts/OWSContactsManager.m @@ -726,7 +726,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan - (nullable NSString *)formattedProfileNameForRecipientId:(NSString *)recipientId { - NSString *_Nullable profileName = [self.profileManager profileNameForRecipientId:recipientId]; + NSString *_Nullable profileName = [self.profileManager profileNameForRecipientWithID:recipientId]; if (profileName.length == 0) { return nil; } @@ -739,7 +739,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan - (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId { - return [self.profileManager profileNameForRecipientId:recipientId]; + return [self.profileManager profileNameForRecipientWithID:recipientId]; } - (nullable NSString *)nameFromSystemContactsForRecipientId:(NSString *)recipientId @@ -900,7 +900,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan return savedContactName; } - NSString *_Nullable profileName = [self.profileManager profileNameForRecipientId:recipientId]; + NSString *_Nullable profileName = [self.profileManager profileNameForRecipientWithID:recipientId]; if (profileName.length > 0) { NSString *numberAndProfileNameFormat = NSLocalizedString(@"PROFILE_NAME_AND_PHONE_NUMBER_LABEL_FORMAT", @"Label text combining the phone number and profile name separated by a simple demarcation character. " @@ -950,7 +950,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan return [[NSAttributedString alloc] initWithString:savedContactName attributes:primaryAttributes]; } - NSString *_Nullable profileName = [self.profileManager profileNameForRecipientId:recipientId]; + NSString *_Nullable profileName = [self.profileManager profileNameForRecipientWithID:recipientId]; if (profileName.length > 0) { return [[NSAttributedString alloc] initWithString:profileName]; // Loki: Original code @@ -980,7 +980,7 @@ NSString *const OWSContactsManagerKeyNextFullIntersectionDate = @"OWSContactsMan NSString *formattedPhoneNumber = [PhoneNumber bestEffortFormatPartialUserSpecifiedTextToLookLikeAPhoneNumber:recipientId]; - NSString *_Nullable profileName = [self.profileManager profileNameForRecipientId:recipientId]; + NSString *_Nullable profileName = [self.profileManager profileNameForRecipientWithID:recipientId]; if (profileName.length > 0) { NSString *numberAndProfileNameFormat = NSLocalizedString(@"PROFILE_NAME_AND_PHONE_NUMBER_LABEL_FORMAT", @"Label text combining the phone number and profile name separated by a simple demarcation character. " diff --git a/SignalMessaging/profiles/OWSProfileManager.h b/SignalMessaging/profiles/OWSProfileManager.h index 28f361c39..f187fc453 100644 --- a/SignalMessaging/profiles/OWSProfileManager.h +++ b/SignalMessaging/profiles/OWSProfileManager.h @@ -75,7 +75,7 @@ extern const NSUInteger kOWSProfileManager_MaxAvatarDiameter; - (nullable OWSAES256Key *)profileKeyForRecipientId:(NSString *)recipientId; -- (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId; +- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID; - (nullable UIImage *)profileAvatarForRecipientId:(NSString *)recipientId; - (nullable NSData *)profileAvatarDataForRecipientId:(NSString *)recipientId; diff --git a/SignalMessaging/profiles/OWSProfileManager.m b/SignalMessaging/profiles/OWSProfileManager.m index 1bbea7d6e..128d70084 100644 --- a/SignalMessaging/profiles/OWSProfileManager.m +++ b/SignalMessaging/profiles/OWSProfileManager.m @@ -465,7 +465,7 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error); successBlock(); } -- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName avatarUrl:(nullable NSString *)avatarURL { +- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName avatarURL:(nullable NSString *)avatarURL { [self updateServiceWithProfileName:localProfileName avatarUrl:avatarURL success:^{} failure:^(NSError * _Nonnull error) {}]; } @@ -983,7 +983,6 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error); [userProfile updateWithAvatarUrlPath:avatarURL avatarFileName:nil dbConnection:self.dbConnection completion:^{ [self downloadAvatarForUserProfile:userProfile]; }]; - // [self fetchProfileForRecipientId:recipientId]; }); }]; }); @@ -1012,14 +1011,14 @@ typedef void (^ProfileManagerFailureBlock)(NSError *error); return userProfile.profileKey; } -- (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId +- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID { - OWSAssertDebug(recipientId.length > 0); + OWSAssertDebug(recipientID.length > 0); // For "local reads", use the local user profile. - OWSUserProfile *userProfile = ([self.tsAccountManager.localNumber isEqualToString:recipientId] + OWSUserProfile *userProfile = ([self.tsAccountManager.localNumber isEqualToString:recipientID] ? self.localUserProfile - : [OWSUserProfile getOrBuildUserProfileForRecipientId:recipientId dbConnection:self.dbConnection]); + : [OWSUserProfile getOrBuildUserProfileForRecipientId:recipientID dbConnection:self.dbConnection]); return userProfile.profileName; } diff --git a/SignalServiceKit/src/Contacts/Threads/TSGroupThread.m b/SignalServiceKit/src/Contacts/Threads/TSGroupThread.m index db4bede17..018d2b46e 100644 --- a/SignalServiceKit/src/Contacts/Threads/TSGroupThread.m +++ b/SignalServiceKit/src/Contacts/Threads/TSGroupThread.m @@ -259,7 +259,6 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific } self.groupModel.groupMemberIds = newGroupMemberIDs.allObjects; [self saveWithTransaction:transaction]; - [transaction addCompletionQueue:dispatch_get_main_queue() completionBlock:^{ [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId]; }]; diff --git a/SignalServiceKit/src/Devices/OWSRecordTranscriptJob.m b/SignalServiceKit/src/Devices/OWSRecordTranscriptJob.m index cf0143742..96c5e4a76 100644 --- a/SignalServiceKit/src/Devices/OWSRecordTranscriptJob.m +++ b/SignalServiceKit/src/Devices/OWSRecordTranscriptJob.m @@ -105,7 +105,7 @@ NS_ASSUME_NONNULL_BEGIN linkPreview:transcript.linkPreview]; if (serverID != 0) { - outgoingMessage.groupChatServerID = serverID; + outgoingMessage.openGroupServerMessageID = serverID; } NSArray *attachmentPointers = diff --git a/SignalServiceKit/src/Loki/API/Public Chats/LokiPublicChatPoller.swift b/SignalServiceKit/src/Loki/API/Public Chats/LokiPublicChatPoller.swift index fbf50c42d..a312e0439 100644 --- a/SignalServiceKit/src/Loki/API/Public Chats/LokiPublicChatPoller.swift +++ b/SignalServiceKit/src/Loki/API/Public Chats/LokiPublicChatPoller.swift @@ -172,7 +172,7 @@ public final class LokiPublicChatPoller : NSObject { if (message.displayName.count > 0) { SSKEnvironment.shared.profileManager.updateProfileForContact(withID: masterHexEncodedPublicKey!, displayName: message.displayName, with: transaction) } - SSKEnvironment.shared.profileManager.updateService(withProfileName: message.displayName, avatarUrl: profilePicture.url) + SSKEnvironment.shared.profileManager.updateService(withProfileName: message.displayName, avatarURL: profilePicture.url) SSKEnvironment.shared.profileManager.setProfileKeyData(profilePicture.profileKey, forRecipientId: masterHexEncodedPublicKey!, avatarURL: profilePicture.url) } } diff --git a/SignalServiceKit/src/Loki/Database/LokiDatabaseUtilities.swift b/SignalServiceKit/src/Loki/Database/LokiDatabaseUtilities.swift index 90326cf11..a8eec9a78 100644 --- a/SignalServiceKit/src/Loki/Database/LokiDatabaseUtilities.swift +++ b/SignalServiceKit/src/Loki/Database/LokiDatabaseUtilities.swift @@ -18,7 +18,7 @@ public final class LokiDatabaseUtilities : NSObject { } return (senderHexEncodedPublicKey == quoteeHexEncodedPublicKey) && (interaction.uniqueThreadId == threadID) }, with: transaction).first as! TSMessage? else { return 0 } - return message.groupChatServerID + return message.openGroupServerMessageID } // MARK: Device Links diff --git a/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationMessageFinder.swift b/SignalServiceKit/src/Loki/Messaging/ExpiringFriendRequestFinder.swift similarity index 78% rename from SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationMessageFinder.swift rename to SignalServiceKit/src/Loki/Messaging/ExpiringFriendRequestFinder.swift index 800cabe35..49d11db90 100644 --- a/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationMessageFinder.swift +++ b/SignalServiceKit/src/Loki/Messaging/ExpiringFriendRequestFinder.swift @@ -3,17 +3,17 @@ This class is used for finding friend request messages which are pending expiration. Modeled after `OWSDisappearingMessagesFinder`. */ -@objc(LKFriendRequestExpirationMessageFinder) -public final class FriendRequestExpirationMessageFinder : NSObject { +@objc(LKExpiringFriendRequestFinder) +public final class ExpiringFriendRequestFinder : NSObject { private static let friendRequestExpireColumn = "friend_request_expires_at" private static let friendRequestExpireIndex = "loki_index_friend_request_expires_at" public func nextExpirationTimestamp(with transaction: YapDatabaseReadTransaction) -> UInt64? { - let query = "WHERE \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) > 0 ORDER BY \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) ASC" + let query = "WHERE \(ExpiringFriendRequestFinder.friendRequestExpireColumn) > 0 ORDER BY \(ExpiringFriendRequestFinder.friendRequestExpireColumn) ASC" let dbQuery = YapDatabaseQuery(string: query, parameters: []) - let ext = transaction.ext(FriendRequestExpirationMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction + let ext = transaction.ext(ExpiringFriendRequestFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction var firstMessage: TSMessage? = nil ext?.enumerateKeysAndObjects(matching: dbQuery) { (collection, key, object, stop) in firstMessage = object as? TSMessage @@ -36,10 +36,10 @@ public final class FriendRequestExpirationMessageFinder : NSObject { var messageIds = [String]() let now = NSDate.ows_millisecondTimeStamp() - let query = "WHERE \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) > 0 AND \(FriendRequestExpirationMessageFinder.friendRequestExpireColumn) <= \(now)" + let query = "WHERE \(ExpiringFriendRequestFinder.friendRequestExpireColumn) > 0 AND \(ExpiringFriendRequestFinder.friendRequestExpireColumn) <= \(now)" // When (friendRequestExpiresAt == 0) then the friend request SHOULD NOT be set to expired let dbQuery = YapDatabaseQuery(string: query, parameters: []) - if let ext = transaction.ext(FriendRequestExpirationMessageFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction { + if let ext = transaction.ext(ExpiringFriendRequestFinder.friendRequestExpireIndex) as? YapDatabaseSecondaryIndexTransaction { ext.enumerateKeys(matching: dbQuery) { (_, key, _) in messageIds.append(key) } @@ -52,7 +52,7 @@ public final class FriendRequestExpirationMessageFinder : NSObject { // MARK: Database Extension -public extension FriendRequestExpirationMessageFinder { +public extension ExpiringFriendRequestFinder { @objc public static var indexDatabaseExtension: YapDatabaseSecondaryIndex { let setup = YapDatabaseSecondaryIndexSetup() diff --git a/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationJob.swift b/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationJob.swift index c3f2fbbe7..bdd04fb28 100644 --- a/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationJob.swift +++ b/SignalServiceKit/src/Loki/Messaging/FriendRequestExpirationJob.swift @@ -5,7 +5,7 @@ @objc(LKFriendRequestExpirationJob) public final class FriendRequestExpirationJob : NSObject { private let databaseConnection: YapDatabaseConnection - private let messageFinder = FriendRequestExpirationMessageFinder() + private let messageFinder = ExpiringFriendRequestFinder() // These properties should only be accessed on the main thread. private var hasStarted = false diff --git a/SignalServiceKit/src/Loki/Utilities/Debugging.swift b/SignalServiceKit/src/Loki/Utilities/Debugging.swift index 2a68c09ec..87a709f44 100644 --- a/SignalServiceKit/src/Loki/Utilities/Debugging.swift +++ b/SignalServiceKit/src/Loki/Utilities/Debugging.swift @@ -1,5 +1,5 @@ -// For some reason NSLog doesn't seem to work. This is a workaround to still allow debugging from Obj-C. +// For some reason NSLog doesn't seem to work from SignalServiceKit. This is a workaround to still allow debugging from Obj-C. @objc(LKLogger) public final class ObjC_Logger : NSObject { diff --git a/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift b/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift index 50ecd878e..7bfe38846 100644 --- a/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift +++ b/SignalServiceKit/src/Loki/Utilities/DisplayNameUtilities.swift @@ -19,7 +19,7 @@ public final class UserDisplayNameUtilities : NSObject { if hexEncodedPublicKey == userHexEncodedPublicKey { return userDisplayName } else { - return SSKEnvironment.shared.profileManager.profileName(forRecipientId: hexEncodedPublicKey) + return SSKEnvironment.shared.profileManager.profileNameForRecipient(withID: hexEncodedPublicKey) } } diff --git a/SignalServiceKit/src/Messages/Attachments/OWSAttachmentDownloads.m b/SignalServiceKit/src/Messages/Attachments/OWSAttachmentDownloads.m index f98e71815..076de2151 100644 --- a/SignalServiceKit/src/Messages/Attachments/OWSAttachmentDownloads.m +++ b/SignalServiceKit/src/Messages/Attachments/OWSAttachmentDownloads.m @@ -500,7 +500,7 @@ typedef void (^AttachmentDownloadFailure)(NSError *error); manager.completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); // We want to avoid large downloads from a compromised or buggy service. - const long kMaxDownloadSize = 12 * 1024 * 1024; + const long kMaxDownloadSize = 10 * 1024 * 1024; __block BOOL hasCheckedContentLength = NO; NSString *tempFilePath = diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachment.m b/SignalServiceKit/src/Messages/Attachments/TSAttachment.m index 0b27a72ec..6ca417e28 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachment.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachment.m @@ -36,7 +36,6 @@ NSUInteger const TSAttachmentSchemaVersion = 4; albumMessageId:(nullable NSString *)albumMessageId { OWSAssertDebug(serverId > 0); -// OWSAssertDebug(encryptionKey.length > 0); if (byteCount <= 0) { // This will fail with legacy iOS clients which don't upload attachment size. OWSLogWarn(@"Missing byteCount for attachment with serverId: %lld", serverId); @@ -138,7 +137,6 @@ NSUInteger const TSAttachmentSchemaVersion = 4; { if (!pointer.lazyRestoreFragment) { OWSAssertDebug(pointer.serverId > 0); -// OWSAssertDebug(pointer.encryptionKey.length > 0); if (pointer.byteCount <= 0) { // This will fail with legacy iOS clients which don't upload attachment size. OWSLogWarn(@"Missing pointer.byteCount for attachment with serverId: %lld", pointer.serverId); diff --git a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.m b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.m index 9b9181da7..56ffad853 100644 --- a/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.m +++ b/SignalServiceKit/src/Messages/DeviceSyncing/OWSOutgoingSentMessageTranscript.m @@ -80,7 +80,6 @@ NS_ASSUME_NONNULL_BEGIN TSOutgoingMessageRecipientState *_Nullable recipientState = [self.message recipientStateForRecipientId:recipientId]; if (!recipientState) { - // OWSFailDebug(@"missing recipient state for: %@", recipientId); continue; } if (recipientState.state != OWSOutgoingMessageRecipientStateSent) { diff --git a/SignalServiceKit/src/Messages/Interactions/TSInteraction.m b/SignalServiceKit/src/Messages/Interactions/TSInteraction.m index 3b7ab2381..f09360281 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSInteraction.m +++ b/SignalServiceKit/src/Messages/Interactions/TSInteraction.m @@ -188,10 +188,7 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value) { OWSAssertDebug(other); -// uint64_t sortId1 = self.sortId; -// uint64_t sortId2 = other.sortId; - - // Loki: Sort the messages by sender's timestamp + // Loki: Sort the messages by the sender's timestamp (Signal uses sortId) uint64_t sortId1 = self.timestamp; uint64_t sortId2 = other.timestamp; diff --git a/SignalServiceKit/src/Messages/Interactions/TSMessage.h b/SignalServiceKit/src/Messages/Interactions/TSMessage.h index d1ea16e9d..2d12315e1 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSMessage.h +++ b/SignalServiceKit/src/Messages/Interactions/TSMessage.h @@ -47,9 +47,9 @@ typedef NS_ENUM(NSInteger, LKMessageFriendRequestStatus) { @property BOOL skipSave; // P2P @property (nonatomic) BOOL isP2P; -// Group chat -@property (nonatomic) uint64_t groupChatServerID; // Should ideally be publicChatServerID -@property (nonatomic, readonly) BOOL isGroupChatMessage; // Should ideally be isPublicChatMessage +// Open groups +@property (nonatomic) uint64_t openGroupServerMessageID; +@property (nonatomic, readonly) BOOL isOpenGroupMessage; - (instancetype)initInteractionWithTimestamp:(uint64_t)timestamp inThread:(TSThread *)thread NS_UNAVAILABLE; @@ -96,9 +96,9 @@ typedef NS_ENUM(NSInteger, LKMessageFriendRequestStatus) { - (void)saveFriendRequestStatus:(LKMessageFriendRequestStatus)friendRequestStatus withTransaction:(YapDatabaseReadWriteTransaction *_Nullable)transaction; - (void)saveFriendRequestExpiresAt:(u_int64_t)expiresAt withTransaction:(YapDatabaseReadWriteTransaction *_Nullable)transaction; -#pragma mark - Group Chat +#pragma mark - Open Groups -- (void)saveGroupChatServerID:(uint64_t)serverMessageID in:(YapDatabaseReadWriteTransaction *_Nullable)transaction; +- (void)saveOpenGroupServerMessageID:(uint64_t)serverMessageID in:(YapDatabaseReadWriteTransaction *_Nullable)transaction; #pragma mark - Link Preview diff --git a/SignalServiceKit/src/Messages/Interactions/TSMessage.m b/SignalServiceKit/src/Messages/Interactions/TSMessage.m index 2d4a2d4f6..586826a0d 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSMessage.m @@ -82,7 +82,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4; _linkPreview = linkPreview; _friendRequestStatus = LKMessageFriendRequestStatusNone; _friendRequestExpiresAt = 0; - _groupChatServerID = -1; + _openGroupServerMessageID = -1; return self; } @@ -350,23 +350,22 @@ static const NSUInteger OWSMessageSchemaVersion = 4; if (attachmentDescription.length > 0 && bodyDescription.length > 0) { // Attachment with caption. -// if ([CurrentAppContext() isRTL]) { -// return [[bodyDescription stringByAppendingString:@": "] stringByAppendingString:attachmentDescription]; -// } else { + if ([CurrentAppContext() isRTL]) { + return [[bodyDescription stringByAppendingString:@": "] stringByAppendingString:attachmentDescription]; + } else { return [[attachmentDescription stringByAppendingString:@": "] stringByAppendingString:bodyDescription]; -// } + } } else if (bodyDescription.length > 0) { return bodyDescription; } else if (attachmentDescription.length > 0) { return attachmentDescription; } else if (self.contactShare) { -// if (CurrentAppContext().isRTL) { -// return [self.contactShare.name.displayName stringByAppendingString:@" 👤"]; -// } else { + if (CurrentAppContext().isRTL) { + return [self.contactShare.name.displayName stringByAppendingString:@" 👤"]; + } else { return [@"👤 " stringByAppendingString:self.contactShare.name.displayName]; -// } + } } else { -// OWSFailDebug(@"message has neither body nor attachment."); // TODO: We should do better here. return @""; } @@ -495,14 +494,14 @@ static const NSUInteger OWSMessageSchemaVersion = 4; return self.isFriendRequest && self.friendRequestStatus != LKMessageFriendRequestStatusSendingOrFailed; } -#pragma mark - Group Chat +#pragma mark - Open Groups -- (BOOL)isGroupChatMessage { - return self.groupChatServerID > 0; +- (BOOL)isOpenGroupMessage { + return self.openGroupServerMessageID > 0; } -- (void)saveGroupChatServerID:(uint64_t)serverMessageID in:(YapDatabaseReadWriteTransaction *_Nullable)transaction { - self.groupChatServerID = serverMessageID; +- (void)saveOpenGroupServerMessageID:(uint64_t)serverMessageID in:(YapDatabaseReadWriteTransaction *_Nullable)transaction { + self.openGroupServerMessageID = serverMessageID; if (transaction == nil) { [self save]; [self.dbReadWriteConnection flushTransactionsWithCompletionQueue:dispatch_get_main_queue() completionBlock:^{}]; @@ -512,7 +511,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4; } } -#pragma mark - Link Preview +#pragma mark - Link Previews - (void)generateLinkPreviewIfNeededFromURL:(NSString *)url { [OWSLinkPreview tryToBuildPreviewInfoObjcWithPreviewUrl:url] diff --git a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m index 58f8a4a7c..a738ba85b 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSOutgoingMessage.m @@ -693,10 +693,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt changeBlock:^(TSOutgoingMessage *message) { TSOutgoingMessageRecipientState *_Nullable recipientState = message.recipientStateMap[recipientId]; - if (!recipientState) { - // OWSFailDebug(@"Missing recipient state for recipient: %@", recipientId); - return; - } + if (!recipientState) { return; } recipientState.state = OWSOutgoingMessageRecipientStateSent; recipientState.wasSentByUD = wasSentByUD; [message setIsCalculatingPoW:NO]; @@ -712,10 +709,7 @@ NSString *NSStringForOutgoingMessageRecipientState(OWSOutgoingMessageRecipientSt changeBlock:^(TSOutgoingMessage *message) { TSOutgoingMessageRecipientState *_Nullable recipientState = message.recipientStateMap[recipientId]; - if (!recipientState) { - // OWSFailDebug(@"Missing recipient state for recipient: %@", recipientId); - return; - } + if (!recipientState) { return; } recipientState.state = OWSOutgoingMessageRecipientStateSkipped; [message setIsCalculatingPoW:NO]; }]; diff --git a/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.m b/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.m index d6b51118c..bf7cd1349 100644 --- a/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.m +++ b/SignalServiceKit/src/Messages/Interactions/TSQuotedMessage.m @@ -157,8 +157,6 @@ NS_ASSUME_NONNULL_BEGIN } } - // OWSAssertDebug(bodySource != TSQuotedMessageContentSourceUnknown); - NSMutableArray *attachmentInfos = [NSMutableArray new]; for (SSKProtoDataMessageQuoteQuotedAttachment *quotedAttachment in quoteProto.attachments) { hasAttachment = YES; @@ -208,7 +206,6 @@ NS_ASSUME_NONNULL_BEGIN } if (body.length == 0 && !hasAttachment) { -// OWSFailDebug(@"quoted message has neither text nor attachment"); return nil; } diff --git a/SignalServiceKit/src/Messages/OWSMessageHandler.m b/SignalServiceKit/src/Messages/OWSMessageHandler.m index d56e30afc..6a36a344c 100644 --- a/SignalServiceKit/src/Messages/OWSMessageHandler.m +++ b/SignalServiceKit/src/Messages/OWSMessageHandler.m @@ -78,10 +78,6 @@ NSString *envelopeAddress(SSKProtoEnvelope *envelope) } else { // Don't fire an analytics event; if we ever add a new content type, we'd generate a ton of // analytics traffic. - // Loki: Original code - // ======== -// OWSFailDebug(@"Unknown content type."); - // ======== return @"UnknownContent"; } } diff --git a/SignalServiceKit/src/Messages/OWSMessageManager.m b/SignalServiceKit/src/Messages/OWSMessageManager.m index 7cc98d993..16e690ee2 100644 --- a/SignalServiceKit/src/Messages/OWSMessageManager.m +++ b/SignalServiceKit/src/Messages/OWSMessageManager.m @@ -1601,7 +1601,7 @@ NS_ASSUME_NONNULL_BEGIN // Loki: Parse Loki specific properties if needed if (envelope.isPtpMessage) { incomingMessage.isP2P = YES; } - if (dataMessage.publicChatInfo != nil && dataMessage.publicChatInfo.hasServerID) { incomingMessage.groupChatServerID = dataMessage.publicChatInfo.serverID; } + if (dataMessage.publicChatInfo != nil && dataMessage.publicChatInfo.hasServerID) { incomingMessage.openGroupServerMessageID = dataMessage.publicChatInfo.serverID; } NSArray *attachmentPointers = [TSAttachmentPointer attachmentPointersFromProtos:dataMessage.attachments diff --git a/SignalServiceKit/src/Messages/OWSMessageReceiver.m b/SignalServiceKit/src/Messages/OWSMessageReceiver.m index adb2aa990..d39208cde 100644 --- a/SignalServiceKit/src/Messages/OWSMessageReceiver.m +++ b/SignalServiceKit/src/Messages/OWSMessageReceiver.m @@ -398,8 +398,8 @@ NSString *const OWSMessageDecryptJobFinderExtensionGroup = @"OWSMessageProcessin OWSAssertDebug(transaction); // Loki: Don't process any messages from ourself - ECKeyPair *_Nullable keyPair = OWSIdentityManager.sharedManager.identityKeyPair; - if (keyPair && [result.source isEqualToString:keyPair.hexEncodedPublicKey]) { + ECKeyPair *_Nullable userKeyPair = OWSIdentityManager.sharedManager.identityKeyPair; + if (userKeyPair && [result.source isEqualToString:userKeyPair.hexEncodedPublicKey]) { dispatch_async(self.serialQueue, ^{ completion(YES); }); diff --git a/SignalServiceKit/src/Messages/OWSMessageSend.swift b/SignalServiceKit/src/Messages/OWSMessageSend.swift index 6202ef9ff..c0747a727 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSend.swift +++ b/SignalServiceKit/src/Messages/OWSMessageSend.swift @@ -21,7 +21,7 @@ public class OWSMessageSend: NSObject { @objc public let recipient: SignalRecipient - private static let kMaxRetriesPerRecipient: Int = 1 + private static let kMaxRetriesPerRecipient: Int = 1 // Loki: We have our own retrying @objc public var remainingAttempts = OWSMessageSend.kMaxRetriesPerRecipient diff --git a/SignalServiceKit/src/Messages/OWSMessageSender.m b/SignalServiceKit/src/Messages/OWSMessageSender.m index c6ad7e784..47680d687 100644 --- a/SignalServiceKit/src/Messages/OWSMessageSender.m +++ b/SignalServiceKit/src/Messages/OWSMessageSender.m @@ -1280,7 +1280,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException"; [[LKPublicChatAPI sendMessage:groupMessage toGroup:publicChat.channel onServer:publicChat.server] .thenOn(OWSDispatch.sendingQueue, ^(LKGroupMessage *groupMessage) { [self.dbConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [message saveGroupChatServerID:groupMessage.serverID in:transaction]; + [message saveOpenGroupServerMessageID:groupMessage.serverID in:transaction]; [OWSPrimaryStorage.sharedManager setIDForMessageWithServerID:groupMessage.serverID to:message.uniqueId in:transaction]; }]; [self messageSendDidSucceed:messageSend deviceMessages:deviceMessages wasSentByUD:messageSend.isUDSend wasSentByWebsocket:false]; diff --git a/SignalServiceKit/src/Messages/TSGroupModel.m b/SignalServiceKit/src/Messages/TSGroupModel.m index b02a1fad7..ba34114e1 100644 --- a/SignalServiceKit/src/Messages/TSGroupModel.m +++ b/SignalServiceKit/src/Messages/TSGroupModel.m @@ -151,22 +151,21 @@ const int32_t kGroupIdLength = 16; if ([newModel.removedMembers containsObject:hexEncodedPublicKey]) { updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:NSLocalizedString(@"YOU_WERE_REMOVED", @"")]; - } - else { - NSArray *removedMembersNames = [[newModel.removedMembers allObjects] map:^NSString*(NSString* item) { + } else { + NSArray *removedMemberNames = [[newModel.removedMembers allObjects] map:^NSString*(NSString* item) { return [contactsManager displayNameForPhoneIdentifier:item]; }]; - if ([removedMembersNames count] > 1) { + if ([removedMemberNames count] > 1) { updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:NSLocalizedString(@"GROUP_MEMBERS_REMOVED", @""), - [removedMembersNames componentsJoinedByString:@", "]]]; + [removedMemberNames componentsJoinedByString:@", "]]]; } else { updatedGroupInfoString = [updatedGroupInfoString stringByAppendingString:[NSString stringWithFormat:NSLocalizedString(@"GROUP_MEMBER_REMOVED", @""), - [removedMembersNames componentsJoinedByString:@", "]]]; + removedMemberNames[0]]]; } } } diff --git a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m index a3d6bd213..a07a7373e 100644 --- a/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m +++ b/SignalServiceKit/src/Network/API/Requests/OWSRequestFactory.m @@ -64,7 +64,6 @@ NS_ASSUME_NONNULL_BEGIN + (TSRequest *)acknowledgeMessageDeliveryRequestWithSource:(NSString *)source timestamp:(UInt64)timestamp { -// OWSAssertDebug(source.length > 0); OWSAssertDebug(timestamp > 0); NSString *path = [NSString stringWithFormat:@"v1/messages/%@/%llu", source, timestamp]; @@ -220,7 +219,6 @@ NS_ASSUME_NONNULL_BEGIN NSString *path = [textSecureAccountsAPI stringByAppendingString:textSecureAttributesAPI]; NSString *authKey = self.tsAccountManager.serverAuthToken; - // OWSAssertDebug(authKey.length > 0); NSString *_Nullable pin = [self.ows2FAManager pinCode]; NSDictionary *accountAttributes = [self accountAttributesWithPin:pin authKey:authKey]; @@ -321,7 +319,6 @@ NS_ASSUME_NONNULL_BEGIN + (NSDictionary *)accountAttributesWithPin:(nullable NSString *)pin authKey:(NSString *)authKey { - // OWSAssertDebug(authKey.length > 0); uint32_t registrationId = [self.tsAccountManager getOrGenerateRegistrationId]; BOOL isManualMessageFetchEnabled = self.tsAccountManager.isManualMessageFetchEnabled; diff --git a/SignalServiceKit/src/Network/API/TSNetworkManager.m b/SignalServiceKit/src/Network/API/TSNetworkManager.m index a04bec4a7..fb7e50658 100644 --- a/SignalServiceKit/src/Network/API/TSNetworkManager.m +++ b/SignalServiceKit/src/Network/API/TSNetworkManager.m @@ -384,7 +384,6 @@ dispatch_queue_t NetworkManagerQueue() { OWSAssertDebug(failureBlock); OWSAssertDebug(request); - // OWSAssertDebug(task); OWSAssertDebug(networkError); NSInteger statusCode = [task statusCode]; @@ -504,7 +503,7 @@ dispatch_queue_t NetworkManagerQueue() request:(TSRequest *)request statusCode:(NSInteger)statusCode { /* Loki: Original code - * We don't really care about invalid auth + * We don't care about invalid auth * ======== OWSLogVerbose(@"Invalid auth: %@", task.originalRequest.allHTTPHeaderFields); diff --git a/SignalServiceKit/src/Network/MessageSenderJobQueue.swift b/SignalServiceKit/src/Network/MessageSenderJobQueue.swift index 028e7390c..a27f3ba19 100644 --- a/SignalServiceKit/src/Network/MessageSenderJobQueue.swift +++ b/SignalServiceKit/src/Network/MessageSenderJobQueue.swift @@ -79,7 +79,7 @@ public class MessageSenderJobQueue: NSObject, JobQueue { public typealias DurableOperationType = MessageSenderOperation public static let jobRecordLabel: String = "MessageSender" - public static let maxRetries: UInt = 1 + public static let maxRetries: UInt = 1 // Loki: We have our own retrying public let requiresInternet: Bool = true public var runningOperations: [MessageSenderOperation] = [] @@ -94,9 +94,10 @@ public class MessageSenderJobQueue: NSObject, JobQueue { public var isSetup: Bool = false + /// Used when the user clears their database to cancel any outstanding jobs. @objc public func clearAllJobs() { self.dbConnection.readWrite { transaction in - let statuses: [SSKJobRecordStatus] = [ .unknown, .ready, .running, .permanentlyFailed, .unknown ] + let statuses: [SSKJobRecordStatus] = [ .unknown, .ready, .running, .permanentlyFailed ] var records: [SSKJobRecord] = [] statuses.forEach { records += self.finder.allRecords(label: self.jobRecordLabel, status: $0, transaction: transaction) diff --git a/SignalServiceKit/src/Network/OWSSignalService.m b/SignalServiceKit/src/Network/OWSSignalService.m index 4cd89785d..a3b5ae31b 100644 --- a/SignalServiceKit/src/Network/OWSSignalService.m +++ b/SignalServiceKit/src/Network/OWSSignalService.m @@ -188,6 +188,7 @@ NSString *const kNSNotificationName_IsCensorshipCircumventionActiveDidChange = NSURLSessionConfiguration *configuration = NSURLSessionConfiguration.ephemeralSessionConfiguration; AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration]; AFSecurityPolicy *securityPolicy = AFSecurityPolicy.defaultPolicy; + // Snode to snode communication uses self-signed certificates but clients can safely ignore this securityPolicy.allowInvalidCertificates = YES; securityPolicy.validatesDomainName = NO; sessionManager.securityPolicy = securityPolicy; diff --git a/SignalServiceKit/src/Protocols/ProfileManagerProtocol.h b/SignalServiceKit/src/Protocols/ProfileManagerProtocol.h index f2d13a742..d7cb222a4 100644 --- a/SignalServiceKit/src/Protocols/ProfileManagerProtocol.h +++ b/SignalServiceKit/src/Protocols/ProfileManagerProtocol.h @@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN - (OWSAES256Key *)localProfileKey; - (nullable NSString *)localProfileName; -- (nullable NSString *)profileNameForRecipientId:(NSString *)recipientId; +- (nullable NSString *)profileNameForRecipientWithID:(NSString *)recipientID; - (nullable NSString *)profilePictureURL; - (nullable NSData *)profileKeyDataForRecipientId:(NSString *)recipientId; @@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)fetchProfileForRecipientId:(NSString *)recipientId; - (void)updateProfileForContactWithID:(NSString *)contactID displayName:(NSString *)displayName with:(YapDatabaseReadWriteTransaction *)transaction; -- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName avatarUrl:(nullable NSString *)avatarURL; +- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName avatarURL:(nullable NSString *)avatarURL; @end diff --git a/SignalServiceKit/src/SSKEnvironment.m b/SignalServiceKit/src/SSKEnvironment.m index ecfa64f94..be9b85881 100644 --- a/SignalServiceKit/src/SSKEnvironment.m +++ b/SignalServiceKit/src/SSKEnvironment.m @@ -157,25 +157,26 @@ static SSKEnvironment *sharedSSKEnvironment; } #pragma mark - Mutable Accessors +/* +- (nullable id)callMessageHandler +{ + @synchronized(self) { + OWSAssertDebug(_callMessageHandler); -//- (nullable id)callMessageHandler -//{ -// @synchronized(self) { -// OWSAssertDebug(_callMessageHandler); -// -// return _callMessageHandler; -// } -//} -// -//- (void)setCallMessageHandler:(nullable id)callMessageHandler -//{ -// @synchronized(self) { -// OWSAssertDebug(callMessageHandler); -// OWSAssertDebug(!_callMessageHandler); -// -// _callMessageHandler = callMessageHandler; -// } -//} + return _callMessageHandler; + } +} + +- (void)setCallMessageHandler:(nullable id)callMessageHandler +{ + @synchronized(self) { + OWSAssertDebug(callMessageHandler); + OWSAssertDebug(!_callMessageHandler); + + _callMessageHandler = callMessageHandler; + } +} + */ - (nullable id)notificationsManager { diff --git a/SignalServiceKit/src/Storage/OWSPrimaryStorage.m b/SignalServiceKit/src/Storage/OWSPrimaryStorage.m index ec3dbcd1d..f05fcc8b9 100644 --- a/SignalServiceKit/src/Storage/OWSPrimaryStorage.m +++ b/SignalServiceKit/src/Storage/OWSPrimaryStorage.m @@ -216,7 +216,7 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage) [SSKJobRecordFinder asyncRegisterDatabaseExtensionObjCWithStorage:self]; // Loki - [LKFriendRequestExpirationMessageFinder asyncRegisterDatabaseExtensions:self]; + [LKExpiringFriendRequestFinder asyncRegisterDatabaseExtensions:self]; [LKDeviceLinkIndex asyncRegisterDatabaseExtensions:self]; [self.database diff --git a/SignalServiceKit/src/Storage/OWSStorage.m b/SignalServiceKit/src/Storage/OWSStorage.m index 344afc49e..11c6d1cbe 100644 --- a/SignalServiceKit/src/Storage/OWSStorage.m +++ b/SignalServiceKit/src/Storage/OWSStorage.m @@ -496,8 +496,7 @@ NSString *const kNSUserDefaults_DatabaseExtensionVersionMap = @"kNSUserDefaults_ unarchiver.delegate = unarchiverDelegate; return [unarchiver decodeObjectForKey:@"root"]; } @catch (NSException *exception) { - // Sync log in case we bail. -// OWSFailDebug(@"error deserializing object: %@, %@", collection, exception); + // Sync log in case we bail OWSProdCritical([OWSAnalyticsEvents storageErrorDeserialization]); @throw exception; } diff --git a/SignalServiceKit/src/TSConstants.h b/SignalServiceKit/src/TSConstants.h index 3ce8e32e2..c28b67512 100644 --- a/SignalServiceKit/src/TSConstants.h +++ b/SignalServiceKit/src/TSConstants.h @@ -21,7 +21,7 @@ typedef NS_ENUM(NSInteger, TSWhisperMessageType) { #define textSecureHTTPTimeOut 10 -#define kLegalTermsUrlString @"https://github.com/loki-project/loki-messenger-ios/blob/master/privacy-policy.md" +#define kLegalTermsUrlString @"https://getsession.org/legal/#privacy-policy" //#ifndef DEBUG diff --git a/SignalServiceKit/src/Util/NSError+MessageSending.m b/SignalServiceKit/src/Util/NSError+MessageSending.m index 0ae550bfb..0c01ebe15 100644 --- a/SignalServiceKit/src/Util/NSError+MessageSending.m +++ b/SignalServiceKit/src/Util/NSError+MessageSending.m @@ -22,7 +22,6 @@ static void *kNSError_MessageSender_IsFatal = &kNSError_MessageSender_IsFatal; NSNumber *value = objc_getAssociatedObject(self, kNSError_MessageSender_IsRetryable); // This value should always be set for all errors by the time OWSSendMessageOperation // queries it's value. If not, default to retrying in production. - // OWSAssertDebug(value); return value ? [value boolValue] : YES; } diff --git a/SignalServiceKit/src/Util/OWSAnalytics.m b/SignalServiceKit/src/Util/OWSAnalytics.m index 678cdaff3..f7c070c41 100755 --- a/SignalServiceKit/src/Util/OWSAnalytics.m +++ b/SignalServiceKit/src/Util/OWSAnalytics.m @@ -360,7 +360,7 @@ NSString *NSStringForOWSAnalyticsSeverity(OWSAnalyticsSeverity severity) location:(const char *)location line:(int)line { - // Loki: Do nothing + return; // Loki: Do nothing DDLogFlag logFlag; switch (severity) { case OWSAnalyticsSeverityInfo: