mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Removed some more legacy code which has been refactored
This commit is contained in:
parent
5de8d9c7a8
commit
49dd341b6d
32 changed files with 114 additions and 1656 deletions
|
@ -54,7 +54,6 @@
|
||||||
4503F1BE20470A5B00CEE724 /* classic-quiet.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 4503F1BB20470A5B00CEE724 /* classic-quiet.aifc */; };
|
4503F1BE20470A5B00CEE724 /* classic-quiet.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 4503F1BB20470A5B00CEE724 /* classic-quiet.aifc */; };
|
||||||
4503F1BF20470A5B00CEE724 /* classic.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 4503F1BC20470A5B00CEE724 /* classic.aifc */; };
|
4503F1BF20470A5B00CEE724 /* classic.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 4503F1BC20470A5B00CEE724 /* classic.aifc */; };
|
||||||
450DF2091E0DD2C6003D14BE /* UserNotificationsAdaptee.swift in Sources */ = {isa = PBXBuildFile; fileRef = 450DF2081E0DD2C6003D14BE /* UserNotificationsAdaptee.swift */; };
|
450DF2091E0DD2C6003D14BE /* UserNotificationsAdaptee.swift in Sources */ = {isa = PBXBuildFile; fileRef = 450DF2081E0DD2C6003D14BE /* UserNotificationsAdaptee.swift */; };
|
||||||
451166C01FD86B98000739BA /* AccountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 451166BF1FD86B98000739BA /* AccountManager.swift */; };
|
|
||||||
451A13B11E13DED2000A50FD /* AppNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 451A13B01E13DED2000A50FD /* AppNotifications.swift */; };
|
451A13B11E13DED2000A50FD /* AppNotifications.swift in Sources */ = {isa = PBXBuildFile; fileRef = 451A13B01E13DED2000A50FD /* AppNotifications.swift */; };
|
||||||
4520D8D51D417D8E00123472 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4520D8D41D417D8E00123472 /* Photos.framework */; };
|
4520D8D51D417D8E00123472 /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4520D8D41D417D8E00123472 /* Photos.framework */; };
|
||||||
4521C3C01F59F3BA00B4C582 /* TextFieldHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4521C3BF1F59F3BA00B4C582 /* TextFieldHelper.swift */; };
|
4521C3C01F59F3BA00B4C582 /* TextFieldHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4521C3BF1F59F3BA00B4C582 /* TextFieldHelper.swift */; };
|
||||||
|
@ -287,16 +286,12 @@
|
||||||
C32C5A88256DBCF9003C73A2 /* MessageReceiver+Handling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C5A87256DBCF9003C73A2 /* MessageReceiver+Handling.swift */; };
|
C32C5A88256DBCF9003C73A2 /* MessageReceiver+Handling.swift in Sources */ = {isa = PBXBuildFile; fileRef = C32C5A87256DBCF9003C73A2 /* MessageReceiver+Handling.swift */; };
|
||||||
C32C5B48256DC211003C73A2 /* NSNotificationCenter+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB6C255A580F00E217F9 /* NSNotificationCenter+OWS.m */; };
|
C32C5B48256DC211003C73A2 /* NSNotificationCenter+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB6C255A580F00E217F9 /* NSNotificationCenter+OWS.m */; };
|
||||||
C32C5B51256DC219003C73A2 /* NSNotificationCenter+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB3B255A580B00E217F9 /* NSNotificationCenter+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
C32C5B51256DC219003C73A2 /* NSNotificationCenter+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB3B255A580B00E217F9 /* NSNotificationCenter+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
C32C5B84256DC54F003C73A2 /* SSKEnvironment.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDAF4255A580600E217F9 /* SSKEnvironment.m */; };
|
|
||||||
C32C5B8D256DC565003C73A2 /* SSKEnvironment.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB31255A580A00E217F9 /* SSKEnvironment.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
C32C5BCC256DC830003C73A2 /* Storage+ClosedGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F1372566120F0092EF10 /* Storage+ClosedGroups.swift */; };
|
C32C5BCC256DC830003C73A2 /* Storage+ClosedGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F1372566120F0092EF10 /* Storage+ClosedGroups.swift */; };
|
||||||
C32C5C3D256DCBAF003C73A2 /* AppReadiness.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB75255A581000E217F9 /* AppReadiness.m */; };
|
C32C5C3D256DCBAF003C73A2 /* AppReadiness.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB75255A581000E217F9 /* AppReadiness.m */; };
|
||||||
C32C5C46256DCBB2003C73A2 /* AppReadiness.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB01255A580700E217F9 /* AppReadiness.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
C32C5C46256DCBB2003C73A2 /* AppReadiness.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB01255A580700E217F9 /* AppReadiness.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
C32C5C4F256DCC36003C73A2 /* Storage+OpenGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F18825661BA50092EF10 /* Storage+OpenGroups.swift */; };
|
C32C5C4F256DCC36003C73A2 /* Storage+OpenGroups.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F18825661BA50092EF10 /* Storage+OpenGroups.swift */; };
|
||||||
C32C5C88256DD0D2003C73A2 /* Storage+Messaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F19225661BF80092EF10 /* Storage+Messaging.swift */; };
|
C32C5C88256DD0D2003C73A2 /* Storage+Messaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F19225661BF80092EF10 /* Storage+Messaging.swift */; };
|
||||||
C32C5C89256DD0D2003C73A2 /* Storage+Jobs.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F17625661AFA0092EF10 /* Storage+Jobs.swift */; };
|
C32C5C89256DD0D2003C73A2 /* Storage+Jobs.swift in Sources */ = {isa = PBXBuildFile; fileRef = B8D8F17625661AFA0092EF10 /* Storage+Jobs.swift */; };
|
||||||
C32C5CA4256DD1DC003C73A2 /* TSAccountManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB88255A581200E217F9 /* TSAccountManager.m */; };
|
|
||||||
C32C5CAD256DD1DF003C73A2 /* TSAccountManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB94255A581300E217F9 /* TSAccountManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
C32C5CF0256DD3E4003C73A2 /* Storage+Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F0A5FD255C988A007BE2A3 /* Storage+Shared.swift */; };
|
C32C5CF0256DD3E4003C73A2 /* Storage+Shared.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3F0A5FD255C988A007BE2A3 /* Storage+Shared.swift */; };
|
||||||
C32C5D19256DD493003C73A2 /* LinkPreviewDraft.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBA8255A581500E217F9 /* LinkPreviewDraft.swift */; };
|
C32C5D19256DD493003C73A2 /* LinkPreviewDraft.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBA8255A581500E217F9 /* LinkPreviewDraft.swift */; };
|
||||||
C32C5D83256DD5B6003C73A2 /* SSKKeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBBC255A581600E217F9 /* SSKKeychainStorage.swift */; };
|
C32C5D83256DD5B6003C73A2 /* SSKKeychainStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDBBC255A581600E217F9 /* SSKKeychainStorage.swift */; };
|
||||||
|
@ -410,7 +405,6 @@
|
||||||
C3548F0824456AB6009433A8 /* UIView+Wrapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0724456AB6009433A8 /* UIView+Wrapping.swift */; };
|
C3548F0824456AB6009433A8 /* UIView+Wrapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3548F0724456AB6009433A8 /* UIView+Wrapping.swift */; };
|
||||||
C354E75A23FE2A7600CE22E3 /* BaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C354E75923FE2A7600CE22E3 /* BaseVC.swift */; };
|
C354E75A23FE2A7600CE22E3 /* BaseVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = C354E75923FE2A7600CE22E3 /* BaseVC.swift */; };
|
||||||
C35D0DB525AE5F1200B6BF49 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35D0DB425AE5F1200B6BF49 /* UIEdgeInsets.swift */; };
|
C35D0DB525AE5F1200B6BF49 /* UIEdgeInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35D0DB425AE5F1200B6BF49 /* UIEdgeInsets.swift */; };
|
||||||
C35D76DB26606304009AA5FB /* ThreadUpdateBatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35D76DA26606303009AA5FB /* ThreadUpdateBatcher.swift */; };
|
|
||||||
C35E8AAE2485E51D00ACB629 /* IP2Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35E8AAD2485E51D00ACB629 /* IP2Country.swift */; };
|
C35E8AAE2485E51D00ACB629 /* IP2Country.swift in Sources */ = {isa = PBXBuildFile; fileRef = C35E8AAD2485E51D00ACB629 /* IP2Country.swift */; };
|
||||||
C374EEE225DA26740073A857 /* LinkPreviewModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C374EEE125DA26740073A857 /* LinkPreviewModal.swift */; };
|
C374EEE225DA26740073A857 /* LinkPreviewModal.swift in Sources */ = {isa = PBXBuildFile; fileRef = C374EEE125DA26740073A857 /* LinkPreviewModal.swift */; };
|
||||||
C374EEEB25DA3CA70073A857 /* ConversationTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C374EEEA25DA3CA70073A857 /* ConversationTitleView.swift */; };
|
C374EEEB25DA3CA70073A857 /* ConversationTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C374EEEA25DA3CA70073A857 /* ConversationTitleView.swift */; };
|
||||||
|
@ -521,10 +515,6 @@
|
||||||
C3A01E07261D24C400290BEB /* storage-seed-3.der in Resources */ = {isa = PBXBuildFile; fileRef = C3A01E04261D24C400290BEB /* storage-seed-3.der */; };
|
C3A01E07261D24C400290BEB /* storage-seed-3.der in Resources */ = {isa = PBXBuildFile; fileRef = C3A01E04261D24C400290BEB /* storage-seed-3.der */; };
|
||||||
C3A3A08F256E1728004D228D /* FullTextSearchFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB7F255A581100E217F9 /* FullTextSearchFinder.swift */; };
|
C3A3A08F256E1728004D228D /* FullTextSearchFinder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB7F255A581100E217F9 /* FullTextSearchFinder.swift */; };
|
||||||
C3A3A0FE256E1A3C004D228D /* TSDatabaseSecondaryIndexes.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB20255A580900E217F9 /* TSDatabaseSecondaryIndexes.m */; };
|
C3A3A0FE256E1A3C004D228D /* TSDatabaseSecondaryIndexes.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB20255A580900E217F9 /* TSDatabaseSecondaryIndexes.m */; };
|
||||||
C3A3A107256E1A5C004D228D /* OWSDisappearingMessagesFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDA86255A57FC00E217F9 /* OWSDisappearingMessagesFinder.m */; };
|
|
||||||
C3A3A108256E1A5C004D228D /* OWSIncomingMessageFinder.m in Sources */ = {isa = PBXBuildFile; fileRef = C33FDB1E255A580900E217F9 /* OWSIncomingMessageFinder.m */; };
|
|
||||||
C3A3A111256E1A93004D228D /* OWSIncomingMessageFinder.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDAC0255A580100E217F9 /* OWSIncomingMessageFinder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
C3A3A122256E1A97004D228D /* OWSDisappearingMessagesFinder.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDC05255A581D00E217F9 /* OWSDisappearingMessagesFinder.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
C3A3A12B256E1AD5004D228D /* TSDatabaseSecondaryIndexes.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB25255A580900E217F9 /* TSDatabaseSecondaryIndexes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
C3A3A12B256E1AD5004D228D /* TSDatabaseSecondaryIndexes.h in Headers */ = {isa = PBXBuildFile; fileRef = C33FDB25255A580900E217F9 /* TSDatabaseSecondaryIndexes.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
C3A3A171256E1D25004D228D /* SSKReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A3A170256E1D25004D228D /* SSKReachabilityManager.swift */; };
|
C3A3A171256E1D25004D228D /* SSKReachabilityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A3A170256E1D25004D228D /* SSKReachabilityManager.swift */; };
|
||||||
C3A71D0B2558989C0043A11F /* MessageWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D0A2558989C0043A11F /* MessageWrapper.swift */; };
|
C3A71D0B2558989C0043A11F /* MessageWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A71D0A2558989C0043A11F /* MessageWrapper.swift */; };
|
||||||
|
@ -981,7 +971,6 @@
|
||||||
4503F1BC20470A5B00CEE724 /* classic.aifc */ = {isa = PBXFileReference; lastKnownFileType = file; path = classic.aifc; sourceTree = "<group>"; };
|
4503F1BC20470A5B00CEE724 /* classic.aifc */ = {isa = PBXFileReference; lastKnownFileType = file; path = classic.aifc; sourceTree = "<group>"; };
|
||||||
4509E7991DD653700025A59F /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = ThirdParty/WebRTC/Build/WebRTC.framework; sourceTree = "<group>"; };
|
4509E7991DD653700025A59F /* WebRTC.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebRTC.framework; path = ThirdParty/WebRTC/Build/WebRTC.framework; sourceTree = "<group>"; };
|
||||||
450DF2081E0DD2C6003D14BE /* UserNotificationsAdaptee.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UserNotificationsAdaptee.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
450DF2081E0DD2C6003D14BE /* UserNotificationsAdaptee.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = UserNotificationsAdaptee.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||||
451166BF1FD86B98000739BA /* AccountManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountManager.swift; sourceTree = "<group>"; };
|
|
||||||
451A13B01E13DED2000A50FD /* AppNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppNotifications.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
451A13B01E13DED2000A50FD /* AppNotifications.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = AppNotifications.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
|
||||||
4520D8D41D417D8E00123472 /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = System/Library/Frameworks/Photos.framework; sourceTree = SDKROOT; };
|
4520D8D41D417D8E00123472 /* Photos.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Photos.framework; path = System/Library/Frameworks/Photos.framework; sourceTree = SDKROOT; };
|
||||||
4521C3BF1F59F3BA00B4C582 /* TextFieldHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldHelper.swift; sourceTree = "<group>"; };
|
4521C3BF1F59F3BA00B4C582 /* TextFieldHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TextFieldHelper.swift; sourceTree = "<group>"; };
|
||||||
|
@ -1259,7 +1248,6 @@
|
||||||
C33FDA6F255A57FA00E217F9 /* ReachabilityManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityManager.swift; sourceTree = "<group>"; };
|
C33FDA6F255A57FA00E217F9 /* ReachabilityManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReachabilityManager.swift; sourceTree = "<group>"; };
|
||||||
C33FDA73255A57FA00E217F9 /* ECKeyPair+Hexadecimal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ECKeyPair+Hexadecimal.swift"; sourceTree = "<group>"; };
|
C33FDA73255A57FA00E217F9 /* ECKeyPair+Hexadecimal.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "ECKeyPair+Hexadecimal.swift"; sourceTree = "<group>"; };
|
||||||
C33FDA7A255A57FB00E217F9 /* NSRegularExpression+SSK.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+SSK.swift"; sourceTree = "<group>"; };
|
C33FDA7A255A57FB00E217F9 /* NSRegularExpression+SSK.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+SSK.swift"; sourceTree = "<group>"; };
|
||||||
C33FDA86255A57FC00E217F9 /* OWSDisappearingMessagesFinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDisappearingMessagesFinder.m; sourceTree = "<group>"; };
|
|
||||||
C33FDA87255A57FC00E217F9 /* TypingIndicators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypingIndicators.swift; sourceTree = "<group>"; };
|
C33FDA87255A57FC00E217F9 /* TypingIndicators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypingIndicators.swift; sourceTree = "<group>"; };
|
||||||
C33FDA88255A57FD00E217F9 /* YapDatabaseTransaction+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YapDatabaseTransaction+OWS.h"; sourceTree = "<group>"; };
|
C33FDA88255A57FD00E217F9 /* YapDatabaseTransaction+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "YapDatabaseTransaction+OWS.h"; sourceTree = "<group>"; };
|
||||||
C33FDA8B255A57FD00E217F9 /* AppVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppVersion.m; sourceTree = "<group>"; };
|
C33FDA8B255A57FD00E217F9 /* AppVersion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppVersion.m; sourceTree = "<group>"; };
|
||||||
|
@ -1275,7 +1263,6 @@
|
||||||
C33FDAB8255A580100E217F9 /* NSArray+Functional.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Functional.m"; sourceTree = "<group>"; };
|
C33FDAB8255A580100E217F9 /* NSArray+Functional.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+Functional.m"; sourceTree = "<group>"; };
|
||||||
C33FDAB9255A580100E217F9 /* OWSStorage+Subclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OWSStorage+Subclass.h"; sourceTree = "<group>"; };
|
C33FDAB9255A580100E217F9 /* OWSStorage+Subclass.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "OWSStorage+Subclass.h"; sourceTree = "<group>"; };
|
||||||
C33FDABE255A580100E217F9 /* TSConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSConstants.m; sourceTree = "<group>"; };
|
C33FDABE255A580100E217F9 /* TSConstants.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSConstants.m; sourceTree = "<group>"; };
|
||||||
C33FDAC0255A580100E217F9 /* OWSIncomingMessageFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSIncomingMessageFinder.h; sourceTree = "<group>"; };
|
|
||||||
C33FDAC1255A580100E217F9 /* NSSet+Functional.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSSet+Functional.m"; sourceTree = "<group>"; };
|
C33FDAC1255A580100E217F9 /* NSSet+Functional.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSSet+Functional.m"; sourceTree = "<group>"; };
|
||||||
C33FDAC3255A580200E217F9 /* OWSDispatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDispatch.m; sourceTree = "<group>"; };
|
C33FDAC3255A580200E217F9 /* OWSDispatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSDispatch.m; sourceTree = "<group>"; };
|
||||||
C33FDADC255A580400E217F9 /* NSObject+Casting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Casting.h"; sourceTree = "<group>"; };
|
C33FDADC255A580400E217F9 /* NSObject+Casting.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Casting.h"; sourceTree = "<group>"; };
|
||||||
|
@ -1285,7 +1272,6 @@
|
||||||
C33FDAEF255A580500E217F9 /* NSData+Image.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Image.m"; sourceTree = "<group>"; };
|
C33FDAEF255A580500E217F9 /* NSData+Image.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Image.m"; sourceTree = "<group>"; };
|
||||||
C33FDAF1255A580500E217F9 /* OWSThumbnailService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSThumbnailService.swift; sourceTree = "<group>"; };
|
C33FDAF1255A580500E217F9 /* OWSThumbnailService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSThumbnailService.swift; sourceTree = "<group>"; };
|
||||||
C33FDAF2255A580500E217F9 /* ProxiedContentDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxiedContentDownloader.swift; sourceTree = "<group>"; };
|
C33FDAF2255A580500E217F9 /* ProxiedContentDownloader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProxiedContentDownloader.swift; sourceTree = "<group>"; };
|
||||||
C33FDAF4255A580600E217F9 /* SSKEnvironment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSKEnvironment.m; sourceTree = "<group>"; };
|
|
||||||
C33FDAFC255A580600E217F9 /* MIMETypeUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIMETypeUtil.h; sourceTree = "<group>"; };
|
C33FDAFC255A580600E217F9 /* MIMETypeUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MIMETypeUtil.h; sourceTree = "<group>"; };
|
||||||
C33FDAFD255A580600E217F9 /* LRUCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LRUCache.swift; sourceTree = "<group>"; };
|
C33FDAFD255A580600E217F9 /* LRUCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LRUCache.swift; sourceTree = "<group>"; };
|
||||||
C33FDAFE255A580600E217F9 /* OWSStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSStorage.h; sourceTree = "<group>"; };
|
C33FDAFE255A580600E217F9 /* OWSStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSStorage.h; sourceTree = "<group>"; };
|
||||||
|
@ -1296,13 +1282,11 @@
|
||||||
C33FDB14255A580800E217F9 /* OWSMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMath.h; sourceTree = "<group>"; };
|
C33FDB14255A580800E217F9 /* OWSMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSMath.h; sourceTree = "<group>"; };
|
||||||
C33FDB17255A580800E217F9 /* FunctionalUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtil.m; sourceTree = "<group>"; };
|
C33FDB17255A580800E217F9 /* FunctionalUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FunctionalUtil.m; sourceTree = "<group>"; };
|
||||||
C33FDB1C255A580900E217F9 /* UIImage+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+OWS.h"; sourceTree = "<group>"; };
|
C33FDB1C255A580900E217F9 /* UIImage+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+OWS.h"; sourceTree = "<group>"; };
|
||||||
C33FDB1E255A580900E217F9 /* OWSIncomingMessageFinder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSIncomingMessageFinder.m; sourceTree = "<group>"; };
|
|
||||||
C33FDB20255A580900E217F9 /* TSDatabaseSecondaryIndexes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSDatabaseSecondaryIndexes.m; sourceTree = "<group>"; };
|
C33FDB20255A580900E217F9 /* TSDatabaseSecondaryIndexes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSDatabaseSecondaryIndexes.m; sourceTree = "<group>"; };
|
||||||
C33FDB22255A580900E217F9 /* OWSMediaUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSMediaUtils.swift; sourceTree = "<group>"; };
|
C33FDB22255A580900E217F9 /* OWSMediaUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OWSMediaUtils.swift; sourceTree = "<group>"; };
|
||||||
C33FDB25255A580900E217F9 /* TSDatabaseSecondaryIndexes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSDatabaseSecondaryIndexes.h; sourceTree = "<group>"; };
|
C33FDB25255A580900E217F9 /* TSDatabaseSecondaryIndexes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSDatabaseSecondaryIndexes.h; sourceTree = "<group>"; };
|
||||||
C33FDB29255A580A00E217F9 /* NSData+Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Image.h"; sourceTree = "<group>"; };
|
C33FDB29255A580A00E217F9 /* NSData+Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Image.h"; sourceTree = "<group>"; };
|
||||||
C33FDB2C255A580A00E217F9 /* TSDatabaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSDatabaseView.h; sourceTree = "<group>"; };
|
C33FDB2C255A580A00E217F9 /* TSDatabaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSDatabaseView.h; sourceTree = "<group>"; };
|
||||||
C33FDB31255A580A00E217F9 /* SSKEnvironment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSKEnvironment.h; sourceTree = "<group>"; };
|
|
||||||
C33FDB34255A580B00E217F9 /* ClosedGroupPoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosedGroupPoller.swift; sourceTree = "<group>"; };
|
C33FDB34255A580B00E217F9 /* ClosedGroupPoller.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClosedGroupPoller.swift; sourceTree = "<group>"; };
|
||||||
C33FDB36255A580B00E217F9 /* Storage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = "<group>"; };
|
C33FDB36255A580B00E217F9 /* Storage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = "<group>"; };
|
||||||
C33FDB38255A580B00E217F9 /* OWSBackgroundTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackgroundTask.h; sourceTree = "<group>"; };
|
C33FDB38255A580B00E217F9 /* OWSBackgroundTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBackgroundTask.h; sourceTree = "<group>"; };
|
||||||
|
@ -1332,10 +1316,8 @@
|
||||||
C33FDB80255A581100E217F9 /* Notification+Loki.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Notification+Loki.swift"; sourceTree = "<group>"; };
|
C33FDB80255A581100E217F9 /* Notification+Loki.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Notification+Loki.swift"; sourceTree = "<group>"; };
|
||||||
C33FDB81255A581100E217F9 /* UIImage+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+OWS.m"; sourceTree = "<group>"; };
|
C33FDB81255A581100E217F9 /* UIImage+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+OWS.m"; sourceTree = "<group>"; };
|
||||||
C33FDB85255A581100E217F9 /* AppContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppContext.m; sourceTree = "<group>"; };
|
C33FDB85255A581100E217F9 /* AppContext.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppContext.m; sourceTree = "<group>"; };
|
||||||
C33FDB88255A581200E217F9 /* TSAccountManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TSAccountManager.m; sourceTree = "<group>"; };
|
|
||||||
C33FDB8A255A581200E217F9 /* AppContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppContext.h; sourceTree = "<group>"; };
|
C33FDB8A255A581200E217F9 /* AppContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppContext.h; sourceTree = "<group>"; };
|
||||||
C33FDB8F255A581200E217F9 /* ParamParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParamParser.swift; sourceTree = "<group>"; };
|
C33FDB8F255A581200E217F9 /* ParamParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParamParser.swift; sourceTree = "<group>"; };
|
||||||
C33FDB94255A581300E217F9 /* TSAccountManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSAccountManager.h; sourceTree = "<group>"; };
|
|
||||||
C33FDBA1255A581400E217F9 /* OWSOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOperation.h; sourceTree = "<group>"; };
|
C33FDBA1255A581400E217F9 /* OWSOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSOperation.h; sourceTree = "<group>"; };
|
||||||
C33FDBA8255A581500E217F9 /* LinkPreviewDraft.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkPreviewDraft.swift; sourceTree = "<group>"; };
|
C33FDBA8255A581500E217F9 /* LinkPreviewDraft.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkPreviewDraft.swift; sourceTree = "<group>"; };
|
||||||
C33FDBAB255A581500E217F9 /* OWSFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSFileSystem.h; sourceTree = "<group>"; };
|
C33FDBAB255A581500E217F9 /* OWSFileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSFileSystem.h; sourceTree = "<group>"; };
|
||||||
|
@ -1354,7 +1336,6 @@
|
||||||
C33FDBFE255A581C00E217F9 /* NSSet+Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSSet+Functional.h"; sourceTree = "<group>"; };
|
C33FDBFE255A581C00E217F9 /* NSSet+Functional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSSet+Functional.h"; sourceTree = "<group>"; };
|
||||||
C33FDC02255A581D00E217F9 /* OWSPrimaryStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSPrimaryStorage.m; sourceTree = "<group>"; };
|
C33FDC02255A581D00E217F9 /* OWSPrimaryStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSPrimaryStorage.m; sourceTree = "<group>"; };
|
||||||
C33FDC03255A581D00E217F9 /* ByteParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteParser.h; sourceTree = "<group>"; };
|
C33FDC03255A581D00E217F9 /* ByteParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteParser.h; sourceTree = "<group>"; };
|
||||||
C33FDC05255A581D00E217F9 /* OWSDisappearingMessagesFinder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSDisappearingMessagesFinder.h; sourceTree = "<group>"; };
|
|
||||||
C33FDC0B255A581D00E217F9 /* OWSError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSError.m; sourceTree = "<group>"; };
|
C33FDC0B255A581D00E217F9 /* OWSError.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSError.m; sourceTree = "<group>"; };
|
||||||
C33FDC12255A581E00E217F9 /* TSConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSConstants.h; sourceTree = "<group>"; };
|
C33FDC12255A581E00E217F9 /* TSConstants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TSConstants.h; sourceTree = "<group>"; };
|
||||||
C33FDC16255A581E00E217F9 /* FunctionalUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionalUtil.h; sourceTree = "<group>"; };
|
C33FDC16255A581E00E217F9 /* FunctionalUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FunctionalUtil.h; sourceTree = "<group>"; };
|
||||||
|
@ -1379,7 +1360,6 @@
|
||||||
C3548F0724456AB6009433A8 /* UIView+Wrapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Wrapping.swift"; sourceTree = "<group>"; };
|
C3548F0724456AB6009433A8 /* UIView+Wrapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+Wrapping.swift"; sourceTree = "<group>"; };
|
||||||
C354E75923FE2A7600CE22E3 /* BaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseVC.swift; sourceTree = "<group>"; };
|
C354E75923FE2A7600CE22E3 /* BaseVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseVC.swift; sourceTree = "<group>"; };
|
||||||
C35D0DB425AE5F1200B6BF49 /* UIEdgeInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsets.swift; sourceTree = "<group>"; };
|
C35D0DB425AE5F1200B6BF49 /* UIEdgeInsets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIEdgeInsets.swift; sourceTree = "<group>"; };
|
||||||
C35D76DA26606303009AA5FB /* ThreadUpdateBatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadUpdateBatcher.swift; sourceTree = "<group>"; };
|
|
||||||
C35E8AA22485C72300ACB629 /* SwiftCSV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftCSV.framework; path = ThirdParty/Carthage/Build/iOS/SwiftCSV.framework; sourceTree = "<group>"; };
|
C35E8AA22485C72300ACB629 /* SwiftCSV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftCSV.framework; path = ThirdParty/Carthage/Build/iOS/SwiftCSV.framework; sourceTree = "<group>"; };
|
||||||
C35E8AAD2485E51D00ACB629 /* IP2Country.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IP2Country.swift; sourceTree = "<group>"; };
|
C35E8AAD2485E51D00ACB629 /* IP2Country.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IP2Country.swift; sourceTree = "<group>"; };
|
||||||
C374EEE125DA26740073A857 /* LinkPreviewModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkPreviewModal.swift; sourceTree = "<group>"; };
|
C374EEE125DA26740073A857 /* LinkPreviewModal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkPreviewModal.swift; sourceTree = "<group>"; };
|
||||||
|
@ -1946,7 +1926,6 @@
|
||||||
76EB03C118170B33006006FC /* Utilities */ = {
|
76EB03C118170B33006006FC /* Utilities */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
451166BF1FD86B98000739BA /* AccountManager.swift */,
|
|
||||||
4C090A1A210FD9C7001FD7F9 /* HapticFeedback.swift */,
|
4C090A1A210FD9C7001FD7F9 /* HapticFeedback.swift */,
|
||||||
34D5CCA71EAE3D30005515DB /* AvatarViewHelper.h */,
|
34D5CCA71EAE3D30005515DB /* AvatarViewHelper.h */,
|
||||||
34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */,
|
34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */,
|
||||||
|
@ -2485,15 +2464,6 @@
|
||||||
path = Quotes;
|
path = Quotes;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
C32C5BB9256DC7C4003C73A2 /* To Do */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
C33FDB94255A581300E217F9 /* TSAccountManager.h */,
|
|
||||||
C33FDB88255A581200E217F9 /* TSAccountManager.m */,
|
|
||||||
);
|
|
||||||
path = "To Do";
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
C32C5BCB256DC818003C73A2 /* Database */ = {
|
C32C5BCB256DC818003C73A2 /* Database */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -2960,10 +2930,6 @@
|
||||||
C38EF281255B6D84007E1867 /* OWSAudioSession.swift */,
|
C38EF281255B6D84007E1867 /* OWSAudioSession.swift */,
|
||||||
C33FDB38255A580B00E217F9 /* OWSBackgroundTask.h */,
|
C33FDB38255A580B00E217F9 /* OWSBackgroundTask.h */,
|
||||||
C33FDC1B255A581F00E217F9 /* OWSBackgroundTask.m */,
|
C33FDC1B255A581F00E217F9 /* OWSBackgroundTask.m */,
|
||||||
C33FDC05255A581D00E217F9 /* OWSDisappearingMessagesFinder.h */,
|
|
||||||
C33FDA86255A57FC00E217F9 /* OWSDisappearingMessagesFinder.m */,
|
|
||||||
C33FDAC0255A580100E217F9 /* OWSIncomingMessageFinder.h */,
|
|
||||||
C33FDB1E255A580900E217F9 /* OWSIncomingMessageFinder.m */,
|
|
||||||
C38EF2F1255B6DBB007E1867 /* OWSPreferences.h */,
|
C38EF2F1255B6DBB007E1867 /* OWSPreferences.h */,
|
||||||
C38EF308255B6DBE007E1867 /* OWSPreferences.m */,
|
C38EF308255B6DBE007E1867 /* OWSPreferences.m */,
|
||||||
FDF0B75D280AAF35004C14C5 /* Preferences.swift */,
|
FDF0B75D280AAF35004C14C5 /* Preferences.swift */,
|
||||||
|
@ -2974,12 +2940,9 @@
|
||||||
C38EF2EC255B6DBA007E1867 /* ProximityMonitoringManager.swift */,
|
C38EF2EC255B6DBA007E1867 /* ProximityMonitoringManager.swift */,
|
||||||
C3BBE0B42554F0E10050F1E3 /* ProofOfWork.swift */,
|
C3BBE0B42554F0E10050F1E3 /* ProofOfWork.swift */,
|
||||||
C38EEF09255B49A8007E1867 /* SNProtoEnvelope+Conversion.swift */,
|
C38EEF09255B49A8007E1867 /* SNProtoEnvelope+Conversion.swift */,
|
||||||
C33FDB31255A580A00E217F9 /* SSKEnvironment.h */,
|
|
||||||
C33FDAF4255A580600E217F9 /* SSKEnvironment.m */,
|
|
||||||
FDF0B7542807C4BB004C14C5 /* SSKEnvironment.swift */,
|
FDF0B7542807C4BB004C14C5 /* SSKEnvironment.swift */,
|
||||||
C3A3A170256E1D25004D228D /* SSKReachabilityManager.swift */,
|
C3A3A170256E1D25004D228D /* SSKReachabilityManager.swift */,
|
||||||
C3ECBF7A257056B700EA7FCE /* Threading.swift */,
|
C3ECBF7A257056B700EA7FCE /* Threading.swift */,
|
||||||
C35D76DA26606303009AA5FB /* ThreadUpdateBatcher.swift */,
|
|
||||||
C33FDB5F255A580E00E217F9 /* YapDatabaseConnection+OWS.h */,
|
C33FDB5F255A580E00E217F9 /* YapDatabaseConnection+OWS.h */,
|
||||||
C33FDB43255A580C00E217F9 /* YapDatabaseConnection+OWS.m */,
|
C33FDB43255A580C00E217F9 /* YapDatabaseConnection+OWS.m */,
|
||||||
C33FDA88255A57FD00E217F9 /* YapDatabaseTransaction+OWS.h */,
|
C33FDA88255A57FD00E217F9 /* YapDatabaseTransaction+OWS.h */,
|
||||||
|
@ -3060,7 +3023,6 @@
|
||||||
children = (
|
children = (
|
||||||
C3C2A7802553AA6300C340D1 /* Protos */,
|
C3C2A7802553AA6300C340D1 /* Protos */,
|
||||||
C3C2A70A25539DF900C340D1 /* Meta */,
|
C3C2A70A25539DF900C340D1 /* Meta */,
|
||||||
C32C5BB9256DC7C4003C73A2 /* To Do */,
|
|
||||||
C3BBE07F2554CDD70050F1E3 /* Storage.swift */,
|
C3BBE07F2554CDD70050F1E3 /* Storage.swift */,
|
||||||
C32C5BCB256DC818003C73A2 /* Database */,
|
C32C5BCB256DC818003C73A2 /* Database */,
|
||||||
C300A5BB2554AFFB00555489 /* Messages */,
|
C300A5BB2554AFFB00555489 /* Messages */,
|
||||||
|
@ -3672,11 +3634,9 @@
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
C32C5EE5256DF506003C73A2 /* YapDatabaseConnection+OWS.h in Headers */,
|
C32C5EE5256DF506003C73A2 /* YapDatabaseConnection+OWS.h in Headers */,
|
||||||
C32C5B8D256DC565003C73A2 /* SSKEnvironment.h in Headers */,
|
|
||||||
C3C2A6F425539DE700C340D1 /* SessionMessagingKit.h in Headers */,
|
C3C2A6F425539DE700C340D1 /* SessionMessagingKit.h in Headers */,
|
||||||
C32C5C46256DCBB2003C73A2 /* AppReadiness.h in Headers */,
|
C32C5C46256DCBB2003C73A2 /* AppReadiness.h in Headers */,
|
||||||
B8856CB1256F0F47001CE70E /* OWSBackupFragment.h in Headers */,
|
B8856CB1256F0F47001CE70E /* OWSBackupFragment.h in Headers */,
|
||||||
C3A3A122256E1A97004D228D /* OWSDisappearingMessagesFinder.h in Headers */,
|
|
||||||
C3A3A12B256E1AD5004D228D /* TSDatabaseSecondaryIndexes.h in Headers */,
|
C3A3A12B256E1AD5004D228D /* TSDatabaseSecondaryIndexes.h in Headers */,
|
||||||
C32C5FC4256E0209003C73A2 /* OWSBackgroundTask.h in Headers */,
|
C32C5FC4256E0209003C73A2 /* OWSBackgroundTask.h in Headers */,
|
||||||
C32C5EF7256DF567003C73A2 /* TSDatabaseView.h in Headers */,
|
C32C5EF7256DF567003C73A2 /* TSDatabaseView.h in Headers */,
|
||||||
|
@ -3686,9 +3646,7 @@
|
||||||
B8856CF7256F105E001CE70E /* OWSAudioPlayer.h in Headers */,
|
B8856CF7256F105E001CE70E /* OWSAudioPlayer.h in Headers */,
|
||||||
B8856D3D256F11B2001CE70E /* Environment.h in Headers */,
|
B8856D3D256F11B2001CE70E /* Environment.h in Headers */,
|
||||||
C32C5E7E256DE023003C73A2 /* YapDatabaseTransaction+OWS.h in Headers */,
|
C32C5E7E256DE023003C73A2 /* YapDatabaseTransaction+OWS.h in Headers */,
|
||||||
C32C5CAD256DD1DF003C73A2 /* TSAccountManager.h in Headers */,
|
|
||||||
C32C5EA0256DE0D6003C73A2 /* OWSPrimaryStorage.h in Headers */,
|
C32C5EA0256DE0D6003C73A2 /* OWSPrimaryStorage.h in Headers */,
|
||||||
C3A3A111256E1A93004D228D /* OWSIncomingMessageFinder.h in Headers */,
|
|
||||||
B8856E33256F18D5001CE70E /* OWSStorage+Subclass.h in Headers */,
|
B8856E33256F18D5001CE70E /* OWSStorage+Subclass.h in Headers */,
|
||||||
C32C5E64256DDFD6003C73A2 /* OWSStorage.h in Headers */,
|
C32C5E64256DDFD6003C73A2 /* OWSStorage.h in Headers */,
|
||||||
);
|
);
|
||||||
|
@ -4636,8 +4594,6 @@
|
||||||
FDD250702837199200198BDA /* GarbageCollectionJob.swift in Sources */,
|
FDD250702837199200198BDA /* GarbageCollectionJob.swift in Sources */,
|
||||||
C32A026325A801AA000ED5D4 /* NSData+messagePadding.m in Sources */,
|
C32A026325A801AA000ED5D4 /* NSData+messagePadding.m in Sources */,
|
||||||
FD6A7A6B2818C17C00035AC1 /* UpdateProfilePictureJob.swift in Sources */,
|
FD6A7A6B2818C17C00035AC1 /* UpdateProfilePictureJob.swift in Sources */,
|
||||||
C32C5B84256DC54F003C73A2 /* SSKEnvironment.m in Sources */,
|
|
||||||
C3A3A108256E1A5C004D228D /* OWSIncomingMessageFinder.m in Sources */,
|
|
||||||
C352A31325574F5200338F3E /* MessageReceiveJob.swift in Sources */,
|
C352A31325574F5200338F3E /* MessageReceiveJob.swift in Sources */,
|
||||||
C3C2A7562553A3AB00C340D1 /* VisibleMessage+Quote.swift in Sources */,
|
C3C2A7562553A3AB00C340D1 /* VisibleMessage+Quote.swift in Sources */,
|
||||||
C3227FF6260AAD66006EA627 /* OpenGroupMessageV2.swift in Sources */,
|
C3227FF6260AAD66006EA627 /* OpenGroupMessageV2.swift in Sources */,
|
||||||
|
@ -4648,7 +4604,6 @@
|
||||||
C32C5A76256DBBCF003C73A2 /* SignalAttachment.swift in Sources */,
|
C32C5A76256DBBCF003C73A2 /* SignalAttachment.swift in Sources */,
|
||||||
FDA8EB00280E8D58002B68E5 /* FailedAttachmentDownloadsJob.swift in Sources */,
|
FDA8EB00280E8D58002B68E5 /* FailedAttachmentDownloadsJob.swift in Sources */,
|
||||||
FD09798927FD1C5A00936362 /* OpenGroup.swift in Sources */,
|
FD09798927FD1C5A00936362 /* OpenGroup.swift in Sources */,
|
||||||
C32C5CA4256DD1DC003C73A2 /* TSAccountManager.m in Sources */,
|
|
||||||
C3BBE0B52554F0E10050F1E3 /* ProofOfWork.swift in Sources */,
|
C3BBE0B52554F0E10050F1E3 /* ProofOfWork.swift in Sources */,
|
||||||
C3A3A08F256E1728004D228D /* FullTextSearchFinder.swift in Sources */,
|
C3A3A08F256E1728004D228D /* FullTextSearchFinder.swift in Sources */,
|
||||||
FDF0B7472804F0CE004C14C5 /* DisappearingMessagesJob.swift in Sources */,
|
FDF0B7472804F0CE004C14C5 /* DisappearingMessagesJob.swift in Sources */,
|
||||||
|
@ -4666,7 +4621,6 @@
|
||||||
FD09798327FD1A1500936362 /* ClosedGroup.swift in Sources */,
|
FD09798327FD1A1500936362 /* ClosedGroup.swift in Sources */,
|
||||||
B8856D34256F1192001CE70E /* Environment.m in Sources */,
|
B8856D34256F1192001CE70E /* Environment.m in Sources */,
|
||||||
B8B320B7258C30D70020074B /* HTMLMetadata.swift in Sources */,
|
B8B320B7258C30D70020074B /* HTMLMetadata.swift in Sources */,
|
||||||
C3A3A107256E1A5C004D228D /* OWSDisappearingMessagesFinder.m in Sources */,
|
|
||||||
FD09798727FD1B7800936362 /* GroupMember.swift in Sources */,
|
FD09798727FD1B7800936362 /* GroupMember.swift in Sources */,
|
||||||
FD09799127FD499200936362 /* BoxKeyPair+Utilities.swift in Sources */,
|
FD09799127FD499200936362 /* BoxKeyPair+Utilities.swift in Sources */,
|
||||||
FDB4BBC92839BEF000B7C95D /* ProfileManagerError.swift in Sources */,
|
FDB4BBC92839BEF000B7C95D /* ProfileManagerError.swift in Sources */,
|
||||||
|
@ -4703,7 +4657,6 @@
|
||||||
FDF0B75A2807F3A3004C14C5 /* MessageSenderError.swift in Sources */,
|
FDF0B75A2807F3A3004C14C5 /* MessageSenderError.swift in Sources */,
|
||||||
C32C5EDC256DF501003C73A2 /* YapDatabaseConnection+OWS.m in Sources */,
|
C32C5EDC256DF501003C73A2 /* YapDatabaseConnection+OWS.m in Sources */,
|
||||||
C3BBE0762554CDA60050F1E3 /* Configuration.swift in Sources */,
|
C3BBE0762554CDA60050F1E3 /* Configuration.swift in Sources */,
|
||||||
C35D76DB26606304009AA5FB /* ThreadUpdateBatcher.swift in Sources */,
|
|
||||||
B8856D69256F141F001CE70E /* OWSWindowManager.m in Sources */,
|
B8856D69256F141F001CE70E /* OWSWindowManager.m in Sources */,
|
||||||
C3ECBF7B257056B700EA7FCE /* Threading.swift in Sources */,
|
C3ECBF7B257056B700EA7FCE /* Threading.swift in Sources */,
|
||||||
C32C5A88256DBCF9003C73A2 /* MessageReceiver+Handling.swift in Sources */,
|
C32C5A88256DBCF9003C73A2 /* MessageReceiver+Handling.swift in Sources */,
|
||||||
|
@ -4782,7 +4735,6 @@
|
||||||
B84A89BC25DE328A0040017D /* ProfilePictureVC.swift in Sources */,
|
B84A89BC25DE328A0040017D /* ProfilePictureVC.swift in Sources */,
|
||||||
34386A54207D271D009F5D9C /* NeverClearView.swift in Sources */,
|
34386A54207D271D009F5D9C /* NeverClearView.swift in Sources */,
|
||||||
FDCDB8E02811007F00352A0C /* HomeViewModel.swift in Sources */,
|
FDCDB8E02811007F00352A0C /* HomeViewModel.swift in Sources */,
|
||||||
451166C01FD86B98000739BA /* AccountManager.swift in Sources */,
|
|
||||||
C374EEF425DB31D40073A857 /* VoiceMessageRecordingView.swift in Sources */,
|
C374EEF425DB31D40073A857 /* VoiceMessageRecordingView.swift in Sources */,
|
||||||
B83F2B88240CB75A000A54AB /* UIImage+Scaling.swift in Sources */,
|
B83F2B88240CB75A000A54AB /* UIImage+Scaling.swift in Sources */,
|
||||||
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */,
|
3430FE181F7751D4000EC51B /* GiphyAPI.swift in Sources */,
|
||||||
|
|
|
@ -6,11 +6,8 @@
|
||||||
#import "ConversationViewItem.h"
|
#import "ConversationViewItem.h"
|
||||||
#import "Session-Swift.h"
|
#import "Session-Swift.h"
|
||||||
#import "AnyPromise.h"
|
#import "AnyPromise.h"
|
||||||
#import <SignalUtilitiesKit/OWSUnreadIndicator.h>
|
|
||||||
#import <SessionUtilitiesKit/NSData+Image.h>
|
#import <SessionUtilitiesKit/NSData+Image.h>
|
||||||
#import <SessionUtilitiesKit/NSString+SSK.h>
|
#import <SessionUtilitiesKit/NSString+SSK.h>
|
||||||
#import <SessionMessagingKit/TSInteraction.h>
|
|
||||||
#import <SessionMessagingKit/SSKEnvironment.h>
|
|
||||||
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
|
@ -67,24 +67,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||||
// Setup the UI
|
// Setup the UI
|
||||||
self?.ensureRootViewController()
|
self?.ensureRootViewController()
|
||||||
|
|
||||||
|
|
||||||
// Every time the user upgrades to a new version:
|
|
||||||
//
|
|
||||||
// * Update account attributes.
|
|
||||||
// * Sync configuration.
|
|
||||||
if Identity.userExists() {
|
if Identity.userExists() {
|
||||||
// TODO: This
|
let appVersion: AppVersion = AppVersion.sharedInstance()
|
||||||
// AppVersion *appVersion = AppVersion.sharedInstance;
|
|
||||||
// if (appVersion.lastAppVersion.length > 0
|
|
||||||
// && ![appVersion.lastAppVersion isEqualToString:appVersion.currentAppVersion]) {
|
|
||||||
// [[self.tsAccountManager updateAccountAttributes] retainUntilComplete];
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we need a config sync then trigger it now
|
// If the device needs to sync config or the user updated to a new version
|
||||||
if (needsConfigSync) {
|
if
|
||||||
GRDBStorage.shared.write { db in
|
needsConfigSync || ( // TODO: 'needsConfigSync' logic for migrations
|
||||||
try MessageSender.syncConfiguration(db, forceSyncNow: true).retainUntilComplete()
|
(appVersion.lastAppVersion?.count ?? 0) > 0 &&
|
||||||
|
appVersion.lastAppVersion != appVersion.currentAppVersion
|
||||||
|
)
|
||||||
|
{
|
||||||
|
GRDBStorage.shared.write { db in
|
||||||
|
try MessageSender.syncConfiguration(db, forceSyncNow: true).retainUntilComplete()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,6 @@ import SignalUtilitiesKit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
|
||||||
public var accountManager: AccountManager
|
|
||||||
|
|
||||||
@objc
|
@objc
|
||||||
public var notificationPresenter: NotificationPresenter
|
public var notificationPresenter: NotificationPresenter
|
||||||
|
|
||||||
|
@ -47,7 +44,6 @@ import SignalUtilitiesKit
|
||||||
}
|
}
|
||||||
|
|
||||||
private override init() {
|
private override init() {
|
||||||
self.accountManager = AccountManager()
|
|
||||||
self.notificationPresenter = NotificationPresenter()
|
self.notificationPresenter = NotificationPresenter()
|
||||||
self.pushRegistrationManager = PushRegistrationManager()
|
self.pushRegistrationManager = PushRegistrationManager()
|
||||||
self._userNotificationActionHandler = UserNotificationActionHandler()
|
self._userNotificationActionHandler = UserNotificationActionHandler()
|
||||||
|
|
|
@ -56,7 +56,6 @@
|
||||||
#import <SignalUtilitiesKit/OWSDispatch.h>
|
#import <SignalUtilitiesKit/OWSDispatch.h>
|
||||||
#import <SignalUtilitiesKit/OWSError.h>
|
#import <SignalUtilitiesKit/OWSError.h>
|
||||||
#import <SessionUtilitiesKit/OWSFileSystem.h>
|
#import <SessionUtilitiesKit/OWSFileSystem.h>
|
||||||
#import <SessionMessagingKit/TSAccountManager.h>
|
|
||||||
#import <SessionUtilitiesKit/LKGroupUtilities.h>
|
#import <SessionUtilitiesKit/LKGroupUtilities.h>
|
||||||
#import <SessionUtilitiesKit/UIImage+OWS.h>
|
#import <SessionUtilitiesKit/UIImage+OWS.h>
|
||||||
#import <YYImage/YYImage.h>
|
#import <YYImage/YYImage.h>
|
||||||
|
|
|
@ -50,8 +50,8 @@ public enum SyncPushTokensJob: JobExecutor {
|
||||||
|
|
||||||
PushRegistrationManager.shared.requestPushTokens()
|
PushRegistrationManager.shared.requestPushTokens()
|
||||||
.then { (pushToken: String, voipToken: String) -> Promise<Void> in
|
.then { (pushToken: String, voipToken: String) -> Promise<Void> in
|
||||||
let lastPushToken: String? = GRDBStorage.shared.read { db in db[.lastRecordedPushToken] }
|
let lastPushToken: String? = GRDBStorage.shared[.lastRecordedPushToken]
|
||||||
let lastVoipToken: String? = GRDBStorage.shared.read { db in db[.lastRecordedVoipToken] }
|
let lastVoipToken: String? = GRDBStorage.shared[.lastRecordedVoipToken]
|
||||||
let shouldUploadTokens: Bool = (
|
let shouldUploadTokens: Bool = (
|
||||||
!uploadOnlyIfStale || (
|
!uploadOnlyIfStale || (
|
||||||
lastPushToken != pushToken ||
|
lastPushToken != pushToken ||
|
||||||
|
@ -64,14 +64,13 @@ public enum SyncPushTokensJob: JobExecutor {
|
||||||
|
|
||||||
let (promise, seal) = Promise<Void>.pending()
|
let (promise, seal) = Promise<Void>.pending()
|
||||||
|
|
||||||
SSKEnvironment.shared.tsAccountManager
|
SyncPushTokensJob.registerForPushNotifications(
|
||||||
.registerForPushNotifications(
|
pushToken: pushToken,
|
||||||
pushToken: pushToken,
|
voipToken: voipToken,
|
||||||
voipToken: voipToken,
|
isForcedUpdate: shouldUploadTokens,
|
||||||
isForcedUpdate: shouldUploadTokens,
|
success: { seal.fulfill(()) },
|
||||||
success: { seal.fulfill(()) },
|
failure: seal.reject
|
||||||
failure: seal.reject
|
)
|
||||||
)
|
|
||||||
|
|
||||||
return promise
|
return promise
|
||||||
.done { _ in
|
.done { _ in
|
||||||
|
@ -119,6 +118,46 @@ private func redact(_ string: String) -> String {
|
||||||
return OWSIsDebugBuild() ? string : "[ READACTED \(string.prefix(2))...\(string.suffix(2)) ]"
|
return OWSIsDebugBuild() ? string : "[ READACTED \(string.prefix(2))...\(string.suffix(2)) ]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension SyncPushTokensJob {
|
||||||
|
fileprivate static func registerForPushNotifications(
|
||||||
|
pushToken: String,
|
||||||
|
voipToken: String,
|
||||||
|
isForcedUpdate: Bool,
|
||||||
|
success: @escaping () -> (),
|
||||||
|
failure: @escaping (Error) -> (),
|
||||||
|
remainingRetries: Int = 3
|
||||||
|
) {
|
||||||
|
let isUsingFullAPNs: Bool = UserDefaults.standard[.isUsingFullAPNs]
|
||||||
|
let pushTokenAsData = Data(hex: pushToken)
|
||||||
|
let promise: Promise<Void> = (isUsingFullAPNs ?
|
||||||
|
PushNotificationAPI.register(
|
||||||
|
with: pushTokenAsData,
|
||||||
|
publicKey: getUserHexEncodedPublicKey(),
|
||||||
|
isForcedUpdate: isForcedUpdate
|
||||||
|
) :
|
||||||
|
PushNotificationAPI.unregister(pushTokenAsData)
|
||||||
|
)
|
||||||
|
|
||||||
|
promise
|
||||||
|
.done { success() }
|
||||||
|
.catch { error in
|
||||||
|
guard remainingRetries == 0 else {
|
||||||
|
SyncPushTokensJob.registerForPushNotifications(
|
||||||
|
pushToken: pushToken,
|
||||||
|
voipToken: voipToken,
|
||||||
|
isForcedUpdate: isForcedUpdate,
|
||||||
|
success: success,
|
||||||
|
failure: failure,
|
||||||
|
remainingRetries: (remainingRetries - 1)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
failure(error)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - Objective C Support
|
// MARK: - Objective C Support
|
||||||
|
|
||||||
@objc(OWSSyncPushTokensJob)
|
@objc(OWSSyncPushTokensJob)
|
||||||
|
|
|
@ -136,7 +136,7 @@ final class LinkDeviceVC : BaseVC, UIPageViewControllerDataSource, UIPageViewCon
|
||||||
}
|
}
|
||||||
let (ed25519KeyPair, x25519KeyPair) = try! Identity.generate(from: seed)
|
let (ed25519KeyPair, x25519KeyPair) = try! Identity.generate(from: seed)
|
||||||
Onboarding.Flow.link.preregister(with: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
|
Onboarding.Flow.link.preregister(with: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
|
||||||
TSAccountManager.sharedInstance().didRegister()
|
Identity.didRegister()
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(handleInitialConfigurationMessageReceived), name: .initialConfigurationMessageReceived, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(handleInitialConfigurationMessageReceived), name: .initialConfigurationMessageReceived, object: nil)
|
||||||
ModalActivityIndicatorViewController.present(fromViewController: navigationController!) { [weak self] modal in
|
ModalActivityIndicatorViewController.present(fromViewController: navigationController!) { [weak self] modal in
|
||||||
self?.activityIndicatorModal = modal
|
self?.activityIndicatorModal = modal
|
||||||
|
@ -144,8 +144,6 @@ final class LinkDeviceVC : BaseVC, UIPageViewControllerDataSource, UIPageViewCon
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func handleInitialConfigurationMessageReceived(_ notification: Notification) {
|
@objc private func handleInitialConfigurationMessageReceived(_ notification: Notification) {
|
||||||
TSAccountManager.sharedInstance().phoneNumberAwaitingVerification = getUserHexEncodedPublicKey()
|
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.navigationController!.dismiss(animated: true) {
|
self.navigationController!.dismiss(animated: true) {
|
||||||
let pnModeVC = PNModeVC()
|
let pnModeVC = PNModeVC()
|
||||||
|
|
|
@ -16,7 +16,7 @@ enum Onboarding {
|
||||||
let userDefaults = UserDefaults.standard
|
let userDefaults = UserDefaults.standard
|
||||||
Identity.store(seed: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
|
Identity.store(seed: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
|
||||||
let x25519PublicKey = x25519KeyPair.hexEncodedPublicKey
|
let x25519PublicKey = x25519KeyPair.hexEncodedPublicKey
|
||||||
TSAccountManager.sharedInstance().phoneNumberAwaitingVerification = x25519PublicKey
|
|
||||||
GRDBStorage.shared.write { db in
|
GRDBStorage.shared.write { db in
|
||||||
try Contact(id: x25519PublicKey)
|
try Contact(id: x25519PublicKey)
|
||||||
.with(
|
.with(
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import UIKit
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
import SessionMessagingKit
|
||||||
|
|
||||||
final class PNModeVC : BaseVC, OptionViewDelegate {
|
final class PNModeVC : BaseVC, OptionViewDelegate {
|
||||||
|
|
||||||
|
@ -94,7 +96,7 @@ final class PNModeVC : BaseVC, OptionViewDelegate {
|
||||||
return present(alert, animated: true, completion: nil)
|
return present(alert, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)
|
UserDefaults.standard[.isUsingFullAPNs] = (selectedOptionView == apnsOptionView)
|
||||||
TSAccountManager.sharedInstance().didRegister()
|
Identity.didRegister()
|
||||||
let homeVC = HomeVC()
|
let homeVC = HomeVC()
|
||||||
navigationController!.setViewControllers([ homeVC ], animated: true)
|
navigationController!.setViewControllers([ homeVC ], animated: true)
|
||||||
|
|
||||||
|
|
|
@ -1,130 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
import PromiseKit
|
|
||||||
import SignalUtilitiesKit
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Signal is actually two services - textSecure for messages and red phone (for calls).
|
|
||||||
* AccountManager delegates to both.
|
|
||||||
*/
|
|
||||||
@objc
|
|
||||||
public class AccountManager: NSObject {
|
|
||||||
|
|
||||||
// MARK: - Dependencies
|
|
||||||
|
|
||||||
private var preferences: OWSPreferences {
|
|
||||||
return Environment.shared.preferences
|
|
||||||
}
|
|
||||||
|
|
||||||
private var tsAccountManager: TSAccountManager {
|
|
||||||
return TSAccountManager.sharedInstance()
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: -
|
|
||||||
|
|
||||||
@objc
|
|
||||||
public override init() {
|
|
||||||
super.init()
|
|
||||||
|
|
||||||
SwiftSingletons.register(self)
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: registration
|
|
||||||
|
|
||||||
@objc func registerObjc(verificationCode: String,
|
|
||||||
pin: String?) -> AnyPromise {
|
|
||||||
return AnyPromise(register(verificationCode: verificationCode, pin: pin))
|
|
||||||
}
|
|
||||||
|
|
||||||
func register(verificationCode: String,
|
|
||||||
pin: String?) -> Promise<Void> {
|
|
||||||
guard verificationCode.count > 0 else {
|
|
||||||
let error = OWSErrorWithCodeDescription(.userError,
|
|
||||||
NSLocalizedString("REGISTRATION_ERROR_BLANK_VERIFICATION_CODE",
|
|
||||||
comment: "alert body during registration"))
|
|
||||||
return Promise(error: error)
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger.debug("registering with signal server")
|
|
||||||
let registrationPromise: Promise<Void> = firstly {
|
|
||||||
return self.registerForTextSecure(verificationCode: verificationCode, pin: pin)
|
|
||||||
}.then { _ -> Promise<Void> in
|
|
||||||
return self.syncPushTokens().recover { (error) -> Promise<Void> in
|
|
||||||
switch error {
|
|
||||||
case PushRegistrationError.pushNotSupported(let description):
|
|
||||||
// This can happen with:
|
|
||||||
// - simulators, none of which support receiving push notifications
|
|
||||||
// - on iOS11 devices which have disabled "Allow Notifications" and disabled "Enable Background Refresh" in the system settings.
|
|
||||||
Logger.info("Recovered push registration error. Registering for manual message fetcher because push not supported: \(description)")
|
|
||||||
return self.enableManualMessageFetching()
|
|
||||||
default:
|
|
||||||
throw error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.done { (_) -> Void in
|
|
||||||
self.completeRegistration()
|
|
||||||
}
|
|
||||||
|
|
||||||
registrationPromise.retainUntilComplete()
|
|
||||||
|
|
||||||
return registrationPromise
|
|
||||||
}
|
|
||||||
|
|
||||||
private func registerForTextSecure(verificationCode: String,
|
|
||||||
pin: String?) -> Promise<Void> {
|
|
||||||
return Promise { resolver in
|
|
||||||
tsAccountManager.verifyAccount(withCode: verificationCode,
|
|
||||||
pin: pin,
|
|
||||||
success: { resolver.fulfill(()) },
|
|
||||||
failure: resolver.reject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private func syncPushTokens() -> Promise<Void> {
|
|
||||||
Logger.info("")
|
|
||||||
|
|
||||||
guard let job: Job = Job(
|
|
||||||
variant: .syncPushTokens,
|
|
||||||
details: SyncPushTokensJob.Details(
|
|
||||||
uploadOnlyIfStale: false
|
|
||||||
)
|
|
||||||
)
|
|
||||||
else { return Promise(error: GRDBStorageError.decodingFailed) }
|
|
||||||
|
|
||||||
let (promise, seal) = Promise<Void>.pending()
|
|
||||||
|
|
||||||
SyncPushTokensJob.run(
|
|
||||||
job,
|
|
||||||
success: { _, _ in seal.fulfill(()) },
|
|
||||||
failure: { _, error, _ in seal.reject(error ?? GRDBStorageError.generic) },
|
|
||||||
deferred: { _ in seal.reject(GRDBStorageError.generic) }
|
|
||||||
)
|
|
||||||
|
|
||||||
return promise
|
|
||||||
}
|
|
||||||
|
|
||||||
private func completeRegistration() {
|
|
||||||
Logger.info("")
|
|
||||||
tsAccountManager.didRegister()
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Message Delivery
|
|
||||||
|
|
||||||
func updatePushTokens(pushToken: String, voipToken: String, isForcedUpdate: Bool) -> Promise<Void> {
|
|
||||||
return Promise { resolver in
|
|
||||||
tsAccountManager.registerForPushNotifications(pushToken: pushToken,
|
|
||||||
voipToken: voipToken,
|
|
||||||
isForcedUpdate: isForcedUpdate,
|
|
||||||
success: { resolver.fulfill(()) },
|
|
||||||
failure: resolver.reject)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func enableManualMessageFetching() -> Promise<Void> {
|
|
||||||
let anyPromise = tsAccountManager.setIsManualMessageFetchEnabled(true)
|
|
||||||
return Promise(anyPromise).asVoid()
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -64,7 +64,7 @@ public extension DisappearingMessagesConfiguration {
|
||||||
|
|
||||||
var previewText: String {
|
var previewText: String {
|
||||||
guard let senderName: String = senderName else {
|
guard let senderName: String = senderName else {
|
||||||
// Changed by localNumber on this device or via synced transcript
|
// Changed by this device or via synced transcript
|
||||||
guard isEnabled, durationSeconds > 0 else { return "YOU_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION".localized() }
|
guard isEnabled, durationSeconds > 0 else { return "YOU_DISABLED_DISAPPEARING_MESSAGES_CONFIGURATION".localized() }
|
||||||
|
|
||||||
return String(
|
return String(
|
||||||
|
|
|
@ -5,11 +5,9 @@
|
||||||
#import "OWSPrimaryStorage.h"
|
#import "OWSPrimaryStorage.h"
|
||||||
#import "AppContext.h"
|
#import "AppContext.h"
|
||||||
#import "OWSFileSystem.h"
|
#import "OWSFileSystem.h"
|
||||||
#import "OWSIncomingMessageFinder.h"
|
|
||||||
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
|
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
|
||||||
#import "OWSStorage.h"
|
#import "OWSStorage.h"
|
||||||
#import "OWSStorage+Subclass.h"
|
#import "OWSStorage+Subclass.h"
|
||||||
#import "SSKEnvironment.h"
|
|
||||||
#import "TSDatabaseSecondaryIndexes.h"
|
#import "TSDatabaseSecondaryIndexes.h"
|
||||||
#import "TSDatabaseView.h"
|
#import "TSDatabaseView.h"
|
||||||
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
|
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
|
||||||
|
@ -173,8 +171,6 @@ void VerifyRegistrationsForPrimaryStorage(OWSStorage *storage)
|
||||||
[TSDatabaseView asyncRegisterThreadOutgoingMessagesDatabaseView:self];
|
[TSDatabaseView asyncRegisterThreadOutgoingMessagesDatabaseView:self];
|
||||||
|
|
||||||
[FullTextSearchFinder asyncRegisterDatabaseExtensionWithStorage:self];
|
[FullTextSearchFinder asyncRegisterDatabaseExtensionWithStorage:self];
|
||||||
[OWSIncomingMessageFinder asyncRegisterExtensionWithPrimaryStorage:self];
|
|
||||||
[OWSDisappearingMessagesFinder asyncRegisterDatabaseExtensions:self];
|
|
||||||
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:self];
|
[TSDatabaseView asyncRegisterLazyRestoreAttachmentsDatabaseView:self];
|
||||||
|
|
||||||
[self.database
|
[self.database
|
||||||
|
|
|
@ -9,14 +9,11 @@ FOUNDATION_EXPORT const unsigned char SessionMessagingKitVersionString[];
|
||||||
#import <SessionMessagingKit/OWSAudioPlayer.h>
|
#import <SessionMessagingKit/OWSAudioPlayer.h>
|
||||||
#import <SessionMessagingKit/OWSBackgroundTask.h>
|
#import <SessionMessagingKit/OWSBackgroundTask.h>
|
||||||
#import <SessionMessagingKit/OWSBackupFragment.h>
|
#import <SessionMessagingKit/OWSBackupFragment.h>
|
||||||
#import <SessionMessagingKit/OWSIncomingMessageFinder.h>
|
|
||||||
#import <SessionMessagingKit/OWSPreferences.h>
|
#import <SessionMessagingKit/OWSPreferences.h>
|
||||||
#import <SessionMessagingKit/OWSPrimaryStorage.h>
|
#import <SessionMessagingKit/OWSPrimaryStorage.h>
|
||||||
#import <SessionMessagingKit/OWSStorage.h>
|
#import <SessionMessagingKit/OWSStorage.h>
|
||||||
#import <SessionMessagingKit/OWSStorage+Subclass.h>
|
#import <SessionMessagingKit/OWSStorage+Subclass.h>
|
||||||
#import <SessionMessagingKit/OWSWindowManager.h>
|
#import <SessionMessagingKit/OWSWindowManager.h>
|
||||||
#import <SessionMessagingKit/SSKEnvironment.h>
|
|
||||||
#import <SessionMessagingKit/TSAccountManager.h>
|
|
||||||
#import <SessionMessagingKit/TSDatabaseSecondaryIndexes.h>
|
#import <SessionMessagingKit/TSDatabaseSecondaryIndexes.h>
|
||||||
#import <SessionMessagingKit/TSDatabaseView.h>
|
#import <SessionMessagingKit/TSDatabaseView.h>
|
||||||
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
|
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
|
||||||
|
|
|
@ -1,167 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
extern NSString *const TSRegistrationErrorDomain;
|
|
||||||
extern NSString *const TSRegistrationErrorUserInfoHTTPStatus;
|
|
||||||
extern NSString *const RegistrationStateDidChangeNotification;
|
|
||||||
extern NSString *const kNSNotificationName_LocalNumberDidChange;
|
|
||||||
|
|
||||||
@class AnyPromise;
|
|
||||||
@class OWSPrimaryStorage;
|
|
||||||
@class TSNetworkManager;
|
|
||||||
@class YapDatabaseReadTransaction;
|
|
||||||
@class YapDatabaseReadWriteTransaction;
|
|
||||||
|
|
||||||
typedef NS_ENUM(NSUInteger, OWSRegistrationState) {
|
|
||||||
OWSRegistrationState_Unregistered,
|
|
||||||
OWSRegistrationState_PendingBackupRestore,
|
|
||||||
OWSRegistrationState_Registered,
|
|
||||||
OWSRegistrationState_Deregistered,
|
|
||||||
OWSRegistrationState_Reregistering,
|
|
||||||
};
|
|
||||||
|
|
||||||
@interface TSAccountManager : NSObject
|
|
||||||
|
|
||||||
@property (nonatomic, nullable) NSString *phoneNumberAwaitingVerification;
|
|
||||||
|
|
||||||
#pragma mark - Initializers
|
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage NS_DESIGNATED_INITIALIZER;
|
|
||||||
|
|
||||||
+ (instancetype)sharedInstance;
|
|
||||||
|
|
||||||
- (OWSRegistrationState)registrationState;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns if a user is registered or not
|
|
||||||
*
|
|
||||||
* @return registered or not
|
|
||||||
*/
|
|
||||||
- (BOOL)isRegistered;
|
|
||||||
- (BOOL)isRegisteredAndReady;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns current phone number for this device, which may not yet have been registered.
|
|
||||||
*
|
|
||||||
* @return E164 formatted phone number
|
|
||||||
*/
|
|
||||||
+ (nullable NSString *)localNumber;
|
|
||||||
- (nullable NSString *)localNumber;
|
|
||||||
|
|
||||||
// A variant of localNumber that never opens a "sneaky" transaction.
|
|
||||||
- (nullable NSString *)storedOrCachedLocalNumber:(YapDatabaseReadTransaction *)transaction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Symmetric key that's used to encrypt message payloads from the server,
|
|
||||||
*
|
|
||||||
* @return signaling key
|
|
||||||
*/
|
|
||||||
+ (nullable NSString *)signalingKey;
|
|
||||||
- (nullable NSString *)signalingKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The server auth token allows the Signal client to connect to the Signal server
|
|
||||||
*
|
|
||||||
* @return server authentication token
|
|
||||||
*/
|
|
||||||
+ (nullable NSString *)serverAuthToken;
|
|
||||||
- (nullable NSString *)serverAuthToken;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The registration ID is unique to an installation of TextSecure, it allows to know if the app was reinstalled
|
|
||||||
*
|
|
||||||
* @return registrationID;
|
|
||||||
*/
|
|
||||||
|
|
||||||
+ (uint32_t)getOrGenerateRegistrationId:(YapDatabaseReadWriteTransaction *)transaction;
|
|
||||||
- (uint32_t)getOrGenerateRegistrationId;
|
|
||||||
- (uint32_t)getOrGenerateRegistrationId:(YapDatabaseReadWriteTransaction *)transaction;
|
|
||||||
|
|
||||||
#pragma mark - Register with phone number
|
|
||||||
|
|
||||||
- (void)registerWithPhoneNumber:(NSString *)phoneNumber
|
|
||||||
captchaToken:(nullable NSString *)captchaToken
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock
|
|
||||||
smsVerification:(BOOL)isSMS;
|
|
||||||
|
|
||||||
- (void)rerequestSMSWithCaptchaToken:(nullable NSString *)captchaToken
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock;
|
|
||||||
|
|
||||||
- (void)rerequestVoiceWithCaptchaToken:(nullable NSString *)captchaToken
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock;
|
|
||||||
|
|
||||||
- (void)verifyAccountWithCode:(NSString *)verificationCode
|
|
||||||
pin:(nullable NSString *)pin
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock;
|
|
||||||
|
|
||||||
// Called once registration is complete - meaning the following have succeeded:
|
|
||||||
// - obtained signal server credentials
|
|
||||||
// - uploaded pre-keys
|
|
||||||
// - uploaded push tokens
|
|
||||||
- (void)didRegister;
|
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register's the device's push notification token with the server
|
|
||||||
*
|
|
||||||
* @param pushToken Apple's Push Token
|
|
||||||
*/
|
|
||||||
- (void)registerForPushNotificationsWithPushToken:(NSString *)pushToken
|
|
||||||
voipToken:(NSString *)voipToken
|
|
||||||
isForcedUpdate:(BOOL)isForcedUpdate
|
|
||||||
success:(void (^)(void))successHandler
|
|
||||||
failure:(void (^)(NSError *error))failureHandler
|
|
||||||
NS_SWIFT_NAME(registerForPushNotifications(pushToken:voipToken:isForcedUpdate:success:failure:));
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ (void)unregisterTextSecureWithSuccess:(void (^)(void))success failure:(void (^)(NSError *error))failureBlock;
|
|
||||||
|
|
||||||
#pragma mark - De-Registration
|
|
||||||
|
|
||||||
// De-registration reflects whether or not the "last known contact"
|
|
||||||
// with the service was:
|
|
||||||
//
|
|
||||||
// * A 403 from the service, indicating de-registration.
|
|
||||||
// * A successful auth'd request _or_ websocket connection indicating
|
|
||||||
// valid registration.
|
|
||||||
- (BOOL)isDeregistered;
|
|
||||||
- (void)setIsDeregistered:(BOOL)isDeregistered;
|
|
||||||
|
|
||||||
#pragma mark - Re-registration
|
|
||||||
|
|
||||||
// Re-registration is the process of re-registering _with the same phone number_.
|
|
||||||
|
|
||||||
// Returns YES on success.
|
|
||||||
- (nullable NSString *)reregisterationPhoneNumber;
|
|
||||||
- (BOOL)isReregistering;
|
|
||||||
|
|
||||||
#pragma mark - Manual Message Fetch
|
|
||||||
|
|
||||||
- (BOOL)isManualMessageFetchEnabled;
|
|
||||||
- (AnyPromise *)setIsManualMessageFetchEnabled:(BOOL)value __attribute__((warn_unused_result));
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
- (void)registerForTestsWithLocalNumber:(NSString *)localNumber;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- (AnyPromise *)updateAccountAttributes __attribute__((warn_unused_result));
|
|
||||||
|
|
||||||
// This should only be used during the registration process.
|
|
||||||
- (AnyPromise *)performUpdateAccountAttributes __attribute__((warn_unused_result));
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,499 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "TSAccountManager.h"
|
|
||||||
#import "AppContext.h"
|
|
||||||
#import "AppReadiness.h"
|
|
||||||
#import "NSNotificationCenter+OWS.h"
|
|
||||||
#import "SSKEnvironment.h"
|
|
||||||
#import "YapDatabaseConnection+OWS.h"
|
|
||||||
#import "YapDatabaseTransaction+OWS.h"
|
|
||||||
#import <PromiseKit/AnyPromise.h>
|
|
||||||
#import <Reachability/Reachability.h>
|
|
||||||
#import <SignalCoreKit/NSData+OWS.h>
|
|
||||||
#import <SignalCoreKit/Randomness.h>
|
|
||||||
#import <SessionMessagingKit/SessionMessagingKit-Swift.h>
|
|
||||||
#import <YapDatabase/YapDatabase.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
NSString *const TSRegistrationErrorDomain = @"TSRegistrationErrorDomain";
|
|
||||||
NSString *const TSRegistrationErrorUserInfoHTTPStatus = @"TSHTTPStatus";
|
|
||||||
NSString *const RegistrationStateDidChangeNotification = @"RegistrationStateDidChangeNotification";
|
|
||||||
NSString *const kNSNotificationName_LocalNumberDidChange = @"kNSNotificationName_LocalNumberDidChange";
|
|
||||||
|
|
||||||
NSString *const TSAccountManager_RegisteredNumberKey = @"TSStorageRegisteredNumberKey";
|
|
||||||
NSString *const TSAccountManager_IsDeregisteredKey = @"TSAccountManager_IsDeregisteredKey";
|
|
||||||
NSString *const TSAccountManager_ReregisteringPhoneNumberKey = @"TSAccountManager_ReregisteringPhoneNumberKey";
|
|
||||||
NSString *const TSAccountManager_LocalRegistrationIdKey = @"TSStorageLocalRegistrationId";
|
|
||||||
NSString *const TSAccountManager_HasPendingRestoreDecisionKey = @"TSAccountManager_HasPendingRestoreDecisionKey";
|
|
||||||
|
|
||||||
NSString *const TSAccountManager_UserAccountCollection = @"TSStorageUserAccountCollection";
|
|
||||||
NSString *const TSAccountManager_ServerAuthToken = @"TSStorageServerAuthToken";
|
|
||||||
NSString *const TSAccountManager_ServerSignalingKey = @"TSStorageServerSignalingKey";
|
|
||||||
NSString *const TSAccountManager_ManualMessageFetchKey = @"TSAccountManager_ManualMessageFetchKey";
|
|
||||||
NSString *const TSAccountManager_NeedsAccountAttributesUpdateKey = @"TSAccountManager_NeedsAccountAttributesUpdateKey";
|
|
||||||
|
|
||||||
@interface TSAccountManager ()
|
|
||||||
|
|
||||||
@property (atomic, readonly) BOOL isRegistered;
|
|
||||||
|
|
||||||
@property (nonatomic, nullable) NSString *cachedLocalNumber;
|
|
||||||
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
|
|
||||||
|
|
||||||
@property (nonatomic, nullable) NSNumber *cachedIsDeregistered;
|
|
||||||
|
|
||||||
@property (nonatomic) Reachability *reachability;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
|
|
||||||
@implementation TSAccountManager
|
|
||||||
|
|
||||||
@synthesize isRegistered = _isRegistered;
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
if (!self) {
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dbConnection = [primaryStorage newDatabaseConnection];
|
|
||||||
self.reachability = [Reachability reachabilityForInternetConnection];
|
|
||||||
|
|
||||||
if (!CurrentAppContext().isMainApp) {
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
||||||
selector:@selector(yapDatabaseModifiedExternally:)
|
|
||||||
name:YapDatabaseModifiedExternallyNotification
|
|
||||||
object:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
|
||||||
[[self updateAccountAttributesIfNecessary] retainUntilComplete];
|
|
||||||
}];
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
||||||
selector:@selector(reachabilityChanged)
|
|
||||||
name:kReachabilityChangedNotification
|
|
||||||
object:nil];
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)dealloc
|
|
||||||
{
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (instancetype)sharedInstance
|
|
||||||
{
|
|
||||||
return SSKEnvironment.shared.tsAccountManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Dependencies
|
|
||||||
|
|
||||||
- (id<ProfileManagerProtocol>)profileManager {
|
|
||||||
return SSKEnvironment.shared.profileManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
|
|
||||||
- (void)setPhoneNumberAwaitingVerification:(NSString *_Nullable)phoneNumberAwaitingVerification
|
|
||||||
{
|
|
||||||
_phoneNumberAwaitingVerification = phoneNumberAwaitingVerification;
|
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:kNSNotificationName_LocalNumberDidChange
|
|
||||||
object:nil
|
|
||||||
userInfo:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (OWSRegistrationState)registrationState
|
|
||||||
{
|
|
||||||
if (!self.isRegistered) {
|
|
||||||
return OWSRegistrationState_Unregistered;
|
|
||||||
} else if (self.isDeregistered) {
|
|
||||||
if (self.isReregistering) {
|
|
||||||
return OWSRegistrationState_Reregistering;
|
|
||||||
} else {
|
|
||||||
return OWSRegistrationState_Deregistered;
|
|
||||||
}
|
|
||||||
} else if (self.isDeregistered) {
|
|
||||||
return OWSRegistrationState_PendingBackupRestore;
|
|
||||||
} else {
|
|
||||||
return OWSRegistrationState_Registered;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isRegistered
|
|
||||||
{
|
|
||||||
@synchronized (self) {
|
|
||||||
if (_isRegistered) {
|
|
||||||
return YES;
|
|
||||||
} else {
|
|
||||||
// Cache this once it's true since it's called alot, involves a dbLookup, and once set - it doesn't change.
|
|
||||||
_isRegistered = [self storedLocalNumber] != nil;
|
|
||||||
}
|
|
||||||
return _isRegistered;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isRegisteredAndReady
|
|
||||||
{
|
|
||||||
return self.registrationState == OWSRegistrationState_Registered;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)didRegister
|
|
||||||
{
|
|
||||||
NSString *phoneNumber = self.phoneNumberAwaitingVerification;
|
|
||||||
|
|
||||||
[self storeLocalNumber:phoneNumber];
|
|
||||||
|
|
||||||
// Warm these cached values.
|
|
||||||
[self isRegistered];
|
|
||||||
[self localNumber];
|
|
||||||
[self isDeregistered];
|
|
||||||
|
|
||||||
[self postRegistrationStateDidChangeNotification];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (nullable NSString *)localNumber
|
|
||||||
{
|
|
||||||
return [[self sharedInstance] localNumber];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)localNumber
|
|
||||||
{
|
|
||||||
NSString *awaitingVerif = self.phoneNumberAwaitingVerification;
|
|
||||||
if (awaitingVerif) {
|
|
||||||
return awaitingVerif;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache this since we access this a lot, and once set it will not change.
|
|
||||||
@synchronized(self)
|
|
||||||
{
|
|
||||||
if (self.cachedLocalNumber == nil) {
|
|
||||||
self.cachedLocalNumber = self.storedLocalNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.cachedLocalNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)storedLocalNumber
|
|
||||||
{
|
|
||||||
@synchronized (self) {
|
|
||||||
return [self.dbConnection stringForKey:TSAccountManager_RegisteredNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)storedOrCachedLocalNumber:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
if (self.cachedLocalNumber) {
|
|
||||||
return self.cachedLocalNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return [transaction stringForKey:TSAccountManager_RegisteredNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)storeLocalNumber:(NSString *)localNumber
|
|
||||||
{
|
|
||||||
@synchronized (self) {
|
|
||||||
[self.dbConnection setObject:localNumber
|
|
||||||
forKey:TSAccountManager_RegisteredNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
|
|
||||||
[self.dbConnection removeObjectForKey:TSAccountManager_ReregisteringPhoneNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
|
|
||||||
self.phoneNumberAwaitingVerification = nil;
|
|
||||||
|
|
||||||
self.cachedLocalNumber = localNumber;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (uint32_t)getOrGenerateRegistrationId:(YapDatabaseReadWriteTransaction *)transaction
|
|
||||||
{
|
|
||||||
return [[self sharedInstance] getOrGenerateRegistrationId:transaction];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (uint32_t)getOrGenerateRegistrationId
|
|
||||||
{
|
|
||||||
__block uint32_t result;
|
|
||||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
|
||||||
result = [self getOrGenerateRegistrationId:transaction];
|
|
||||||
}];
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (uint32_t)getOrGenerateRegistrationId:(YapDatabaseReadWriteTransaction *)transaction
|
|
||||||
{
|
|
||||||
// Unlike other methods in this class, there's no need for a `@synchronized` block
|
|
||||||
// here, since we're already in a write transaction, and all writes occur on a serial queue.
|
|
||||||
//
|
|
||||||
// Since other code in this class which uses @synchronized(self) also needs to open write
|
|
||||||
// transaction, using @synchronized(self) here, inside of a WriteTransaction risks deadlock.
|
|
||||||
uint32_t registrationID = [[transaction objectForKey:TSAccountManager_LocalRegistrationIdKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection] unsignedIntValue];
|
|
||||||
|
|
||||||
if (registrationID == 0) {
|
|
||||||
registrationID = (uint32_t)arc4random_uniform(16380) + 1;
|
|
||||||
|
|
||||||
[transaction setObject:[NSNumber numberWithUnsignedInteger:registrationID]
|
|
||||||
forKey:TSAccountManager_LocalRegistrationIdKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
return registrationID;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)registerForPushNotificationsWithPushToken:(NSString *)pushToken
|
|
||||||
voipToken:(NSString *)voipToken
|
|
||||||
isForcedUpdate:(BOOL)isForcedUpdate
|
|
||||||
success:(void (^)(void))successHandler
|
|
||||||
failure:(void (^)(NSError *))failureHandler
|
|
||||||
{
|
|
||||||
[self registerForPushNotificationsWithPushToken:pushToken
|
|
||||||
voipToken:voipToken
|
|
||||||
isForcedUpdate:isForcedUpdate
|
|
||||||
success:successHandler
|
|
||||||
failure:failureHandler
|
|
||||||
remainingRetries:3];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)registerForPushNotificationsWithPushToken:(NSString *)pushToken
|
|
||||||
voipToken:(NSString *)voipToken
|
|
||||||
isForcedUpdate:(BOOL)isForcedUpdate
|
|
||||||
success:(void (^)(void))successHandler
|
|
||||||
failure:(void (^)(NSError *))failureHandler
|
|
||||||
remainingRetries:(int)remainingRetries
|
|
||||||
{
|
|
||||||
BOOL isUsingFullAPNs = [NSUserDefaults.standardUserDefaults boolForKey:@"isUsingFullAPNs"];
|
|
||||||
NSData *pushTokenAsData = [NSData dataFromHexString:pushToken];
|
|
||||||
AnyPromise *promise = isUsingFullAPNs ? [LKPushNotificationAPI registerWithToken:pushTokenAsData hexEncodedPublicKey:self.localNumber isForcedUpdate:isForcedUpdate]
|
|
||||||
: [LKPushNotificationAPI unregisterToken:pushTokenAsData];
|
|
||||||
promise
|
|
||||||
.then(^() {
|
|
||||||
successHandler();
|
|
||||||
})
|
|
||||||
.catch(^(NSError *error) {
|
|
||||||
if (remainingRetries > 0) {
|
|
||||||
[self registerForPushNotificationsWithPushToken:pushToken voipToken:voipToken isForcedUpdate:isForcedUpdate success:successHandler failure:failureHandler
|
|
||||||
remainingRetries:remainingRetries - 1];
|
|
||||||
} else {
|
|
||||||
failureHandler(error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)rerequestSMSWithCaptchaToken:(nullable NSString *)captchaToken
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock
|
|
||||||
{
|
|
||||||
// TODO: Can we remove phoneNumberAwaitingVerification?
|
|
||||||
NSString *number = self.phoneNumberAwaitingVerification;
|
|
||||||
|
|
||||||
[self registerWithPhoneNumber:number
|
|
||||||
captchaToken:captchaToken
|
|
||||||
success:successBlock
|
|
||||||
failure:failureBlock
|
|
||||||
smsVerification:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)rerequestVoiceWithCaptchaToken:(nullable NSString *)captchaToken
|
|
||||||
success:(void (^)(void))successBlock
|
|
||||||
failure:(void (^)(NSError *error))failureBlock
|
|
||||||
{
|
|
||||||
NSString *number = self.phoneNumberAwaitingVerification;
|
|
||||||
|
|
||||||
[self registerWithPhoneNumber:number
|
|
||||||
captchaToken:captchaToken
|
|
||||||
success:successBlock
|
|
||||||
failure:failureBlock
|
|
||||||
smsVerification:NO];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark Server keying material
|
|
||||||
|
|
||||||
+ (NSString *)generateNewAccountAuthenticationToken {
|
|
||||||
NSData *authToken = [Randomness generateRandomBytes:16];
|
|
||||||
NSString *authTokenPrint = [[NSData dataWithData:authToken] hexadecimalString];
|
|
||||||
return authTokenPrint;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (nullable NSString *)signalingKey
|
|
||||||
{
|
|
||||||
return [[self sharedInstance] signalingKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)signalingKey
|
|
||||||
{
|
|
||||||
return [self.dbConnection stringForKey:TSAccountManager_ServerSignalingKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (nullable NSString *)serverAuthToken
|
|
||||||
{
|
|
||||||
return [[self sharedInstance] serverAuthToken];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)serverAuthToken
|
|
||||||
{
|
|
||||||
return [self.dbConnection stringForKey:TSAccountManager_ServerAuthToken
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)storeServerAuthToken:(NSString *)authToken
|
|
||||||
{
|
|
||||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
||||||
[transaction setObject:authToken
|
|
||||||
forKey:TSAccountManager_ServerAuthToken
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)yapDatabaseModifiedExternally:(NSNotification *)notification
|
|
||||||
{
|
|
||||||
// Any database write by the main app might reflect a deregistration,
|
|
||||||
// so clear the cached "is registered" state. This will significantly
|
|
||||||
// erode the value of this cache in the SAE.
|
|
||||||
@synchronized(self)
|
|
||||||
{
|
|
||||||
_isRegistered = NO;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - De-Registration
|
|
||||||
|
|
||||||
- (BOOL)isDeregistered
|
|
||||||
{
|
|
||||||
// Cache this since we access this a lot, and once set it will not change.
|
|
||||||
@synchronized(self) {
|
|
||||||
if (self.cachedIsDeregistered == nil) {
|
|
||||||
self.cachedIsDeregistered = @([self.dbConnection boolForKey:TSAccountManager_IsDeregisteredKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection
|
|
||||||
defaultValue:NO]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return self.cachedIsDeregistered.boolValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setIsDeregistered:(BOOL)isDeregistered
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
if (self.cachedIsDeregistered && self.cachedIsDeregistered.boolValue == isDeregistered) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.cachedIsDeregistered = @(isDeregistered);
|
|
||||||
}
|
|
||||||
|
|
||||||
[LKStorage writeWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
||||||
[transaction setObject:@(isDeregistered)
|
|
||||||
forKey:TSAccountManager_IsDeregisteredKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}];
|
|
||||||
|
|
||||||
[self postRegistrationStateDidChangeNotification];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSString *)reregisterationPhoneNumber
|
|
||||||
{
|
|
||||||
NSString *_Nullable result = [self.dbConnection stringForKey:TSAccountManager_ReregisteringPhoneNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isReregistering
|
|
||||||
{
|
|
||||||
return nil !=
|
|
||||||
[self.dbConnection stringForKey:TSAccountManager_ReregisteringPhoneNumberKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isManualMessageFetchEnabled
|
|
||||||
{
|
|
||||||
return [self.dbConnection boolForKey:TSAccountManager_ManualMessageFetchKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection
|
|
||||||
defaultValue:NO];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (AnyPromise *)setIsManualMessageFetchEnabled:(BOOL)value {
|
|
||||||
[self.dbConnection setBool:value
|
|
||||||
forKey:TSAccountManager_ManualMessageFetchKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
|
|
||||||
// Try to update the account attributes to reflect this change.
|
|
||||||
return [self updateAccountAttributes];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)registerForTestsWithLocalNumber:(NSString *)localNumber
|
|
||||||
{
|
|
||||||
[self storeLocalNumber:localNumber];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Account Attributes
|
|
||||||
|
|
||||||
- (AnyPromise *)updateAccountAttributes {
|
|
||||||
// Enqueue a "account attribute update", recording the "request time".
|
|
||||||
[self.dbConnection setObject:[NSDate new]
|
|
||||||
forKey:TSAccountManager_NeedsAccountAttributesUpdateKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
|
|
||||||
return [self updateAccountAttributesIfNecessary];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (AnyPromise *)updateAccountAttributesIfNecessary {
|
|
||||||
if (!self.isRegistered) {
|
|
||||||
return [AnyPromise promiseWithValue:@(1)];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [AnyPromise promiseWithValue:@(1)];
|
|
||||||
|
|
||||||
NSDate *_Nullable updateRequestDate =
|
|
||||||
[self.dbConnection objectForKey:TSAccountManager_NeedsAccountAttributesUpdateKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
if (!updateRequestDate) {
|
|
||||||
return [AnyPromise promiseWithValue:@(1)];
|
|
||||||
}
|
|
||||||
AnyPromise *promise = [self performUpdateAccountAttributes];
|
|
||||||
promise = promise.then(^(id value) {
|
|
||||||
[LKStorage writeSyncWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
|
|
||||||
// Clear the update request unless a new update has been requested
|
|
||||||
// while this update was in flight.
|
|
||||||
NSDate *_Nullable latestUpdateRequestDate =
|
|
||||||
[transaction objectForKey:TSAccountManager_NeedsAccountAttributesUpdateKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
if (latestUpdateRequestDate && [latestUpdateRequestDate isEqual:updateRequestDate]) {
|
|
||||||
[transaction removeObjectForKey:TSAccountManager_NeedsAccountAttributesUpdateKey
|
|
||||||
inCollection:TSAccountManager_UserAccountCollection];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
return promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)reachabilityChanged {
|
|
||||||
[AppReadiness runNowOrWhenAppDidBecomeReady:^{
|
|
||||||
[[self updateAccountAttributesIfNecessary] retainUntilComplete];
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Notifications
|
|
||||||
|
|
||||||
- (void)postRegistrationStateDidChangeNotification
|
|
||||||
{
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationNameAsync:RegistrationStateDidChangeNotification
|
|
||||||
object:nil
|
|
||||||
userInfo:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,47 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@class OWSPrimaryStorage;
|
|
||||||
@class OWSStorage;
|
|
||||||
@class TSMessage;
|
|
||||||
@class TSThread;
|
|
||||||
@class YapDatabaseReadTransaction;
|
|
||||||
|
|
||||||
@interface OWSDisappearingMessagesFinder : NSObject
|
|
||||||
|
|
||||||
- (void)enumerateExpiredMessagesWithBlock:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction;
|
|
||||||
|
|
||||||
- (void)enumerateUnstartedExpiringMessagesInThread:(TSThread *)thread
|
|
||||||
block:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction;
|
|
||||||
|
|
||||||
- (void)enumerateMessagesWhichFailedToStartExpiringWithBlock:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
* uint64_t millisecond timestamp wrapped in a number. Retrieve with `unsignedLongLongvalue`.
|
|
||||||
* or nil if there are no upcoming expired messages
|
|
||||||
*/
|
|
||||||
- (nullable NSNumber *)nextExpirationTimestampWithTransaction:(YapDatabaseReadTransaction *_Nonnull)transaction;
|
|
||||||
|
|
||||||
+ (NSString *)databaseExtensionName;
|
|
||||||
|
|
||||||
+ (void)asyncRegisterDatabaseExtensions:(OWSStorage *)storage;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
/**
|
|
||||||
* Only use the sync version for testing, generally we'll want to register extensions async
|
|
||||||
*/
|
|
||||||
+ (void)blockingRegisterDatabaseExtensions:(OWSStorage *)storage;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,241 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OWSDisappearingMessagesFinder.h"
|
|
||||||
#import "OWSPrimaryStorage.h"
|
|
||||||
#import "TSIncomingMessage.h"
|
|
||||||
#import "TSMessage.h"
|
|
||||||
#import "TSOutgoingMessage.h"
|
|
||||||
#import "TSThread.h"
|
|
||||||
#import <SignalCoreKit/NSDate+OWS.h>
|
|
||||||
#import <YapDatabase/YapDatabase.h>
|
|
||||||
#import <YapDatabase/YapDatabaseQuery.h>
|
|
||||||
#import <YapDatabase/YapDatabaseSecondaryIndex.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
static NSString *const OWSDisappearingMessageFinderThreadIdColumn = @"thread_id";
|
|
||||||
static NSString *const OWSDisappearingMessageFinderExpiresAtColumn = @"expires_at";
|
|
||||||
static NSString *const OWSDisappearingMessageFinderExpiresAtIndex = @"index_messages_on_expires_at_and_thread_id_v2";
|
|
||||||
|
|
||||||
@implementation OWSDisappearingMessagesFinder
|
|
||||||
|
|
||||||
- (NSArray<NSString *> *)fetchUnstartedExpiringMessageIdsInThread:(TSThread *)thread
|
|
||||||
transaction:(YapDatabaseReadTransaction *_Nonnull)transaction
|
|
||||||
{
|
|
||||||
NSMutableArray<NSString *> *messageIds = [NSMutableArray new];
|
|
||||||
NSString *formattedString = [NSString stringWithFormat:@"WHERE %@ = 0 AND %@ = \"%@\"",
|
|
||||||
OWSDisappearingMessageFinderExpiresAtColumn,
|
|
||||||
OWSDisappearingMessageFinderThreadIdColumn,
|
|
||||||
thread.uniqueId];
|
|
||||||
|
|
||||||
YapDatabaseQuery *query = [YapDatabaseQuery queryWithFormat:formattedString];
|
|
||||||
[[transaction ext:OWSDisappearingMessageFinderExpiresAtIndex]
|
|
||||||
enumerateKeysMatchingQuery:query
|
|
||||||
usingBlock:^void(NSString *collection, NSString *key, BOOL *stop) {
|
|
||||||
[messageIds addObject:key];
|
|
||||||
}];
|
|
||||||
|
|
||||||
return [messageIds copy];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray<NSString *> *)fetchMessageIdsWhichFailedToStartExpiring:(YapDatabaseReadTransaction *_Nonnull)transaction
|
|
||||||
{
|
|
||||||
NSMutableArray<NSString *> *messageIds = [NSMutableArray new];
|
|
||||||
NSString *formattedString =
|
|
||||||
[NSString stringWithFormat:@"WHERE %@ = 0", OWSDisappearingMessageFinderExpiresAtColumn];
|
|
||||||
|
|
||||||
YapDatabaseQuery *query = [YapDatabaseQuery queryWithFormat:formattedString];
|
|
||||||
[[transaction ext:OWSDisappearingMessageFinderExpiresAtIndex]
|
|
||||||
enumerateKeysAndObjectsMatchingQuery:query
|
|
||||||
usingBlock:^void(NSString *collection, NSString *key, id object, BOOL *stop) {
|
|
||||||
if (![object isKindOfClass:[TSMessage class]]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TSMessage *message = (TSMessage *)object;
|
|
||||||
if ([message shouldStartExpireTimerWithTransaction:transaction]) {
|
|
||||||
if ([message isKindOfClass:[TSIncomingMessage class]]) {
|
|
||||||
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)message;
|
|
||||||
if (!incomingMessage.wasRead) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
[messageIds addObject:key];
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
|
|
||||||
return [messageIds copy];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (NSArray<NSString *> *)fetchExpiredMessageIdsWithTransaction:(YapDatabaseReadTransaction *_Nonnull)transaction
|
|
||||||
{
|
|
||||||
NSMutableArray<NSString *> *messageIds = [NSMutableArray new];
|
|
||||||
|
|
||||||
uint64_t now = [NSDate ows_millisecondTimeStamp];
|
|
||||||
// When (expiresAt == 0) the message SHOULD NOT expire. Careful ;)
|
|
||||||
NSString *formattedString = [NSString stringWithFormat:@"WHERE %@ > 0 AND %@ <= %lld",
|
|
||||||
OWSDisappearingMessageFinderExpiresAtColumn,
|
|
||||||
OWSDisappearingMessageFinderExpiresAtColumn,
|
|
||||||
now];
|
|
||||||
YapDatabaseQuery *query = [YapDatabaseQuery queryWithFormat:formattedString];
|
|
||||||
[[transaction ext:OWSDisappearingMessageFinderExpiresAtIndex]
|
|
||||||
enumerateKeysMatchingQuery:query
|
|
||||||
usingBlock:^void(NSString *collection, NSString *key, BOOL *stop) {
|
|
||||||
[messageIds addObject:key];
|
|
||||||
}];
|
|
||||||
|
|
||||||
return [messageIds copy];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (nullable NSNumber *)nextExpirationTimestampWithTransaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
NSString *formattedString = [NSString stringWithFormat:@"WHERE %@ > 0 ORDER BY %@ ASC",
|
|
||||||
OWSDisappearingMessageFinderExpiresAtColumn,
|
|
||||||
OWSDisappearingMessageFinderExpiresAtColumn];
|
|
||||||
YapDatabaseQuery *query = [YapDatabaseQuery queryWithFormat:formattedString];
|
|
||||||
|
|
||||||
__block TSMessage *firstMessage;
|
|
||||||
[[transaction ext:OWSDisappearingMessageFinderExpiresAtIndex]
|
|
||||||
enumerateKeysAndObjectsMatchingQuery:query
|
|
||||||
usingBlock:^void(NSString *collection, NSString *key, id object, BOOL *stop) {
|
|
||||||
firstMessage = (TSMessage *)object;
|
|
||||||
*stop = YES;
|
|
||||||
}];
|
|
||||||
|
|
||||||
if (firstMessage && firstMessage.expiresAt > 0) {
|
|
||||||
return [NSNumber numberWithUnsignedLongLong:firstMessage.expiresAt];
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)enumerateUnstartedExpiringMessagesInThread:(TSThread *)thread
|
|
||||||
block:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
for (NSString *expiringMessageId in
|
|
||||||
[self fetchUnstartedExpiringMessageIdsInThread:thread transaction:transaction]) {
|
|
||||||
TSMessage *_Nullable message = [TSMessage fetchObjectWithUniqueID:expiringMessageId transaction:transaction];
|
|
||||||
if ([message isKindOfClass:[TSMessage class]]) {
|
|
||||||
block(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)enumerateMessagesWhichFailedToStartExpiringWithBlock:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
for (NSString *expiringMessageId in [self fetchMessageIdsWhichFailedToStartExpiring:transaction]) {
|
|
||||||
|
|
||||||
TSMessage *_Nullable message = [TSMessage fetchObjectWithUniqueID:expiringMessageId transaction:transaction];
|
|
||||||
if (![message isKindOfClass:[TSMessage class]]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (![message shouldStartExpireTimerWithTransaction:transaction]) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
block(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Don't use this in production. Useful for testing.
|
|
||||||
* We don't want to instantiate potentially many messages at once.
|
|
||||||
*/
|
|
||||||
- (NSArray<TSMessage *> *)fetchUnstartedExpiringMessagesInThread:(TSThread *)thread
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
NSMutableArray<TSMessage *> *messages = [NSMutableArray new];
|
|
||||||
[self enumerateUnstartedExpiringMessagesInThread:thread
|
|
||||||
block:^(TSMessage *message) {
|
|
||||||
[messages addObject:message];
|
|
||||||
}
|
|
||||||
transaction:transaction];
|
|
||||||
|
|
||||||
return [messages copy];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)enumerateExpiredMessagesWithBlock:(void (^_Nonnull)(TSMessage *message))block
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
// Since we can't directly mutate the enumerated expired messages, we store only their ids in hopes of saving a
|
|
||||||
// little memory and then enumerate the (larger) TSMessage objects one at a time.
|
|
||||||
for (NSString *expiredMessageId in [self fetchExpiredMessageIdsWithTransaction:transaction]) {
|
|
||||||
TSMessage *_Nullable message = [TSMessage fetchObjectWithUniqueID:expiredMessageId transaction:transaction];
|
|
||||||
if ([message isKindOfClass:[TSMessage class]]) {
|
|
||||||
block(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Don't use this in production. Useful for testing.
|
|
||||||
* We don't want to instantiate potentially many messages at once.
|
|
||||||
*/
|
|
||||||
- (NSArray<TSMessage *> *)fetchExpiredMessagesWithTransaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
NSMutableArray<TSMessage *> *messages = [NSMutableArray new];
|
|
||||||
[self enumerateExpiredMessagesWithBlock:^(TSMessage *message) {
|
|
||||||
[messages addObject:message];
|
|
||||||
}
|
|
||||||
transaction:transaction];
|
|
||||||
|
|
||||||
return [messages copy];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - YapDatabaseExtension
|
|
||||||
|
|
||||||
+ (YapDatabaseSecondaryIndex *)indexDatabaseExtension
|
|
||||||
{
|
|
||||||
YapDatabaseSecondaryIndexSetup *setup = [YapDatabaseSecondaryIndexSetup new];
|
|
||||||
[setup addColumn:OWSDisappearingMessageFinderExpiresAtColumn withType:YapDatabaseSecondaryIndexTypeInteger];
|
|
||||||
[setup addColumn:OWSDisappearingMessageFinderThreadIdColumn withType:YapDatabaseSecondaryIndexTypeText];
|
|
||||||
|
|
||||||
YapDatabaseSecondaryIndexHandler *handler =
|
|
||||||
[YapDatabaseSecondaryIndexHandler withObjectBlock:^(YapDatabaseReadTransaction *transaction,
|
|
||||||
NSMutableDictionary *dict,
|
|
||||||
NSString *collection,
|
|
||||||
NSString *key,
|
|
||||||
id object) {
|
|
||||||
if (![object isKindOfClass:[TSMessage class]]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TSMessage *message = (TSMessage *)object;
|
|
||||||
|
|
||||||
if (![message shouldStartExpireTimerWithTransaction:transaction]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
dict[OWSDisappearingMessageFinderExpiresAtColumn] = @(message.expiresAt);
|
|
||||||
dict[OWSDisappearingMessageFinderThreadIdColumn] = message.uniqueThreadId;
|
|
||||||
}];
|
|
||||||
|
|
||||||
return [[YapDatabaseSecondaryIndex alloc] initWithSetup:setup handler:handler versionTag:@"1"];
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Useful for tests, don't use in app startup path because it's slow.
|
|
||||||
+ (void)blockingRegisterDatabaseExtensions:(OWSStorage *)storage
|
|
||||||
{
|
|
||||||
[storage registerExtension:[self indexDatabaseExtension] withName:OWSDisappearingMessageFinderExpiresAtIndex];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
+ (NSString *)databaseExtensionName
|
|
||||||
{
|
|
||||||
return OWSDisappearingMessageFinderExpiresAtIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)asyncRegisterDatabaseExtensions:(OWSStorage *)storage
|
|
||||||
{
|
|
||||||
[storage asyncRegisterExtension:[self indexDatabaseExtension] withName:OWSDisappearingMessageFinderExpiresAtIndex];
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,30 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@class OWSPrimaryStorage;
|
|
||||||
@class OWSStorage;
|
|
||||||
@class YapDatabaseReadTransaction;
|
|
||||||
|
|
||||||
@interface OWSIncomingMessageFinder : NSObject
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage NS_DESIGNATED_INITIALIZER;
|
|
||||||
|
|
||||||
+ (NSString *)databaseExtensionName;
|
|
||||||
+ (void)asyncRegisterExtensionWithPrimaryStorage:(OWSStorage *)storage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Detects existance of a duplicate incoming message.
|
|
||||||
*/
|
|
||||||
- (BOOL)existsMessageWithTimestamp:(uint64_t)timestamp
|
|
||||||
sourceId:(NSString *)sourceId
|
|
||||||
sourceDeviceId:(uint32_t)sourceDeviceId
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,144 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "OWSIncomingMessageFinder.h"
|
|
||||||
#import "OWSPrimaryStorage.h"
|
|
||||||
#import "TSIncomingMessage.h"
|
|
||||||
#import <YapDatabase/YapDatabase.h>
|
|
||||||
#import <YapDatabase/YapDatabaseSecondaryIndex.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
NSString *const OWSIncomingMessageFinderExtensionName = @"OWSIncomingMessageFinderExtensionName";
|
|
||||||
|
|
||||||
NSString *const OWSIncomingMessageFinderColumnTimestamp = @"OWSIncomingMessageFinderColumnTimestamp";
|
|
||||||
NSString *const OWSIncomingMessageFinderColumnSourceId = @"OWSIncomingMessageFinderColumnSourceId";
|
|
||||||
NSString *const OWSIncomingMessageFinderColumnSourceDeviceId = @"OWSIncomingMessageFinderColumnSourceDeviceId";
|
|
||||||
|
|
||||||
@interface OWSIncomingMessageFinder ()
|
|
||||||
|
|
||||||
@property (nonatomic, readonly) OWSPrimaryStorage *primaryStorage;
|
|
||||||
@property (nonatomic, readonly) YapDatabaseConnection *dbConnection;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation OWSIncomingMessageFinder
|
|
||||||
|
|
||||||
@synthesize dbConnection = _dbConnection;
|
|
||||||
|
|
||||||
#pragma mark - init
|
|
||||||
|
|
||||||
- (instancetype)init
|
|
||||||
{
|
|
||||||
return [self initWithPrimaryStorage:[OWSPrimaryStorage sharedManager]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
if (!self) {
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
_primaryStorage = primaryStorage;
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - properties
|
|
||||||
|
|
||||||
- (YapDatabaseConnection *)dbConnection
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
if (!_dbConnection) {
|
|
||||||
_dbConnection = [self.primaryStorage newDatabaseConnection];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return _dbConnection;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - YAP integration
|
|
||||||
|
|
||||||
+ (YapDatabaseSecondaryIndex *)indexExtension
|
|
||||||
{
|
|
||||||
YapDatabaseSecondaryIndexSetup *setup = [YapDatabaseSecondaryIndexSetup new];
|
|
||||||
|
|
||||||
[setup addColumn:OWSIncomingMessageFinderColumnTimestamp withType:YapDatabaseSecondaryIndexTypeInteger];
|
|
||||||
[setup addColumn:OWSIncomingMessageFinderColumnSourceId withType:YapDatabaseSecondaryIndexTypeText];
|
|
||||||
[setup addColumn:OWSIncomingMessageFinderColumnSourceDeviceId withType:YapDatabaseSecondaryIndexTypeInteger];
|
|
||||||
|
|
||||||
YapDatabaseSecondaryIndexWithObjectBlock block = ^(YapDatabaseReadTransaction *transaction,
|
|
||||||
NSMutableDictionary *dict,
|
|
||||||
NSString *collection,
|
|
||||||
NSString *key,
|
|
||||||
id object) {
|
|
||||||
if ([object isKindOfClass:[TSIncomingMessage class]]) {
|
|
||||||
TSIncomingMessage *incomingMessage = (TSIncomingMessage *)object;
|
|
||||||
|
|
||||||
// On new messages authorId should be set on all incoming messages, but there was a time when authorId was
|
|
||||||
// only set on incoming group messages.
|
|
||||||
NSObject *authorIdOrNull = incomingMessage.authorId ? incomingMessage.authorId : [NSNull null];
|
|
||||||
[dict setObject:@(incomingMessage.timestamp) forKey:OWSIncomingMessageFinderColumnTimestamp];
|
|
||||||
[dict setObject:authorIdOrNull forKey:OWSIncomingMessageFinderColumnSourceId];
|
|
||||||
[dict setObject:@(incomingMessage.sourceDeviceId) forKey:OWSIncomingMessageFinderColumnSourceDeviceId];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
YapDatabaseSecondaryIndexHandler *handler = [YapDatabaseSecondaryIndexHandler withObjectBlock:block];
|
|
||||||
|
|
||||||
return [[YapDatabaseSecondaryIndex alloc] initWithSetup:setup handler:handler versionTag:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (NSString *)databaseExtensionName
|
|
||||||
{
|
|
||||||
return OWSIncomingMessageFinderExtensionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)asyncRegisterExtensionWithPrimaryStorage:(OWSStorage *)storage
|
|
||||||
{
|
|
||||||
[storage asyncRegisterExtension:self.indexExtension withName:OWSIncomingMessageFinderExtensionName];
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// We should not normally hit this, as we should have prefer registering async, but it is useful for testing.
|
|
||||||
- (void)registerExtension
|
|
||||||
{
|
|
||||||
[self.primaryStorage registerExtension:self.class.indexExtension withName:OWSIncomingMessageFinderExtensionName];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#pragma mark - instance methods
|
|
||||||
|
|
||||||
- (BOOL)existsMessageWithTimestamp:(uint64_t)timestamp
|
|
||||||
sourceId:(NSString *)sourceId
|
|
||||||
sourceDeviceId:(uint32_t)sourceDeviceId
|
|
||||||
transaction:(YapDatabaseReadTransaction *)transaction
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
if (![self.primaryStorage registeredExtension:OWSIncomingMessageFinderExtensionName]) {
|
|
||||||
|
|
||||||
// we should be initializing this at startup rather than have an unexpectedly slow lazy setup at random.
|
|
||||||
[self registerExtension];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NSString *queryFormat = [NSString stringWithFormat:@"WHERE %@ = ? AND %@ = ? AND %@ = ?",
|
|
||||||
OWSIncomingMessageFinderColumnTimestamp,
|
|
||||||
OWSIncomingMessageFinderColumnSourceId,
|
|
||||||
OWSIncomingMessageFinderColumnSourceDeviceId];
|
|
||||||
// YapDatabaseQuery params must be objects
|
|
||||||
YapDatabaseQuery *query = [YapDatabaseQuery queryWithFormat:queryFormat, @(timestamp), sourceId, @(sourceDeviceId)];
|
|
||||||
|
|
||||||
NSUInteger count;
|
|
||||||
BOOL success = [[transaction ext:OWSIncomingMessageFinderExtensionName] getNumberOfRows:&count matchingQuery:query];
|
|
||||||
if (!success) {
|
|
||||||
return NO;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -3,7 +3,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <SessionMessagingKit/SSKEnvironment.h>
|
|
||||||
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
|
#import <SessionMessagingKit/YapDatabaseConnection+OWS.h>
|
||||||
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>
|
#import <SessionMessagingKit/YapDatabaseTransaction+OWS.h>
|
||||||
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
|
#import <SessionUtilitiesKit/SessionUtilitiesKit.h>
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
@class ContactDiscoveryService;
|
|
||||||
@class ContactsUpdater;
|
|
||||||
@class OWS2FAManager;
|
|
||||||
@class OWSAttachmentDownloads;
|
|
||||||
@class OWSBatchMessageProcessor;
|
|
||||||
@class OWSDisappearingMessagesJob;
|
|
||||||
@class OWSIdentityManager;
|
|
||||||
@class OWSMessageDecrypter;
|
|
||||||
@class OWSMessageManager;
|
|
||||||
@class OWSMessageReceiver;
|
|
||||||
@class OWSMessageSender;
|
|
||||||
@class OWSOutgoingReceiptManager;
|
|
||||||
@class OWSPrimaryStorage;
|
|
||||||
@class OWSReadReceiptManager;
|
|
||||||
@class SSKMessageSenderJobQueue;
|
|
||||||
@class TSAccountManager;
|
|
||||||
@class TSSocketManager;
|
|
||||||
@class YapDatabaseConnection;
|
|
||||||
|
|
||||||
@protocol ContactsManagerProtocol;
|
|
||||||
@protocol NotificationsProtocol;
|
|
||||||
@protocol OWSCallMessageHandler;
|
|
||||||
@protocol ProfileManagerProtocol;
|
|
||||||
@protocol OWSUDManager;
|
|
||||||
@protocol SSKReachabilityManager;
|
|
||||||
@protocol OWSSyncManagerProtocol;
|
|
||||||
@protocol OWSTypingIndicators;
|
|
||||||
|
|
||||||
@interface SSKEnvironment : NSObject
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage
|
|
||||||
tsAccountManager:(TSAccountManager *)tsAccountManager
|
|
||||||
disappearingMessagesJob:(OWSDisappearingMessagesJob *)disappearingMessagesJob
|
|
||||||
readReceiptManager:(OWSReadReceiptManager *)readReceiptManager
|
|
||||||
outgoingReceiptManager:(OWSOutgoingReceiptManager *)outgoingReceiptManager
|
|
||||||
reachabilityManager:(id<SSKReachabilityManager>)reachabilityManager
|
|
||||||
typingIndicators:(id<OWSTypingIndicators>)typingIndicators NS_DESIGNATED_INITIALIZER;
|
|
||||||
|
|
||||||
- (instancetype)init NS_UNAVAILABLE;
|
|
||||||
|
|
||||||
@property (nonatomic, readonly, class) SSKEnvironment *shared;
|
|
||||||
|
|
||||||
+ (void)setShared:(SSKEnvironment *)env;
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
// Should only be called by tests.
|
|
||||||
+ (void)clearSharedForTests;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@property (nonatomic, readonly) id<ProfileManagerProtocol> profileManager;
|
|
||||||
@property (nonatomic, readonly) OWSPrimaryStorage *primaryStorage;
|
|
||||||
@property (nonatomic, readonly) OWSIdentityManager *identityManager;
|
|
||||||
@property (nonatomic, readonly) TSAccountManager *tsAccountManager;
|
|
||||||
@property (nonatomic, readonly) OWSDisappearingMessagesJob *disappearingMessagesJob;
|
|
||||||
@property (nonatomic, readonly) OWSReadReceiptManager *readReceiptManager;
|
|
||||||
@property (nonatomic, readonly) OWSOutgoingReceiptManager *outgoingReceiptManager;
|
|
||||||
@property (nonatomic, readonly) id<SSKReachabilityManager> reachabilityManager;
|
|
||||||
@property (nonatomic, readonly) id<OWSTypingIndicators> typingIndicators;
|
|
||||||
|
|
||||||
// This property is configured after Environment is created.
|
|
||||||
@property (atomic, nullable) id<NotificationsProtocol> notificationsManager;
|
|
||||||
|
|
||||||
@property (atomic, readonly) YapDatabaseConnection *objectReadWriteConnection;
|
|
||||||
@property (atomic, readonly) YapDatabaseConnection *sessionStoreDBConnection;
|
|
||||||
@property (atomic, readonly) YapDatabaseConnection *migrationDBConnection;
|
|
||||||
@property (atomic, readonly) YapDatabaseConnection *analyticsDBConnection;
|
|
||||||
|
|
||||||
- (BOOL)isComplete;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -1,135 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "SSKEnvironment.h"
|
|
||||||
#import "AppContext.h"
|
|
||||||
#import "OWSPrimaryStorage.h"
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
|
||||||
|
|
||||||
static SSKEnvironment *sharedSSKEnvironment;
|
|
||||||
|
|
||||||
@interface SSKEnvironment ()
|
|
||||||
|
|
||||||
@property (nonatomic) OWSPrimaryStorage *primaryStorage;
|
|
||||||
@property (nonatomic) TSAccountManager *tsAccountManager;
|
|
||||||
@property (nonatomic) OWSDisappearingMessagesJob *disappearingMessagesJob;
|
|
||||||
@property (nonatomic) OWSReadReceiptManager *readReceiptManager;
|
|
||||||
@property (nonatomic) OWSOutgoingReceiptManager *outgoingReceiptManager;
|
|
||||||
@property (nonatomic) id<SSKReachabilityManager> reachabilityManager;
|
|
||||||
@property (nonatomic) id<OWSTypingIndicators> typingIndicators;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
#pragma mark -
|
|
||||||
|
|
||||||
@implementation SSKEnvironment
|
|
||||||
|
|
||||||
@synthesize notificationsManager = _notificationsManager;
|
|
||||||
@synthesize objectReadWriteConnection = _objectReadWriteConnection;
|
|
||||||
@synthesize sessionStoreDBConnection = _sessionStoreDBConnection;
|
|
||||||
@synthesize migrationDBConnection = _migrationDBConnection;
|
|
||||||
@synthesize analyticsDBConnection = _analyticsDBConnection;
|
|
||||||
|
|
||||||
- (instancetype)initWithPrimaryStorage:(OWSPrimaryStorage *)primaryStorage
|
|
||||||
tsAccountManager:(TSAccountManager *)tsAccountManager
|
|
||||||
disappearingMessagesJob:(OWSDisappearingMessagesJob *)disappearingMessagesJob
|
|
||||||
readReceiptManager:(OWSReadReceiptManager *)readReceiptManager
|
|
||||||
outgoingReceiptManager:(OWSOutgoingReceiptManager *)outgoingReceiptManager
|
|
||||||
reachabilityManager:(id<SSKReachabilityManager>)reachabilityManager
|
|
||||||
typingIndicators:(id<OWSTypingIndicators>)typingIndicators
|
|
||||||
{
|
|
||||||
self = [super init];
|
|
||||||
|
|
||||||
if (!self) {
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
_primaryStorage = primaryStorage;
|
|
||||||
_tsAccountManager = tsAccountManager;
|
|
||||||
_disappearingMessagesJob = disappearingMessagesJob;
|
|
||||||
_readReceiptManager = readReceiptManager;
|
|
||||||
_outgoingReceiptManager = outgoingReceiptManager;
|
|
||||||
_reachabilityManager = reachabilityManager;
|
|
||||||
_typingIndicators = typingIndicators;
|
|
||||||
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (instancetype)shared
|
|
||||||
{
|
|
||||||
return sharedSSKEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)setShared:(SSKEnvironment *)env
|
|
||||||
{
|
|
||||||
sharedSSKEnvironment = env;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)clearSharedForTests
|
|
||||||
{
|
|
||||||
sharedSSKEnvironment = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Mutable Accessors
|
|
||||||
|
|
||||||
- (nullable id<NotificationsProtocol>)notificationsManager
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
return _notificationsManager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setNotificationsManager:(nullable id<NotificationsProtocol>)notificationsManager
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
_notificationsManager = notificationsManager;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL)isComplete
|
|
||||||
{
|
|
||||||
return self.notificationsManager != nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (YapDatabaseConnection *)objectReadWriteConnection
|
|
||||||
{
|
|
||||||
@synchronized(self) {
|
|
||||||
if (!_objectReadWriteConnection) {
|
|
||||||
_objectReadWriteConnection = self.primaryStorage.newDatabaseConnection;
|
|
||||||
}
|
|
||||||
return _objectReadWriteConnection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (YapDatabaseConnection *)sessionStoreDBConnection {
|
|
||||||
@synchronized(self) {
|
|
||||||
if (!_sessionStoreDBConnection) {
|
|
||||||
_sessionStoreDBConnection = self.primaryStorage.newDatabaseConnection;
|
|
||||||
}
|
|
||||||
return _sessionStoreDBConnection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (YapDatabaseConnection *)migrationDBConnection {
|
|
||||||
@synchronized(self) {
|
|
||||||
if (!_migrationDBConnection) {
|
|
||||||
_migrationDBConnection = self.primaryStorage.newDatabaseConnection;
|
|
||||||
}
|
|
||||||
return _migrationDBConnection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (YapDatabaseConnection *)analyticsDBConnection {
|
|
||||||
@synchronized(self) {
|
|
||||||
if (!_analyticsDBConnection) {
|
|
||||||
_analyticsDBConnection = self.primaryStorage.newDatabaseConnection;
|
|
||||||
}
|
|
||||||
return _analyticsDBConnection;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
|
@ -6,7 +6,6 @@ import SessionUtilitiesKit
|
||||||
@objc
|
@objc
|
||||||
public class SSKEnvironment: NSObject {
|
public class SSKEnvironment: NSObject {
|
||||||
@objc public let primaryStorage: OWSPrimaryStorage
|
@objc public let primaryStorage: OWSPrimaryStorage
|
||||||
public let tsAccountManager: TSAccountManager
|
|
||||||
public let reachabilityManager: SSKReachabilityManager
|
public let reachabilityManager: SSKReachabilityManager
|
||||||
|
|
||||||
// Note: This property is configured after Environment is created.
|
// Note: This property is configured after Environment is created.
|
||||||
|
@ -27,11 +26,9 @@ public class SSKEnvironment: NSObject {
|
||||||
|
|
||||||
@objc public init(
|
@objc public init(
|
||||||
primaryStorage: OWSPrimaryStorage,
|
primaryStorage: OWSPrimaryStorage,
|
||||||
tsAccountManager: TSAccountManager,
|
|
||||||
reachabilityManager: SSKReachabilityManager
|
reachabilityManager: SSKReachabilityManager
|
||||||
) {
|
) {
|
||||||
self.primaryStorage = primaryStorage
|
self.primaryStorage = primaryStorage
|
||||||
self.tsAccountManager = tsAccountManager
|
|
||||||
self.reachabilityManager = reachabilityManager
|
self.reachabilityManager = reachabilityManager
|
||||||
|
|
||||||
self.objectReadWriteConnection = primaryStorage.newDatabaseConnection()
|
self.objectReadWriteConnection = primaryStorage.newDatabaseConnection()
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
|
|
||||||
final class ThreadUpdateBatcher {
|
|
||||||
private var threadIDs: Set<String> = []
|
|
||||||
|
|
||||||
private lazy var timer = Timer.scheduledTimer(withTimeInterval: 0.25, repeats: true) { [weak self] _ in self?.touch() }
|
|
||||||
|
|
||||||
static let shared = ThreadUpdateBatcher()
|
|
||||||
|
|
||||||
private init() {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
SessionUtilitiesKit.touch(self.timer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
deinit { timer.invalidate() }
|
|
||||||
|
|
||||||
func touch(_ threadID: String) {
|
|
||||||
threadIDs.insert(threadID)
|
|
||||||
}
|
|
||||||
|
|
||||||
@objc private func touch() {
|
|
||||||
let threadIDs = self.threadIDs
|
|
||||||
self.threadIDs.removeAll()
|
|
||||||
Storage.write { transaction in
|
|
||||||
for threadID in threadIDs {
|
|
||||||
guard let thread = TSThread.fetch(uniqueId: threadID, transaction: transaction) else { return }
|
|
||||||
thread.touch(with: transaction)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -19,4 +19,3 @@
|
||||||
#import <SessionMessagingKit/AppReadiness.h>
|
#import <SessionMessagingKit/AppReadiness.h>
|
||||||
#import <SignalUtilitiesKit/AppVersion.h>
|
#import <SignalUtilitiesKit/AppVersion.h>
|
||||||
#import <SessionUtilitiesKit/OWSMath.h>
|
#import <SessionUtilitiesKit/OWSMath.h>
|
||||||
#import <SessionMessagingKit/TSAccountManager.h>
|
|
||||||
|
|
|
@ -128,3 +128,28 @@ public extension Identity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Convenience
|
||||||
|
|
||||||
|
public extension Notification.Name {
|
||||||
|
static let registrationStateDidChange = Notification.Name("registrationStateDidChange")
|
||||||
|
}
|
||||||
|
|
||||||
|
public extension Identity {
|
||||||
|
static func didRegister() {
|
||||||
|
NotificationCenter.default.post(name: .registrationStateDidChange, object: nil, userInfo: nil)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - Objective-C Support
|
||||||
|
|
||||||
|
// TODO: Remove this when possible
|
||||||
|
@objc(SUKIdentity)
|
||||||
|
public class SUKIdentity: NSObject {
|
||||||
|
@objc(userExists)
|
||||||
|
public static func userExists() -> Bool {
|
||||||
|
return GRDBStorage.shared
|
||||||
|
.read { db in Identity.userExists(db) }
|
||||||
|
.defaulting(to: false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -8,8 +8,8 @@ import MediaPlayer
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
import SessionUIKit
|
import SessionUIKit
|
||||||
import CoreServices
|
import CoreServices
|
||||||
|
import SessionMessagingKit
|
||||||
|
|
||||||
@objc
|
|
||||||
public protocol AttachmentApprovalViewControllerDelegate: AnyObject {
|
public protocol AttachmentApprovalViewControllerDelegate: AnyObject {
|
||||||
func attachmentApproval(
|
func attachmentApproval(
|
||||||
_ attachmentApproval: AttachmentApprovalViewController,
|
_ attachmentApproval: AttachmentApprovalViewController,
|
||||||
|
@ -25,14 +25,12 @@ public protocol AttachmentApprovalViewControllerDelegate: AnyObject {
|
||||||
didChangeMessageText newMessageText: String?
|
didChangeMessageText newMessageText: String?
|
||||||
)
|
)
|
||||||
|
|
||||||
@objc
|
func attachmentApproval(
|
||||||
optional func attachmentApproval(
|
|
||||||
_ attachmentApproval: AttachmentApprovalViewController,
|
_ attachmentApproval: AttachmentApprovalViewController,
|
||||||
didRemoveAttachment attachment: SignalAttachment
|
didRemoveAttachment attachment: SignalAttachment
|
||||||
)
|
)
|
||||||
|
|
||||||
@objc
|
func attachmentApprovalDidTapAddMore(_ attachmentApproval: AttachmentApprovalViewController)
|
||||||
optional func attachmentApprovalDidTapAddMore(_ attachmentApproval: AttachmentApprovalViewController)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: -
|
// MARK: -
|
||||||
|
@ -45,9 +43,8 @@ public enum AttachmentApprovalViewControllerMode: UInt {
|
||||||
|
|
||||||
// MARK: -
|
// MARK: -
|
||||||
|
|
||||||
@objc
|
|
||||||
public class AttachmentApprovalViewController: UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
|
public class AttachmentApprovalViewController: UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
|
||||||
@objc public enum Mode: UInt {
|
public enum Mode: UInt {
|
||||||
case modal
|
case modal
|
||||||
case sharedNavigation
|
case sharedNavigation
|
||||||
}
|
}
|
||||||
|
@ -122,7 +119,6 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
|
||||||
notImplemented()
|
notImplemented()
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc
|
|
||||||
required public init(
|
required public init(
|
||||||
mode: Mode,
|
mode: Mode,
|
||||||
threadId: String,
|
threadId: String,
|
||||||
|
@ -248,7 +244,7 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
|
||||||
|
|
||||||
// If the first item is just text, or is a URL and LinkPreviews are disabled
|
// If the first item is just text, or is a URL and LinkPreviews are disabled
|
||||||
// then just fill the 'message' box with it
|
// then just fill the 'message' box with it
|
||||||
if firstItem.attachment.isText || (firstItem.attachment.isUrl && OWSLinkPreview.previewURL(forRawBodyText: firstItem.attachment.text()) == nil) {
|
if firstItem.attachment.isText || (firstItem.attachment.isUrl && LinkPreview.previewUrl(for: firstItem.attachment.text()) == nil) {
|
||||||
bottomToolView.attachmentTextToolbar.messageText = firstItem.attachment.text()
|
bottomToolView.attachmentTextToolbar.messageText = firstItem.attachment.text()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,7 +605,11 @@ public class AttachmentApprovalViewController: UIPageViewController, UIPageViewC
|
||||||
}
|
}
|
||||||
|
|
||||||
galleryRailView.configureCellViews(
|
galleryRailView.configureCellViews(
|
||||||
itemProvider: attachmentItemCollection,
|
album: (attachmentItemCollection.attachmentItems as [GalleryRailItem])
|
||||||
|
.appending(attachmentItemCollection.isAddMoreVisible ?
|
||||||
|
AddMoreRailItem() :
|
||||||
|
nil
|
||||||
|
),
|
||||||
focusedItem: currentItem,
|
focusedItem: currentItem,
|
||||||
cellViewBuilder: cellViewBuilder
|
cellViewBuilder: cellViewBuilder
|
||||||
)
|
)
|
||||||
|
@ -797,17 +797,11 @@ extension SignalAttachmentItem: GalleryRailItem {
|
||||||
|
|
||||||
return imageView
|
return imageView
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: -
|
func isEqual(to other: GalleryRailItem?) -> Bool {
|
||||||
|
guard let otherAttachmentItem: SignalAttachmentItem = other as? SignalAttachmentItem else { return false }
|
||||||
|
|
||||||
extension AttachmentItemCollection: GalleryRailItemProvider {
|
return (self.attachment == otherAttachmentItem.attachment)
|
||||||
var railItems: [GalleryRailItem] {
|
|
||||||
if isAddMoreVisible {
|
|
||||||
return self.attachmentItems + [AddMoreRailItem()]
|
|
||||||
} else {
|
|
||||||
return self.attachmentItems
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +810,7 @@ extension AttachmentItemCollection: GalleryRailItemProvider {
|
||||||
extension AttachmentApprovalViewController: GalleryRailViewDelegate {
|
extension AttachmentApprovalViewController: GalleryRailViewDelegate {
|
||||||
public func galleryRailView(_ galleryRailView: GalleryRailView, didTapItem imageRailItem: GalleryRailItem) {
|
public func galleryRailView(_ galleryRailView: GalleryRailView, didTapItem imageRailItem: GalleryRailItem) {
|
||||||
if imageRailItem is AddMoreRailItem {
|
if imageRailItem is AddMoreRailItem {
|
||||||
self.approvalDelegate?.attachmentApprovalDidTapAddMore?(self)
|
self.approvalDelegate?.attachmentApprovalDidTapAddMore(self)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import PromiseKit
|
import PromiseKit
|
||||||
|
import SessionMessagingKit
|
||||||
|
|
||||||
class AddMoreRailItem: GalleryRailItem {
|
class AddMoreRailItem: GalleryRailItem {
|
||||||
func buildRailItemView() -> UIView {
|
func buildRailItemView() -> UIView {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#import "AttachmentSharing.h"
|
#import "AttachmentSharing.h"
|
||||||
#import "UIUtil.h"
|
#import "UIUtil.h"
|
||||||
#import <SessionUtilitiesKit/AppContext.h>
|
#import <SessionUtilitiesKit/AppContext.h>
|
||||||
#import <SessionMessagingKit/TSAttachmentStream.h>
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
#import <SignalUtilitiesKit/OWSDatabaseMigration.h>
|
#import <SignalUtilitiesKit/OWSDatabaseMigration.h>
|
||||||
#import <SessionMessagingKit/OWSBackgroundTask.h>
|
#import <SessionMessagingKit/OWSBackgroundTask.h>
|
||||||
#import <SessionMessagingKit/OWSStorage.h>
|
#import <SessionMessagingKit/OWSStorage.h>
|
||||||
#import <SessionMessagingKit/SSKEnvironment.h>
|
|
||||||
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@ -44,7 +43,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
OWSPreferences *preferences = [OWSPreferences new];
|
OWSPreferences *preferences = [OWSPreferences new];
|
||||||
|
|
||||||
TSAccountManager *tsAccountManager = [[TSAccountManager alloc] initWithPrimaryStorage:primaryStorage];
|
|
||||||
id<SSKReachabilityManager> reachabilityManager = [SSKReachabilityManagerImpl new];
|
id<SSKReachabilityManager> reachabilityManager = [SSKReachabilityManagerImpl new];
|
||||||
|
|
||||||
OWSAudioSession *audioSession = [OWSAudioSession new];
|
OWSAudioSession *audioSession = [OWSAudioSession new];
|
||||||
|
@ -59,15 +57,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
// TODO: Add this back
|
// TODO: Add this back
|
||||||
// TODO: Refactor this file to Swift
|
// TODO: Refactor this file to Swift
|
||||||
[SSKEnvironment setShared:[[SSKEnvironment alloc] initWithPrimaryStorage:primaryStorage
|
[SSKEnvironment setShared:[[SSKEnvironment alloc] initWithPrimaryStorage:primaryStorage
|
||||||
tsAccountManager:tsAccountManager
|
|
||||||
reachabilityManager:reachabilityManager]];
|
reachabilityManager:reachabilityManager]];
|
||||||
// [SSKEnvironment setShared:[[SSKEnvironment alloc] initWithPrimaryStorage:primaryStorage
|
|
||||||
// tsAccountManager:tsAccountManager
|
|
||||||
// disappearingMessagesJob:disappearingMessagesJob
|
|
||||||
// readReceiptManager:readReceiptManager
|
|
||||||
// outgoingReceiptManager:outgoingReceiptManager
|
|
||||||
// reachabilityManager:reachabilityManager
|
|
||||||
// typingIndicators:typingIndicators]];
|
|
||||||
|
|
||||||
appSpecificSingletonBlock();
|
appSpecificSingletonBlock();
|
||||||
|
|
||||||
|
@ -77,7 +67,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
[SNConfiguration performMainSetup]; // Must happen before the performUpdateCheck call below
|
[SNConfiguration performMainSetup]; // Must happen before the performUpdateCheck call below
|
||||||
|
|
||||||
// Register renamed classes.
|
// Register renamed classes.
|
||||||
[NSKeyedUnarchiver setClass:[OWSUserProfile class] forClassName:[OWSUserProfile collection]];
|
|
||||||
[NSKeyedUnarchiver setClass:[OWSDatabaseMigration class] forClassName:[OWSDatabaseMigration collection]];
|
[NSKeyedUnarchiver setClass:[OWSDatabaseMigration class] forClassName:[OWSDatabaseMigration collection]];
|
||||||
|
|
||||||
[OWSStorage registerExtensionsWithMigrationBlock:^() {
|
[OWSStorage registerExtensionsWithMigrationBlock:^() {
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import UIKit
|
import Foundation
|
||||||
|
|
||||||
public extension Notification.Name {
|
public extension Notification.Name {
|
||||||
|
|
||||||
// State changes
|
// State changes
|
||||||
static let registrationStateDidChange = Notification.Name("registrationStateDidChange")
|
|
||||||
static let blockedContactsUpdated = Notification.Name("blockedContactsUpdated")
|
static let blockedContactsUpdated = Notification.Name("blockedContactsUpdated")
|
||||||
static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
|
static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
|
||||||
static let threadDeleted = Notification.Name("threadDeleted")
|
static let threadDeleted = Notification.Name("threadDeleted")
|
||||||
|
@ -17,7 +16,6 @@ public extension Notification.Name {
|
||||||
@objc public extension NSNotification {
|
@objc public extension NSNotification {
|
||||||
|
|
||||||
// State changes
|
// State changes
|
||||||
@objc static let registrationStateDidChange = Notification.Name.registrationStateDidChange.rawValue as NSString
|
|
||||||
@objc static let blockedContactsUpdated = Notification.Name.blockedContactsUpdated.rawValue as NSString
|
@objc static let blockedContactsUpdated = Notification.Name.blockedContactsUpdated.rawValue as NSString
|
||||||
@objc static let contactOnlineStatusChanged = Notification.Name.contactOnlineStatusChanged.rawValue as NSString
|
@objc static let contactOnlineStatusChanged = Notification.Name.contactOnlineStatusChanged.rawValue as NSString
|
||||||
@objc static let threadDeleted = Notification.Name.threadDeleted.rawValue as NSString
|
@objc static let threadDeleted = Notification.Name.threadDeleted.rawValue as NSString
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
#import <SessionUtilitiesKit/AppContext.h>
|
#import <SessionUtilitiesKit/AppContext.h>
|
||||||
#import <SignalUtilitiesKit/AppVersion.h>
|
#import <SignalUtilitiesKit/AppVersion.h>
|
||||||
#import <SessionUtilitiesKit/NSUserDefaults+OWS.h>
|
#import <SessionUtilitiesKit/NSUserDefaults+OWS.h>
|
||||||
#import <SessionMessagingKit/TSAccountManager.h>
|
|
||||||
#import <YapDatabase/YapDatabase.h>
|
#import <YapDatabase/YapDatabase.h>
|
||||||
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
|
||||||
|
|
||||||
|
@ -18,15 +17,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
@implementation VersionMigrations
|
@implementation VersionMigrations
|
||||||
|
|
||||||
#pragma mark - Dependencies
|
|
||||||
|
|
||||||
+ (TSAccountManager *)tsAccountManager
|
|
||||||
{
|
|
||||||
OWSAssertDebug(SSKEnvironment.shared.tsAccountManager);
|
|
||||||
|
|
||||||
return SSKEnvironment.shared.tsAccountManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - Utility methods
|
#pragma mark - Utility methods
|
||||||
|
|
||||||
+ (void)performUpdateCheckWithCompletion:(VersionMigrationCompletion)completion
|
+ (void)performUpdateCheckWithCompletion:(VersionMigrationCompletion)completion
|
||||||
|
@ -57,11 +47,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.1.70"] && [self.tsAccountManager isRegistered]) {
|
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.1.70"] && [SUKIdentity userExists]) {
|
||||||
[self clearVideoCache];
|
[self clearVideoCache];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.3.0"] && [self.tsAccountManager isRegistered]) {
|
if ([self isVersion:previousVersion atLeast:@"2.0.0" andLessThan:@"2.3.0"] && [SUKIdentity userExists]) {
|
||||||
[self clearBloomFilterCache];
|
[self clearBloomFilterCache];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue