Don't allow input on rss groups.

This commit is contained in:
Mikunj 2019-08-28 15:49:16 +10:00 committed by Niels Andriesse
parent 9bee25f6c6
commit 7acfa40915
4 changed files with 19 additions and 2 deletions

View File

@ -564,6 +564,16 @@ typedef enum : NSUInteger {
return !groupThread.isLocalUserInGroup;
}
- (BOOL)isRSSGroup
{
if (![_thread isKindOfClass:[TSGroupThread class]]) {
return NO;
}
TSGroupThread *groupThread = (TSGroupThread *)self.thread;
return groupThread.isRSS;
}
- (void)hideInputIfNeeded
{
if (_peek) {
@ -572,7 +582,7 @@ typedef enum : NSUInteger {
return;
}
if (self.userLeftGroup) {
if (self.userLeftGroup || self.isRSSGroup) {
self.inputToolbar.hidden = YES; // user has requested they leave the group. further sends disallowed
[self dismissKeyBoard];
} else {

View File

@ -16,6 +16,7 @@ extern NSString *const TSGroupThread_NotificationKey_UniqueId;
@interface TSGroupThread : TSThread
@property (nonatomic, strong) TSGroupModel *groupModel;
@property (nonatomic, readonly) BOOL isRSS;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel;
+ (instancetype)getOrCreateThreadWithGroupModel:(TSGroupModel *)groupModel

View File

@ -266,6 +266,12 @@ NSString *const TSGroupThread_NotificationKey_UniqueId = @"TSGroupThread_Notific
return [self.class stableColorNameForNewConversationWithString:[self threadIdFromGroupId:groupId]];
}
- (BOOL)isRSS
{
NSString *groupID = [[NSString alloc] initWithData:self.groupModel.groupId encoding:NSUTF8StringEncoding];
return groupID != nil && [groupID containsString:@"rss:"];
}
@end
NS_ASSUME_NONNULL_END

View File

@ -7,7 +7,7 @@ public final class LokiRSSFeed : NSObject {
@objc public let isDeletable: Bool
@objc public init(id: String, server: String, displayName: String, isDeletable: Bool) {
self.id = id
self.id = "rss://\(id)"
self.server = server
self.displayName = displayName
self.isDeletable = isDeletable