Minor refactoring

pull/154/head
nielsandriesse 6 years ago
parent 7243dcb48d
commit 0b29def940

@ -425,7 +425,7 @@ typedef enum : NSUInteger {
name:NSNotification.threadSessionRestoreDevicesChanged name:NSNotification.threadSessionRestoreDevicesChanged
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleGroupThreadUpdated:) selector:@selector(handleGroupThreadUpdatedNotification:)
name:NSNotification.groupThreadUpdated name:NSNotification.groupThreadUpdated
object:nil]; object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self [[NSNotificationCenter defaultCenter] addObserver:self
@ -511,7 +511,7 @@ typedef enum : NSUInteger {
[self ensureBannerState]; [self ensureBannerState];
} }
- (void)handleGroupThreadUpdated:(NSNotification *)notification - (void)handleGroupThreadUpdatedNotification:(NSNotification *)notification
{ {
OWSAssertIsOnMainThread(); OWSAssertIsOnMainThread();

@ -237,8 +237,7 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific
self.groupModel = newGroupModel; self.groupModel = newGroupModel;
[self saveWithTransaction:transaction]; [self saveWithTransaction:transaction];
[transaction addCompletionQueue:dispatch_get_main_queue() [transaction addCompletionQueue:dispatch_get_main_queue() completionBlock:^{
completionBlock:^{
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId]; [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId];
}]; }];
} }
@ -261,8 +260,7 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific
self.groupModel.groupMemberIds = newGroupMemberIDs.allObjects; self.groupModel.groupMemberIds = newGroupMemberIDs.allObjects;
[self saveWithTransaction:transaction]; [self saveWithTransaction:transaction];
[transaction addCompletionQueue:dispatch_get_main_queue() [transaction addCompletionQueue:dispatch_get_main_queue() completionBlock:^{
completionBlock:^{
[NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId]; [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.groupThreadUpdated object:self.uniqueId];
}]; }];
} }

@ -4,7 +4,7 @@ public extension Notification.Name {
// State changes // State changes
public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged") public static let contactOnlineStatusChanged = Notification.Name("contactOnlineStatusChanged")
public static let threadFriendRequestStatusChanged = Notification.Name("threadFriendRequestStatusChanged") public static let threadFriendRequestStatusChanged = Notification.Name("threadFriendRequestStatusChanged")
public static let groupThreadUpdated = Notification.Name("groupThreadLeft") public static let groupThreadUpdated = Notification.Name("groupThreadUpdated")
public static let messageFriendRequestStatusChanged = Notification.Name("messageFriendRequestStatusChanged") public static let messageFriendRequestStatusChanged = Notification.Name("messageFriendRequestStatusChanged")
public static let threadDeleted = Notification.Name("threadDeleted") public static let threadDeleted = Notification.Name("threadDeleted")
public static let threadSessionRestoreDevicesChanged = Notification.Name("threadSessionRestoreDevicesChanged") public static let threadSessionRestoreDevicesChanged = Notification.Name("threadSessionRestoreDevicesChanged")

Loading…
Cancel
Save