diff --git a/VideoCalls/ChatMessageTableViewCell.h b/VideoCalls/ChatMessageTableViewCell.h index bd4246a8a..2a602e23d 100644 --- a/VideoCalls/ChatMessageTableViewCell.h +++ b/VideoCalls/ChatMessageTableViewCell.h @@ -32,6 +32,7 @@ static NSString *AutoCompletionCellIdentifier = @"AutoCompletionCellIdentifier - (void)setGuestAvatar:(NSString *)displayName; - (void)setBotAvatar; - (void)setChangelogAvatar; +- (void)setNotesAvatar; - (void)setDeliveryState:(ChatMessageDeliveryState)state; @end diff --git a/VideoCalls/ChatMessageTableViewCell.m b/VideoCalls/ChatMessageTableViewCell.m index 8896fa4ca..3bdc86c90 100644 --- a/VideoCalls/ChatMessageTableViewCell.m +++ b/VideoCalls/ChatMessageTableViewCell.m @@ -189,6 +189,11 @@ - (void)setChangelogAvatar [_avatarView setImage:[UIImage imageNamed:@"changelog"]]; } +- (void)setNotesAvatar +{ + [_avatarView setImage:[UIImage imageNamed:@"notes"]]; +} + - (void)setDeliveryState:(ChatMessageDeliveryState)state { [self.statusView.subviews makeObjectsPerformSelector: @selector(removeFromSuperview)]; diff --git a/VideoCalls/Images.xcassets/notes.imageset/Contents.json b/VideoCalls/Images.xcassets/notes.imageset/Contents.json new file mode 100644 index 000000000..707901d9f --- /dev/null +++ b/VideoCalls/Images.xcassets/notes.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "notes.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "notes@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "notes@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/VideoCalls/Images.xcassets/notes.imageset/notes.png b/VideoCalls/Images.xcassets/notes.imageset/notes.png new file mode 100644 index 000000000..a5d99a3a9 Binary files /dev/null and b/VideoCalls/Images.xcassets/notes.imageset/notes.png differ diff --git a/VideoCalls/Images.xcassets/notes.imageset/notes@2x.png b/VideoCalls/Images.xcassets/notes.imageset/notes@2x.png new file mode 100644 index 000000000..c8409dd26 Binary files /dev/null and b/VideoCalls/Images.xcassets/notes.imageset/notes@2x.png differ diff --git a/VideoCalls/Images.xcassets/notes.imageset/notes@3x.png b/VideoCalls/Images.xcassets/notes.imageset/notes@3x.png new file mode 100644 index 000000000..8bbb501f4 Binary files /dev/null and b/VideoCalls/Images.xcassets/notes.imageset/notes@3x.png differ diff --git a/VideoCalls/NCChatViewController.m b/VideoCalls/NCChatViewController.m index 6f8e4d556..e530d4e42 100644 --- a/VideoCalls/NCChatViewController.m +++ b/VideoCalls/NCChatViewController.m @@ -304,6 +304,9 @@ - (void)setTitleView case kNCRoomTypeChangelog: [_titleView.image setImage:[UIImage imageNamed:@"changelog"]]; break; + case kNCRoomTypeNotes: + [_titleView.image setImage:[UIImage imageNamed:@"notes"]]; + break; default: break; } @@ -1554,6 +1557,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } else if ([message.actorType isEqualToString:@"bots"]) { if ([message.actorId isEqualToString:@"changelog"]) { [normalCell setChangelogAvatar]; + } else if ([message.actorId isEqualToString:@"notes"]) { + [normalCell setNotesAvatar]; } else { [normalCell setBotAvatar]; } @@ -1598,6 +1603,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } else if ([message.actorType isEqualToString:@"bots"]) { if ([message.actorId isEqualToString:@"changelog"]) { [normalCell setChangelogAvatar]; + } else if ([message.actorId isEqualToString:@"notes"]) { + [normalCell setNotesAvatar]; } else { [normalCell setBotAvatar]; } diff --git a/VideoCalls/NCRoom.h b/VideoCalls/NCRoom.h index 66bf7125a..609a49cd2 100644 --- a/VideoCalls/NCRoom.h +++ b/VideoCalls/NCRoom.h @@ -16,7 +16,8 @@ typedef enum NCRoomType { kNCRoomTypeOneToOne = 1, kNCRoomTypeGroup, kNCRoomTypePublic, - kNCRoomTypeChangelog + kNCRoomTypeChangelog, + kNCRoomTypeNotes } NCRoomType; typedef enum NCRoomNotificationLevel { @@ -78,6 +79,7 @@ extern NSString * const NCRoomObjectTypeSharePassword; - (BOOL)canModerate; - (BOOL)isNameEditable; - (BOOL)isLeavable; +- (BOOL)isMyNotes; - (BOOL)userCanStartCall; - (NSString *)deletionMessage; - (NSString *)notificationLevelString; diff --git a/VideoCalls/NCRoom.m b/VideoCalls/NCRoom.m index 69fad9c09..e2482d547 100644 --- a/VideoCalls/NCRoom.m +++ b/VideoCalls/NCRoom.m @@ -128,6 +128,11 @@ - (BOOL)isLockedOneToOne return self.type == kNCRoomTypeOneToOne && [[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityLockedOneToOneRooms]; } +- (BOOL)isMyNotes +{ + return self.type == kNCRoomTypeNotes; +} + - (BOOL)userCanStartCall { if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityStartCallFlag] && !self.canStartCall) { @@ -149,6 +154,8 @@ - (NSString *)deletionMessage NSString *message = @"Do you really want to delete this conversation?"; if (self.type == kNCRoomTypeOneToOne) { message = [NSString stringWithFormat:@"If you delete the conversation, it will also be deleted for %@", self.displayName]; + } else if (self.type == kNCRoomTypeNotes) { + message = @"Do you really want to delete \"My notes\"?"; } else if ([self.participants count] > 1) { message = @"If you delete the conversation, it will also be deleted for all other participants."; } @@ -194,7 +201,7 @@ - (NSString *)lastMessageString actorName = @"Guest"; } // No actor name cases - if (self.lastMessage.isSystemMessage || (self.type == kNCRoomTypeOneToOne && !ownMessage) || self.type == kNCRoomTypeChangelog) { + if (self.lastMessage.isSystemMessage || (self.type == kNCRoomTypeOneToOne && !ownMessage) || self.type == kNCRoomTypeChangelog || self.type == kNCRoomTypeNotes) { actorName = @""; } // Use only the first name diff --git a/VideoCalls/RoomInfoTableViewController.m b/VideoCalls/RoomInfoTableViewController.m index bdba41753..7e7915a9b 100644 --- a/VideoCalls/RoomInfoTableViewController.m +++ b/VideoCalls/RoomInfoTableViewController.m @@ -199,7 +199,7 @@ - (NSArray *)getRoomInfoSections // Room actions section [sections addObject:[NSNumber numberWithInt:kRoomInfoSectionActions]]; // Moderator sections - if (_room.canModerate) { + if (_room.canModerate && !_room.isMyNotes) { // Public room section [sections addObject:[NSNumber numberWithInt:kRoomInfoSectionPublic]]; // Webinar section @@ -229,7 +229,7 @@ - (NSArray *)getRoomActions // Favorite action [actions addObject:[NSNumber numberWithInt:kRoomActionFavorite]]; // Notification levels action - if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNotificationLevels]) { + if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNotificationLevels] && !_room.isMyNotes) { [actions addObject:[NSNumber numberWithInt:kRoomActionNotifications]]; } // Public room actions @@ -1091,6 +1091,13 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } break; + case kNCRoomTypeNotes: + { + cell.roomNameTextField.text = _room.displayName; + [cell.roomImage setImage:[UIImage imageNamed:@"notes"]]; + } + break; + default: break; } diff --git a/VideoCalls/RoomSearchTableViewController.m b/VideoCalls/RoomSearchTableViewController.m index 451c0764b..6e830b3f7 100644 --- a/VideoCalls/RoomSearchTableViewController.m +++ b/VideoCalls/RoomSearchTableViewController.m @@ -132,6 +132,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell.roomImage setImage:[UIImage imageNamed:@"changelog"]]; break; + case kNCRoomTypeNotes: + [cell.roomImage setImage:[UIImage imageNamed:@"notes"]]; + break; + default: break; } diff --git a/VideoCalls/RoomsTableViewController.m b/VideoCalls/RoomsTableViewController.m index b03882e52..73426688d 100644 --- a/VideoCalls/RoomsTableViewController.m +++ b/VideoCalls/RoomsTableViewController.m @@ -638,7 +638,7 @@ - (void)presentMoreActionsForRoomAtIndexPath:(NSIndexPath *)indexPath [favoriteAction setValue:[[UIImage imageNamed:favImageName] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forKey:@"image"]; [optionsActionSheet addAction:favoriteAction]; // Notification levels - if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNotificationLevels]) { + if ([[NCSettingsController sharedInstance] serverHasTalkCapability:kCapabilityNotificationLevels] && !room.isMyNotes) { UIAlertAction *notificationsAction = [UIAlertAction actionWithTitle:[NSString stringWithFormat:@"Notifications: %@", room.notificationLevelString] style:UIAlertActionStyleDefault handler:^void (UIAlertAction *action) { @@ -861,6 +861,10 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell.roomImage setImage:[UIImage imageNamed:@"changelog"]]; break; + case kNCRoomTypeNotes: + [cell.roomImage setImage:[UIImage imageNamed:@"notes"]]; + break; + default: break; }