Browse Source

Make things compile again

pull/313/head
Niels Andriesse 2 years ago
parent
commit
ac6baec6f2
  1. 2
      Podfile
  2. 2
      Podfile.lock
  3. 9
      Session/Configuration.swift
  4. 26
      Session/Meta/Signal-Bridging-Header.h
  5. 2
      Session/Meta/Signal-Prefix.pch
  6. 4
      Session/Signal/AboutTableViewController.m
  7. 7
      Session/Signal/AppDelegate.m
  8. 2
      Session/Signal/AvatarViewHelper.m
  9. 2
      Session/Signal/ConversationView/Cells/AttachmentUploadView.m
  10. 8
      Session/Signal/ConversationView/Cells/ConversationMediaView.swift
  11. 19
      Session/Signal/ConversationView/Cells/MediaDownloadView.swift
  12. 2
      Session/Signal/ConversationView/Cells/OWSBubbleShapeView.m
  13. 2
      Session/Signal/ConversationView/Cells/OWSBubbleView.m
  14. 2
      Session/Signal/ConversationView/Cells/OWSGenericAttachmentView.m
  15. 13
      Session/Signal/ConversationView/Cells/OWSMessageBubbleView.m
  16. 2
      Session/Signal/ConversationView/Cells/OWSMessageHeaderView.m
  17. 2
      Session/Signal/ConversationView/Cells/OWSMessageTextView.m
  18. 4
      Session/Signal/ConversationView/Cells/OWSQuotedMessageView.m
  19. 8
      Session/Signal/ConversationView/Cells/OWSSystemMessageCell.m
  20. 2
      Session/Signal/ConversationView/ConversationInputTextView.m
  21. 4
      Session/Signal/ConversationView/ConversationInputToolbar.m
  22. 73
      Session/Signal/ConversationView/ConversationViewController.m
  23. 1
      Session/Signal/ConversationView/ConversationViewItem.h
  24. 13
      Session/Signal/ConversationView/ConversationViewItem.m
  25. 2
      Session/Signal/ConversationView/ConversationViewModel.m
  26. 2
      Session/Signal/DateUtil.m
  27. 2
      Session/Signal/MainAppContext.m
  28. 2
      Session/Signal/NotificationSettingsOptionsViewController.m
  29. 6
      Session/Signal/NotificationSettingsViewController.m
  30. 2
      Session/Signal/OWSBackupExportJob.m
  31. 2
      Session/Signal/OWSBackupImportJob.m
  32. 2
      Session/Signal/OWSBackupJob.h
  33. 4
      Session/Signal/OWSBackupSettingsViewController.m
  34. 8
      Session/Signal/OWSConversationSettingsViewController.m
  35. 6
      Session/Signal/OWSOrphanDataCleaner.m
  36. 4
      Session/Signal/OWSProgressView.m
  37. 2
      Session/Signal/OWSScreenLockUI.m
  38. 4
      Session/Signal/OWSSoundSettingsViewController.m
  39. 6
      Session/Signal/PrivacySettingsTableViewController.m
  40. 2
      Session/Signal/SignalApp.m
  41. 2
      Session/View Controllers/EditClosedGroupVC.swift
  42. 2
      Session/View Controllers/HomeVC.swift
  43. 2
      Session/View Controllers/NewClosedGroupVC.swift
  44. 0
      SessionMessagingKit/Database/OWSBackupFragment.h
  45. 0
      SessionMessagingKit/Database/OWSBackupFragment.m
  46. 56
      SessionMessagingKit/Database/OWSPrimaryStorage.m
  47. 0
      SessionMessagingKit/Database/OWSStorage+Subclass.h
  48. 1
      SessionMessagingKit/Messages/Signal/TSMessage.m
  49. 7
      SessionMessagingKit/Meta/SessionMessagingKit.h
  50. 7
      SessionMessagingKit/Sending & Receiving/Attachments/TSAttachmentPointer.h
  51. 25
      SessionMessagingKit/Sending & Receiving/Attachments/TSAttachmentPointer.m
  52. 39
      SessionMessagingKit/Sending & Receiving/Blocking/OWSBlockingManager.m
  53. 51
      SessionMessagingKit/Sending & Receiving/Expiration/OWSDisappearingMessagesJob.m
  54. 39
      SessionMessagingKit/To Do/TSAccountManager.m
  55. 17
      SessionMessagingKit/Utilities/AppReadiness.m
  56. 10
      SessionMessagingKit/Utilities/DeviceSleepManager.swift
  57. 0
      SessionMessagingKit/Utilities/Environment.h
  58. 15
      SessionMessagingKit/Utilities/Environment.m
  59. 5
      SessionMessagingKit/Utilities/OWSAudioPlayer.h
  60. 40
      SessionMessagingKit/Utilities/OWSAudioPlayer.m
  61. 0
      SessionMessagingKit/Utilities/OWSAudioSession.swift
  62. 70
      SessionMessagingKit/Utilities/OWSIdentityManager.m
  63. 2
      SessionMessagingKit/Utilities/OWSPreferences.h
  64. 33
      SessionMessagingKit/Utilities/OWSPreferences.m
  65. 3
      SessionMessagingKit/Utilities/OWSSounds.h
  66. 27
      SessionMessagingKit/Utilities/OWSSounds.m
  67. 2
      SessionMessagingKit/Utilities/OWSWindowManager.h
  68. 121
      SessionMessagingKit/Utilities/OWSWindowManager.m
  69. 0
      SessionMessagingKit/Utilities/ProximityMonitoringManager.swift
  70. 9
      SessionShareExtension/Meta/SignalShareExtension-Bridging-Header.h
  71. 1
      SessionShareExtension/ShareAppExtensionContext.m
  72. 3
      SessionUtilitiesKit/Meta/SessionUtilitiesKit.h
  73. 2
      SessionUtilitiesKit/NSString+SSK.h
  74. 3
      SessionUtilitiesKit/NSString+SSK.m
  75. 0
      SessionUtilitiesKit/OWSMath.h
  76. 5
      SessionUtilitiesKit/String+SSK.swift
  77. 2
      SessionUtilitiesKit/UIDevice+featureSupport.swift
  78. 9
      SessionUtilitiesKit/UIView+OWS.h
  79. 73
      SessionUtilitiesKit/UIView+OWS.m
  80. 0
      SessionUtilitiesKit/Weak.swift
  81. 190
      Signal.xcodeproj/project.pbxproj
  82. 2
      SignalUtilitiesKit/AppSetup.m
  83. 6
      SignalUtilitiesKit/Messaging/Sending & Receiving/MessageSender+Handling.swift
  84. 19
      SignalUtilitiesKit/Messaging/TSAttachmentPointer+Backups.h
  85. 34
      SignalUtilitiesKit/Messaging/TSAttachmentPointer+Backups.m
  86. 8
      SignalUtilitiesKit/Meta/SignalUtilitiesKit.h
  87. 0
      SignalUtilitiesKit/OWSAlerts.swift
  88. 2
      SignalUtilitiesKit/To Do/OWSProfileManager.m
  89. 2
      SignalUtilitiesKit/To Do/OWSUserProfile.m
  90. 4
      SignalUtilitiesKit/UI/MediaMessageView.swift
  91. 2
      SignalUtilitiesKit/UI/SelectRecipientViewController.m
  92. 2
      SignalUtilitiesKit/UI/SelectThreadViewController.m
  93. 2
      SignalUtilitiesKit/UI/SharingThreadPickerViewController.m

