try to make settings for group chat working

This commit is contained in:
Ryan ZHAO 2020-01-13 11:14:49 +11:00
parent 1b6828888f
commit b29096ad21
8 changed files with 45 additions and 6 deletions

View File

@ -134,7 +134,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableThreadSanitizer = "YES"
enableUBSanitizer = "YES"
launchStyle = "0"
useCustomWorkingDirectory = "NO"

View File

@ -7,7 +7,7 @@
<key>CarthageVersion</key>
<string>0.34.0</string>
<key>OSXVersion</key>
<string>10.15.1</string>
<string>10.15.2</string>
<key>WebRTCCommit</key>
<string>1445d719bf05280270e9f77576f80f973fd847f8 M73</string>
</dict>

View File

@ -89,6 +89,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)commonInit
{
_groupId = [Randomness generateRandomBytes:kGroupIdLength];
_groupType = SIGNAL;
_messageSender = SSKEnvironment.shared.messageSender;
_contactsViewHelper = [[ContactsViewHelper alloc] initWithDelegate:self];

View File

@ -185,6 +185,17 @@ const CGFloat kIconViewLength = 24;
return [self.thread isKindOfClass:[TSGroupThread class]];
}
-(BOOL)isPrivateGroupChat
{
if (self.isGroupThread) {
TSGroupThread *thread = (TSGroupThread*)self.thread;
if (thread.isRSSFeed || thread.isPublicChat) {
return false;
}
}
return true;
}
- (void)configureWithThread:(TSThread *)thread uiDatabaseConnection:(YapDatabaseConnection *)uiDatabaseConnection
{
OWSAssertDebug(thread);
@ -624,8 +635,8 @@ const CGFloat kIconViewLength = 24;
// Group settings section.
/*
if (self.isGroupThread) {
if (self.isGroupThread && self.isPrivateGroupChat) {
NSArray *groupItems = @[
[OWSTableItem
itemWithCustomCellBlock:^{
@ -676,7 +687,7 @@ const CGFloat kIconViewLength = 24;
@"Conversation settings table section title")
items:groupItems]];
}
*/
// Mute thread section.
@ -1075,8 +1086,10 @@ const CGFloat kIconViewLength = 24;
- (void)showGroupMembersView
{
OWSLogInfo(@"Setting show thread");
TSGroupThread *groupThread = (TSGroupThread *)self.thread;
ShowGroupMembersViewController *showGroupMembersViewController = [ShowGroupMembersViewController new];
[showGroupMembersViewController configWithThread:(TSGroupThread *)self.thread];
[showGroupMembersViewController configWithThread:groupThread];
[self.navigationController pushViewController:showGroupMembersViewController animated:YES];
}

View File

@ -92,6 +92,8 @@ NS_ASSUME_NONNULL_BEGIN
OWSAssertDebug(self.thread.groupModel.groupMemberIds);
self.memberRecipientIds = [NSSet setWithArray:self.thread.groupModel.groupMemberIds];
OWSLogInfo(@"Setting show thread %@", self.thread.groupModel.groupName);
}
- (void)viewDidLoad
@ -112,6 +114,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)updateTableContents
{
// OWSLogInfo(@"Setting show thread %@", self.thread.groupModel.groupName);
OWSAssertDebug(self.thread);
OWSTableContents *contents = [OWSTableContents new];

View File

@ -72,6 +72,8 @@ typedef NS_ENUM(NSInteger, LKThreadFriendRequestStatus) {
* @return YES if is a group thread, NO otherwise.
*/
- (BOOL)isGroupThread;
//- (BOOL)isPublicChat;
//- (BOOL)isRSSFeed;
/**
* Returns the name of the thread.

View File

@ -94,6 +94,12 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
}
_friendRequestStatus = LKThreadFriendRequestStatusNone;
// Loki - Friend request logic doesn't apply to group chats, always treat them as friends
if (self.isGroupThread) {
_friendRequestStatus = LKThreadFriendRequestStatusFriends;
}
// OWSLogInfo(@"FRIEND REQUEST STATUS %@", self.friendRequestStatusDescription);
}
return self;
@ -225,6 +231,20 @@ ConversationColorName const kConversationColorName_Default = ConversationColorNa
return NO;
}
//- (BOOL)isPublicChat
//{
// OWSAbstractMethod();
//
// return NO;
//}
//
//- (BOOL)isRSSFeed
//{
// OWSAbstractMethod();
//
// return NO;
//}
// Override in ContactThread
- (nullable NSString *)contactIdentifier
{

View File

@ -17,6 +17,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId;
@property (nonatomic, strong) TSGroupModel *groupModel;
@property (nonatomic, readonly) BOOL isRSSFeed;
@property (nonatomic, readonly) BOOL isPublicChat;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel