Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🗒 "My Notes" conversation #311

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions VideoCalls/ChatMessageTableViewCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static NSString *AutoCompletionCellIdentifier = @"AutoCompletionCellIdentifier
- (void)setGuestAvatar:(NSString *)displayName;
- (void)setBotAvatar;
- (void)setChangelogAvatar;
- (void)setNotesAvatar;
- (void)setDeliveryState:(ChatMessageDeliveryState)state;

@end
5 changes: 5 additions & 0 deletions VideoCalls/ChatMessageTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)];
Expand Down
23 changes: 23 additions & 0 deletions VideoCalls/Images.xcassets/notes.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "notes.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Binary file added VideoCalls/Images.xcassets/notes.imageset/notes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions VideoCalls/NCChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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];
}
Expand Down Expand Up @@ -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];
}
Expand Down
4 changes: 3 additions & 1 deletion VideoCalls/NCRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ typedef enum NCRoomType {
kNCRoomTypeOneToOne = 1,
kNCRoomTypeGroup,
kNCRoomTypePublic,
kNCRoomTypeChangelog
kNCRoomTypeChangelog,
kNCRoomTypeNotes
} NCRoomType;

typedef enum NCRoomNotificationLevel {
Expand Down Expand Up @@ -78,6 +79,7 @@ extern NSString * const NCRoomObjectTypeSharePassword;
- (BOOL)canModerate;
- (BOOL)isNameEditable;
- (BOOL)isLeavable;
- (BOOL)isMyNotes;
- (BOOL)userCanStartCall;
- (NSString *)deletionMessage;
- (NSString *)notificationLevelString;
Expand Down
9 changes: 8 additions & 1 deletion VideoCalls/NCRoom.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.";
}
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions VideoCalls/RoomInfoTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
4 changes: 4 additions & 0 deletions VideoCalls/RoomSearchTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 5 additions & 1 deletion VideoCalls/RoomsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down