2
Podfile

@ -72,6 +72,7 @@ target 'SessionMessagingKit' do
pod 'HKDFKit', :inhibit_warnings => true
pod 'Mantle', git: 'https://github.com/signalapp/Mantle', branch: 'signal-master', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'PureLayout', '~> 3.1.4', :inhibit_warnings => true
pod 'Reachability', :inhibit_warnings => true
pod 'SAMKeychain', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
@ -104,6 +105,7 @@ target 'SessionUtilitiesKit' do
pod 'Curve25519Kit', git: 'https://github.com/signalapp/Curve25519Kit.git', :inhibit_warnings => true
pod 'Mantle', git: 'https://github.com/signalapp/Mantle', branch: 'signal-master', :inhibit_warnings => true
pod 'PromiseKit', :inhibit_warnings => true
pod 'PureLayout', '~> 3.1.4', :inhibit_warnings => true
pod 'SAMKeychain', :inhibit_warnings => true
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit.git', :inhibit_warnings => true
pod 'YapDatabase/SQLCipher', :git => 'https://github.com/signalapp/YapDatabase.git', branch: 'signal-release', :inhibit_warnings => true

2
Podfile.lock

@ -230,6 +230,6 @@ SPEC CHECKSUMS:
YYImage: 6db68da66f20d9f169ceb94dfb9947c3867b9665
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb
PODFILE CHECKSUM: b12682bc3bf974c758ec8e4b9838639f7ec51d5e
PODFILE CHECKSUM: f65f7b4344906f219fb7e1e4ca93b4ed1ac3132a
COCOAPODS: 1.10.0.rc.1

9
Session/Configuration.swift

@ -10,17 +10,12 @@ final class Configuration : NSObject {
@objc static func performMainSetup() {
SNMessagingKit.configure(
storage: Storage.shared,
messageSenderDelegate: MessageSenderDelegate.shared,
messageReceiverDelegate: MessageReceiverDelegate.shared,
signalStorage: OWSPrimaryStorage.shared(),
identityKeyStore: OWSIdentityManager.shared(),
sessionRestorationImplementation: SessionRestorationImplementation(),
certificateValidator: SMKCertificateDefaultValidator(trustRoot: OWSUDManagerImpl.trustRoot()),
openGroupAPIDelegate: OpenGroupAPIDelegate.shared,
pnServerURL: PushNotificationAPI.server,
pnServerPublicKey: PushNotificationAPI.serverPublicKey
certificateValidator: SMKCertificateDefaultValidator(trustRoot: OWSUDManagerImpl.trustRoot())
)
SessionProtocolKit.configure(storage: Storage.shared, sharedSenderKeysDelegate: MessageSenderDelegate.shared)
SessionProtocolKit.configure(storage: Storage.shared, sharedSenderKeysDelegate: MessageSender.shared)
SessionSnodeKit.configure(storage: Storage.shared)
SessionUtilitiesKit.configure(owsPrimaryStorage: OWSPrimaryStorage.shared(), maxFileSize: UInt(Double(FileServerAPI.maxFileSize) / FileServerAPI.fileSizeORMultiplier))
}

26
Session/Meta/Signal-Bridging-Header.h

@ -49,49 +49,49 @@
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/ContactTableViewCell.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSAudioPlayer.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSAudioPlayer.h>
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/OWSQuotedReplyModel.h>
#import <SignalUtilitiesKit/OWSSounds.h>
#import <SessionMessagingKit/OWSQuotedReplyModel.h>
#import <SessionMessagingKit/OWSSounds.h>
#import <SignalUtilitiesKit/OWSViewController.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SignalUtilitiesKit/UIFont+OWS.h>
#import <SignalUtilitiesKit/UIUtil.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SignalUtilitiesKit/UIViewController+OWS.h>
#import <SignalUtilitiesKit/AppVersion.h>
#import <SessionUtilitiesKit/DataSource.h>
#import <SessionUtilitiesKit/MIMETypeUtil.h>
#import <SessionUtilitiesKit/NSData+Image.h>
#import <SessionUtilitiesKit/NSNotificationCenter+OWS.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SessionMessagingKit/OWSBackgroundTask.h>
#import <SignalUtilitiesKit/OWSContactsOutputStream.h>
#import <SignalUtilitiesKit/OWSDispatch.h>
#import <SignalUtilitiesKit/OWSError.h>
#import <SessionUtilitiesKit/OWSFileSystem.h>
#import <SessionMessagingKit/OWSIdentityManager.h>
#import <SignalUtilitiesKit/OWSMediaGalleryFinder.h>
#import <SessionMessagingKit/OWSMediaGalleryFinder.h>
#import <SignalUtilitiesKit/OWSPrimaryStorage+SessionStore.h>
#import <SignalUtilitiesKit/OWSRecipientIdentity.h>
#import <SessionMessagingKit/OWSRecipientIdentity.h>
#import <SignalUtilitiesKit/SignalAccount.h>
#import <SignalUtilitiesKit/SignalRecipient.h>
#import <SessionMessagingKit/SignalRecipient.h>
#import <SessionMessagingKit/TSAccountManager.h>
#import <SessionMessagingKit/TSAttachment.h>
#import <SessionMessagingKit/TSAttachmentPointer.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SessionMessagingKit/TSContactThread.h>
#import <SignalUtilitiesKit/TSErrorMessage.h>
#import <SessionMessagingKit/TSErrorMessage.h>
#import <SessionMessagingKit/TSGroupThread.h>
#import <SessionMessagingKit/TSIncomingMessage.h>
#import <SignalUtilitiesKit/TSInfoMessage.h>
#import <SessionMessagingKit/TSInfoMessage.h>
#import <SessionMessagingKit/TSOutgoingMessage.h>
#import <SignalUtilitiesKit/TSPreKeyManager.h>
#import <SessionMessagingKit/TSThread.h>
#import <SignalUtilitiesKit/LKGroupUtilities.h>
#import <SessionUtilitiesKit/LKGroupUtilities.h>
#import <SessionUtilitiesKit/UIImage+OWS.h>
#import <WebRTC/RTCAudioSession.h>
#import <WebRTC/RTCCameraPreviewView.h>

2
Session/Meta/Signal-Prefix.pch

@ -18,7 +18,7 @@
#import <SignalCoreKit/NSObject+OWS.h>
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalUtilitiesKit/SSKAsserts.h>
#import <SignalUtilitiesKit/NSArray+Functional.h>
#import <SessionUtilitiesKit/NSArray+Functional.h>
#import <SignalUtilitiesKit/NSSet+Functional.h>
#import <SignalUtilitiesKit/NSObject+Casting.h>
#import <SessionUIKit/SessionUIKit.h>

4
Session/Signal/AboutTableViewController.m

@ -5,8 +5,8 @@
#import "AboutTableViewController.h"
#import "Session-Swift.h"
#import "UIView+OWS.h"
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SignalUtilitiesKit/UIUtil.h>
#import <SessionMessagingKit/OWSPrimaryStorage.h>
#import <SessionMessagingKit/TSDatabaseView.h>

7
Session/Signal/AppDelegate.m

@ -13,9 +13,9 @@
#import <PromiseKit/AnyPromise.h>
#import <SignalCoreKit/iOSVersions.h>
#import <SignalUtilitiesKit/AppSetup.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/OWSNavigationController.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/VersionMigrations.h>
#import <SessionMessagingKit/AppReadiness.h>
@ -23,7 +23,7 @@
#import <SessionMessagingKit/OWSDisappearingMessagesJob.h>
#import <SignalUtilitiesKit/OWSFailedAttachmentDownloadsJob.h>
#import <SignalUtilitiesKit/OWSFailedMessagesJob.h>
#import <SignalUtilitiesKit/OWSMath.h>
#import <SessionUtilitiesKit/OWSMath.h>
#import <SessionMessagingKit/OWSReadReceiptManager.h>
#import <SessionMessagingKit/SSKEnvironment.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
@ -776,7 +776,6 @@ static NSTimeInterval launchStartedAt;
- (void)startOpenGroupPollersIfNeeded
{
[LKPublicChatManager.shared startPollersIfNeeded];
[SSKEnvironment.shared.attachmentDownloads continueDownloadIfPossible];
}
- (void)stopOpenGroupPollers { [LKPublicChatManager.shared stopPollers]; }

2
Session/Signal/AvatarViewHelper.m

@ -9,7 +9,7 @@
#import <SignalUtilitiesKit/UIUtil.h>
#import <SignalUtilitiesKit/TSGroupModel.h>
#import <SessionMessagingKit/TSGroupModel.h>
#import <SessionMessagingKit/TSGroupThread.h>
#import <SessionMessagingKit/TSThread.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>

2
Session/Signal/ConversationView/Cells/AttachmentUploadView.m

@ -6,7 +6,7 @@
#import "OWSBezierPathView.h"
#import "OWSProgressView.h"
#import <SignalUtilitiesKit/UIFont+OWS.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/AppContext.h>
#import <SignalUtilitiesKit/OWSUploadOperation.h>
#import <SessionMessagingKit/TSAttachmentStream.h>

8
Session/Signal/ConversationView/Cells/ConversationMediaView.swift

@ -13,12 +13,6 @@ public class ConversationMediaView: UIView {
case failed
}
// MARK: - Dependencies
private var attachmentDownloads: OWSAttachmentDownloads {
return SSKEnvironment.shared.attachmentDownloads
}
// MARK: -
private let mediaCache: NSCache<NSString, AnyObject>
@ -163,11 +157,13 @@ public class ConversationMediaView: UIView {
configure(forError: .invalid)
return
}
/*
guard nil != attachmentDownloads.downloadProgress(forAttachmentId: attachmentId) else {
// Not being downloaded.
configure(forError: .missing)
return
}
*/
backgroundColor = (Theme.isDarkThemeEnabled ? .ows_gray90 : .ows_gray05)
let view: UIView

19
Session/Signal/ConversationView/Cells/MediaDownloadView.swift

@ -7,12 +7,6 @@ import Foundation
@objc
public class MediaDownloadView: UIView {
// MARK: - Dependencies
private var attachmentDownloads: OWSAttachmentDownloads {
return SSKEnvironment.shared.attachmentDownloads
}
// MARK: -
private let attachmentId: String
@ -75,13 +69,13 @@ public class MediaDownloadView: UIView {
shapeLayer1.frame = self.bounds
shapeLayer2.frame = self.bounds
guard let progress = attachmentDownloads.downloadProgress(forAttachmentId: attachmentId) else {
Logger.warn("No progress for attachment.")
shapeLayer1.path = nil
shapeLayer2.path = nil
return
}
shapeLayer1.path = nil
shapeLayer2.path = nil
return
// We can't display download progress yet
/*
// Prevent the shape layer from animating changes.
CATransaction.begin()
CATransaction.setDisableActions(true)
@ -115,5 +109,6 @@ public class MediaDownloadView: UIView {
shapeLayer2.fillColor = fillColor2.cgColor
CATransaction.commit()
*/
}
}

2
Session/Signal/ConversationView/Cells/OWSBubbleShapeView.m

@ -4,7 +4,7 @@
#import "OWSBubbleShapeView.h"
#import "OWSBubbleView.h"
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/ConversationView/Cells/OWSBubbleView.m

@ -4,7 +4,7 @@
#import "OWSBubbleView.h"
#import "MainAppContext.h"
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import "Session-Swift.h"
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/ConversationView/Cells/OWSGenericAttachmentView.m

@ -11,7 +11,7 @@
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SessionUtilitiesKit/MIMETypeUtil.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SignalCoreKit/NSString+OWS.h>

13
Session/Signal/ConversationView/Cells/OWSMessageBubbleView.m

@ -14,7 +14,7 @@
#import "OWSQuotedMessageView.h"
#import "Session-Swift.h"
#import "UIColor+OWS.h"
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN
@ -52,13 +52,6 @@ NS_ASSUME_NONNULL_BEGIN
@implementation OWSMessageBubbleView
#pragma mark - Dependencies
- (OWSAttachmentDownloads *)attachmentDownloads
{
return SSKEnvironment.shared.attachmentDownloads;
}
#pragma mark -
- (instancetype)initWithFrame:(CGRect)frame
@ -846,10 +839,6 @@ NS_ASSUME_NONNULL_BEGIN
OWSFailDebug(@"Missing uniqueId.");
return;
}
if ([self.attachmentDownloads downloadProgressForAttachmentId:uniqueId] == nil) {
OWSFailDebug(@"Missing download progress.");
return;
}
UIView *overlayView = [UIView new];
overlayView.backgroundColor = [self.bubbleColor colorWithAlphaComponent:0.5];

2
Session/Signal/ConversationView/Cells/OWSMessageHeaderView.m

@ -8,7 +8,7 @@
#import <SignalUtilitiesKit/OWSUnreadIndicator.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SignalUtilitiesKit/UIFont+OWS.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/ConversationView/Cells/OWSMessageTextView.m

@ -3,7 +3,7 @@
//
#import "OWSMessageTextView.h"
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN

4
Session/Signal/ConversationView/Cells/OWSQuotedMessageView.m

@ -11,9 +11,9 @@
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SignalUtilitiesKit/TSMessage.h>
#import <SessionMessagingKit/TSMessage.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN

8
Session/Signal/ConversationView/Cells/OWSSystemMessageCell.m

@ -9,10 +9,10 @@
#import "UIColor+OWS.h"
#import "UIFont+OWS.h"
#import "UIView+OWS.h"
#import <SignalUtilitiesKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/TSErrorMessage.h>
#import <SignalUtilitiesKit/TSInfoMessage.h>
#import <SessionMessagingKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/TSErrorMessage.h>
#import <SessionMessagingKit/TSInfoMessage.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/ConversationView/ConversationInputTextView.m

@ -4,7 +4,7 @@
#import "ConversationInputTextView.h"
#import "Session-Swift.h"
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SignalCoreKit/NSString+OWS.h>
NS_ASSUME_NONNULL_BEGIN

4
Session/Signal/ConversationView/ConversationInputToolbar.m

@ -12,8 +12,8 @@
#import <PromiseKit/AnyPromise.h>
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SignalUtilitiesKit/TSQuotedMessage.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SessionMessagingKit/TSQuotedMessage.h>
NS_ASSUME_NONNULL_BEGIN

73
Session/Signal/ConversationView/ConversationViewController.m

@ -42,7 +42,7 @@
#import <PromiseKit/AnyPromise.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/OWSNavigationController.h>
#import <SignalUtilitiesKit/OWSUnreadIndicator.h>
@ -51,7 +51,7 @@
#import <SignalUtilitiesKit/UIUtil.h>
#import <SignalUtilitiesKit/UIViewController+OWS.h>
#import <SessionUtilitiesKit/MIMETypeUtil.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SignalUtilitiesKit/OWSAttachmentDownloads.h>
#import <SessionMessagingKit/OWSBlockingManager.h>
#import <SessionMessagingKit/OWSDisappearingMessagesConfiguration.h>
@ -62,9 +62,9 @@
#import <SessionMessagingKit/OWSReadReceiptManager.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SessionMessagingKit/TSAccountManager.h>
#import <SignalUtilitiesKit/TSGroupModel.h>
#import <SignalUtilitiesKit/TSInvalidIdentityKeyReceivingErrorMessage.h>
#import <SignalUtilitiesKit/TSQuotedMessage.h>
#import <SessionMessagingKit/TSGroupModel.h>
#import <SessionMessagingKit/TSInvalidIdentityKeyReceivingErrorMessage.h>
#import <SessionMessagingKit/TSQuotedMessage.h>
#import <YapDatabase/YapDatabase.h>
#import <YapDatabase/YapDatabaseAutoView.h>
#import <YapDatabase/YapDatabaseViewChange.h>
@ -271,11 +271,6 @@ typedef enum : NSUInteger {
return SSKEnvironment.shared.typingIndicators;
}
- (OWSAttachmentDownloads *)attachmentDownloads
{
return SSKEnvironment.shared.attachmentDownloads;
}
- (TSAccountManager *)tsAccountManager
{
OWSAssertDebug(SSKEnvironment.shared.tsAccountManager);
@ -1457,16 +1452,18 @@ typedef enum : NSUInteger {
{
OWSAssert(message);
[self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.attachmentDownloads downloadAttachmentsForMessage:message
transaction:transaction
success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread);
}
failure:^(NSError *error) {
OWSLogWarn(@"Failed to redownload message with error: %@", error);
}];
}];
// TODO TODO TODO
// [self.uiDatabaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
// [self.attachmentDownloads downloadAttachmentsForMessage:message
// transaction:transaction
// success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
// OWSLogInfo(@"Successfully redownloaded attachment in thread: %@", message.thread);
// }
// failure:^(NSError *error) {
// OWSLogWarn(@"Failed to redownload message with error: %@", error);
// }];
// }];
}
- (void)handleUnsentMessageTap:(TSOutgoingMessage *)message
@ -1914,23 +1911,25 @@ typedef enum : NSUInteger {
return;
}
[self.uiDatabaseConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
[self.attachmentDownloads downloadAttachmentPointer:attachmentPointer
success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
OWSAssertDebug(attachmentStreams.count == 1);
TSAttachmentStream *attachmentStream = attachmentStreams.firstObject;
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) {
[message setQuotedMessageThumbnailAttachmentStream:attachmentStream];
[message saveWithTransaction:postSuccessTransaction];
}];
}
failure:^(NSError *error) {
OWSLogWarn(@"Failed to redownload thumbnail with error: %@", error);
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) {
[message touchWithTransaction:postSuccessTransaction];
}];
}];
}];
// TODO TODO TODO
// [self.uiDatabaseConnection asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
// [self.attachmentDownloads downloadAttachmentPointer:attachmentPointer
// success:^(NSArray<TSAttachmentStream *> *attachmentStreams) {
// OWSAssertDebug(attachmentStreams.count == 1);
// TSAttachmentStream *attachmentStream = attachmentStreams.firstObject;
// [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) {
// [message setQuotedMessageThumbnailAttachmentStream:attachmentStream];
// [message saveWithTransaction:postSuccessTransaction];
// }];
// }
// failure:^(NSError *error) {
// OWSLogWarn(@"Failed to redownload thumbnail with error: %@", error);
// [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *postSuccessTransaction) {
// [message touchWithTransaction:postSuccessTransaction];
// }];
// }];
// }];
}
- (void)didTapConversationItem:(id<ConversationViewItem>)viewItem quotedReply:(OWSQuotedReplyModel *)quotedReply

1
Session/Signal/ConversationView/ConversationViewItem.h

@ -3,6 +3,7 @@
//
#import "ConversationViewLayout.h"
#import <SessionMessagingKit/OWSAudioPlayer.h>
NS_ASSUME_NONNULL_BEGIN

13
Session/Signal/ConversationView/ConversationViewItem.m

@ -12,9 +12,9 @@
#import "AnyPromise.h"
#import <SignalUtilitiesKit/OWSUnreadIndicator.h>
#import <SessionUtilitiesKit/NSData+Image.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SignalUtilitiesKit/TSInteraction.h>
#import <SessionMessagingKit/TSInteraction.h>
#import <SessionMessagingKit/SSKEnvironment.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
@ -449,6 +449,15 @@ NSString *NSStringForOWSMessageCellType(OWSMessageCellType cellType)
[self.lastAudioMessageView setProgress:progress / duration];
}
- (void)showInvalidAudioFileAlert
{
OWSAssertIsOnMainThread();
[OWSAlerts
showErrorAlertWithMessage:NSLocalizedString(@"INVALID_AUDIO_FILE_ALERT_ERROR_MESSAGE",
@"Message for the alert indicating that an audio file is invalid.")];
}
#pragma mark - Displayable Text
// TODO: Now that we're caching the displayable text on the view items,

2
Session/Signal/ConversationView/ConversationViewModel.m

@ -19,7 +19,7 @@
#import <SessionMessagingKit/TSOutgoingMessage.h>
#import <SessionMessagingKit/TSThread.h>
#import <SessionMessagingKit/TSGroupThread.h>
#import <SignalUtilitiesKit/TSGroupModel.h>
#import <SessionMessagingKit/TSGroupModel.h>
#import <YapDatabase/YapDatabase.h>
#import <YapDatabase/YapDatabaseAutoView.h>
#import <YapDatabase/YapDatabaseViewChange.h>

2
Session/Signal/DateUtil.m

@ -5,7 +5,7 @@
#import "DateUtil.h"
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/OWSFormat.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/MainAppContext.m

@ -5,7 +5,7 @@
#import "MainAppContext.h"
#import "Session-Swift.h"
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SessionMessagingKit/OWSIdentityManager.h>

2
Session/Signal/NotificationSettingsOptionsViewController.m

@ -5,7 +5,7 @@
#import "NotificationSettingsOptionsViewController.h"
#import "Session-Swift.h"
#import "SignalApp.h"
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
@implementation NotificationSettingsOptionsViewController

6
Session/Signal/NotificationSettingsViewController.m

@ -7,9 +7,9 @@
#import "NotificationSettingsViewController.h"
#import "NotificationSettingsOptionsViewController.h"
#import "OWSSoundSettingsViewController.h"
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SignalUtilitiesKit/OWSSounds.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SessionMessagingKit/OWSSounds.h>
#import <SignalUtilitiesKit/UIUtil.h>
#import "Session-Swift.h"

2
Session/Signal/OWSBackupExportJob.m

@ -15,7 +15,7 @@
#import <SessionUtilitiesKit/OWSFileSystem.h>
#import <SessionMessagingKit/TSAttachment.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SignalUtilitiesKit/TSMessage.h>
#import <SessionMessagingKit/TSMessage.h>
#import <SessionMessagingKit/TSThread.h>
@import CloudKit;

2
Session/Signal/OWSBackupImportJob.m

@ -12,7 +12,7 @@
#import <SessionMessagingKit/OWSBackgroundTask.h>
#import <SessionUtilitiesKit/OWSFileSystem.h>
#import <SessionMessagingKit/TSAttachment.h>
#import <SignalUtilitiesKit/TSMessage.h>
#import <SessionMessagingKit/TSMessage.h>
#import <SessionMessagingKit/TSThread.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/OWSBackupJob.h

@ -3,7 +3,7 @@
//
#import "TSYapDatabaseObject.h"
#import <SignalUtilitiesKit/OWSBackupFragment.h>
#import <SessionMessagingKit/OWSBackupFragment.h>
NS_ASSUME_NONNULL_BEGIN

4
Session/Signal/OWSBackupSettingsViewController.m

@ -8,11 +8,11 @@
#import <PromiseKit/AnyPromise.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SignalUtilitiesKit/UIFont+OWS.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/MIMETypeUtil.h>
NS_ASSUME_NONNULL_BEGIN

8
Session/Signal/OWSConversationSettingsViewController.m

@ -15,14 +15,14 @@
#import "UIView+OWS.h"
#import <Curve25519Kit/Curve25519.h>
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/OWSProfileManager.h>
#import <SignalUtilitiesKit/OWSSounds.h>
#import <SessionMessagingKit/OWSSounds.h>
#import <SignalUtilitiesKit/OWSUserProfile.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIUtil.h>
#import <SignalUtilitiesKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SessionMessagingKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SessionMessagingKit/OWSDisappearingMessagesConfiguration.h>
#import <SessionMessagingKit/OWSPrimaryStorage.h>
@ -950,7 +950,7 @@ static CGRect oldframe;
if (gThread.usesSharedSenderKeys) {
NSString *groupPublicKey = [LKGroupUtilities getDecodedGroupID:gThread.groupModel.groupId];
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
[[SNMessageSenderDelegate leaveGroupWithPublicKey:groupPublicKey transaction:transaction] retainUntilComplete];
[[SNMessageSender leaveGroupWithPublicKey:groupPublicKey transaction:transaction] retainUntilComplete];
}];
}

6
Session/Signal/OWSOrphanDataCleaner.m

@ -13,9 +13,9 @@
#import <SessionUtilitiesKit/OWSFileSystem.h>
#import <SessionMessagingKit/OWSPrimaryStorage.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
#import <SignalUtilitiesKit/TSInteraction.h>
#import <SignalUtilitiesKit/TSMessage.h>
#import <SignalUtilitiesKit/TSQuotedMessage.h>
#import <SessionMessagingKit/TSInteraction.h>
#import <SessionMessagingKit/TSMessage.h>
#import <SessionMessagingKit/TSQuotedMessage.h>
#import <SessionMessagingKit/TSThread.h>
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>

4
Session/Signal/OWSProgressView.m

@ -3,8 +3,8 @@
//
#import "OWSProgressView.h"
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SignalUtilitiesKit/OWSMath.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/OWSMath.h>
NS_ASSUME_NONNULL_BEGIN

2
Session/Signal/OWSScreenLockUI.m

@ -7,7 +7,7 @@
#import "Session-Swift.h"
#import <SignalUtilitiesKit/ScreenLockViewController.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIView+OWS.h>
#import <SessionUtilitiesKit/UIView+OWS.h>
NS_ASSUME_NONNULL_BEGIN

4
Session/Signal/OWSSoundSettingsViewController.m

@ -4,8 +4,8 @@
#import "OWSSoundSettingsViewController.h"
#import <AVFoundation/AVFoundation.h>
#import <SignalUtilitiesKit/OWSAudioPlayer.h>
#import <SignalUtilitiesKit/OWSSounds.h>
#import <SessionMessagingKit/OWSAudioPlayer.h>
#import <SessionMessagingKit/OWSSounds.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIUtil.h>
#import "Session-Swift.h"

6
Session/Signal/PrivacySettingsTableViewController.m

@ -6,12 +6,12 @@
#import "Session-Swift.h"
#import <SignalCoreKit/NSString+OWS.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SignalUtilitiesKit/OWSPreferences.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/NSString+SSK.h>
#import <SessionUtilitiesKit/NSString+SSK.h>
#import <SignalUtilitiesKit/ThreadUtil.h>
#import <SessionMessagingKit/OWSReadReceiptManager.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>

2
Session/Signal/SignalApp.m

@ -8,7 +8,7 @@
#import "Session-Swift.h"
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/DebugLogger.h>
#import <SignalUtilitiesKit/Environment.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSPrimaryStorage.h>
#import <SessionMessagingKit/TSContactThread.h>
#import <SessionMessagingKit/TSGroupThread.h>

2
Session/View Controllers/EditClosedGroupVC.swift

@ -253,7 +253,7 @@ final class EditClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelega
}
ModalActivityIndicatorViewController.present(fromViewController: navigationController!, canCancel: false) { [weak self] _ in
Storage.writeSync { [weak self] transaction in
MessageSenderDelegate.update(groupPublicKey, with: members, name: name, transaction: transaction).done(on: DispatchQueue.main) {
MessageSender.update(groupPublicKey, with: members, name: name, transaction: transaction).done(on: DispatchQueue.main) {
guard let self = self else { return }
self.dismiss(animated: true, completion: nil) // Dismiss the loader
popToConversationVC(self)

2
Session/View Controllers/HomeVC.swift

@ -384,7 +384,7 @@ final class HomeVC : BaseVC, UITableViewDataSource, UITableViewDelegate, UIScrol
} else if let thread = thread as? TSGroupThread, thread.usesSharedSenderKeys == true {
let groupID = thread.groupModel.groupId
let groupPublicKey = LKGroupUtilities.getDecodedGroupID(groupID)
let _ = MessageSenderDelegate.leave(groupPublicKey, using: transaction).ensure {
let _ = MessageSender.leave(groupPublicKey, using: transaction).ensure {
Storage.writeSync { transaction in
thread.removeAllThreadInteractions(with: transaction)
thread.remove(with: transaction)

2
Session/View Controllers/NewClosedGroupVC.swift

@ -170,7 +170,7 @@ final class NewClosedGroupVC : BaseVC, UITableViewDataSource, UITableViewDelegat
ModalActivityIndicatorViewController.present(fromViewController: navigationController!, canCancel: false) { [weak self] _ in
var promise: Promise<TSGroupThread>!
Storage.writeSync { transaction in
promise = MessageSenderDelegate.createClosedGroup(name: name, members: selectedContacts, transaction: transaction)
promise = MessageSender.createClosedGroup(name: name, members: selectedContacts, transaction: transaction)
}
let _ = promise.done(on: DispatchQueue.main) { thread in
self?.presentingViewController?.dismiss(animated: true, completion: nil)

0
SignalUtilitiesKit/OWSBackupFragment.h → SessionMessagingKit/Database/OWSBackupFragment.h

0
SignalUtilitiesKit/OWSBackupFragment.m → SessionMessagingKit/Database/OWSBackupFragment.m

56
SessionMessagingKit/Database/OWSPrimaryStorage.m

@ -8,13 +8,14 @@
#import "OWSFileSystem.h"
#import "OWSIncomingMessageFinder.h"
#import "OWSMediaGalleryFinder.h"
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
#import "OWSStorage.h"
#import "OWSStorage+Subclass.h"
#import "SSKEnvironment.h"
#import "TSDatabaseSecondaryIndexes.h"
#import "TSDatabaseView.h"
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
#import <YapDatabase/YapDatabaseConnectionPool.h>
#import "SSKAsserts.h"
NS_ASSUME_NONNULL_BEGIN
@ -27,15 +28,10 @@ NSString *const OWSUIDatabaseConnectionNotificationsKey = @"OWSUIDatabaseConnect
void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
{
OWSCAssertDebug(storage);
[[storage newDatabaseConnection] asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction) {
for (NSString *extensionName in storage.registeredExtensionNames) {
OWSLogVerbose(@"Verifying database extension: %@", extensionName);
YapDatabaseViewTransaction *_Nullable viewTransaction = [transaction ext:extensionName];
if (!viewTransaction) {
OWSCFailDebug(@"VerifyRegistrationsForPrimaryStorage missing database extension: %@", extensionName);
[OWSStorage incrementVersionOfDatabaseExtension:extensionName];
}
}
@ -60,8 +56,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
+ (instancetype)sharedManager
{
OWSAssertDebug(SSKEnvironment.shared.primaryStorage);
return SSKEnvironment.shared.primaryStorage;
}
@ -88,8 +82,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
selector:@selector(yapDatabaseModifiedExternally:)
name:YapDatabaseModifiedExternallyNotification
object:nil];
OWSSingletonAssert();
}
return self;
@ -97,9 +89,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
- (void)dealloc
{
// Surface memory leaks by logging the deallocation of this class.
OWSLogVerbose(@"Dealloc: %@", self.class);
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
@ -121,16 +110,11 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
- (void)yapDatabaseModified:(NSNotification *)notification
{
OWSAssertIsOnMainThread();
OWSLogVerbose(@"");
[self updateUIDatabaseConnectionToLatest];
}
- (void)updateUIDatabaseConnectionToLatest
{
OWSAssertIsOnMainThread();
// Notify observers we're about to update the database connection
[[NSNotificationCenter defaultCenter] postNotificationName:OWSUIDatabaseConnectionWillUpdateNotification object:self.dbNotificationObject];
@ -147,7 +131,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
- (YapDatabaseConnection *)uiDatabaseConnection
{
OWSAssertIsOnMainThread();
return _uiDatabaseConnection;
}
@ -171,17 +154,12 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
// seeing, this issue only seems to affect sync and not async registrations. We've always
// been opening write transactions before the async registrations complete without negative
// consequences.
OWSAssertDebug(!self.areSyncRegistrationsComplete);
self.areSyncRegistrationsComplete = YES;
}
- (void)runAsyncRegistrationsWithCompletion:(void (^_Nonnull)(void))completion
{
OWSAssertDebug(completion);
OWSAssertDebug(self.database);
OWSLogVerbose(@"async registrations enqueuing.");
// Asynchronously register other extensions.
//
// All sync registrations must be done before all async registrations,
@ -207,9 +185,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
[self.database
flushExtensionRequestsWithCompletionQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
completionBlock:^{
OWSAssertDebug(!self.areAsyncRegistrationsComplete);
OWSLogVerbose(@"async registrations complete.");
self.areAsyncRegistrationsComplete = YES;
completion();
@ -225,10 +200,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
+ (void)protectFiles
{
OWSLogInfo(@"Database file size: %@", [OWSFileSystem fileSizeOfPath:self.sharedDataDatabaseFilePath]);
OWSLogInfo(@"\t SHM file size: %@", [OWSFileSystem fileSizeOfPath:self.sharedDataDatabaseFilePath_SHM]);
OWSLogInfo(@"\t WAL file size: %@", [OWSFileSystem fileSizeOfPath:self.sharedDataDatabaseFilePath_WAL]);
// Protect the entire new database directory.
[OWSFileSystem protectFileOrFolderAtPath:self.sharedDataDatabaseDirPath];
}
@ -242,9 +213,7 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
{
NSString *databaseDirPath = [[OWSFileSystem appSharedDataDirectoryPath] stringByAppendingPathComponent:@"database"];
if (![OWSFileSystem ensureDirectoryExists:databaseDirPath]) {
OWSFail(@"Could not create new database directory");
}
[OWSFileSystem ensureDirectoryExists:databaseDirPath];
return databaseDirPath;
}
@ -295,8 +264,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
+ (nullable NSError *)migrateToSharedData
{
OWSLogInfo(@"");
// Given how sensitive this migration is, we verbosely
// log the contents of all involved paths before and after.
NSArray<NSString *> *paths = @[
@ -308,11 +275,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
self.sharedDataDatabaseFilePath_WAL,
];
NSFileManager *fileManager = [NSFileManager defaultManager];
for (NSString *path in paths) {
if ([fileManager fileExistsAtPath:path]) {
OWSLogInfo(@"before migrateToSharedData: %@, %@", path, [OWSFileSystem fileSizeOfPath:path]);
}
}
// We protect the db files here, which is somewhat redundant with what will happen in
// `moveAppFilePath:` which also ensures file protection.
@ -361,19 +323,11 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
return error;
}
for (NSString *path in paths) {
if ([fileManager fileExistsAtPath:path]) {
OWSLogInfo(@"after migrateToSharedData: %@, %@", path, [OWSFileSystem fileSizeOfPath:path]);
}
}
return nil;
}
+ (NSString *)databaseFilePath
{
OWSLogVerbose(@"databasePath: %@", OWSPrimaryStorage.sharedDataDatabaseFilePath);
return self.sharedDataDatabaseFilePath;
}
@ -431,8 +385,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
- (void)touchDbAsync
{
OWSLogInfo(@"");
// There appears to be a bug in YapDatabase that sometimes delays modifications
// made in another process (e.g. the SAE) from showing up in other processes.
// There's a simple workaround: a trivial write to the database flushes changes

0
SignalUtilitiesKit/Database/OWSStorage+Subclass.h → SessionMessagingKit/Database/OWSStorage+Subclass.h

1
SessionMessagingKit/Messages/Signal/TSMessage.m

@ -14,7 +14,6 @@
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
#import <YapDatabase/YapDatabase.h>
#import <YapDatabase/YapDatabaseTransaction.h>
#import "OWSPrimaryStorage+Loki.h"
#import "TSContactThread.h"
#import <SignalCoreKit/NSString+OWS.h>

7
SessionMessagingKit/Meta/SessionMessagingKit.h

@ -4,8 +4,11 @@ FOUNDATION_EXPORT double SessionMessagingKitVersionNumber;
FOUNDATION_EXPORT const unsigned char SessionMessagingKitVersionString[];
#import <SessionMessagingKit/AppReadiness.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/NotificationsProtocol.h>
#import <SessionMessagingKit/OWSAudioPlayer.h>
#import <SessionMessagingKit/OWSBackgroundTask.h>
#import <SessionMessagingKit/OWSBackupFragment.h>
#import <SessionMessagingKit/OWSBlockingManager.h>
#import <SessionMessagingKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SessionMessagingKit/OWSDisappearingMessagesConfiguration.h>
@ -15,12 +18,16 @@ FOUNDATION_EXPORT const unsigned char SessionMessagingKitVersionString[];
#import <SessionMessagingKit/OWSIncomingMessageFinder.h>
#import <SessionMessagingKit/OWSMediaGalleryFinder.h>
#import <SessionMessagingKit/OWSOutgoingReceiptManager.h>
#import <SessionMessagingKit/OWSPreferences.h>
#import <SessionMessagingKit/OWSPrimaryStorage.h>
#import <SessionMessagingKit/OWSQuotedReplyModel.h>
#import <SessionMessagingKit/OWSReadReceiptManager.h>
#import <SessionMessagingKit/OWSReadTracking.h>
#import <SessionMessagingKit/OWSRecipientIdentity.h>
#import <SessionMessagingKit/OWSSounds.h>
#import <SessionMessagingKit/OWSStorage.h>
#import <SessionMessagingKit/OWSStorage+Subclass.h>
#import <SessionMessagingKit/OWSWindowManager.h>
#import <SessionMessagingKit/ProfileManagerProtocol.h>
#import <SessionMessagingKit/ProtoUtils.h>
#import <SessionMessagingKit/SignalRecipient.h>

7
SessionMessagingKit/Sending & Receiving/Attachments/TSAttachmentPointer.h

@ -60,6 +60,13 @@ typedef NS_ENUM(NSUInteger, TSAttachmentPointerState) {
(NSArray<SNProtoAttachmentPointer *> *)attachmentProtos
albumMessage:(TSMessage *)message;
// Non-nil for attachments which need "lazy backup restore."
- (nullable OWSBackupFragment *)lazyRestoreFragment;
// Marks attachment as needing "lazy backup restore."
- (void)markForLazyRestoreWithFragment:(OWSBackupFragment *)lazyRestoreFragment
transaction:(YapDatabaseReadWriteTransaction *)transaction;
@end
NS_ASSUME_NONNULL_END

25
SessionMessagingKit/Sending & Receiving/Attachments/TSAttachmentPointer.m

@ -176,6 +176,31 @@ NS_ASSUME_NONNULL_BEGIN
}
}
#pragma mark - Backups