diff --git a/Session.xcodeproj/project.pbxproj b/Session.xcodeproj/project.pbxproj index 179733f8b..58947be29 100644 --- a/Session.xcodeproj/project.pbxproj +++ b/Session.xcodeproj/project.pbxproj @@ -21,7 +21,6 @@ 3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3430FE171F7751D4000EC51B /* GiphyAPI.swift */; }; 34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34330AA21E79686200DF2FB9 /* OWSProgressView.m */; }; 34386A54207D271D009F5D9C /* NeverClearView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34386A53207D271C009F5D9C /* NeverClearView.swift */; }; - 344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */ = {isa = PBXBuildFile; fileRef = 344825C5211390C800DB4BD8 /* OWSOrphanDataCleaner.m */; }; 346129991FD1E4DA00532771 /* SignalApp.m in Sources */ = {isa = PBXBuildFile; fileRef = 346129971FD1E4D900532771 /* SignalApp.m */; }; 34661FB820C1C0D60056EDD6 /* message_sent.aiff in Resources */ = {isa = PBXBuildFile; fileRef = 34661FB720C1C0D60056EDD6 /* message_sent.aiff */; }; 346B66311F4E29B200E5122F /* CropScaleImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 346B66301F4E29B200E5122F /* CropScaleImageViewController.swift */; }; @@ -454,24 +453,20 @@ C33FDCFA255A582000E217F9 /* SignalIOSProto.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB40255A580C00E217F9 /* SignalIOSProto.swift */; }; C33FDD03255A582000E217F9 /* WeakTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB49255A580C00E217F9 /* WeakTimer.swift */; }; C33FDD06255A582000E217F9 /* AppVersion.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB4C255A580D00E217F9 /* AppVersion.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C33FDD12255A582000E217F9 /* OWSPrimaryStorage+Loki.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB58255A580E00E217F9 /* OWSPrimaryStorage+Loki.m */; }; C33FDD13255A582000E217F9 /* OWSFailedAttachmentDownloadsJob.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB59255A580E00E217F9 /* OWSFailedAttachmentDownloadsJob.m */; }; C33FDD23255A582000E217F9 /* FeatureFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB69255A580F00E217F9 /* FeatureFlags.swift */; }; C33FDD32255A582000E217F9 /* OWSOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB78255A581000E217F9 /* OWSOperation.m */; }; C33FDD3A255A582000E217F9 /* Notification+Loki.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB80255A581100E217F9 /* Notification+Loki.swift */; }; C33FDD49255A582000E217F9 /* ParamParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB8F255A581200E217F9 /* ParamParser.swift */; }; C33FDD53255A582000E217F9 /* OWSPrimaryStorage+keyFromIntLong.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB99255A581300E217F9 /* OWSPrimaryStorage+keyFromIntLong.m */; }; - C33FDD5A255A582000E217F9 /* TSStorageHeaders.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBA0255A581400E217F9 /* TSStorageHeaders.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDD5B255A582000E217F9 /* OWSOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBA1255A581400E217F9 /* OWSOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDD68255A582000E217F9 /* SignalAccount.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBAE255A581500E217F9 /* SignalAccount.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDD6E255A582000E217F9 /* NSURLSessionDataTask+StatusCode.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBB4255A581600E217F9 /* NSURLSessionDataTask+StatusCode.m */; }; C33FDD74255A582000E217F9 /* OWSPrimaryStorage+keyFromIntLong.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBBA255A581600E217F9 /* OWSPrimaryStorage+keyFromIntLong.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C33FDD75255A582000E217F9 /* OWSPrimaryStorage+Loki.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBBB255A581600E217F9 /* OWSPrimaryStorage+Loki.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDD7C255A582000E217F9 /* SSKAsserts.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBC2255A581700E217F9 /* SSKAsserts.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDD8D255A582000E217F9 /* OWSSignalAddress.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBD3255A581800E217F9 /* OWSSignalAddress.swift */; }; C33FDD91255A582000E217F9 /* OWSMessageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBD7255A581900E217F9 /* OWSMessageUtils.m */; }; C33FDD92255A582000E217F9 /* SignalIOS.pb.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBD8255A581900E217F9 /* SignalIOS.pb.swift */; }; - C33FDDA9255A582000E217F9 /* TSStorageKeys.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBEF255A581B00E217F9 /* TSStorageKeys.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDDB0255A582000E217F9 /* NSURLSessionDataTask+StatusCode.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBF6255A581C00E217F9 /* NSURLSessionDataTask+StatusCode.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDDB2255A582000E217F9 /* NSArray+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBF8255A581C00E217F9 /* NSArray+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; }; C33FDDB3255A582000E217F9 /* OWSError.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDBF9255A581C00E217F9 /* OWSError.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -518,8 +513,6 @@ C37F54DC255BB84A002AEA92 /* SessionSnodeKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3C2A59F255385C100C340D1 /* SessionSnodeKit.framework */; }; C38D5E8D2575011E00B6A65C /* MessageSender+ClosedGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38D5E8C2575011E00B6A65C /* MessageSender+ClosedGroups.swift */; }; C38EF00C255B61CC007E1867 /* SignalUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C33FD9AB255A548A00E217F9 /* SignalUtilitiesKit.framework */; }; - C38EF216255B6D3B007E1867 /* Theme.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF212255B6D3A007E1867 /* Theme.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C38EF218255B6D3B007E1867 /* Theme.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF214255B6D3A007E1867 /* Theme.m */; }; C38EF228255B6D5D007E1867 /* AttachmentSharing.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF223255B6D5D007E1867 /* AttachmentSharing.m */; }; C38EF22A255B6D5D007E1867 /* AttachmentSharing.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF225255B6D5D007E1867 /* AttachmentSharing.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38EF22B255B6D5D007E1867 /* ShareViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */; }; @@ -614,7 +607,6 @@ C38EF3C7255B6DE7007E1867 /* ImageEditorCanvasView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3B7255B6DE6007E1867 /* ImageEditorCanvasView.swift */; }; C38EF3EF255B6DF7007E1867 /* ThreadViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3D1255B6DEE007E1867 /* ThreadViewHelper.m */; }; C38EF3F0255B6DF7007E1867 /* ThreadViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF3D2255B6DEE007E1867 /* ThreadViewHelper.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C38EF3F1255B6DF7007E1867 /* OWSSearchBar.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF3D3255B6DEE007E1867 /* OWSSearchBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38EF3F2255B6DF7007E1867 /* DisappearingTimerConfigurationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3D4255B6DEE007E1867 /* DisappearingTimerConfigurationView.swift */; }; C38EF3F4255B6DF7007E1867 /* ContactCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3D6255B6DEF007E1867 /* ContactCellView.m */; }; C38EF3F5255B6DF7007E1867 /* OWSTextField.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF3D7255B6DF0007E1867 /* OWSTextField.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -633,7 +625,6 @@ C38EF404255B6DF7007E1867 /* ContactTableViewCell.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF3E6255B6DF4007E1867 /* ContactTableViewCell.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38EF405255B6DF7007E1867 /* OWSButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3E7255B6DF5007E1867 /* OWSButton.swift */; }; C38EF407255B6DF7007E1867 /* Toast.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3E9255B6DF6007E1867 /* Toast.swift */; }; - C38EF408255B6DF7007E1867 /* OWSSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3EA255B6DF6007E1867 /* OWSSearchBar.m */; }; C38EF409255B6DF7007E1867 /* ContactTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3EB255B6DF6007E1867 /* ContactTableViewCell.m */; }; C38EF40A255B6DF7007E1867 /* OWSFlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3EC255B6DF6007E1867 /* OWSFlatButton.swift */; }; C38EF40B255B6DF7007E1867 /* TappableStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF3ED255B6DF6007E1867 /* TappableStackView.swift */; }; @@ -727,7 +718,6 @@ C3D9E3C025676AD70040E4F3 /* TSAttachment.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAC2255A580200E217F9 /* TSAttachment.m */; }; C3D9E3C925676AF30040E4F3 /* TSYapDatabaseObject.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA90255A57FD00E217F9 /* TSYapDatabaseObject.m */; }; C3D9E3FA25676BCE0040E4F3 /* TSYapDatabaseObject.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDAA1255A57FF00E217F9 /* TSYapDatabaseObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - C3D9E40C25676C100040E4F3 /* Storage+Conformances.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D9E40B25676C100040E4F3 /* Storage+Conformances.swift */; }; C3D9E41525676C320040E4F3 /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB36255A580B00E217F9 /* Storage.swift */; }; C3D9E41F25676C870040E4F3 /* OWSPrimaryStorageProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D9E41E25676C870040E4F3 /* OWSPrimaryStorageProtocol.swift */; }; C3D9E43125676D3D0040E4F3 /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D9E43025676D3D0040E4F3 /* Configuration.swift */; }; @@ -970,8 +960,6 @@ 34386A53207D271C009F5D9C /* NeverClearView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NeverClearView.swift; sourceTree = ""; }; 34480B371FD092A900BC14EF /* SignalShareExtension-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SignalShareExtension-Bridging-Header.h"; sourceTree = ""; }; 34480B381FD092E300BC14EF /* SessionShareExtension-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "SessionShareExtension-Prefix.pch"; sourceTree = ""; }; - 344825C4211390C700DB4BD8 /* OWSOrphanDataCleaner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOrphanDataCleaner.h; sourceTree = ""; }; - 344825C5211390C800DB4BD8 /* OWSOrphanDataCleaner.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSOrphanDataCleaner.m; sourceTree = ""; }; 346129971FD1E4D900532771 /* SignalApp.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SignalApp.m; sourceTree = ""; }; 346129981FD1E4DA00532771 /* SignalApp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SignalApp.h; sourceTree = ""; }; 34661FB720C1C0D60056EDD6 /* message_sent.aiff */ = {isa = PBXFileReference; lastKnownFileType = audio.aiff; name = message_sent.aiff; path = Session/Meta/AudioFiles/message_sent.aiff; sourceTree = SOURCE_ROOT; }; @@ -1418,7 +1406,6 @@ C33FDB51255A580D00E217F9 /* NSUserDefaults+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSUserDefaults+OWS.h"; sourceTree = ""; }; C33FDB54255A580D00E217F9 /* DataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataSource.h; sourceTree = ""; }; C33FDB56255A580D00E217F9 /* TSOutgoingMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSOutgoingMessage.m; sourceTree = ""; }; - C33FDB58255A580E00E217F9 /* OWSPrimaryStorage+Loki.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OWSPrimaryStorage+Loki.m"; sourceTree = ""; }; C33FDB59255A580E00E217F9 /* OWSFailedAttachmentDownloadsJob.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSFailedAttachmentDownloadsJob.m; sourceTree = ""; }; C33FDB5B255A580E00E217F9 /* YapDatabaseTransaction+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "YapDatabaseTransaction+OWS.m"; sourceTree = ""; }; C33FDB5C255A580E00E217F9 /* NSArray+Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+Functional.h"; sourceTree = ""; }; @@ -1449,7 +1436,6 @@ C33FDB99255A581300E217F9 /* OWSPrimaryStorage+keyFromIntLong.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "OWSPrimaryStorage+keyFromIntLong.m"; sourceTree = ""; }; C33FDB9C255A581300E217F9 /* TSIncomingMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSIncomingMessage.h; sourceTree = ""; }; C33FDB9E255A581400E217F9 /* TSAttachmentPointer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAttachmentPointer.m; sourceTree = ""; }; - C33FDBA0255A581400E217F9 /* TSStorageHeaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSStorageHeaders.h; sourceTree = ""; }; C33FDBA1255A581400E217F9 /* OWSOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOperation.h; sourceTree = ""; }; C33FDBA4255A581400E217F9 /* OWSDisappearingMessagesConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDisappearingMessagesConfiguration.m; sourceTree = ""; }; C33FDBA8255A581500E217F9 /* OWSLinkPreview.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSLinkPreview.swift; sourceTree = ""; }; @@ -1462,7 +1448,6 @@ C33FDBB8255A581600E217F9 /* TSThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSThread.m; sourceTree = ""; }; C33FDBB9255A581600E217F9 /* ProfileManagerProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileManagerProtocol.h; sourceTree = ""; }; C33FDBBA255A581600E217F9 /* OWSPrimaryStorage+keyFromIntLong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OWSPrimaryStorage+keyFromIntLong.h"; sourceTree = ""; }; - C33FDBBB255A581600E217F9 /* OWSPrimaryStorage+Loki.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OWSPrimaryStorage+Loki.h"; sourceTree = ""; }; C33FDBBC255A581600E217F9 /* SSKKeychainStorage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SSKKeychainStorage.swift; sourceTree = ""; }; C33FDBC1255A581700E217F9 /* General.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = General.swift; sourceTree = ""; }; C33FDBC2255A581700E217F9 /* SSKAsserts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSKAsserts.h; sourceTree = ""; }; @@ -1476,7 +1461,6 @@ C33FDBE9255A581A00E217F9 /* TSInteraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSInteraction.m; sourceTree = ""; }; C33FDBEB255A581B00E217F9 /* OWSBlockingManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBlockingManager.h; sourceTree = ""; }; C33FDBEC255A581B00E217F9 /* OWSRecipientIdentity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSRecipientIdentity.m; sourceTree = ""; }; - C33FDBEF255A581B00E217F9 /* TSStorageKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSStorageKeys.h; sourceTree = ""; }; C33FDBF1255A581B00E217F9 /* OWSIdentityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSIdentityManager.h; sourceTree = ""; }; C33FDBF6255A581C00E217F9 /* NSURLSessionDataTask+StatusCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURLSessionDataTask+StatusCode.h"; sourceTree = ""; }; C33FDBF8255A581C00E217F9 /* NSArray+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+OWS.h"; sourceTree = ""; }; @@ -1529,8 +1513,6 @@ C37F5402255BA9ED002AEA92 /* Environment.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Environment.m; sourceTree = ""; }; C38D5E8C2575011E00B6A65C /* MessageSender+ClosedGroups.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MessageSender+ClosedGroups.swift"; sourceTree = ""; }; C38EEF09255B49A8007E1867 /* SNProtoEnvelope+Conversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SNProtoEnvelope+Conversion.swift"; sourceTree = ""; }; - C38EF212255B6D3A007E1867 /* Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Theme.h; path = SignalUtilitiesKit/Utilities/Theme.h; sourceTree = SOURCE_ROOT; }; - C38EF214255B6D3A007E1867 /* Theme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Theme.m; path = SignalUtilitiesKit/Utilities/Theme.m; sourceTree = SOURCE_ROOT; }; C38EF223255B6D5D007E1867 /* AttachmentSharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AttachmentSharing.m; path = "SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.m"; sourceTree = SOURCE_ROOT; }; C38EF224255B6D5D007E1867 /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SignalAttachment.swift; path = "SessionMessagingKit/Sending & Receiving/Attachments/SignalAttachment.swift"; sourceTree = SOURCE_ROOT; }; C38EF225255B6D5D007E1867 /* AttachmentSharing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentSharing.h; path = "SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.h"; sourceTree = SOURCE_ROOT; }; @@ -1647,7 +1629,6 @@ C38EF3B7255B6DE6007E1867 /* ImageEditorCanvasView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ImageEditorCanvasView.swift; path = "SignalUtilitiesKit/Media Viewing & Editing/Image Editing/ImageEditorCanvasView.swift"; sourceTree = SOURCE_ROOT; }; C38EF3D1255B6DEE007E1867 /* ThreadViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ThreadViewHelper.m; path = SignalUtilitiesKit/Database/ThreadViewHelper.m; sourceTree = SOURCE_ROOT; }; C38EF3D2255B6DEE007E1867 /* ThreadViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadViewHelper.h; path = SignalUtilitiesKit/Database/ThreadViewHelper.h; sourceTree = SOURCE_ROOT; }; - C38EF3D3255B6DEE007E1867 /* OWSSearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSSearchBar.h; path = "SignalUtilitiesKit/Shared Views/OWSSearchBar.h"; sourceTree = SOURCE_ROOT; }; C38EF3D4255B6DEE007E1867 /* DisappearingTimerConfigurationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DisappearingTimerConfigurationView.swift; path = SignalUtilitiesKit/Messaging/DisappearingTimerConfigurationView.swift; sourceTree = SOURCE_ROOT; }; C38EF3D6255B6DEF007E1867 /* ContactCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ContactCellView.m; path = "SignalUtilitiesKit/To Do/ContactCellView.m"; sourceTree = SOURCE_ROOT; }; C38EF3D7255B6DF0007E1867 /* OWSTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSTextField.h; path = "SignalUtilitiesKit/Shared Views/OWSTextField.h"; sourceTree = SOURCE_ROOT; }; @@ -1666,7 +1647,6 @@ C38EF3E6255B6DF4007E1867 /* ContactTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContactTableViewCell.h; path = "SignalUtilitiesKit/To Do/ContactTableViewCell.h"; sourceTree = SOURCE_ROOT; }; C38EF3E7255B6DF5007E1867 /* OWSButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSButton.swift; path = "SignalUtilitiesKit/Shared Views/OWSButton.swift"; sourceTree = SOURCE_ROOT; }; C38EF3E9255B6DF6007E1867 /* Toast.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Toast.swift; path = "SignalUtilitiesKit/Shared Views/Toast.swift"; sourceTree = SOURCE_ROOT; }; - C38EF3EA255B6DF6007E1867 /* OWSSearchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSSearchBar.m; path = "SignalUtilitiesKit/Shared Views/OWSSearchBar.m"; sourceTree = SOURCE_ROOT; }; C38EF3EB255B6DF6007E1867 /* ContactTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ContactTableViewCell.m; path = "SignalUtilitiesKit/To Do/ContactTableViewCell.m"; sourceTree = SOURCE_ROOT; }; C38EF3EC255B6DF6007E1867 /* OWSFlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSFlatButton.swift; path = "SignalUtilitiesKit/Shared Views/OWSFlatButton.swift"; sourceTree = SOURCE_ROOT; }; C38EF3ED255B6DF6007E1867 /* TappableStackView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TappableStackView.swift; path = "SignalUtilitiesKit/Shared Views/TappableStackView.swift"; sourceTree = SOURCE_ROOT; }; @@ -1747,7 +1727,6 @@ C3CA3ABD255CDB0D00F4C6D4 /* portuguese.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = portuguese.txt; sourceTree = ""; }; C3CA3AC7255CDB2900F4C6D4 /* spanish.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = spanish.txt; sourceTree = ""; }; C3D0972A2510499C00F6E3E4 /* BackgroundPoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundPoller.swift; sourceTree = ""; }; - C3D9E40B25676C100040E4F3 /* Storage+Conformances.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Storage+Conformances.swift"; sourceTree = ""; }; C3D9E41E25676C870040E4F3 /* OWSPrimaryStorageProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OWSPrimaryStorageProtocol.swift; sourceTree = ""; }; C3D9E43025676D3D0040E4F3 /* Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Configuration.swift; sourceTree = ""; }; C3DA9C0625AE7396008F7C7E /* ConfigurationMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationMessage.swift; sourceTree = ""; }; @@ -2023,8 +2002,6 @@ 4CC1ECFA211A553000CC13BE /* AppUpdateNag.swift */, B90418E4183E9DD40038554A /* DateUtil.h */, B90418E5183E9DD40038554A /* DateUtil.m */, - 344825C4211390C700DB4BD8 /* OWSOrphanDataCleaner.h */, - 344825C5211390C800DB4BD8 /* OWSOrphanDataCleaner.m */, 4C21D5D5223A9DC500EF8A77 /* UIAlerts+iOS9.m */, 45C0DC1A1E68FE9000E04C47 /* UIApplication+OWS.swift */, 45C0DC1D1E69011F00E04C47 /* UIStoryboard+OWS.swift */, @@ -3079,8 +3056,6 @@ C38EF3EC255B6DF6007E1867 /* OWSFlatButton.swift */, C38EF3DB255B6DF1007E1867 /* OWSLayerView.swift */, C38EF3D9255B6DF1007E1867 /* OWSNavigationBar.swift */, - C38EF3D3255B6DEE007E1867 /* OWSSearchBar.h */, - C38EF3EA255B6DF6007E1867 /* OWSSearchBar.m */, C38EF3D7255B6DF0007E1867 /* OWSTextField.h */, C38EF3E0255B6DF3007E1867 /* OWSTextField.m */, C38EF3D8255B6DF0007E1867 /* OWSTextView.h */, @@ -3104,8 +3079,6 @@ C38EF3EB255B6DF6007E1867 /* ContactTableViewCell.m */, C38EF2D2255B6DAF007E1867 /* OWSProfileManager.h */, C38EF2CF255B6DAE007E1867 /* OWSProfileManager.m */, - C33FDBBB255A581600E217F9 /* OWSPrimaryStorage+Loki.h */, - C33FDB58255A580E00E217F9 /* OWSPrimaryStorage+Loki.m */, ); path = "To Do"; sourceTree = ""; @@ -3139,11 +3112,8 @@ C38EF2E5255B6DB9007E1867 /* AppPreferences.swift */, C33FDBBA255A581600E217F9 /* OWSPrimaryStorage+keyFromIntLong.h */, C33FDB99255A581300E217F9 /* OWSPrimaryStorage+keyFromIntLong.m */, - C3D9E40B25676C100040E4F3 /* Storage+Conformances.swift */, C38EF3D2255B6DEE007E1867 /* ThreadViewHelper.h */, C38EF3D1255B6DEE007E1867 /* ThreadViewHelper.m */, - C33FDBA0255A581400E217F9 /* TSStorageHeaders.h */, - C33FDBEF255A581B00E217F9 /* TSStorageKeys.h */, C33FDA6D255A57FA00E217F9 /* YapDatabase+Promise.swift */, ); path = Database; @@ -3356,8 +3326,6 @@ C38EF302255B6DBE007E1867 /* OWSAnyTouchGestureRecognizer.h */, C38EF2F0255B6DBB007E1867 /* OWSAnyTouchGestureRecognizer.m */, C38EF2ED255B6DBB007E1867 /* DisplayableText.swift */, - C38EF212255B6D3A007E1867 /* Theme.h */, - C38EF214255B6D3A007E1867 /* Theme.m */, C38EF3DC255B6DF1007E1867 /* DirectionalPanGestureRecognizer.swift */, C38EF240255B6D67007E1867 /* UIView+OWS.swift */, C38EF236255B6D65007E1867 /* UIViewController+OWS.h */, @@ -3627,7 +3595,6 @@ C33FDD5B255A582000E217F9 /* OWSOperation.h in Headers */, C38EF313255B6DBF007E1867 /* OWSUnreadIndicator.h in Headers */, C33FDD7C255A582000E217F9 /* SSKAsserts.h in Headers */, - C33FDDA9255A582000E217F9 /* TSStorageKeys.h in Headers */, C38EF3F6255B6DF7007E1867 /* OWSTextView.h in Headers */, C38EF24C255B6D67007E1867 /* NSAttributedString+OWS.h in Headers */, C38EF32B255B6DBF007E1867 /* OWSFormat.h in Headers */, @@ -3640,12 +3607,9 @@ C38EF36D255B6DCC007E1867 /* SharingThreadPickerViewController.h in Headers */, C38EF35D255B6DCC007E1867 /* OWSNavigationController.h in Headers */, C38EF249255B6D67007E1867 /* UIColor+OWS.h in Headers */, - C38EF216255B6D3B007E1867 /* Theme.h in Headers */, C38EF3F0255B6DF7007E1867 /* ThreadViewHelper.h in Headers */, C38EF274255B6D7A007E1867 /* OWSResaveCollectionDBMigration.h in Headers */, C33FDC95255A582000E217F9 /* OWSFailedMessagesJob.h in Headers */, - C38EF3F1255B6DF7007E1867 /* OWSSearchBar.h in Headers */, - C33FDD75255A582000E217F9 /* OWSPrimaryStorage+Loki.h in Headers */, C38EF277255B6D7A007E1867 /* OWSDatabaseMigration.h in Headers */, C38EF3F5255B6DF7007E1867 /* OWSTextField.h in Headers */, C38EF275255B6D7A007E1867 /* OWSDatabaseMigrationRunner.h in Headers */, @@ -3668,7 +3632,6 @@ C33FD9AF255A548A00E217F9 /* SignalUtilitiesKit.h in Headers */, C33FDC50255A582000E217F9 /* OWSDispatch.h in Headers */, C33FDD06255A582000E217F9 /* AppVersion.h in Headers */, - C33FDD5A255A582000E217F9 /* TSStorageHeaders.h in Headers */, C33FDCA2255A582000E217F9 /* OWSMessageUtils.h in Headers */, B8F5F54E25EC50A5003BF8D4 /* BlockListUIUtils.h in Headers */, C38EF28F255B6D86007E1867 /* VersionMigrations.h in Headers */, @@ -4456,8 +4419,6 @@ C38EF39B255B6DDA007E1867 /* ThreadViewModel.swift in Sources */, C38EF2A5255B6D93007E1867 /* Identicon+ObjC.swift in Sources */, C38EF273255B6D7A007E1867 /* OWSDatabaseMigrationRunner.m in Sources */, - C33FDD12255A582000E217F9 /* OWSPrimaryStorage+Loki.m in Sources */, - C3D9E40C25676C100040E4F3 /* Storage+Conformances.swift in Sources */, C38EF31A255B6DBF007E1867 /* OWSAnyTouchGestureRecognizer.m in Sources */, C38EF36C255B6DCC007E1867 /* SharingThreadPickerViewController.m in Sources */, C38EF385255B6DD2007E1867 /* AttachmentTextToolbar.swift in Sources */, @@ -4503,7 +4464,6 @@ C38EF400255B6DF7007E1867 /* GalleryRailView.swift in Sources */, C38EF32E255B6DBF007E1867 /* ImageCache.swift in Sources */, C38EF32F255B6DBF007E1867 /* OWSFormat.m in Sources */, - C38EF218255B6D3B007E1867 /* Theme.m in Sources */, C38EF3BA255B6DE7007E1867 /* ImageEditorItem.swift in Sources */, C38EF3F7255B6DF7007E1867 /* OWSNavigationBar.swift in Sources */, C38EF2D4255B6DAF007E1867 /* OWSProfileManager.m in Sources */, @@ -4517,7 +4477,6 @@ C33FDCFA255A582000E217F9 /* SignalIOSProto.swift in Sources */, C33FDD13255A582000E217F9 /* OWSFailedAttachmentDownloadsJob.m in Sources */, C38EF24D255B6D67007E1867 /* UIView+OWS.swift in Sources */, - C38EF408255B6DF7007E1867 /* OWSSearchBar.m in Sources */, C38EF38B255B6DD2007E1867 /* AttachmentPrepViewController.swift in Sources */, C33FDC7B255A582000E217F9 /* NSSet+Functional.m in Sources */, C38EF405255B6DF7007E1867 /* OWSButton.swift in Sources */, @@ -4890,7 +4849,6 @@ 7BA9057E27911C5800998B3C /* GlobalSearchViewController.swift in Sources */, 4CA485BB2232339F004B9E7D /* PhotoCaptureViewController.swift in Sources */, 34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */, - 344825C6211390C800DB4BD8 /* OWSOrphanDataCleaner.m in Sources */, C328254925CA60E60062D0A7 /* ContextMenuVC+Action.swift in Sources */, 4542DF54208D40AC007B4E76 /* LoadingViewController.swift in Sources */, 34D5CCA91EAE3D30005515DB /* AvatarViewHelper.m in Sources */, diff --git a/Session/Conversations/ConversationViewModel.m b/Session/Conversations/ConversationViewModel.m index ac9ba0ccc..3c2b632dc 100644 --- a/Session/Conversations/ConversationViewModel.m +++ b/Session/Conversations/ConversationViewModel.m @@ -281,10 +281,6 @@ NS_ASSUME_NONNULL_BEGIN selector:@selector(typingIndicatorStateDidChange:) name:[OWSTypingIndicatorsImpl typingIndicatorStateDidChange] object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(profileWhitelistDidChange:) - name:kNSNotificationName_ProfileWhitelistDidChange - object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(blockListDidChange:) name:kNSNotificationName_BlockListDidChange @@ -295,14 +291,6 @@ NS_ASSUME_NONNULL_BEGIN object:nil]; } -- (void)profileWhitelistDidChange:(NSNotification *)notification -{ - OWSAssertIsOnMainThread(); - - self.conversationProfileState = nil; - [self updateForTransientItems]; -} - - (void)localProfileDidChange:(NSNotification *)notification { OWSAssertIsOnMainThread(); diff --git a/Session/Conversations/LongTextViewController.swift b/Session/Conversations/LongTextViewController.swift index ed8e043f8..ecb9ac5bf 100644 --- a/Session/Conversations/LongTextViewController.swift +++ b/Session/Conversations/LongTextViewController.swift @@ -113,7 +113,7 @@ public class LongTextViewController: OWSViewController { // MARK: - Create Views private func createViews() { - view.backgroundColor = Theme.backgroundColor + view.backgroundColor = Colors.navigationBarBackground let messageTextView = OWSTextView() self.messageTextView = messageTextView diff --git a/Session/Conversations/Message Cells/Content Views/MediaView.swift b/Session/Conversations/Message Cells/Content Views/MediaView.swift index 9c9e7b77b..15ff3b413 100644 --- a/Session/Conversations/Message Cells/Content Views/MediaView.swift +++ b/Session/Conversations/Message Cells/Content Views/MediaView.swift @@ -3,6 +3,7 @@ // import Foundation +import SessionUIKit @objc(OWSMediaView) public class MediaView: UIView { @@ -149,7 +150,7 @@ public class MediaView: UIView { configure(forError: .missing) return } - backgroundColor = (Theme.isDarkThemeEnabled ? .ows_gray90 : .ows_gray05) + backgroundColor = (isDarkMode ? .ows_gray90 : .ows_gray05) let loader = MediaLoaderView() addSubview(loader) loader.pin([ UIView.HorizontalEdge.left, UIView.VerticalEdge.bottom, UIView.HorizontalEdge.right ], to: self) @@ -352,7 +353,7 @@ public class MediaView: UIView { } private func configure(forError error: MediaError) { - backgroundColor = (Theme.isDarkThemeEnabled ? .ows_gray90 : .ows_gray05) + backgroundColor = (isDarkMode ? .ows_gray90 : .ows_gray05) let icon: UIImage switch error { case .failed: diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift index 1cfcf101c..ccd544701 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerCell.swift @@ -270,7 +270,7 @@ class GifPickerCell: UICollectionViewCell { private func clearViewState() { imageView?.image = nil - self.backgroundColor = (Theme.isDarkThemeEnabled + self.backgroundColor = (isDarkMode ? UIColor(white: 0.25, alpha: 1.0) : UIColor(white: 0.95, alpha: 1.0)) } diff --git a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift index 350ecf378..f667a47b7 100644 --- a/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift +++ b/Session/Media Viewing & Editing/GIFs/GifPickerViewController.swift @@ -3,10 +3,10 @@ // import Foundation -import SignalUtilitiesKit import Reachability import SignalUtilitiesKit import PromiseKit +import SessionUIKit @objc protocol GifPickerViewControllerDelegate: class { @@ -234,7 +234,7 @@ class GifPickerViewController: OWSViewController, UISearchBarDelegate, UICollect private func createErrorLabel(text: String) -> UILabel { let label = UILabel() label.text = text - label.textColor = Theme.primaryColor + label.textColor = Colors.text label.font = UIFont.ows_mediumFont(withSize: 20) label.textAlignment = .center label.numberOfLines = 0 diff --git a/Session/Media Viewing & Editing/MediaDetailViewController.m b/Session/Media Viewing & Editing/MediaDetailViewController.m index 446000b80..ece98e334 100644 --- a/Session/Media Viewing & Editing/MediaDetailViewController.m +++ b/Session/Media Viewing & Editing/MediaDetailViewController.m @@ -16,6 +16,7 @@ #import #import #import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -201,18 +202,18 @@ NS_ASSUME_NONNULL_BEGIN self.mediaView = animatedView; } else { self.mediaView = [UIView new]; - self.mediaView.backgroundColor = Theme.offBackgroundColor; + self.mediaView.backgroundColor = LKColors.unimportant; } } else if (!self.image) { // Still loading thumbnail. self.mediaView = [UIView new]; - self.mediaView.backgroundColor = Theme.offBackgroundColor; + self.mediaView.backgroundColor = LKColors.unimportant; } else if (self.isVideo) { if (self.attachmentStream.isValidVideo) { self.mediaView = [self buildVideoPlayerView]; } else { self.mediaView = [UIView new]; - self.mediaView.backgroundColor = Theme.offBackgroundColor; + self.mediaView.backgroundColor = LKColors.unimportant; } } else { // Present the static image using standard UIImageView diff --git a/Session/Media Viewing & Editing/MediaPageViewController.swift b/Session/Media Viewing & Editing/MediaPageViewController.swift index 9301d4f57..7f52cd17f 100644 --- a/Session/Media Viewing & Editing/MediaPageViewController.swift +++ b/Session/Media Viewing & Editing/MediaPageViewController.swift @@ -4,6 +4,7 @@ import UIKit import PromiseKit +import SessionUIKit // Objc wrapper for the MediaGalleryItem struct @objc @@ -280,7 +281,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy var shareBarButton: UIBarButtonItem = { let shareBarButton = UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(didPressShare)) - shareBarButton.tintColor = Theme.darkThemePrimaryColor + shareBarButton.tintColor = Colors.text return shareBarButton }() @@ -288,7 +289,7 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou let deleteBarButton = UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(didPressDelete)) - deleteBarButton.tintColor = Theme.darkThemePrimaryColor + deleteBarButton.tintColor = Colors.text return deleteBarButton }() @@ -298,14 +299,14 @@ class MediaPageViewController: UIPageViewController, UIPageViewControllerDataSou lazy var videoPlayBarButton: UIBarButtonItem = { let videoPlayBarButton = UIBarButtonItem(barButtonSystemItem: .play, target: self, action: #selector(didPressPlayBarButton)) - videoPlayBarButton.tintColor = Theme.darkThemePrimaryColor + videoPlayBarButton.tintColor = Colors.text return videoPlayBarButton }() lazy var videoPauseBarButton: UIBarButtonItem = { let videoPauseBarButton = UIBarButtonItem(barButtonSystemItem: .pause, target: self, action: #selector(didPressPauseBarButton)) - videoPauseBarButton.tintColor = Theme.darkThemePrimaryColor + videoPauseBarButton.tintColor = Colors.text return videoPauseBarButton }() diff --git a/Session/Media Viewing & Editing/MediaTileViewController.swift b/Session/Media Viewing & Editing/MediaTileViewController.swift index 2c6a82972..6958a2c34 100644 --- a/Session/Media Viewing & Editing/MediaTileViewController.swift +++ b/Session/Media Viewing & Editing/MediaTileViewController.swift @@ -3,6 +3,8 @@ // import Foundation +import SessionUIKit +import UIKit public protocol MediaTileViewControllerDelegate: class { func mediaTileViewController(_ viewController: MediaTileViewController, didTapView tappedView: UIView, mediaGalleryItem: MediaGalleryItem) @@ -75,7 +77,7 @@ public class MediaTileViewController: UICollectionViewController, MediaGalleryDa let deleteButton = UIBarButtonItem(barButtonSystemItem: .trash, target: self, action: #selector(didPressDelete)) - deleteButton.tintColor = Theme.darkThemeNavbarIconColor + deleteButton.tintColor = Colors.text return deleteButton }() @@ -823,16 +825,16 @@ private class MediaGallerySectionHeader: UICollectionReusableView { override init(frame: CGRect) { label = UILabel() - label.textColor = Theme.darkThemePrimaryColor + label.textColor = Colors.text - let blurEffect = Theme.darkThemeBarBlurEffect + let blurEffect = UIBlurEffect(style: .dark) let blurEffectView = UIVisualEffectView(effect: blurEffect) blurEffectView.autoresizingMask = [.flexibleWidth, .flexibleHeight] super.init(frame: frame) - self.backgroundColor = isLightMode ? Colors.cellBackground : Theme.darkThemeNavbarBackgroundColor.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor) + self.backgroundColor = isLightMode ? Colors.cellBackground : UIColor.ows_black.withAlphaComponent(OWSNavigationBar.backgroundBlurMutingFactor) self.addSubview(blurEffectView) self.addSubview(label) @@ -871,7 +873,7 @@ private class MediaGalleryStaticHeader: UICollectionViewCell { addSubview(label) - label.textColor = Theme.darkThemePrimaryColor + label.textColor = Colors.text label.textAlignment = .center label.numberOfLines = 0 label.autoPinEdgesToSuperviewMargins(with: UIEdgeInsets(top: 0, leading: Values.largeSpacing, bottom: 0, trailing: Values.largeSpacing)) diff --git a/Session/Media Viewing & Editing/PhotoGridViewCell.swift b/Session/Media Viewing & Editing/PhotoGridViewCell.swift index 9af59c17f..4b2470c1c 100644 --- a/Session/Media Viewing & Editing/PhotoGridViewCell.swift +++ b/Session/Media Viewing & Editing/PhotoGridViewCell.swift @@ -2,6 +2,9 @@ // Copyright (c) 2018 Open Whisper Systems. All rights reserved. // +import UIKit +import SessionUIKit + public enum PhotoGridItemType { case photo, animated, video } @@ -29,7 +32,7 @@ public class PhotoGridViewCell: UICollectionViewCell { private static let animatedBadgeImage = #imageLiteral(resourceName: "ic_gallery_badge_gif") private static let selectedBadgeImage = #imageLiteral(resourceName: "selected_blue_circle") - public var loadingColor = Theme.offBackgroundColor + public var loadingColor = Colors.unimportant override public var isSelected: Bool { didSet { diff --git a/Session/Meta/AppDelegate.m b/Session/Meta/AppDelegate.m index f0199f467..134598e5c 100644 --- a/Session/Meta/AppDelegate.m +++ b/Session/Meta/AppDelegate.m @@ -4,7 +4,6 @@ #import "AppDelegate.h" #import "MainAppContext.h" -#import "OWSOrphanDataCleaner.h" #import "OWSScreenLockUI.h" #import "Session-Swift.h" #import "SignalApp.h" diff --git a/Session/Shared/DismissableTextField.swift b/Session/Shared/DismissableTextField.swift index b01ca40cb..265b8f5b7 100644 --- a/Session/Shared/DismissableTextField.swift +++ b/Session/Shared/DismissableTextField.swift @@ -23,7 +23,7 @@ class DismissInputBar: UIToolbar { self.items = [spacer, dismissButton] self.isTranslucent = false self.isOpaque = true - self.barTintColor = Theme.toolbarBackgroundColor + self.barTintColor = UIColor.lokiDarkestGray() self.autoresizingMask = .flexibleHeight self.translatesAutoresizingMaskIntoConstraints = false diff --git a/Session/Shared/ReminderView.swift b/Session/Shared/ReminderView.swift index 83cc1738f..4ae32143e 100644 --- a/Session/Shared/ReminderView.swift +++ b/Session/Shared/ReminderView.swift @@ -3,6 +3,7 @@ // import Foundation +import SessionUIKit class ReminderView: UIView { @@ -70,9 +71,9 @@ class ReminderView: UIView { iconColor = UIColor.ows_gray60 case .explanation: // TODO: Theme, review with design. - self.backgroundColor = Theme.offBackgroundColor - textColor = Theme.primaryColor - iconColor = Theme.secondaryColor + self.backgroundColor = Colors.unimportant + textColor = Colors.text + iconColor = Colors.separator } self.clipsToBounds = true diff --git a/Session/Utilities/OWSOrphanDataCleaner.h b/Session/Utilities/OWSOrphanDataCleaner.h deleted file mode 100644 index e77ad8bff..000000000 --- a/Session/Utilities/OWSOrphanDataCleaner.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -NS_ASSUME_NONNULL_BEGIN - -// Notes: -// -// * On disk, we only bother cleaning up files, not directories. -@interface OWSOrphanDataCleaner : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -// This is exposed for the debug UI. -+ (void)auditAndCleanup:(BOOL)shouldCleanup; -// This is exposed for the tests. -+ (void)auditAndCleanup:(BOOL)shouldCleanup completion:(dispatch_block_t)completion; - -+ (void)auditOnLaunchIfNecessary; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Session/Utilities/OWSOrphanDataCleaner.m b/Session/Utilities/OWSOrphanDataCleaner.m deleted file mode 100644 index b494abb91..000000000 --- a/Session/Utilities/OWSOrphanDataCleaner.m +++ /dev/null @@ -1,737 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import "OWSOrphanDataCleaner.h" -#import "DateUtil.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -// LOG_ALL_FILE_PATHS can be used to determine if there are other kinds of files -// that we're not cleaning up. -//#define LOG_ALL_FILE_PATHS - -#define ENABLE_ORPHAN_DATA_CLEANER - -NSString *const OWSOrphanDataCleaner_Collection = @"OWSOrphanDataCleaner_Collection"; -NSString *const OWSOrphanDataCleaner_LastCleaningVersionKey = @"OWSOrphanDataCleaner_LastCleaningVersionKey"; -NSString *const OWSOrphanDataCleaner_LastCleaningDateKey = @"OWSOrphanDataCleaner_LastCleaningDateKey"; - -@interface OWSOrphanData : NSObject - -@property (nonatomic) NSSet *interactionIds; -@property (nonatomic) NSSet *attachmentIds; -@property (nonatomic) NSSet *filePaths; - -@end - -#pragma mark - - -@implementation OWSOrphanData - -@end - -#pragma mark - - -typedef void (^OrphanDataBlock)(OWSOrphanData *); - -@implementation OWSOrphanDataCleaner - -// Unlike CurrentAppContext().isMainAppAndActive, this method can be safely -// invoked off the main thread. -+ (BOOL)isMainAppAndActive -{ - return CurrentAppContext().reportedApplicationState == UIApplicationStateActive; -} - -+ (void)printPaths:(NSArray *)paths label:(NSString *)label -{ - for (NSString *path in [paths sortedArrayUsingSelector:@selector(compare:)]) { - OWSLogDebug(@"%@: %@", label, path); - } -} - -+ (long long)fileSizeOfFilePath:(NSString *)filePath -{ - NSError *error; - NSNumber *fileSize = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error][NSFileSize]; - if (error) { - if ([error.domain isEqualToString:NSCocoaErrorDomain] && error.code == 260) { - OWSLogWarn(@"can't find size of missing file."); - OWSLogDebug(@"can't find size of missing file: %@", filePath); - } else { - OWSFailDebug(@"attributesOfItemAtPath: %@ error: %@", filePath, error); - } - return 0; - } - return fileSize.longLongValue; -} - -+ (nullable NSNumber *)fileSizeOfFilePathsSafe:(NSArray *)filePaths -{ - long long result = 0; - for (NSString *filePath in filePaths) { - if (!self.isMainAppAndActive) { - return nil; - } - result += [self fileSizeOfFilePath:filePath]; - } - return @(result); -} - -+ (nullable NSSet *)filePathsInDirectorySafe:(NSString *)dirPath -{ - NSMutableSet *filePaths = [NSMutableSet new]; - if (![[NSFileManager defaultManager] fileExistsAtPath:dirPath]) { - return filePaths; - } - NSError *error; - NSArray *fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dirPath error:&error]; - if (error) { - OWSFailDebug(@"contentsOfDirectoryAtPath error: %@", error); - return [NSSet new]; - } - for (NSString *fileName in fileNames) { - if (!self.isMainAppAndActive) { - return nil; - } - NSString *filePath = [dirPath stringByAppendingPathComponent:fileName]; - BOOL isDirectory; - [[NSFileManager defaultManager] fileExistsAtPath:filePath isDirectory:&isDirectory]; - if (isDirectory) { - NSSet *_Nullable dirPaths = [self filePathsInDirectorySafe:filePath]; - if (!dirPaths) { - return nil; - } - [filePaths unionSet:dirPaths]; - } else { - [filePaths addObject:filePath]; - } - } - return filePaths; -} - -// This method finds (but does not delete): -// -// * Orphan TSInteractions (with no thread). -// * Orphan TSAttachments (with no message). -// * Orphan attachment files (with no corresponding TSAttachment). -// * Orphan profile avatars. -// * Temporary files (all). -// -// It also finds (we don't clean these up). -// -// * Missing attachment files (cannot be cleaned up). -// These are attachments which have no file on disk. They should be extremely rare - -// the only cases I have seen are probably due to debugging. -// They can't be cleaned up - we don't want to delete the TSAttachmentStream or -// its corresponding message. Better that the broken message shows up in the -// conversation view. -+ (void)findOrphanDataWithRetries:(NSInteger)remainingRetries - databaseConnection:(YapDatabaseConnection *)databaseConnection - success:(OrphanDataBlock)success - failure:(dispatch_block_t)failure -{ - OWSAssertDebug(databaseConnection); - - if (remainingRetries < 1) { - OWSLogInfo(@"Aborting orphan data search."); - dispatch_async(self.workQueue, ^{ - failure(); - }); - return; - } - - // Wait until the app is active... - [CurrentAppContext() runNowOrWhenMainAppIsActive:^{ - // ...but perform the work off the main thread. - dispatch_async(self.workQueue, ^{ - OWSOrphanData *_Nullable orphanData = [self findOrphanDataSync:databaseConnection]; - if (orphanData) { - success(orphanData); - } else { - [self findOrphanDataWithRetries:remainingRetries - 1 - databaseConnection:databaseConnection - success:success - failure:failure]; - } - }); - }]; -} - -// Returns nil on failure, usually indicating that the search -// aborted due to the app resigning active. This method is extremely careful to -// abort if the app resigns active, in order to avoid 0xdead10cc crashes. -+ (nullable OWSOrphanData *)findOrphanDataSync:(YapDatabaseConnection *)databaseConnection -{ - OWSAssertDebug(databaseConnection); - - __block BOOL shouldAbort = NO; - -#ifdef LOG_ALL_FILE_PATHS - { - NSString *documentDirPath = [OWSFileSystem appDocumentDirectoryPath]; - NSArray *_Nullable allDocumentFilePaths = - [self filePathsInDirectorySafe:documentDirPath].allObjects; - allDocumentFilePaths = [allDocumentFilePaths sortedArrayUsingSelector:@selector(compare:)]; - NSString *attachmentsFolder = [TSAttachmentStream attachmentsFolder]; - for (NSString *filePath in allDocumentFilePaths) { - if ([filePath hasPrefix:attachmentsFolder]) { - continue; - } - OWSLogVerbose(@"non-attachment file: %@", filePath); - } - } - { - NSString *documentDirPath = [OWSFileSystem appSharedDataDirectoryPath]; - NSArray *_Nullable allDocumentFilePaths = - [self filePathsInDirectorySafe:documentDirPath].allObjects; - allDocumentFilePaths = [allDocumentFilePaths sortedArrayUsingSelector:@selector(compare:)]; - NSString *attachmentsFolder = [TSAttachmentStream attachmentsFolder]; - for (NSString *filePath in allDocumentFilePaths) { - if ([filePath hasPrefix:attachmentsFolder]) { - continue; - } - OWSLogVerbose(@"non-attachment file: %@", filePath); - } - } -#endif - - // We treat _all_ temp files as orphan files. This is safe - // because temp files only need to be retained for the - // a single launch of the app. Since our "date threshold" - // for deletion is relative to the current launch time, - // all temp files currently in use should be safe. - NSArray *_Nullable tempFilePaths = [self getTempFilePaths]; - if (!tempFilePaths || !self.isMainAppAndActive) { - return nil; - } - -#ifdef LOG_ALL_FILE_PATHS - { - NSDateFormatter *dateFormatter = [NSDateFormatter new]; - [dateFormatter setDateStyle:NSDateFormatterLongStyle]; - [dateFormatter setTimeStyle:NSDateFormatterLongStyle]; - - tempFilePaths = [tempFilePaths sortedArrayUsingSelector:@selector(compare:)]; - for (NSString *filePath in tempFilePaths) { - NSError *error; - NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error]; - if (!attributes || error) { - OWSLogDebug(@"Could not get attributes of file at: %@", filePath); - OWSFailDebug(@"Could not get attributes of file"); - continue; - } - OWSLogVerbose( - @"temp file: %@, %@", filePath, [dateFormatter stringFromDate:attributes.fileModificationDate]); - } - } -#endif - - NSString *legacyAttachmentsDirPath = TSAttachmentStream.legacyAttachmentsDirPath; - NSString *sharedDataAttachmentsDirPath = TSAttachmentStream.sharedDataAttachmentsDirPath; - NSSet *_Nullable legacyAttachmentFilePaths = [self filePathsInDirectorySafe:legacyAttachmentsDirPath]; - if (!legacyAttachmentFilePaths || !self.isMainAppAndActive) { - return nil; - } - NSSet *_Nullable sharedDataAttachmentFilePaths = - [self filePathsInDirectorySafe:sharedDataAttachmentsDirPath]; - if (!sharedDataAttachmentFilePaths || !self.isMainAppAndActive) { - return nil; - } - - NSString *legacyProfileAvatarsDirPath = OWSUserProfile.legacyProfileAvatarsDirPath; - NSString *sharedDataProfileAvatarsDirPath = OWSUserProfile.sharedDataProfileAvatarsDirPath; - NSSet *_Nullable legacyProfileAvatarsFilePaths = - [self filePathsInDirectorySafe:legacyProfileAvatarsDirPath]; - if (!legacyProfileAvatarsFilePaths || !self.isMainAppAndActive) { - return nil; - } - NSSet *_Nullable sharedDataProfileAvatarFilePaths = - [self filePathsInDirectorySafe:sharedDataProfileAvatarsDirPath]; - if (!sharedDataProfileAvatarFilePaths || !self.isMainAppAndActive) { - return nil; - } - - NSMutableSet *allOnDiskFilePaths = [NSMutableSet new]; - [allOnDiskFilePaths unionSet:legacyAttachmentFilePaths]; - [allOnDiskFilePaths unionSet:sharedDataAttachmentFilePaths]; - [allOnDiskFilePaths unionSet:legacyProfileAvatarsFilePaths]; - [allOnDiskFilePaths unionSet:sharedDataProfileAvatarFilePaths]; - [allOnDiskFilePaths addObjectsFromArray:tempFilePaths]; - - NSSet *profileAvatarFilePaths = [OWSUserProfile allProfileAvatarFilePaths]; - - if (!self.isMainAppAndActive) { - return nil; - } - - NSNumber *_Nullable totalFileSize = [self fileSizeOfFilePathsSafe:allOnDiskFilePaths.allObjects]; - - if (!totalFileSize || !self.isMainAppAndActive) { - return nil; - } - - NSUInteger fileCount = allOnDiskFilePaths.count; - - // Attachments - __block int attachmentStreamCount = 0; - NSMutableSet *allAttachmentFilePaths = [NSMutableSet new]; - NSMutableSet *allAttachmentIds = [NSMutableSet new]; - // Threads - __block NSSet *threadIds; - // Messages - NSMutableSet *orphanInteractionIds = [NSMutableSet new]; - NSMutableSet *allMessageAttachmentIds = [NSMutableSet new]; - [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { - [transaction - enumerateKeysAndObjectsInCollection:TSAttachmentStream.collection - usingBlock:^(NSString *key, TSAttachment *attachment, BOOL *stop) { - if (!self.isMainAppAndActive) { - shouldAbort = YES; - *stop = YES; - return; - } - if (![attachment isKindOfClass:[TSAttachmentStream class]]) { - return; - } - [allAttachmentIds addObject:attachment.uniqueId]; - - TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment; - attachmentStreamCount++; - NSString *_Nullable filePath = [attachmentStream originalFilePath]; - if (filePath) { - [allAttachmentFilePaths addObject:filePath]; - } else { - OWSFailDebug(@"attachment has no file path."); - } - - [allAttachmentFilePaths - addObjectsFromArray:attachmentStream.allThumbnailPaths]; - }]; - - if (shouldAbort) { - return; - } - - threadIds = [NSSet setWithArray:[transaction allKeysInCollection:TSThread.collection]]; - - [transaction - enumerateKeysAndObjectsInCollection:TSMessage.collection - usingBlock:^(NSString *key, TSInteraction *interaction, BOOL *stop) { - if (!self.isMainAppAndActive) { - shouldAbort = YES; - *stop = YES; - return; - } - if (interaction.uniqueThreadId.length < 1 - || ![threadIds containsObject:interaction.uniqueThreadId]) { - [orphanInteractionIds addObject:interaction.uniqueId]; - } - - if (![interaction isKindOfClass:[TSMessage class]]) { - return; - } - - TSMessage *message = (TSMessage *)interaction; - [allMessageAttachmentIds addObjectsFromArray:message.allAttachmentIds]; - }]; - }]; - if (shouldAbort) { - return nil; - } - - OWSLogDebug(@"fileCount: %zu", fileCount); - OWSLogDebug(@"totalFileSize: %lld", totalFileSize.longLongValue); - OWSLogDebug(@"attachmentStreams: %d", attachmentStreamCount); - OWSLogDebug(@"attachmentStreams with file paths: %zu", allAttachmentFilePaths.count); - - NSMutableSet *orphanFilePaths = [allOnDiskFilePaths mutableCopy]; - [orphanFilePaths minusSet:allAttachmentFilePaths]; - [orphanFilePaths minusSet:profileAvatarFilePaths]; - NSMutableSet *missingAttachmentFilePaths = [allAttachmentFilePaths mutableCopy]; - [missingAttachmentFilePaths minusSet:allOnDiskFilePaths]; - - OWSLogDebug(@"orphan file paths: %zu", orphanFilePaths.count); - OWSLogDebug(@"missing attachment file paths: %zu", missingAttachmentFilePaths.count); - - [self printPaths:orphanFilePaths.allObjects label:@"orphan file paths"]; - [self printPaths:missingAttachmentFilePaths.allObjects label:@"missing attachment file paths"]; - - OWSLogDebug(@"attachmentIds: %zu", allAttachmentIds.count); - OWSLogDebug(@"allMessageAttachmentIds: %zu", allMessageAttachmentIds.count); - - NSMutableSet *orphanAttachmentIds = [allAttachmentIds mutableCopy]; - [orphanAttachmentIds minusSet:allMessageAttachmentIds]; - NSMutableSet *missingAttachmentIds = [allMessageAttachmentIds mutableCopy]; - [missingAttachmentIds minusSet:allAttachmentIds]; - - OWSLogDebug(@"orphan attachmentIds: %zu", orphanAttachmentIds.count); - OWSLogDebug(@"missing attachmentIds: %zu", missingAttachmentIds.count); - OWSLogDebug(@"orphan interactions: %zu", orphanInteractionIds.count); - - OWSOrphanData *result = [OWSOrphanData new]; - result.interactionIds = [orphanInteractionIds copy]; - result.attachmentIds = [orphanAttachmentIds copy]; - result.filePaths = [orphanFilePaths copy]; - return result; -} - -+ (BOOL)shouldAuditOnLaunch:(YapDatabaseConnection *)databaseConnection { - OWSAssertIsOnMainThread(); - -#ifndef ENABLE_ORPHAN_DATA_CLEANER - return NO; -#endif - - __block NSString *_Nullable lastCleaningVersion; - __block NSDate *_Nullable lastCleaningDate; - [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { - lastCleaningVersion = [transaction stringForKey:OWSOrphanDataCleaner_LastCleaningVersionKey - inCollection:OWSOrphanDataCleaner_Collection]; - lastCleaningDate = [transaction dateForKey:OWSOrphanDataCleaner_LastCleaningDateKey - inCollection:OWSOrphanDataCleaner_Collection]; - }]; - - // Clean up once per app version. - NSString *currentAppVersion = AppVersion.sharedInstance.currentAppVersion; - if (!lastCleaningVersion || ![lastCleaningVersion isEqualToString:currentAppVersion]) { - OWSLogVerbose(@"Performing orphan data cleanup; new version: %@.", currentAppVersion); - return YES; - } - - // Clean up once per N days. - if (lastCleaningDate) { -#ifdef DEBUG - BOOL shouldAudit = [DateUtil dateIsOlderThanToday:lastCleaningDate]; -#else - BOOL shouldAudit = [DateUtil dateIsOlderThanOneWeek:lastCleaningDate]; -#endif - - if (shouldAudit) { - OWSLogVerbose(@"Performing orphan data cleanup; time has passed."); - } - return shouldAudit; - } - - // Has never audited before. - return NO; -} - -+ (void)auditOnLaunchIfNecessary { - OWSAssertIsOnMainThread(); - - OWSPrimaryStorage *primaryStorage = [OWSPrimaryStorage sharedManager]; - YapDatabaseConnection *databaseConnection = [primaryStorage newDatabaseConnection]; - - if (![self shouldAuditOnLaunch:databaseConnection]) { - return; - } - - // If we want to be cautious, we can disable orphan deletion using - // flag - the cleanup will just be a dry run with logging. - BOOL shouldRemoveOrphans = YES; - [self auditAndCleanup:shouldRemoveOrphans databaseConnection:databaseConnection completion:nil]; -} - -+ (void)auditAndCleanup:(BOOL)shouldRemoveOrphans -{ - [self auditAndCleanup:shouldRemoveOrphans - completion:^ { - }]; -} - -+ (void)auditAndCleanup:(BOOL)shouldRemoveOrphans completion:(dispatch_block_t)completion -{ - OWSPrimaryStorage *primaryStorage = [OWSPrimaryStorage sharedManager]; - YapDatabaseConnection *databaseConnection = [primaryStorage newDatabaseConnection]; - - [self auditAndCleanup:shouldRemoveOrphans databaseConnection:databaseConnection completion:completion]; -} - -// We use the lowest priority possible. -+ (dispatch_queue_t)workQueue -{ - return dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0); -} - -+ (void)auditAndCleanup:(BOOL)shouldRemoveOrphans - databaseConnection:(YapDatabaseConnection *)databaseConnection - completion:(nullable dispatch_block_t)completion -{ - OWSAssertIsOnMainThread(); - OWSAssertDebug(databaseConnection); - - if (!AppReadiness.isAppReady) { - OWSFailDebug(@"can't audit orphan data until app is ready."); - return; - } - if (!CurrentAppContext().isMainApp) { - OWSFailDebug(@"can't audit orphan data in app extensions."); - return; - } - if (CurrentAppContext().isRunningTests) { - OWSLogVerbose(@"Ignoring audit orphan data in tests."); - return; - } - - // Orphan cleanup has two risks: - // - // * As a long-running process that involves access to the - // shared data container, it could cause 0xdead10cc. - // * It could accidentally delete data still in use, - // e.g. a profile avatar which has been saved to disk - // but whose OWSUserProfile hasn't been saved yet. - // - // To prevent 0xdead10cc, the cleaner continually checks - // whether the app has resigned active. If so, it aborts. - // Each phase (search, re-search, processing) retries N times, - // then gives up until the next app launch. - // - // To prevent accidental data deletion, we take the following - // measures: - // - // * Only cleanup data of the following types (which should - // include all relevant app data): profile avatar, - // attachment, temporary files (including temporary - // attachments). - // * We don't delete any data created more recently than N seconds - // _before_ when the app launched. This prevents any stray data - // currently in use by the app from being accidentally cleaned - // up. - const NSInteger kMaxRetries = 3; - [self findOrphanDataWithRetries:kMaxRetries - databaseConnection:databaseConnection - success:^(OWSOrphanData *orphanData) { - [self processOrphans:orphanData - remainingRetries:kMaxRetries - databaseConnection:databaseConnection - shouldRemoveOrphans:shouldRemoveOrphans - success:^{ - OWSLogInfo(@"Completed orphan data cleanup."); - - [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - [transaction setObject:AppVersion.sharedInstance.currentAppVersion - forKey:OWSOrphanDataCleaner_LastCleaningVersionKey - inCollection:OWSOrphanDataCleaner_Collection]; - [transaction setDate:[NSDate new] - forKey:OWSOrphanDataCleaner_LastCleaningDateKey - inCollection:OWSOrphanDataCleaner_Collection]; - }]; - - if (completion) { - completion(); - } - } - failure:^{ - OWSLogInfo(@"Aborting orphan data cleanup."); - if (completion) { - completion(); - } - }]; - } - failure:^{ - OWSLogInfo(@"Aborting orphan data cleanup."); - if (completion) { - completion(); - } - }]; -} - -// Returns NO on failure, usually indicating that orphan processing -// aborted due to the app resigning active. This method is extremely careful to -// abort if the app resigns active, in order to avoid 0xdead10cc crashes. -+ (void)processOrphans:(OWSOrphanData *)orphanData - remainingRetries:(NSInteger)remainingRetries - databaseConnection:(YapDatabaseConnection *)databaseConnection - shouldRemoveOrphans:(BOOL)shouldRemoveOrphans - success:(dispatch_block_t)success - failure:(dispatch_block_t)failure -{ - OWSAssertDebug(databaseConnection); - OWSAssertDebug(orphanData); - - if (remainingRetries < 1) { - OWSLogInfo(@"Aborting orphan data audit."); - dispatch_async(self.workQueue, ^{ - failure(); - }); - return; - } - - // Wait until the app is active... - [CurrentAppContext() runNowOrWhenMainAppIsActive:^{ - // ...but perform the work off the main thread. - dispatch_async(self.workQueue, ^{ - if ([self processOrphansSync:orphanData - databaseConnection:databaseConnection - shouldRemoveOrphans:shouldRemoveOrphans]) { - success(); - return; - } else { - [self processOrphans:orphanData - remainingRetries:remainingRetries - 1 - databaseConnection:databaseConnection - shouldRemoveOrphans:shouldRemoveOrphans - success:success - failure:failure]; - } - }); - }]; -} - -// Returns NO on failure, usually indicating that orphan processing -// aborted due to the app resigning active. This method is extremely careful to -// abort if the app resigns active, in order to avoid 0xdead10cc crashes. -+ (BOOL)processOrphansSync:(OWSOrphanData *)orphanData - databaseConnection:(YapDatabaseConnection *)databaseConnection - shouldRemoveOrphans:(BOOL)shouldRemoveOrphans -{ - OWSAssertDebug(databaseConnection); - OWSAssertDebug(orphanData); - - __block BOOL shouldAbort = NO; - - // We need to avoid cleaning up new files that are still in the process of - // being created/written, so we don't clean up anything recent. - const NSTimeInterval kMinimumOrphanAgeSeconds = CurrentAppContext().isRunningTests ? 0.f : 15 * kMinuteInterval; - NSDate *appLaunchTime = CurrentAppContext().appLaunchTime; - NSTimeInterval thresholdTimestamp = appLaunchTime.timeIntervalSince1970 - kMinimumOrphanAgeSeconds; - NSDate *thresholdDate = [NSDate dateWithTimeIntervalSince1970:thresholdTimestamp]; - [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - NSUInteger interactionsRemoved = 0; - for (NSString *interactionId in orphanData.interactionIds) { - if (!self.isMainAppAndActive) { - shouldAbort = YES; - return; - } - TSInteraction *_Nullable interaction = - [TSInteraction fetchObjectWithUniqueID:interactionId transaction:transaction]; - if (!interaction) { - // This could just be a race condition, but it should be very unlikely. - OWSLogWarn(@"Could not load interaction: %@", interactionId); - continue; - } - // Don't delete interactions which were created in the last N minutes. - NSDate *creationDate = [NSDate ows_dateWithMillisecondsSince1970:interaction.timestamp]; - if ([creationDate isAfterDate:thresholdDate]) { - OWSLogInfo(@"Skipping orphan interaction due to age: %f", fabs(creationDate.timeIntervalSinceNow)); - continue; - } - OWSLogInfo(@"Removing orphan message: %@", interaction.uniqueId); - interactionsRemoved++; - if (!shouldRemoveOrphans) { - continue; - } - [interaction removeWithTransaction:transaction]; - } - OWSLogInfo(@"Deleted orphan interactions: %zu", interactionsRemoved); - - NSUInteger attachmentsRemoved = 0; - for (NSString *attachmentId in orphanData.attachmentIds) { - if (!self.isMainAppAndActive) { - shouldAbort = YES; - return; - } - TSAttachment *_Nullable attachment = - [TSAttachment fetchObjectWithUniqueID:attachmentId transaction:transaction]; - if (!attachment) { - // This can happen on launch since we sync contacts/groups, especially if you have a lot of attachments - // to churn through, it's likely it's been deleted since starting this job. - OWSLogWarn(@"Could not load attachment: %@", attachmentId); - continue; - } - if (![attachment isKindOfClass:[TSAttachmentStream class]]) { - continue; - } - TSAttachmentStream *attachmentStream = (TSAttachmentStream *)attachment; - // Don't delete attachments which were created in the last N minutes. - NSDate *creationDate = attachmentStream.creationTimestamp; - if ([creationDate isAfterDate:thresholdDate]) { - OWSLogInfo(@"Skipping orphan attachment due to age: %f", fabs(creationDate.timeIntervalSinceNow)); - continue; - } - OWSLogInfo(@"Removing orphan attachmentStream: %@", attachmentStream.uniqueId); - attachmentsRemoved++; - if (!shouldRemoveOrphans) { - continue; - } - [attachmentStream removeWithTransaction:transaction]; - } - OWSLogInfo(@"Deleted orphan attachments: %zu", attachmentsRemoved); - }]; - - if (shouldAbort) { - return nil; - } - - NSUInteger filesRemoved = 0; - NSArray *filePaths = [orphanData.filePaths.allObjects sortedArrayUsingSelector:@selector(compare:)]; - for (NSString *filePath in filePaths) { - if (!self.isMainAppAndActive) { - return nil; - } - - NSError *error; - NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:&error]; - if (!attributes || error) { - // This is fine; the file may have been deleted since we found it. - OWSLogWarn(@"Could not get attributes of file at: %@", filePath); - continue; - } - // Don't delete files which were created in the last N minutes. - NSDate *creationDate = attributes.fileModificationDate; - if ([creationDate isAfterDate:thresholdDate]) { - OWSLogInfo(@"Skipping file due to age: %f", fabs([creationDate timeIntervalSinceNow])); - continue; - } - OWSLogInfo(@"Deleting file: %@", filePath); - filesRemoved++; - if (!shouldRemoveOrphans) { - continue; - } - [[NSFileManager defaultManager] removeItemAtPath:filePath error:&error]; - if (error) { - OWSLogDebug(@"Could not remove orphan file at: %@", filePath); - OWSFailDebug(@"Could not remove orphan file"); - } - } - OWSLogInfo(@"Deleted orphan files: %zu", filesRemoved); - - return YES; -} - -+ (nullable NSArray *)getTempFilePaths -{ - NSString *dir1 = OWSTemporaryDirectory(); - NSArray *_Nullable paths1 = [[self filePathsInDirectorySafe:dir1].allObjects mutableCopy]; - - NSString *dir2 = OWSTemporaryDirectoryAccessibleAfterFirstAuth(); - NSArray *_Nullable paths2 = [[self filePathsInDirectorySafe:dir2].allObjects mutableCopy]; - - if (paths1 && paths2) { - return [paths1 arrayByAddingObjectsFromArray:paths2]; - } else { - return nil; - } -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift b/SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift index dff1a97e6..66547950d 100644 --- a/SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift +++ b/SessionMessagingKit/Open Groups/OpenGroupManagerV2.swift @@ -150,7 +150,6 @@ public final class OpenGroupManagerV2 : NSObject { messageIDs.insert(interaction.uniqueId!) messageTimestamps.insert(interaction.timestamp) } - storage.updateMessageIDCollectionByPruningMessagesWithIDs(messageIDs, using: transaction) Storage.shared.removeReceivedMessageTimestamps(messageTimestamps, using: transaction) Storage.shared.removeLastMessageServerID(for: openGroup.room, on: openGroup.server, using: transaction) Storage.shared.removeLastDeletionServerID(for: openGroup.room, on: openGroup.server, using: transaction) diff --git a/SessionMessagingKit/Sending & Receiving/Read Tracking/OWSOutgoingReceiptManager.m b/SessionMessagingKit/Sending & Receiving/Read Tracking/OWSOutgoingReceiptManager.m index 7df3fa741..b639e8008 100644 --- a/SessionMessagingKit/Sending & Receiving/Read Tracking/OWSOutgoingReceiptManager.m +++ b/SessionMessagingKit/Sending & Receiving/Read Tracking/OWSOutgoingReceiptManager.m @@ -16,12 +16,6 @@ NS_ASSUME_NONNULL_BEGIN -typedef NS_ENUM(NSUInteger, OWSReceiptType) { - OWSReceiptType_Delivery, - OWSReceiptType_Read, -}; - -NSString *const kOutgoingDeliveryReceiptManagerCollection = @"kOutgoingDeliveryReceiptManagerCollection"; NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptManagerCollection"; @interface OWSOutgoingReceiptManager () @@ -103,7 +97,7 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa } NSMutableArray *sendPromises = [NSMutableArray array]; - [sendPromises addObjectsFromArray:[self sendReceiptsForReceiptType:OWSReceiptType_Read]]; + [sendPromises addObjectsFromArray:[self sendReceipts]]; if (sendPromises.count < 1) { // No work to do; abort. @@ -132,10 +126,8 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa }); } -- (NSArray *)sendReceiptsForReceiptType:(OWSReceiptType)receiptType { - if (receiptType == OWSReceiptType_Delivery) { return @[]; } // Don't send delivery receipts - - NSString *collection = [self collectionForReceiptType:receiptType]; +- (NSArray *)sendReceipts { + NSString *collection = kOutgoingReadReceiptManagerCollection; NSMutableDictionary *> *queuedReceiptMap = [NSMutableDictionary new]; [self.dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) { @@ -170,7 +162,7 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa [LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { AnyPromise *promise = [SNMessageSender sendNonDurably:readReceipt inThread:thread usingTransaction:transaction] .thenOn(self.serialQueue, ^(id object) { - [self dequeueReceiptsWithRecipientId:recipientId timestamps:timestampsAsSet receiptType:OWSReceiptType_Read]; + [self dequeueReceiptsWithRecipientId:recipientId timestamps:timestampsAsSet]; }); [sendPromises addObject:promise]; }]; @@ -179,22 +171,11 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa return [sendPromises copy]; } -- (void)enqueueDeliveryReceiptForEnvelope:(SNProtoEnvelope *)envelope -{ - [self enqueueReceiptWithRecipientId:envelope.source - timestamp:envelope.timestamp - receiptType:OWSReceiptType_Delivery]; -} - - (void)enqueueReadReceiptForEnvelope:(NSString *)messageAuthorId timestamp:(uint64_t)timestamp { - [self enqueueReceiptWithRecipientId:messageAuthorId timestamp:timestamp receiptType:OWSReceiptType_Read]; + [self enqueueReceiptWithRecipientId:messageAuthorId timestamp:timestamp]; } -- (void)enqueueReceiptWithRecipientId:(NSString *)recipientId - timestamp:(uint64_t)timestamp - receiptType:(OWSReceiptType)receiptType { - NSString *collection = [self collectionForReceiptType:receiptType]; - +- (void)enqueueReceiptWithRecipientId:(NSString *)recipientId timestamp:(uint64_t)timestamp { if (recipientId.length < 1) { return; } @@ -203,23 +184,19 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa } dispatch_async(self.serialQueue, ^{ [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - NSSet *_Nullable oldTimestamps = [transaction objectForKey:recipientId inCollection:collection]; + NSSet *_Nullable oldTimestamps = [transaction objectForKey:recipientId inCollection:kOutgoingReadReceiptManagerCollection]; NSMutableSet *newTimestamps = (oldTimestamps ? [oldTimestamps mutableCopy] : [NSMutableSet new]); [newTimestamps addObject:@(timestamp)]; - [transaction setObject:newTimestamps forKey:recipientId inCollection:collection]; + [transaction setObject:newTimestamps forKey:recipientId inCollection:kOutgoingReadReceiptManagerCollection]; }]; [self process]; }); } -- (void)dequeueReceiptsWithRecipientId:(NSString *)recipientId - timestamps:(NSSet *)timestamps - receiptType:(OWSReceiptType)receiptType { - NSString *collection = [self collectionForReceiptType:receiptType]; - +- (void)dequeueReceiptsWithRecipientId:(NSString *)recipientId timestamps:(NSSet *)timestamps { if (recipientId.length < 1) { return; } @@ -228,15 +205,15 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa } dispatch_async(self.serialQueue, ^{ [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - NSSet *_Nullable oldTimestamps = [transaction objectForKey:recipientId inCollection:collection]; + NSSet *_Nullable oldTimestamps = [transaction objectForKey:recipientId inCollection:kOutgoingReadReceiptManagerCollection]; NSMutableSet *newTimestamps = (oldTimestamps ? [oldTimestamps mutableCopy] : [NSMutableSet new]); [newTimestamps minusSet:timestamps]; if (newTimestamps.count > 0) { - [transaction setObject:newTimestamps forKey:recipientId inCollection:collection]; + [transaction setObject:newTimestamps forKey:recipientId inCollection:kOutgoingReadReceiptManagerCollection]; } else { - [transaction removeObjectForKey:recipientId inCollection:collection]; + [transaction removeObjectForKey:recipientId inCollection:kOutgoingReadReceiptManagerCollection]; } }]; }); @@ -247,15 +224,6 @@ NSString *const kOutgoingReadReceiptManagerCollection = @"kOutgoingReadReceiptMa [self process]; } -- (NSString *)collectionForReceiptType:(OWSReceiptType)receiptType { - switch (receiptType) { - case OWSReceiptType_Delivery: - return kOutgoingDeliveryReceiptManagerCollection; - case OWSReceiptType_Read: - return kOutgoingReadReceiptManagerCollection; - } -} - @end NS_ASSUME_NONNULL_END diff --git a/SessionMessagingKit/Storage.swift b/SessionMessagingKit/Storage.swift index 6de688097..43508d40b 100644 --- a/SessionMessagingKit/Storage.swift +++ b/SessionMessagingKit/Storage.swift @@ -1,5 +1,6 @@ import PromiseKit import Sodium +import SessionSnodeKit public protocol SessionMessagingKitStorageProtocol { @@ -52,7 +53,6 @@ public protocol SessionMessagingKitStorageProtocol { func getAllV2OpenGroups() -> [String:OpenGroupV2] func getV2OpenGroup(for threadID: String) -> OpenGroupV2? func v2GetThreadID(for v2OpenGroupID: String) -> String? - func updateMessageIDCollectionByPruningMessagesWithIDs(_ messageIDs: Set, using transaction: Any) // MARK: - Open Group Public Keys @@ -97,3 +97,5 @@ public protocol SessionMessagingKitStorageProtocol { /// Also touches the associated message. func persist(_ stream: TSAttachmentStream, associatedWith tsIncomingMessageID: String, using transaction: Any) } + +extension Storage: SessionMessagingKitStorageProtocol, SessionSnodeKitStorageProtocol {} diff --git a/SessionMessagingKit/Utilities/OWSIdentityManager.h b/SessionMessagingKit/Utilities/OWSIdentityManager.h index 9972facbc..d283170d6 100644 --- a/SessionMessagingKit/Utilities/OWSIdentityManager.h +++ b/SessionMessagingKit/Utilities/OWSIdentityManager.h @@ -15,8 +15,6 @@ extern NSString *const LKED25519SecretKey; extern NSString *const LKED25519PublicKey; extern NSString *const OWSPrimaryStorageIdentityKeyStoreCollection; -extern NSString *const OWSPrimaryStorageTrustedKeysCollection; - // This notification will be fired whenever identities are created // or their verification state changes. extern NSString *const kNSNotificationName_IdentityStateDidChange; @@ -55,20 +53,8 @@ extern const NSUInteger kStoredIdentityKeyLength; */ - (nullable OWSRecipientIdentity *)untrustedIdentityForSendingToRecipientId:(NSString *)recipientId; -- (BOOL)saveRemoteIdentity:(NSData *)identityKey recipientId:(NSString *)recipientId; - - (nullable ECKeyPair *)identityKeyPair; -#pragma mark - Debug - -#if DEBUG -// Clears everything except the local identity key. -- (void)clearIdentityState:(YapDatabaseReadWriteTransaction *)transaction; - -- (void)snapshotIdentityState:(YapDatabaseReadWriteTransaction *)transaction; -- (void)restoreIdentityState:(YapDatabaseReadWriteTransaction *)transaction; -#endif - @end NS_ASSUME_NONNULL_END diff --git a/SessionMessagingKit/Utilities/OWSIdentityManager.m b/SessionMessagingKit/Utilities/OWSIdentityManager.m index a4a017baf..82b9b3c26 100644 --- a/SessionMessagingKit/Utilities/OWSIdentityManager.m +++ b/SessionMessagingKit/Utilities/OWSIdentityManager.m @@ -33,12 +33,6 @@ NSString *const LKED25519SecretKey = @"LKED25519SecretKey"; NSString *const LKED25519PublicKey = @"LKED25519PublicKey"; NSString *const OWSPrimaryStorageIdentityKeyStoreCollection = @"TSStorageManagerIdentityKeyStoreCollection"; -// Storing recipients identity keys -NSString *const OWSPrimaryStorageTrustedKeysCollection = @"TSStorageManagerTrustedKeysCollection"; - -NSString *const OWSIdentityManager_QueuedVerificationStateSyncMessages = - @"OWSIdentityManager_QueuedVerificationStateSyncMessages"; - // Don't trust an identity for sending to unless they've been around for at least this long const NSTimeInterval kIdentityKeyStoreNonBlockingSecondsThreshold = 5.0; @@ -165,70 +159,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa return (int)[TSAccountManager getOrGenerateRegistrationId:transaction]; } -- (BOOL)saveRemoteIdentity:(NSData *)identityKey recipientId:(NSString *)recipientId -{ - __block BOOL result; - [LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - result = [self saveRemoteIdentity:identityKey recipientId:recipientId protocolContext:transaction]; - }]; - - return result; -} - -- (BOOL)saveRemoteIdentity:(NSData *)identityKey - recipientId:(NSString *)recipientId - protocolContext:(nullable id)protocolContext -{ - YapDatabaseReadWriteTransaction *transaction = protocolContext; - - // Deprecated. We actually no longer use the OWSPrimaryStorageTrustedKeysCollection for trust - // decisions, but it's desirable to try to keep it up to date with our trusted identitys - // while we're switching between versions, e.g. so we don't get into a state where we have a - // session for an identity not in our key store. - [transaction setObject:identityKey forKey:recipientId inCollection:OWSPrimaryStorageTrustedKeysCollection]; - - OWSRecipientIdentity *existingIdentity = - [OWSRecipientIdentity fetchObjectWithUniqueID:recipientId transaction:transaction]; - - if (existingIdentity == nil) { - [[[OWSRecipientIdentity alloc] initWithRecipientId:recipientId - identityKey:identityKey - isFirstKnownKey:YES - createdAt:[NSDate new] - verificationState:OWSVerificationStateDefault] - saveWithTransaction:transaction]; - - [self fireIdentityStateChangeNotification]; - - return NO; - } - - if (![existingIdentity.identityKey isEqual:identityKey]) { - OWSVerificationState verificationState; - switch (existingIdentity.verificationState) { - case OWSVerificationStateDefault: - verificationState = OWSVerificationStateDefault; - break; - case OWSVerificationStateVerified: - case OWSVerificationStateNoLongerVerified: - verificationState = OWSVerificationStateNoLongerVerified; - break; - } - - [[[OWSRecipientIdentity alloc] initWithRecipientId:recipientId - identityKey:identityKey - isFirstKnownKey:NO - createdAt:[NSDate new] - verificationState:verificationState] saveWithTransaction:transaction]; - - [self fireIdentityStateChangeNotification]; - - return YES; - } - - return NO; -} - - (nullable OWSRecipientIdentity *)recipientIdentityForRecipientId:(NSString *)recipientId { __block OWSRecipientIdentity *_Nullable result; @@ -341,65 +271,6 @@ NSString *const kNSNotificationName_IdentityStateDidChange = @"kNSNotificationNa } } -#pragma mark - Debug - -#if DEBUG -- (void)clearIdentityState:(YapDatabaseReadWriteTransaction *)transaction -{ - NSMutableArray *identityKeysToRemove = [NSMutableArray new]; - [transaction enumerateKeysInCollection:OWSPrimaryStorageIdentityKeyStoreCollection - usingBlock:^(NSString *_Nonnull key, BOOL *_Nonnull stop) { - if ([key isEqualToString:OWSPrimaryStorageIdentityKeyStoreIdentityKey]) { - // Don't delete our own key. - return; - } - [identityKeysToRemove addObject:key]; - }]; - for (NSString *key in identityKeysToRemove) { - [transaction removeObjectForKey:key inCollection:OWSPrimaryStorageIdentityKeyStoreCollection]; - } - [transaction removeAllObjectsInCollection:OWSPrimaryStorageTrustedKeysCollection]; -} - -- (NSString *)identityKeySnapshotFilePath -{ - // Prefix name with period "." so that backups will ignore these snapshots. - NSString *dirPath = [OWSFileSystem appDocumentDirectoryPath]; - return [dirPath stringByAppendingPathComponent:@".identity-key-snapshot"]; -} - -- (NSString *)trustedKeySnapshotFilePath -{ - // Prefix name with period "." so that backups will ignore these snapshots. - NSString *dirPath = [OWSFileSystem appDocumentDirectoryPath]; - return [dirPath stringByAppendingPathComponent:@".trusted-key-snapshot"]; -} - -- (void)snapshotIdentityState:(YapDatabaseReadWriteTransaction *)transaction -{ - [transaction snapshotCollection:OWSPrimaryStorageIdentityKeyStoreCollection - snapshotFilePath:self.identityKeySnapshotFilePath]; - [transaction snapshotCollection:OWSPrimaryStorageTrustedKeysCollection - snapshotFilePath:self.trustedKeySnapshotFilePath]; -} - -- (void)restoreIdentityState:(YapDatabaseReadWriteTransaction *)transaction -{ - [transaction restoreSnapshotOfCollection:OWSPrimaryStorageIdentityKeyStoreCollection - snapshotFilePath:self.identityKeySnapshotFilePath]; - [transaction restoreSnapshotOfCollection:OWSPrimaryStorageTrustedKeysCollection - snapshotFilePath:self.trustedKeySnapshotFilePath]; -} - -#endif - -#pragma mark - Notifications - -- (void)applicationDidBecomeActive:(NSNotification *)notification -{ - -} - @end NS_ASSUME_NONNULL_END diff --git a/SessionShareExtension/ShareVC.swift b/SessionShareExtension/ShareVC.swift index 34716c706..9404db53e 100644 --- a/SessionShareExtension/ShareVC.swift +++ b/SessionShareExtension/ShareVC.swift @@ -123,7 +123,6 @@ final class ShareVC : UINavigationController, ShareViewDelegate, AppModeManagerD // We don't need to use OWSMessageReceiver in the SAE. // We don't need to use OWSBatchMessageProcessor in the SAE. - // We don't need to use OWSOrphanDataCleaner in the SAE. // We don't need to fetch the local profile in the SAE OWSReadReceiptManager.shared().prepareCachedValues() diff --git a/SignalUtilitiesKit/Database/Storage+Conformances.swift b/SignalUtilitiesKit/Database/Storage+Conformances.swift deleted file mode 100644 index 21c74ee43..000000000 --- a/SignalUtilitiesKit/Database/Storage+Conformances.swift +++ /dev/null @@ -1,8 +0,0 @@ - -extension Storage : SessionMessagingKitStorageProtocol, SessionSnodeKitStorageProtocol { - - public func updateMessageIDCollectionByPruningMessagesWithIDs(_ messageIDs: Set, using transaction: Any) { - let transaction = transaction as! YapDatabaseReadWriteTransaction - OWSPrimaryStorage.shared().updateMessageIDCollectionByPruningMessagesWithIDs(messageIDs, in: transaction) - } -} diff --git a/SignalUtilitiesKit/Database/TSStorageHeaders.h b/SignalUtilitiesKit/Database/TSStorageHeaders.h deleted file mode 100644 index 9f7894e8e..000000000 --- a/SignalUtilitiesKit/Database/TSStorageHeaders.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// Copyright (c) 2018 Open Whisper Systems. All rights reserved. -// - -#ifndef Signal_TSStorageHeaders_h -#define Signal_TSStorageHeaders_h -#import -#import -#import - -#endif diff --git a/SignalUtilitiesKit/Database/TSStorageKeys.h b/SignalUtilitiesKit/Database/TSStorageKeys.h deleted file mode 100644 index 89834b775..000000000 --- a/SignalUtilitiesKit/Database/TSStorageKeys.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -#ifndef TextSecureKit_TSStorageKeys_h -#define TextSecureKit_TSStorageKeys_h - -/** - * Preferences exposed to the user - */ - -#pragma mark User Preferences - -#define TSStorageUserPreferencesCollection @"TSStorageUserPreferencesCollection" - - -/** - * Internal settings of the application, not exposed to the user. - */ - -#pragma mark Internal Settings - -#define TSStorageInternalSettingsCollection @"TSStorageInternalSettingsCollection" -#define TSStorageInternalSettingsVersion @"TSLastLaunchedVersion" - -#endif - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionViewController.swift b/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionViewController.swift index 6d33c73bb..d792e433d 100644 --- a/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionViewController.swift +++ b/SignalUtilitiesKit/Media Viewing & Editing/Attachment Approval/AttachmentCaptionViewController.swift @@ -3,6 +3,7 @@ // import UIKit +import SessionUIKit protocol AttachmentCaptionDelegate: class { func captionView(_ captionView: AttachmentCaptionViewController, didChangeCaptionText captionText: String?, attachmentItem: SignalAttachmentItem) @@ -217,8 +218,8 @@ class AttachmentCaptionViewController: OWSViewController { placeholderTextView.backgroundColor = .clear placeholderTextView.font = UIFont.ows_dynamicTypeBody - placeholderTextView.textColor = Theme.darkThemePrimaryColor - placeholderTextView.tintColor = Theme.darkThemePrimaryColor + placeholderTextView.textColor = Colors.text + placeholderTextView.tintColor = Colors.text placeholderTextView.returnKeyType = .done return placeholderTextView diff --git a/SignalUtilitiesKit/Media Viewing & Editing/MessageApprovalViewController.swift b/SignalUtilitiesKit/Media Viewing & Editing/MessageApprovalViewController.swift index 8c83c0510..5cea0fcd6 100644 --- a/SignalUtilitiesKit/Media Viewing & Editing/MessageApprovalViewController.swift +++ b/SignalUtilitiesKit/Media Viewing & Editing/MessageApprovalViewController.swift @@ -3,6 +3,7 @@ // import Foundation +import SessionUIKit @objc public protocol MessageApprovalViewControllerDelegate: class { @@ -70,7 +71,7 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat public override func loadView() { self.view = UIView.container() - self.view.backgroundColor = Theme.backgroundColor + self.view.backgroundColor = Colors.navigationBarBackground // Recipient Row let recipientRow = createRecipientRow() @@ -82,8 +83,8 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat // Text View textView = OWSTextView() textView.delegate = self - textView.backgroundColor = Theme.backgroundColor - textView.textColor = Theme.primaryColor + textView.backgroundColor = Colors.navigationBarBackground + textView.textColor = Colors.text textView.font = UIFont.ows_dynamicTypeBody textView.text = self.initialMessageText textView.contentInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: 0.0) @@ -97,11 +98,11 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat private func createRecipientRow() -> UIView { let recipientRow = UIView.container() - recipientRow.backgroundColor = Theme.toolbarBackgroundColor + recipientRow.backgroundColor = UIColor.lokiDarkestGray() // Hairline borders should be 1 pixel, not 1 point. let borderThickness = 1.0 / UIScreen.main.scale - let borderColor = Theme.middleGrayColor + let borderColor = UIColor(white: 0.5, alpha: 1) let topBorder = UIView.container() topBorder.backgroundColor = borderColor @@ -126,12 +127,12 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat let toLabel = UILabel() toLabel.text = NSLocalizedString("MESSAGE_APPROVAL_RECIPIENT_LABEL", comment: "Label for the recipient name in the 'message approval' dialog.") - toLabel.textColor = Theme.secondaryColor + toLabel.textColor = Colors.separator toLabel.font = font recipientRow.addSubview(toLabel) let nameLabel = UILabel() - nameLabel.textColor = Theme.primaryColor + nameLabel.textColor = Colors.text nameLabel.font = font nameLabel.lineBreakMode = .byTruncatingTail recipientRow.addSubview(nameLabel) @@ -164,12 +165,12 @@ public class MessageApprovalViewController: OWSViewController, UITextViewDelegat let publicKey = contactThread.contactSessionID() nameLabel.text = Storage.shared.getContact(with: publicKey)?.displayName(for: .regular) ?? publicKey - nameLabel.textColor = Theme.primaryColor + nameLabel.textColor = Colors.text if let profileName = self.profileName(contactThread: contactThread) { // If there's a profile name worth showing, add it as a second line below the name. let profileNameLabel = UILabel() - profileNameLabel.textColor = Theme.secondaryColor + profileNameLabel.textColor = Colors.separator profileNameLabel.font = font profileNameLabel.text = profileName profileNameLabel.lineBreakMode = .byTruncatingTail diff --git a/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h b/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h index 1d2cedbc2..8ee353b51 100644 --- a/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h +++ b/SignalUtilitiesKit/Meta/SignalUtilitiesKit.h @@ -32,11 +32,9 @@ FOUNDATION_EXPORT const unsigned char SignalUtilitiesKitVersionString[]; #import #import #import -#import #import #import #import -#import #import #import #import @@ -47,12 +45,9 @@ FOUNDATION_EXPORT const unsigned char SignalUtilitiesKitVersionString[]; #import #import #import -#import #import #import #import -#import -#import #import #import #import diff --git a/SignalUtilitiesKit/Shared View Controllers/OWSNavigationController.m b/SignalUtilitiesKit/Shared View Controllers/OWSNavigationController.m index 13f453fcf..6921a9001 100644 --- a/SignalUtilitiesKit/Shared View Controllers/OWSNavigationController.m +++ b/SignalUtilitiesKit/Shared View Controllers/OWSNavigationController.m @@ -55,15 +55,6 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - -- (void)themeDidChange:(NSNotification *)notification -{ - OWSAssertIsOnMainThread(); - - self.navigationBar.barTintColor = [UINavigationBar appearance].barTintColor; - self.navigationBar.tintColor = [UINavigationBar appearance].tintColor; - self.navigationBar.titleTextAttributes = [UINavigationBar appearance].titleTextAttributes; -} - - (void)viewDidLoad { [super viewDidLoad]; @@ -90,11 +81,6 @@ NS_ASSUME_NONNULL_BEGIN OWSNavigationBar *navbar = (OWSNavigationBar *)self.navigationBar; navbar.navBarLayoutDelegate = self; [self updateLayoutForNavbar:navbar]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(themeDidChange:) - name:ThemeDidChangeNotification - object:nil]; } // All OWSNavigationController serve as the UINavigationBarDelegate for their navbar. diff --git a/SignalUtilitiesKit/Shared View Controllers/OWSTableViewController.m b/SignalUtilitiesKit/Shared View Controllers/OWSTableViewController.m index 0882eca30..0a6b1915f 100644 --- a/SignalUtilitiesKit/Shared View Controllers/OWSTableViewController.m +++ b/SignalUtilitiesKit/Shared View Controllers/OWSTableViewController.m @@ -4,7 +4,6 @@ #import "OWSTableViewController.h" #import "OWSNavigationController.h" -#import "Theme.h" #import "UIColor+OWS.h" #import "UIFont+OWS.h" #import "UIView+OWS.h" @@ -594,11 +593,6 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kOWSTableCellIdentifier]; [self applyTheme]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(themeDidChange:) - name:ThemeDidChangeNotification - object:nil]; } - (void)dealloc @@ -816,23 +810,13 @@ NSString *const kOWSTableCellIdentifier = @"kOWSTableCellIdentifier"; [self.delegate tableViewWillBeginDragging]; } -#pragma mark - Theme - -- (void)themeDidChange:(NSNotification *)notification -{ - OWSAssertIsOnMainThread(); - - [self applyTheme]; - [self.tableView reloadData]; -} - - (void)applyTheme { OWSAssertIsOnMainThread(); - self.view.backgroundColor = Theme.backgroundColor; - self.tableView.backgroundColor = Theme.backgroundColor; - self.tableView.separatorColor = Theme.cellSeparatorColor; + self.view.backgroundColor = LKColors.navigationBarBackground; + self.tableView.backgroundColor = LKColors.navigationBarBackground; + self.tableView.separatorColor = LKColors.separator; } @end diff --git a/SignalUtilitiesKit/Shared View Controllers/OWSViewController.m b/SignalUtilitiesKit/Shared View Controllers/OWSViewController.m index 0e5ec8c6a..4ed5a5c87 100644 --- a/SignalUtilitiesKit/Shared View Controllers/OWSViewController.m +++ b/SignalUtilitiesKit/Shared View Controllers/OWSViewController.m @@ -4,7 +4,7 @@ #import "OWSViewController.h" #import "UIView+OWS.h" -#import +#import #import "AppContext.h" NS_ASSUME_NONNULL_BEGIN @@ -87,7 +87,7 @@ UIInterfaceOrientationMask DefaultUIInterfaceOrientationMask(void) [super viewDidLoad]; if (self.shouldUseTheme) { - self.view.backgroundColor = Theme.backgroundColor; + self.view.backgroundColor = [LKColors navigationBarBackground]; } } diff --git a/SignalUtilitiesKit/Shared View Controllers/SheetViewController.swift b/SignalUtilitiesKit/Shared View Controllers/SheetViewController.swift index 1a7d6510f..a8a142acf 100644 --- a/SignalUtilitiesKit/Shared View Controllers/SheetViewController.swift +++ b/SignalUtilitiesKit/Shared View Controllers/SheetViewController.swift @@ -3,6 +3,7 @@ // import Foundation +import SessionUIKit @objc(OWSSheetViewControllerDelegate) public protocol SheetViewControllerDelegate: class { @@ -54,8 +55,8 @@ public class SheetViewController: UIViewController { sheetView.setContentHuggingVerticalHigh() sheetView.setCompressionResistanceHigh() self.sheetViewVerticalConstraint = sheetView.autoPinEdge(.top, to: .bottom, of: self.view) - - handleView.backgroundColor = Theme.isDarkThemeEnabled ? UIColor.ows_white : UIColor.ows_gray05 + + handleView.backgroundColor = isDarkMode ? UIColor.ows_white : UIColor.ows_gray05 let kHandleViewHeight: CGFloat = 5 handleView.autoSetDimensions(to: CGSize(width: 40, height: kHandleViewHeight)) handleView.layer.cornerRadius = kHandleViewHeight / 2 @@ -82,7 +83,7 @@ public class SheetViewController: UIViewController { let backgroundDuration: TimeInterval = 0.1 UIView.animate(withDuration: backgroundDuration) { - let alpha: CGFloat = Theme.isDarkThemeEnabled ? 0.7 : 0.6 + let alpha: CGFloat = isDarkMode ? 0.7 : 0.6 self.view.backgroundColor = UIColor.black.withAlphaComponent(alpha) } @@ -199,8 +200,7 @@ private class SheetView: UIView { override init(frame: CGRect) { super.init(frame: frame) - self.backgroundColor = Theme.isDarkThemeEnabled ? UIColor.ows_gray90 - : UIColor.ows_gray05 + self.backgroundColor = isDarkMode ? UIColor.ows_gray90 : UIColor.ows_gray05 } required init?(coder aDecoder: NSCoder) { diff --git a/SignalUtilitiesKit/Shared Views/OWSNavigationBar.swift b/SignalUtilitiesKit/Shared Views/OWSNavigationBar.swift index 707023a3b..ef81497b4 100644 --- a/SignalUtilitiesKit/Shared Views/OWSNavigationBar.swift +++ b/SignalUtilitiesKit/Shared Views/OWSNavigationBar.swift @@ -50,10 +50,6 @@ public class OWSNavigationBar: UINavigationBar { NotificationCenter.default.addObserver(self, selector: #selector(callDidChange), name: .OWSWindowManagerCallDidChange, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(didChangeStatusBarFrame), name: UIApplication.didChangeStatusBarFrameNotification, object: nil) - NotificationCenter.default.addObserver(self, - selector: #selector(themeDidChange), - name: .ThemeDidChange, - object: nil) } // MARK: FirstResponder Stubbing @@ -82,13 +78,13 @@ public class OWSNavigationBar: UINavigationBar { if UIAccessibility.isReduceTransparencyEnabled { blurEffectView?.isHidden = true - let color = Theme.navbarBackgroundColor + let color = UIColor.lokiDarkestGray() let backgroundImage = UIImage(color: color) self.setBackgroundImage(backgroundImage, for: .default) } else { // Make navbar more translucent than default. Navbars remove alpha from any assigned backgroundColor, so // to achieve transparency, we have to assign a transparent image. - let color = Theme.navbarBackgroundColor + let color = UIColor.lokiDarkestGray() let backgroundImage = UIImage(color: color) self.setBackgroundImage(backgroundImage, for: .default) @@ -97,16 +93,10 @@ public class OWSNavigationBar: UINavigationBar { } } - @objc - public func themeDidChange() { - Logger.debug("") - applyTheme() - } - @objc public var respectsTheme: Bool = true { didSet { - themeDidChange() + applyTheme() } } @@ -191,9 +181,9 @@ public class OWSNavigationBar: UINavigationBar { respectsTheme = false barStyle = .black - titleTextAttributes = [NSAttributedString.Key.foregroundColor: Theme.darkThemePrimaryColor] - barTintColor = Theme.darkThemeBackgroundColor.withAlphaComponent(0.6) - tintColor = Theme.darkThemePrimaryColor + titleTextAttributes = [NSAttributedString.Key.foregroundColor: Colors.text] + barTintColor = Colors.navigationBarBackground.withAlphaComponent(0.6) + tintColor = Colors.text switch type { case .clear: diff --git a/SignalUtilitiesKit/Shared Views/OWSSearchBar.h b/SignalUtilitiesKit/Shared Views/OWSSearchBar.h deleted file mode 100644 index bbac537f4..000000000 --- a/SignalUtilitiesKit/Shared Views/OWSSearchBar.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -NS_ASSUME_NONNULL_BEGIN - -@interface OWSSearchBar : UISearchBar - -+ (void)applyThemeToSearchBar:(UISearchBar *)searchBar; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Shared Views/OWSSearchBar.m b/SignalUtilitiesKit/Shared Views/OWSSearchBar.m deleted file mode 100644 index aa82a0e00..000000000 --- a/SignalUtilitiesKit/Shared Views/OWSSearchBar.m +++ /dev/null @@ -1,118 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import "OWSSearchBar.h" -#import "Theme.h" -#import "UIView+OWS.h" -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@implementation OWSSearchBar - -- (instancetype)init -{ - if (self = [super init]) { - [self ows_configure]; - } - - return self; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - [self ows_configure]; - } - - return self; -} - -- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder -{ - if (self = [super initWithCoder:aDecoder]) { - [self ows_configure]; - } - - return self; -} - -- (void)ows_configure -{ - [self ows_applyTheme]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(themeDidChange:) - name:ThemeDidChangeNotification - object:nil]; -} - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)ows_applyTheme -{ - [self.class applyThemeToSearchBar:self]; -} - -+ (void)applyThemeToSearchBar:(UISearchBar *)searchBar -{ - OWSAssertIsOnMainThread(); - - UIColor *foregroundColor = UIColor.lokiLightestGray; - searchBar.barTintColor = Theme.backgroundColor; - searchBar.barStyle = Theme.barStyle; - searchBar.tintColor = UIColor.lokiGreen; - - // Hide searchBar border. - // Alternatively we could hide the border by using `UISearchBarStyleMinimal`, but that causes an issue when toggling - // from light -> dark -> light theme wherein the textField background color appears darker than it should - // (regardless of our re-setting textfield.backgroundColor below). - searchBar.backgroundImage = [UIImage new]; - - if (Theme.isDarkThemeEnabled) { - UIImage *clearImage = [UIImage imageNamed:@"searchbar_clear"]; - [searchBar setImage:[clearImage asTintedImageWithColor:foregroundColor] - forSearchBarIcon:UISearchBarIconClear - state:UIControlStateNormal]; - - UIImage *searchImage = [UIImage imageNamed:@"searchbar_search"]; - [searchBar setImage:[searchImage asTintedImageWithColor:foregroundColor] - forSearchBarIcon:UISearchBarIconSearch - state:UIControlStateNormal]; - } else { - [searchBar setImage:nil forSearchBarIcon:UISearchBarIconClear state:UIControlStateNormal]; - - [searchBar setImage:nil forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; - } - - [searchBar traverseViewHierarchyWithVisitor:^(UIView *view) { - if ([view isKindOfClass:[UITextField class]]) { - UITextField *textField = (UITextField *)view; - textField.backgroundColor = Theme.searchFieldBackgroundColor; - textField.textColor = Theme.primaryColor; - NSString *placeholder = textField.placeholder; - if (placeholder != nil) { - NSMutableAttributedString *attributedPlaceholder = [[NSMutableAttributedString alloc] initWithString:placeholder]; - [attributedPlaceholder addAttribute:NSForegroundColorAttributeName value:foregroundColor range:NSMakeRange(0, placeholder.length)]; - textField.attributedPlaceholder = attributedPlaceholder; - } - textField.keyboardAppearance = LKAppModeUtilities.isLightMode ? UIKeyboardAppearanceDefault : UIKeyboardAppearanceDark; - } - }]; -} - -- (void)themeDidChange:(NSNotification *)notification -{ - OWSAssertIsOnMainThread(); - - [self ows_applyTheme]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Shared Views/OWSTextField.m b/SignalUtilitiesKit/Shared Views/OWSTextField.m index a311ae255..e2e390ff9 100644 --- a/SignalUtilitiesKit/Shared Views/OWSTextField.m +++ b/SignalUtilitiesKit/Shared Views/OWSTextField.m @@ -3,7 +3,6 @@ // #import "OWSTextField.h" -#import "Theme.h" #import diff --git a/SignalUtilitiesKit/Shared Views/OWSTextView.m b/SignalUtilitiesKit/Shared Views/OWSTextView.m index 825507766..03876d3ff 100644 --- a/SignalUtilitiesKit/Shared Views/OWSTextView.m +++ b/SignalUtilitiesKit/Shared Views/OWSTextView.m @@ -3,7 +3,6 @@ // #import "OWSTextView.h" -#import "Theme.h" #import diff --git a/SignalUtilitiesKit/Shared Views/Toast.swift b/SignalUtilitiesKit/Shared Views/Toast.swift index 3500aaf12..28e6995c7 100644 --- a/SignalUtilitiesKit/Shared Views/Toast.swift +++ b/SignalUtilitiesKit/Shared Views/Toast.swift @@ -3,6 +3,7 @@ // import Foundation +import SessionUIKit @objc public class ToastController: NSObject, ToastViewDelegate { @@ -116,11 +117,11 @@ class ToastView: UIView { super.init(frame: frame) self.layer.cornerRadius = 4 - self.backgroundColor = Theme.toastBackgroundColor + self.backgroundColor = (isDarkMode ? UIColor.ows_gray75 : UIColor.ows_gray60) self.layoutMargins = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8) label.textAlignment = .center - label.textColor = Theme.toastForegroundColor + label.textColor = (isDarkMode ? UIColor.ows_white : UIColor.ows_white) label.font = UIFont.ows_dynamicTypeBody label.numberOfLines = 0 self.addSubview(label) diff --git a/SignalUtilitiesKit/Sharing/SelectRecipientViewController.m b/SignalUtilitiesKit/Sharing/SelectRecipientViewController.m index cf18cc5c4..a6fdfa561 100644 --- a/SignalUtilitiesKit/Sharing/SelectRecipientViewController.m +++ b/SignalUtilitiesKit/Sharing/SelectRecipientViewController.m @@ -14,6 +14,7 @@ #import #import #import +#import NS_ASSUME_NONNULL_BEGIN @@ -47,7 +48,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien { [super loadView]; - self.view.backgroundColor = [Theme backgroundColor]; + self.view.backgroundColor = LKColors.navigationBarBackground; [self createViews]; @@ -86,7 +87,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien [_tableViewController.view autoPinEdgeToSuperviewEdge:ALEdgeBottom]; self.tableViewController.tableView.rowHeight = UITableViewAutomaticDimension; self.tableViewController.tableView.estimatedRowHeight = 60; - _tableViewController.view.backgroundColor = [Theme backgroundColor]; + _tableViewController.view.backgroundColor = LKColors.navigationBarBackground; [self updateTableContents]; } @@ -95,7 +96,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien { UILabel *countryCodeLabel = [UILabel new]; countryCodeLabel.font = [UIFont ows_mediumFontWithSize:18.f]; - countryCodeLabel.textColor = [Theme primaryColor]; + countryCodeLabel.textColor = LKColors.text; countryCodeLabel.text = NSLocalizedString(@"REGISTRATION_DEFAULT_COUNTRY_NAME", @"Label for the country code field"); return countryCodeLabel; @@ -121,7 +122,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien { UILabel *phoneNumberLabel = [UILabel new]; phoneNumberLabel.font = [UIFont ows_mediumFontWithSize:18.f]; - phoneNumberLabel.textColor = [Theme primaryColor]; + phoneNumberLabel.textColor = LKColors.text; phoneNumberLabel.text = NSLocalizedString(@"REGISTRATION_PHONENUMBER_BUTTON", @"Label for the phone number textfield"); return phoneNumberLabel; @@ -137,7 +138,7 @@ NSString *const kSelectRecipientViewControllerCellIdentifier = @"kSelectRecipien if (!_examplePhoneNumberLabel) { _examplePhoneNumberLabel = [UILabel new]; _examplePhoneNumberLabel.font = [self examplePhoneNumberFont]; - _examplePhoneNumberLabel.textColor = [Theme secondaryColor]; + _examplePhoneNumberLabel.textColor = LKColors.separator; SET_SUBVIEW_ACCESSIBILITY_IDENTIFIER(self, _examplePhoneNumberLabel); } diff --git a/SignalUtilitiesKit/Sharing/SelectThreadViewController.m b/SignalUtilitiesKit/Sharing/SelectThreadViewController.m index 0a2f5ffe8..0ae237de3 100644 --- a/SignalUtilitiesKit/Sharing/SelectThreadViewController.m +++ b/SignalUtilitiesKit/Sharing/SelectThreadViewController.m @@ -4,7 +4,6 @@ #import "SelectThreadViewController.h" #import "ContactTableViewCell.h" -#import "OWSSearchBar.h" #import "OWSTableViewController.h" #import "ThreadViewHelper.h" #import "UIColor+OWS.h" diff --git a/SignalUtilitiesKit/To Do/ContactCellView.m b/SignalUtilitiesKit/To Do/ContactCellView.m index 7190ae587..8ebbbbf69 100644 --- a/SignalUtilitiesKit/To Do/ContactCellView.m +++ b/SignalUtilitiesKit/To Do/ContactCellView.m @@ -114,10 +114,10 @@ const CGFloat kContactCellAvatarTextMargin = 12; self.subtitleLabel.font = [UIFont ows_regularFontWithSize:11.f]; self.accessoryLabel.font = [UIFont ows_mediumFontWithSize:13.f]; - self.nameLabel.textColor = [Theme primaryColor]; - self.profileNameLabel.textColor = [Theme secondaryColor]; - self.subtitleLabel.textColor = [Theme secondaryColor]; - self.accessoryLabel.textColor = Theme.middleGrayColor; + self.nameLabel.textColor = LKColors.text; + self.profileNameLabel.textColor = LKColors.separator; + self.subtitleLabel.textColor = LKColors.separator; + self.accessoryLabel.textColor = [UIColor colorWithWhite:0.5f alpha:1.f]; } - (void)configureWithRecipientId:(NSString *)recipientId diff --git a/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.h b/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.h deleted file mode 100644 index 358213958..000000000 --- a/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.h +++ /dev/null @@ -1,13 +0,0 @@ -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface OWSPrimaryStorage (Loki) - -- (void)updateMessageIDCollectionByPruningMessagesWithIDs:(NSSet *)targetMessageIDs in:(YapDatabaseReadWriteTransaction *)transaction NS_SWIFT_NAME(updateMessageIDCollectionByPruningMessagesWithIDs(_:in:)); - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.m b/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.m deleted file mode 100644 index 97e2f4e8a..000000000 --- a/SignalUtilitiesKit/To Do/OWSPrimaryStorage+Loki.m +++ /dev/null @@ -1,26 +0,0 @@ -#import "OWSPrimaryStorage+Loki.h" -#import "OWSPrimaryStorage+keyFromIntLong.h" -#import "OWSIdentityManager.h" -#import "NSDate+OWS.h" -#import "TSAccountManager.h" -#import "YapDatabaseConnection+OWS.h" -#import "YapDatabaseTransaction+OWS.h" -#import "NSObject+Casting.h" -#import - -#define LKMessageIDCollection @"LKMessageIDCollection" - -@implementation OWSPrimaryStorage (Loki) - -- (void)updateMessageIDCollectionByPruningMessagesWithIDs:(NSSet *)targetMessageIDs in:(YapDatabaseReadWriteTransaction *)transaction { - NSMutableArray *serverIDs = [NSMutableArray new]; - [transaction enumerateRowsInCollection:LKMessageIDCollection usingBlock:^(NSString *key, id object, id metadata, BOOL *stop) { - if (![object isKindOfClass:NSString.class]) { return; } - NSString *messageID = (NSString *)object; - if (![targetMessageIDs containsObject:messageID]) { return; } - [serverIDs addObject:key]; - }]; - [transaction removeObjectsForKeys:serverIDs inCollection:LKMessageIDCollection]; -} - -@end diff --git a/SignalUtilitiesKit/To Do/OWSProfileManager.h b/SignalUtilitiesKit/To Do/OWSProfileManager.h index 6df6b5c70..d584604ec 100644 --- a/SignalUtilitiesKit/To Do/OWSProfileManager.h +++ b/SignalUtilitiesKit/To Do/OWSProfileManager.h @@ -6,9 +6,6 @@ NS_ASSUME_NONNULL_BEGIN -extern NSString *const kNSNotificationName_ProfileWhitelistDidChange; -extern NSString *const kNSNotificationName_ProfileKeyDidChange; - extern const NSUInteger kOWSProfileManager_NameDataLength; extern const NSUInteger kOWSProfileManager_MaxAvatarDiameter; diff --git a/SignalUtilitiesKit/To Do/OWSProfileManager.m b/SignalUtilitiesKit/To Do/OWSProfileManager.m index 729049c36..d37b78be1 100644 --- a/SignalUtilitiesKit/To Do/OWSProfileManager.m +++ b/SignalUtilitiesKit/To Do/OWSProfileManager.m @@ -16,7 +16,6 @@ #import #import #import -#import #import #import #import @@ -27,13 +26,6 @@ NS_ASSUME_NONNULL_BEGIN -NSString *const kNSNotificationName_ProfileWhitelistDidChange = @"kNSNotificationName_ProfileWhitelistDidChange"; - -NSString *const kOWSProfileManager_UserWhitelistCollection = @"kOWSProfileManager_UserWhitelistCollection"; -NSString *const kOWSProfileManager_GroupWhitelistCollection = @"kOWSProfileManager_GroupWhitelistCollection"; - -NSString *const kNSNotificationName_ProfileKeyDidChange = @"kNSNotificationName_ProfileKeyDidChange"; - // The max bytes for a user's profile name, encoded in UTF8. // Before encrypting and submitting we NULL pad the name data to this length. const NSUInteger kOWSProfileManager_NameDataLength = 26; diff --git a/SignalUtilitiesKit/Utilities/Theme.h b/SignalUtilitiesKit/Utilities/Theme.h deleted file mode 100644 index 7a5e82e9b..000000000 --- a/SignalUtilitiesKit/Utilities/Theme.h +++ /dev/null @@ -1,68 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -extern NSString *const ThemeDidChangeNotification; - -@interface Theme : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -@property (class, readonly, atomic) BOOL isDarkThemeEnabled; - -+ (void)setIsDarkThemeEnabled:(BOOL)value; - -@property (class, readonly, nonatomic) UIColor *backgroundColor; -@property (class, readonly, nonatomic) UIColor *primaryColor; -@property (class, readonly, nonatomic) UIColor *secondaryColor; -@property (class, readonly, nonatomic) UIColor *boldColor; -@property (class, readonly, nonatomic) UIColor *offBackgroundColor; -@property (class, readonly, nonatomic) UIColor *middleGrayColor; -@property (class, readonly, nonatomic) UIColor *placeholderColor; -@property (class, readonly, nonatomic) UIColor *hairlineColor; - -#pragma mark - Global App Colors - -@property (class, readonly, nonatomic) UIColor *navbarBackgroundColor; -@property (class, readonly, nonatomic) UIColor *navbarIconColor; -@property (class, readonly, nonatomic) UIColor *navbarTitleColor; - -@property (class, readonly, nonatomic) UIColor *toolbarBackgroundColor; - -@property (class, readonly, nonatomic) UIColor *conversationButtonBackgroundColor; - -@property (class, readonly, nonatomic) UIColor *cellSelectedColor; -@property (class, readonly, nonatomic) UIColor *cellSeparatorColor; - -// In some contexts, e.g. media viewing/sending, we always use "dark theme" UI regardless of the -// users chosen theme. -@property (class, readonly, nonatomic) UIColor *darkThemeNavbarIconColor; -@property (class, readonly, nonatomic) UIColor *darkThemeNavbarBackgroundColor; -@property (class, readonly, nonatomic) UIColor *darkThemeBackgroundColor; -@property (class, readonly, nonatomic) UIColor *darkThemePrimaryColor; -@property (class, readonly, nonatomic) UIBlurEffect *darkThemeBarBlurEffect; -@property (class, readonly, nonatomic) UIColor *galleryHighlightColor; - -#pragma mark - - -@property (class, readonly, nonatomic) UIBarStyle barStyle; -@property (class, readonly, nonatomic) UIColor *searchFieldBackgroundColor; -@property (class, readonly, nonatomic) UIBlurEffect *barBlurEffect; -@property (class, readonly, nonatomic) UIKeyboardAppearance keyboardAppearance; -@property (class, readonly, nonatomic) UIKeyboardAppearance darkThemeKeyboardAppearance; - -#pragma mark - - -@property (class, readonly, nonatomic) UIColor *toastForegroundColor; -@property (class, readonly, nonatomic) UIColor *toastBackgroundColor; - -@property (class, readonly, nonatomic) UIColor *scrollButtonBackgroundColor; - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/Theme.m b/SignalUtilitiesKit/Utilities/Theme.m deleted file mode 100644 index 7f298eb6d..000000000 --- a/SignalUtilitiesKit/Utilities/Theme.m +++ /dev/null @@ -1,217 +0,0 @@ -// -// Copyright (c) 2019 Open Whisper Systems. All rights reserved. -// - -#import "Theme.h" -#import "UIColor+OWS.h" -#import "UIUtil.h" -#import -#import -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -NSString *const ThemeDidChangeNotification = @"ThemeDidChangeNotification"; - -NSString *const ThemeCollection = @"ThemeCollection"; -NSString *const ThemeKeyThemeEnabled = @"ThemeKeyThemeEnabled"; - - -@interface Theme () - -@property (nonatomic) NSNumber *isDarkThemeEnabledNumber; - -@end - -@implementation Theme - -+ (instancetype)sharedInstance -{ - static dispatch_once_t onceToken; - static Theme *instance; - dispatch_once(&onceToken, ^{ - instance = [Theme new]; - }); - - return instance; -} - -+ (BOOL)isDarkThemeEnabled -{ - return LKAppModeUtilities.isDarkMode; -} - -- (BOOL)isDarkThemeEnabled -{ - OWSAssertIsOnMainThread(); - - return LKAppModeUtilities.isDarkMode; -} - -+ (void)setIsDarkThemeEnabled:(BOOL)value -{ - return [self.sharedInstance setIsDarkThemeEnabled:value]; -} - -- (void)setIsDarkThemeEnabled:(BOOL)value -{ - return; -} - -+ (UIColor *)backgroundColor -{ - return LKColors.navigationBarBackground; -} - -+ (UIColor *)offBackgroundColor -{ - return LKColors.unimportant; -} - -+ (UIColor *)primaryColor -{ - return LKColors.text; -} - -+ (UIColor *)secondaryColor -{ - return LKColors.separator; -} - -+ (UIColor *)boldColor -{ - return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.blackColor); -} - -+ (UIColor *)middleGrayColor -{ - return [UIColor colorWithWhite:0.5f alpha:1.f]; -} - -+ (UIColor *)placeholderColor -{ - return LKColors.navigationBarBackground; -} - -+ (UIColor *)hairlineColor -{ - return LKColors.separator; -} - -#pragma mark - Global App Colors - -+ (UIColor *)navbarBackgroundColor -{ - return UIColor.lokiDarkestGray; -} - -+ (UIColor *)darkThemeNavbarBackgroundColor -{ - return UIColor.ows_blackColor; -} - -+ (UIColor *)navbarIconColor -{ - return UIColor.lokiGreen; -} - -+ (UIColor *)darkThemeNavbarIconColor; -{ - return LKColors.text; -} - -+ (UIColor *)navbarTitleColor -{ - return Theme.primaryColor; -} - -+ (UIColor *)toolbarBackgroundColor -{ - return self.navbarBackgroundColor; -} - -+ (UIColor *)cellSelectedColor -{ - return UIColor.lokiDarkGray; -} - -+ (UIColor *)cellSeparatorColor -{ - return Theme.hairlineColor; -} - -+ (UIColor *)darkThemeBackgroundColor -{ - return LKColors.navigationBarBackground; -} - -+ (UIColor *)darkThemePrimaryColor -{ - return LKColors.text; -} - -+ (UIColor *)galleryHighlightColor -{ - return UIColor.lokiGreen; -} - -+ (UIColor *)conversationButtonBackgroundColor -{ - return (Theme.isDarkThemeEnabled ? [UIColor colorWithWhite:0.35f alpha:1.f] : UIColor.ows_gray02Color); -} - -+ (UIBlurEffect *)barBlurEffect -{ - return Theme.isDarkThemeEnabled ? self.darkThemeBarBlurEffect - : [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]; -} - -+ (UIBlurEffect *)darkThemeBarBlurEffect -{ - return [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark]; -} - -+ (UIKeyboardAppearance)keyboardAppearance -{ - return LKAppModeUtilities.isLightMode ? UIKeyboardAppearanceDefault : UIKeyboardAppearanceDark; -} - -+ (UIKeyboardAppearance)darkThemeKeyboardAppearance; -{ - return UIKeyboardAppearanceDark; -} - -#pragma mark - Search Bar - -+ (UIBarStyle)barStyle -{ - return Theme.isDarkThemeEnabled ? UIBarStyleBlack : UIBarStyleDefault; -} - -+ (UIColor *)searchFieldBackgroundColor -{ - return Theme.isDarkThemeEnabled ? Theme.offBackgroundColor : UIColor.ows_gray05Color; -} - -#pragma mark - - -+ (UIColor *)toastForegroundColor -{ - return (Theme.isDarkThemeEnabled ? UIColor.ows_whiteColor : UIColor.ows_whiteColor); -} - -+ (UIColor *)toastBackgroundColor -{ - return (Theme.isDarkThemeEnabled ? UIColor.ows_gray75Color : UIColor.ows_gray60Color); -} - -+ (UIColor *)scrollButtonBackgroundColor -{ - return UIColor.lokiDarkerGray; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/SignalUtilitiesKit/Utilities/UIUtil.m b/SignalUtilitiesKit/Utilities/UIUtil.m index 940657363..8110cc330 100644 --- a/SignalUtilitiesKit/Utilities/UIUtil.m +++ b/SignalUtilitiesKit/Utilities/UIUtil.m @@ -3,7 +3,6 @@ // #import "UIUtil.h" -#import "Theme.h" #import "UIColor+OWS.h" #import diff --git a/SignalUtilitiesKit/Utilities/UIViewController+OWS.m b/SignalUtilitiesKit/Utilities/UIViewController+OWS.m index 18ed7599f..bb20c7a7d 100644 --- a/SignalUtilitiesKit/Utilities/UIViewController+OWS.m +++ b/SignalUtilitiesKit/Utilities/UIViewController+OWS.m @@ -4,7 +4,6 @@ #import -#import "Theme.h" #import "UIColor+OWS.h" #import "UIUtil.h" #import "UIView+OWS.h" @@ -96,7 +95,7 @@ NS_ASSUME_NONNULL_BEGIN imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; OWSAssertDebug(backImage); [backButton setImage:backImage forState:UIControlStateNormal]; - backButton.tintColor = Theme.navbarIconColor; + backButton.tintColor = UIColor.lokiGreen; backButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; diff --git a/SignalUtilitiesKit/Utilities/VersionMigrations.m b/SignalUtilitiesKit/Utilities/VersionMigrations.m index 5198baf42..70a121039 100644 --- a/SignalUtilitiesKit/Utilities/VersionMigrations.m +++ b/SignalUtilitiesKit/Utilities/VersionMigrations.m @@ -7,7 +7,6 @@ #import #import #import -#import #import #import #import