зеркало из https://github.com/nextcloud/talk-ios.git
Check rooms read-only state when presenting chat view.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
d9e551c497
Коммит
d1db205465
|
@ -158,6 +158,8 @@
|
|||
_stopReceivingNewMessages = NO;
|
||||
[[NCRoomsManager sharedInstance] startReceivingChatMessagesInRoom:_room];
|
||||
}
|
||||
|
||||
[self checkRoomReadOnlyState];
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated
|
||||
|
@ -248,6 +250,22 @@
|
|||
self.navigationItem.rightBarButtonItems = @[videoCallButton, voiceCallButton];
|
||||
}
|
||||
|
||||
#pragma mark - User Interface
|
||||
|
||||
- (void)checkRoomReadOnlyState
|
||||
{
|
||||
if (_room.readOnlyState == NCRoomReadOnlyStateReadOnly) {
|
||||
// Disable text input
|
||||
self.textInputbar.userInteractionEnabled = NO;
|
||||
self.textInputbar.textView.placeholder = @"This conversation is locked";
|
||||
self.textInputbar.textView.backgroundColor = [UIColor colorWithRed:0.84 green:0.84 blue:0.84 alpha:1.0]; /*#d5d5d5*/
|
||||
// Disable call buttons
|
||||
for (UIBarButtonItem *button in self.navigationItem.rightBarButtonItems) {
|
||||
[button setEnabled:NO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Utils
|
||||
|
||||
- (NSString *)getTimeFromDate:(NSDate *)date
|
||||
|
|
|
@ -24,6 +24,11 @@ typedef enum NCRoomNotificationLevel {
|
|||
kNCRoomNotificationLevelNever
|
||||
} NCRoomNotificationLevel;
|
||||
|
||||
typedef enum NCRoomReadOnlyState {
|
||||
NCRoomReadOnlyStateReadWrite = 0,
|
||||
NCRoomReadOnlyStateReadOnly
|
||||
} NCRoomReadOnlyState;
|
||||
|
||||
extern NSString * const NCRoomObjectTypeFile;
|
||||
extern NSString * const NCRoomObjectTypeSharePassword;
|
||||
|
||||
|
@ -49,6 +54,7 @@ extern NSString * const NCRoomObjectTypeSharePassword;
|
|||
@property (nonatomic, assign) NCRoomNotificationLevel notificationLevel;
|
||||
@property (nonatomic, copy) NSString *objectType;
|
||||
@property (nonatomic, copy) NSString *objectId;
|
||||
@property (nonatomic, assign) NCRoomReadOnlyState readOnlyState;
|
||||
|
||||
+ (instancetype)roomWithDictionary:(NSDictionary *)roomDict;
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ NSString * const NCRoomObjectTypeSharePassword = @"share:password";
|
|||
room.notificationLevel = (NCRoomNotificationLevel)[[roomDict objectForKey:@"notificationLevel"] integerValue];
|
||||
room.objectType = [roomDict objectForKey:@"objectType"];
|
||||
room.objectId = [roomDict objectForKey:@"objectId"];
|
||||
room.readOnlyState = (NCRoomReadOnlyState)[[roomDict objectForKey:@"readOnly"] integerValue];
|
||||
|
||||
id name = [roomDict objectForKey:@"name"];
|
||||
if ([name isKindOfClass:[NSString class]]) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче