nullability annotations for TSGroupModel
- add readonly where possible - group members needn't be a mutable array // FREEBIE
This commit is contained in:
parent
945c7cd1f9
commit
a23f1b86ef
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "DebugUIStress.h"
|
||||
|
@ -479,7 +479,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
readWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
TSGroupModel *groupModel =
|
||||
[[TSGroupModel alloc] initWithTitle:[groupThread.groupModel.groupName stringByAppendingString:@" Copy"]
|
||||
memberIds:[groupThread.groupModel.groupMemberIds mutableCopy]
|
||||
memberIds:groupThread.groupModel.groupMemberIds
|
||||
image:groupThread.groupModel.groupImage
|
||||
groupId:[SecurityUtils generateRandomBytes:16]];
|
||||
thread = [TSGroupThread getOrCreateThreadWithGroupModel:groupModel transaction:transaction];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UpdateGroupViewController.h"
|
||||
|
@ -375,7 +375,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
NSString *groupName = [self.groupNameTextField.text ows_stripped];
|
||||
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:groupName
|
||||
memberIds:[self.memberRecipientIds.allObjects mutableCopy]
|
||||
memberIds:self.memberRecipientIds.allObjects
|
||||
image:self.groupAvatar
|
||||
groupId:self.thread.groupModel.groupId];
|
||||
[self.conversationSettingsViewDelegate groupWasUpdated:groupModel];
|
||||
|
|
|
@ -44,9 +44,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
OWSAssert(localNumber.length > 0);
|
||||
|
||||
TSGroupModel *groupModel = [[TSGroupModel alloc] initWithTitle:nil
|
||||
memberIds:[@[
|
||||
localNumber,
|
||||
] mutableCopy]
|
||||
memberIds:@[ localNumber ]
|
||||
image:nil
|
||||
groupId:groupId];
|
||||
|
||||
|
|
|
@ -922,7 +922,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[TSGroupThread getOrCreateThreadWithGroupId:groupId transaction:transaction];
|
||||
|
||||
TSGroupModel *newGroupModel = [[TSGroupModel alloc] initWithTitle:dataMessage.group.name
|
||||
memberIds:[newMemberIds.allObjects mutableCopy]
|
||||
memberIds:newMemberIds.allObjects
|
||||
image:oldGroupThread.groupModel.groupImage
|
||||
groupId:dataMessage.group.id];
|
||||
NSString *updateGroupInfo = [newGroupThread.groupModel getInfoStringAboutUpdateTo:newGroupModel
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TSYapDatabaseObject.h"
|
||||
#import "ContactsManagerProtocol.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TSGroupModel : TSYapDatabaseObject
|
||||
|
||||
@property (nonatomic, strong) NSArray<NSString *> *groupMemberIds;
|
||||
@property (nonatomic, strong) NSString *groupName;
|
||||
@property (nonatomic, strong) NSData *groupId;
|
||||
@property (nonatomic) NSArray<NSString *> *groupMemberIds;
|
||||
@property (nullable, readonly, nonatomic) NSString *groupName;
|
||||
@property (readonly, nonatomic) NSData *groupId;
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
@property (nonatomic, strong) UIImage *groupImage;
|
||||
@property (nullable, nonatomic, strong) UIImage *groupImage;
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title
|
||||
memberIds:(NSMutableArray<NSString *> *)memberIds
|
||||
image:(UIImage *)image
|
||||
- (instancetype)initWithTitle:(nullable NSString *)title
|
||||
memberIds:(NSArray<NSString *> *)memberIds
|
||||
image:(nullable UIImage *)image
|
||||
groupId:(NSData *)groupId;
|
||||
|
||||
- (BOOL)isEqual:(id)other;
|
||||
|
@ -25,3 +27,5 @@
|
|||
#endif
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "TSGroupModel.h"
|
||||
#import "FunctionalUtil.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@implementation TSGroupModel
|
||||
|
||||
#if TARGET_OS_IOS
|
||||
- (instancetype)initWithTitle:(NSString *)title
|
||||
- (instancetype)initWithTitle:(nullable NSString *)title
|
||||
memberIds:(NSArray<NSString *> *)memberIds
|
||||
image:(UIImage *)image
|
||||
image:(nullable UIImage *)image
|
||||
groupId:(NSData *)groupId
|
||||
{
|
||||
_groupName = title;
|
||||
|
@ -106,3 +108,5 @@
|
|||
#endif
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
Loading…
Reference in New Issue