mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Rework outgoing message state.
This commit is contained in:
parent
9e6062f21c
commit
4b83b4afc5
3 changed files with 68 additions and 0 deletions
|
@ -214,6 +214,8 @@
|
||||||
34D2CCDA2062E7D000CB1A14 /* OWSScreenLockUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCD92062E7D000CB1A14 /* OWSScreenLockUI.m */; };
|
34D2CCDA2062E7D000CB1A14 /* OWSScreenLockUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCD92062E7D000CB1A14 /* OWSScreenLockUI.m */; };
|
||||||
34D2CCDF206939B400CB1A14 /* DebugUIMessagesAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDB206939B100CB1A14 /* DebugUIMessagesAction.m */; };
|
34D2CCDF206939B400CB1A14 /* DebugUIMessagesAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDB206939B100CB1A14 /* DebugUIMessagesAction.m */; };
|
||||||
34D2CCE0206939B400CB1A14 /* DebugUIMessagesAssetLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDC206939B200CB1A14 /* DebugUIMessagesAssetLoader.m */; };
|
34D2CCE0206939B400CB1A14 /* DebugUIMessagesAssetLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDC206939B200CB1A14 /* DebugUIMessagesAssetLoader.m */; };
|
||||||
|
34D5872F208E2C4200D2255A /* OWS109OutgoingMessageState.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D5872D208E2C4100D2255A /* OWS109OutgoingMessageState.m */; };
|
||||||
|
34D58730208E2C4200D2255A /* OWS109OutgoingMessageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D5872E208E2C4100D2255A /* OWS109OutgoingMessageState.h */; };
|
||||||
34D5CCA91EAE3D30005515DB /* AvatarViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */; };
|
34D5CCA91EAE3D30005515DB /* AvatarViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */; };
|
||||||
34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0241ED3673300188D7C /* DebugUIMessages.m */; };
|
34D8C0271ED3673300188D7C /* DebugUIMessages.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0241ED3673300188D7C /* DebugUIMessages.m */; };
|
||||||
34D8C0281ED3673300188D7C /* DebugUITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0261ED3673300188D7C /* DebugUITableViewController.m */; };
|
34D8C0281ED3673300188D7C /* DebugUITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D8C0261ED3673300188D7C /* DebugUITableViewController.m */; };
|
||||||
|
@ -847,6 +849,8 @@
|
||||||
34D2CCDD206939B200CB1A14 /* DebugUIMessagesAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAction.h; sourceTree = "<group>"; };
|
34D2CCDD206939B200CB1A14 /* DebugUIMessagesAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAction.h; sourceTree = "<group>"; };
|
||||||
34D2CCDE206939B400CB1A14 /* DebugUIMessagesAssetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAssetLoader.h; sourceTree = "<group>"; };
|
34D2CCDE206939B400CB1A14 /* DebugUIMessagesAssetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAssetLoader.h; sourceTree = "<group>"; };
|
||||||
34D2CCE220693A1700CB1A14 /* DebugUIMessagesUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesUtils.h; sourceTree = "<group>"; };
|
34D2CCE220693A1700CB1A14 /* DebugUIMessagesUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesUtils.h; sourceTree = "<group>"; };
|
||||||
|
34D5872D208E2C4100D2255A /* OWS109OutgoingMessageState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWS109OutgoingMessageState.m; sourceTree = "<group>"; };
|
||||||
|
34D5872E208E2C4100D2255A /* OWS109OutgoingMessageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWS109OutgoingMessageState.h; sourceTree = "<group>"; };
|
||||||
34D5CCA71EAE3D30005515DB /* AvatarViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvatarViewHelper.h; sourceTree = "<group>"; };
|
34D5CCA71EAE3D30005515DB /* AvatarViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvatarViewHelper.h; sourceTree = "<group>"; };
|
||||||
34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AvatarViewHelper.m; sourceTree = "<group>"; };
|
34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AvatarViewHelper.m; sourceTree = "<group>"; };
|
||||||
34D8C0231ED3673300188D7C /* DebugUIMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessages.h; sourceTree = "<group>"; };
|
34D8C0231ED3673300188D7C /* DebugUIMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessages.h; sourceTree = "<group>"; };
|
||||||
|
@ -1525,6 +1529,8 @@
|
||||||
4503F1C1204711D200CEE724 /* OWS107LegacySounds.m */,
|
4503F1C1204711D200CEE724 /* OWS107LegacySounds.m */,
|
||||||
4598198C204E2F28009414F2 /* OWS108CallLoggingPreference.h */,
|
4598198C204E2F28009414F2 /* OWS108CallLoggingPreference.h */,
|
||||||
4598198D204E2F28009414F2 /* OWS108CallLoggingPreference.m */,
|
4598198D204E2F28009414F2 /* OWS108CallLoggingPreference.m */,
|
||||||
|
34D5872E208E2C4100D2255A /* OWS109OutgoingMessageState.h */,
|
||||||
|
34D5872D208E2C4100D2255A /* OWS109OutgoingMessageState.m */,
|
||||||
346129931FD1E30000532771 /* OWSDatabaseMigration.h */,
|
346129931FD1E30000532771 /* OWSDatabaseMigration.h */,
|
||||||
346129941FD1E30000532771 /* OWSDatabaseMigration.m */,
|
346129941FD1E30000532771 /* OWSDatabaseMigration.m */,
|
||||||
346129E51FD5C0C600532771 /* OWSDatabaseMigrationRunner.h */,
|
346129E51FD5C0C600532771 /* OWSDatabaseMigrationRunner.h */,
|
||||||
|
@ -2379,6 +2385,7 @@
|
||||||
34480B611FD0A98800BC14EF /* UIColor+OWS.h in Headers */,
|
34480B611FD0A98800BC14EF /* UIColor+OWS.h in Headers */,
|
||||||
453518961FC63DBF00210559 /* SignalMessaging.h in Headers */,
|
453518961FC63DBF00210559 /* SignalMessaging.h in Headers */,
|
||||||
3461295A1FD1D74C00532771 /* Environment.h in Headers */,
|
3461295A1FD1D74C00532771 /* Environment.h in Headers */,
|
||||||
|
34D58730208E2C4200D2255A /* OWS109OutgoingMessageState.h in Headers */,
|
||||||
4598198E204E2F28009414F2 /* OWS108CallLoggingPreference.h in Headers */,
|
4598198E204E2F28009414F2 /* OWS108CallLoggingPreference.h in Headers */,
|
||||||
34480B631FD0A98800BC14EF /* UIView+OWS.h in Headers */,
|
34480B631FD0A98800BC14EF /* UIView+OWS.h in Headers */,
|
||||||
451F8A4B1FD715E1005CB9DA /* OWSGroupAvatarBuilder.h in Headers */,
|
451F8A4B1FD715E1005CB9DA /* OWSGroupAvatarBuilder.h in Headers */,
|
||||||
|
@ -3045,6 +3052,7 @@
|
||||||
451F8A3D1FD713CA005CB9DA /* ThreadViewHelper.m in Sources */,
|
451F8A3D1FD713CA005CB9DA /* ThreadViewHelper.m in Sources */,
|
||||||
346129AD1FD1F34E00532771 /* ImageCache.swift in Sources */,
|
346129AD1FD1F34E00532771 /* ImageCache.swift in Sources */,
|
||||||
452C7CA72037628B003D51A5 /* Weak.swift in Sources */,
|
452C7CA72037628B003D51A5 /* Weak.swift in Sources */,
|
||||||
|
34D5872F208E2C4200D2255A /* OWS109OutgoingMessageState.m in Sources */,
|
||||||
451F8A341FD710C3005CB9DA /* ConversationSearcher.swift in Sources */,
|
451F8A341FD710C3005CB9DA /* ConversationSearcher.swift in Sources */,
|
||||||
346129341FD1A88700532771 /* OWSSwiftUtils.swift in Sources */,
|
346129341FD1A88700532771 /* OWSSwiftUtils.swift in Sources */,
|
||||||
346129FE1FD5F31400532771 /* OWS106EnsureProfileComplete.swift in Sources */,
|
346129FE1FD5F31400532771 /* OWS106EnsureProfileComplete.swift in Sources */,
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OWSDatabaseMigration.h"
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface OWS109OutgoingMessageState : OWSDatabaseMigration
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -0,0 +1,47 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "OWS109OutgoingMessageState.h"
|
||||||
|
#import <SignalServiceKit/TSOutgoingMessage.h>
|
||||||
|
#import <YapDatabase/YapDatabaseTransaction.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
// Increment a similar constant for every future DBMigration
|
||||||
|
static NSString *const OWS109OutgoingMessageStateMigrationId = @"109";
|
||||||
|
|
||||||
|
@implementation OWS109OutgoingMessageState
|
||||||
|
|
||||||
|
+ (NSString *)migrationId
|
||||||
|
{
|
||||||
|
return OWS109OutgoingMessageStateMigrationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)runUpWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||||
|
{
|
||||||
|
OWSAssert(transaction);
|
||||||
|
|
||||||
|
NSMutableArray<TSOutgoingMessage *> *outgoingMessages = [NSMutableArray new];
|
||||||
|
[transaction enumerateKeysAndObjectsInCollection:TSOutgoingMessage.collection
|
||||||
|
usingBlock:^(NSString *key, id value, BOOL *stop) {
|
||||||
|
if (![value isKindOfClass:[TSOutgoingMessage class]]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
TSOutgoingMessage *outgoingMessage = (TSOutgoingMessage *)value;
|
||||||
|
[outgoingMessages addObject:outgoingMessage];
|
||||||
|
}];
|
||||||
|
|
||||||
|
DDLogInfo(@"Saving %zd outgoing messages.", outgoingMessages.count);
|
||||||
|
|
||||||
|
// Persist the migration of the outgoing message state.
|
||||||
|
// For performance, we want to upgrade all existing outgoing messages in
|
||||||
|
// a single transaction.
|
||||||
|
for (TSOutgoingMessage *outgoingMessage in outgoingMessages) {
|
||||||
|
[outgoingMessage saveWithTransaction:transaction];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
Loading…
Reference in a new issue