diff --git a/NextcloudTalk/AddParticipantsTableViewController.m b/NextcloudTalk/AddParticipantsTableViewController.m index ba7fad9fc..d32f14b5e 100644 --- a/NextcloudTalk/AddParticipantsTableViewController.m +++ b/NextcloudTalk/AddParticipantsTableViewController.m @@ -467,10 +467,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N TalkAccount *account = self->_room.account; - if (account) { - [cell.contactImage setActorAvatarForId:participant.userId withType:participant.source withDisplayName:participant.name withRoomToken:_room.token using:account]; + if (!account) { + account = [[NCDatabaseManager sharedInstance] activeAccount]; } + [cell.contactImage setActorAvatarForId:participant.userId withType:participant.source withDisplayName:participant.name withRoomToken:_room.token using:account]; + UIImage *selectionImage = [UIImage systemImageNamed:@"circle"]; UIColor *selectionImageColor = [UIColor tertiaryLabelColor]; if ([self isParticipantAlreadySelected:participant]) { diff --git a/NextcloudTalk/AutoCompletionTableViewCell.m b/NextcloudTalk/AutoCompletionTableViewCell.m index 7da9cc3ac..52fea7b51 100644 --- a/NextcloudTalk/AutoCompletionTableViewCell.m +++ b/NextcloudTalk/AutoCompletionTableViewCell.m @@ -99,13 +99,15 @@ - (void)setUserStatus:(NSString *)userStatus { UIImage *statusImage = nil; if ([userStatus isEqualToString:@"online"]) { - statusImage = [UIImage imageNamed:@"user-status-online-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getOnlineSFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } else if ([userStatus isEqualToString:@"away"]) { - statusImage = [UIImage imageNamed:@"user-status-away-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getAwaySFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; + } else if ([userStatus isEqualToString:@"busy"]) { + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getBusySFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } else if ([userStatus isEqualToString:@"dnd"]) { - statusImage = [UIImage imageNamed:@"user-status-dnd-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getDoNotDisturbSFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } - + if (statusImage) { [_userStatusImageView setImage:statusImage]; _userStatusImageView.contentMode = UIViewContentModeCenter; diff --git a/NextcloudTalk/AvatarView.swift b/NextcloudTalk/AvatarView.swift index dd18aa881..9edaead94 100644 --- a/NextcloudTalk/AvatarView.swift +++ b/NextcloudTalk/AvatarView.swift @@ -147,11 +147,15 @@ import SDWebImage private func setUserStatus(_ userStatus: String, with backgroundColor: UIColor) { if userStatus == "online" { - if let statusImage = statusImageWith(name: "circle.fill", color: .systemGreen, padding: 2) { + if let statusImage = statusImageWith(name: "checkmark.circle.fill", color: .systemGreen, padding: 2) { setUserStatusImage(statusImage, with: backgroundColor) } } else if userStatus == "away" { - if let statusImage = statusImageWith(name: "moon.fill", color: .systemYellow, padding: 2) { + if let statusImage = statusImageWith(name: "clock.fill", color: .systemYellow, padding: 2) { + setUserStatusImage(statusImage, with: backgroundColor) + } + } else if userStatus == "busy" { + if let statusImage = statusImageWith(name: "circle.fill", color: .systemRed, padding: 2) { setUserStatusImage(statusImage, with: backgroundColor) } } else if userStatus == "dnd" { diff --git a/NextcloudTalk/ContactsTableViewCell.m b/NextcloudTalk/ContactsTableViewCell.m index 66c55ff7c..965994d77 100644 --- a/NextcloudTalk/ContactsTableViewCell.m +++ b/NextcloudTalk/ContactsTableViewCell.m @@ -55,13 +55,15 @@ - (void)setUserStatus:(NSString *)userStatus { UIImage *statusImage = nil; if ([userStatus isEqualToString:@"online"]) { - statusImage = [UIImage imageNamed:@"user-status-online"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getOnlineSFIcon] ofSize:CGSizeMake(16, 16) centerImage:NO]; } else if ([userStatus isEqualToString:@"away"]) { - statusImage = [UIImage imageNamed:@"user-status-away"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getAwaySFIcon] ofSize:CGSizeMake(16, 16) centerImage:NO]; + } else if ([userStatus isEqualToString:@"busy"]) { + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getBusySFIcon] ofSize:CGSizeMake(16, 16) centerImage:NO]; } else if ([userStatus isEqualToString:@"dnd"]) { - statusImage = [UIImage imageNamed:@"user-status-dnd"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getDoNotDisturbSFIcon] ofSize:CGSizeMake(16, 16) centerImage:NO]; } - + if (statusImage) { [self setUserStatusIconWithImage:statusImage]; } diff --git a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/Contents.json deleted file mode 100644 index 59f28f2f1..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-away-10.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-away-10@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-away-10@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10.png b/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10.png deleted file mode 100644 index 558fde36b..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@2x.png b/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@2x.png deleted file mode 100644 index 277dbc648..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@3x.png b/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@3x.png deleted file mode 100644 index 278cdcd2a..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away-10.imageset/user-status-away-10@3x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-away.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-away.imageset/Contents.json deleted file mode 100644 index 0c8f98b31..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-away.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-away.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-away@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-away@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away.png b/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away.png deleted file mode 100644 index 75d5b337c..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@2x.png b/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@2x.png deleted file mode 100644 index a42aa9bf8..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@3x.png b/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@3x.png deleted file mode 100644 index a65d07a48..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-away.imageset/user-status-away@3x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/Contents.json deleted file mode 100644 index 7977e0c89..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-dnd-10.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-dnd-10@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-dnd-10@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10.png b/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10.png deleted file mode 100644 index 37adc8e29..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@2x.png b/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@2x.png deleted file mode 100644 index cbc27655f..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@3x.png b/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@3x.png deleted file mode 100644 index 74f2a55a5..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd-10.imageset/user-status-dnd-10@3x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/Contents.json deleted file mode 100644 index b25b00802..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-dnd.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-dnd@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-dnd@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd.png b/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd.png deleted file mode 100644 index a4a4f2bbf..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@2x.png b/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@2x.png deleted file mode 100644 index 8d9e48ea8..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@3x.png b/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@3x.png deleted file mode 100644 index a4b48c247..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-dnd.imageset/user-status-dnd@3x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/Contents.json deleted file mode 100644 index 954b87f9e..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-online-10.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-online-10@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-online-10@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10.png b/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10.png deleted file mode 100644 index ae06889c9..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@2x.png b/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@2x.png deleted file mode 100644 index 4210e1739..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@3x.png b/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@3x.png deleted file mode 100644 index e24be1651..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online-10.imageset/user-status-online-10@3x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online.imageset/Contents.json b/NextcloudTalk/Images.xcassets/user-status-online.imageset/Contents.json deleted file mode 100644 index 7861941cd..000000000 --- a/NextcloudTalk/Images.xcassets/user-status-online.imageset/Contents.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "images" : [ - { - "filename" : "user-status-online.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "user-status-online@2x.png", - "idiom" : "universal", - "scale" : "2x" - }, - { - "filename" : "user-status-online@3x.png", - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online.png b/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online.png deleted file mode 100644 index de335ce01..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@2x.png b/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@2x.png deleted file mode 100644 index 78d2d746b..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@2x.png and /dev/null differ diff --git a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@3x.png b/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@3x.png deleted file mode 100644 index 3e8f97fa4..000000000 Binary files a/NextcloudTalk/Images.xcassets/user-status-online.imageset/user-status-online@3x.png and /dev/null differ diff --git a/NextcloudTalk/NCChatTitleView.m b/NextcloudTalk/NCChatTitleView.m index b31dff4a8..5386179ab 100644 --- a/NextcloudTalk/NCChatTitleView.m +++ b/NextcloudTalk/NCChatTitleView.m @@ -122,11 +122,13 @@ - (void)setStatusImageForUserStatus:(NSString *)userStatus { UIImage *statusImage = nil; if ([userStatus isEqualToString:@"online"]) { - statusImage = [UIImage imageNamed:@"user-status-online-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getOnlineSFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } else if ([userStatus isEqualToString:@"away"]) { - statusImage = [UIImage imageNamed:@"user-status-away-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getAwaySFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; + } else if ([userStatus isEqualToString:@"busy"]) { + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getBusySFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } else if ([userStatus isEqualToString:@"dnd"]) { - statusImage = [UIImage imageNamed:@"user-status-dnd-10"]; + statusImage = [NCUtils renderAspectImageWithImage:[NCUserStatus getDoNotDisturbSFIcon] ofSize:CGSizeMake(10, 10) centerImage:NO]; } if (statusImage) { diff --git a/NextcloudTalk/NCDatabaseManager.m b/NextcloudTalk/NCDatabaseManager.m index d26a51181..3e57ca70e 100644 --- a/NextcloudTalk/NCDatabaseManager.m +++ b/NextcloudTalk/NCDatabaseManager.m @@ -16,7 +16,7 @@ NSString *const kTalkDatabaseFolder = @"Library/Application Support/Talk"; NSString *const kTalkDatabaseFileName = @"talk.realm"; -uint64_t const kTalkDatabaseSchemaVersion = 79; +uint64_t const kTalkDatabaseSchemaVersion = 80; NSString * const kCapabilitySystemMessages = @"system-messages"; NSString * const kCapabilityNotificationLevels = @"notification-levels"; @@ -664,6 +664,7 @@ - (void)setServerCapabilities:(NSDictionary *)serverCapabilities forAccountId:(N capabilities.versionMicro = [[version objectForKey:@"micro"] integerValue]; capabilities.edition = [version objectForKey:@"edition"]; capabilities.userStatus = [[userStatusCaps objectForKey:@"enabled"] boolValue]; + capabilities.userStatusSupportsBusy = [[userStatusCaps objectForKey:@"supports_busy"] boolValue]; capabilities.extendedSupport = [[version objectForKey:@"extendedSupport"] boolValue]; capabilities.accountPropertyScopesVersion2 = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesVersion"] integerValue] == 2; capabilities.accountPropertyScopesFederationEnabled = [[provisioningAPICaps objectForKey:@"AccountPropertyScopesFederationEnabled"] boolValue]; diff --git a/NextcloudTalk/NCUserStatus.h b/NextcloudTalk/NCUserStatus.h index 375fdf698..1219cb79f 100644 --- a/NextcloudTalk/NCUserStatus.h +++ b/NextcloudTalk/NCUserStatus.h @@ -10,6 +10,7 @@ NS_ASSUME_NONNULL_BEGIN extern NSString * const kUserStatusOnline; extern NSString * const kUserStatusAway; +extern NSString * const kUserStatusBusy; extern NSString * const kUserStatusDND; extern NSString * const kUserStatusInvisible; extern NSString * const kUserStatusOffline; @@ -29,6 +30,7 @@ extern NSString * const kUserStatusOffline; + (NSString *)readableUserStatusFromUserStatus:(NSString *)userStatus; + (UIImage *)getOnlineSFIcon; + (UIImage *)getAwaySFIcon; ++ (UIImage *)getBusySFIcon; + (UIImage *)getDoNotDisturbSFIcon; + (UIImage *)getInvisibleSFIcon; - (NSString *)readableUserStatus; diff --git a/NextcloudTalk/NCUserStatus.m b/NextcloudTalk/NCUserStatus.m index f7f21d17a..44855876d 100644 --- a/NextcloudTalk/NCUserStatus.m +++ b/NextcloudTalk/NCUserStatus.m @@ -7,6 +7,7 @@ NSString * const kUserStatusOnline = @"online"; NSString * const kUserStatusAway = @"away"; +NSString * const kUserStatusBusy = @"busy"; NSString * const kUserStatusDND = @"dnd"; NSString * const kUserStatusInvisible = @"invisible"; NSString * const kUserStatusOffline = @"offline"; @@ -54,6 +55,8 @@ + (NSString *)readableUserStatusFromUserStatus:(NSString *)userStatus readableUserStatus = NSLocalizedString(@"Online", nil); } else if ([userStatus isEqualToString:kUserStatusAway]) { readableUserStatus = NSLocalizedString(@"Away", nil); + } else if ([userStatus isEqualToString:kUserStatusBusy]) { + readableUserStatus = NSLocalizedString(@"Busy", nil); } else if ([userStatus isEqualToString:kUserStatusDND]) { readableUserStatus = NSLocalizedString(@"Do not disturb", nil); } else if ([userStatus isEqualToString:kUserStatusInvisible]) { @@ -67,12 +70,17 @@ + (NSString *)readableUserStatusFromUserStatus:(NSString *)userStatus + (UIImage *)getOnlineSFIcon { - return [[UIImage systemImageNamed:@"circle.fill"] imageWithTintColor:[UIColor systemGreenColor] renderingMode:UIImageRenderingModeAlwaysOriginal]; + return [[UIImage systemImageNamed:@"checkmark.circle.fill"] imageWithTintColor:[UIColor systemGreenColor] renderingMode:UIImageRenderingModeAlwaysOriginal]; } + (UIImage *)getAwaySFIcon { - return [[UIImage systemImageNamed:@"moon.fill"] imageWithTintColor:[UIColor systemYellowColor] renderingMode:UIImageRenderingModeAlwaysOriginal]; + return [[UIImage systemImageNamed:@"clock.fill"] imageWithTintColor:[UIColor systemYellowColor] renderingMode:UIImageRenderingModeAlwaysOriginal]; +} + ++ (UIImage *)getBusySFIcon +{ + return [[UIImage systemImageNamed:@"circle.fill"] imageWithTintColor:[UIColor systemRedColor] renderingMode:UIImageRenderingModeAlwaysOriginal]; } + (UIImage *)getDoNotDisturbSFIcon @@ -129,6 +137,8 @@ - (UIImage *)getSFUserStatusIcon return [NCUserStatus getOnlineSFIcon]; } else if ([_status isEqualToString:kUserStatusAway]) { return [NCUserStatus getAwaySFIcon]; + } else if ([_status isEqualToString:kUserStatusBusy]) { + return [NCUserStatus getBusySFIcon]; } else if ([_status isEqualToString:kUserStatusDND]) { return [NCUserStatus getDoNotDisturbSFIcon]; } else if ([_status isEqualToString:kUserStatusInvisible]) { @@ -142,6 +152,7 @@ - (BOOL)hasVisibleStatusIcon { return [_status isEqualToString:kUserStatusOnline] || [_status isEqualToString:kUserStatusAway] || + [_status isEqualToString:kUserStatusBusy] || [_status isEqualToString:kUserStatusDND] || [_status isEqualToString:kUserStatusInvisible]; } diff --git a/NextcloudTalk/NCUserStatusExtensions.swift b/NextcloudTalk/NCUserStatusExtensions.swift index 5a4a19529..ec1c5b531 100644 --- a/NextcloudTalk/NCUserStatusExtensions.swift +++ b/NextcloudTalk/NCUserStatusExtensions.swift @@ -9,11 +9,15 @@ import SwiftUI extension NCUserStatus { static func getOnlineIcon() -> some View { - return Image(systemName: "circle.fill").font(.system(size: 16)).symbolRenderingMode(.monochrome).foregroundStyle(.green) + return Image(systemName: "checkmark.circle.fill").font(.system(size: 16)).symbolRenderingMode(.monochrome).foregroundStyle(.green) } static func getAwayIcon() -> some View { - return Image(systemName: "moon.fill").font(.system(size: 16)).symbolRenderingMode(.monochrome).foregroundStyle(.yellow) + return Image(systemName: "clock.fill").font(.system(size: 16)).symbolRenderingMode(.monochrome).foregroundStyle(.yellow) + } + + static func getBusyIcon() -> some View { + return Image(systemName: "circle.fill").font(.system(size: 16)).symbolRenderingMode(.monochrome).foregroundStyle(.red) } static func getDoNotDisturbIcon() -> some View { @@ -33,6 +37,8 @@ extension NCUserStatus { return getOnlineIcon() } else if userStatus == kUserStatusAway { return getAwayIcon() + } else if userStatus == kUserStatusBusy { + return getBusyIcon() } else if userStatus == kUserStatusDND { return getDoNotDisturbIcon() } else if userStatus == kUserStatusInvisible { diff --git a/NextcloudTalk/ServerCapabilities.h b/NextcloudTalk/ServerCapabilities.h index d8104ae37..536f15c2b 100644 --- a/NextcloudTalk/ServerCapabilities.h +++ b/NextcloudTalk/ServerCapabilities.h @@ -29,6 +29,7 @@ NS_ASSUME_NONNULL_BEGIN @property NSInteger versionMicro; @property NSString *edition; @property BOOL userStatus; +@property BOOL userStatusSupportsBusy; @property BOOL extendedSupport; @property BOOL accountPropertyScopesVersion2; @property BOOL accountPropertyScopesFederationEnabled; diff --git a/NextcloudTalk/UserStatusMessageSwiftUIView.swift b/NextcloudTalk/UserStatusMessageSwiftUIView.swift index ce24d39c9..0cb795b9a 100644 --- a/NextcloudTalk/UserStatusMessageSwiftUIView.swift +++ b/NextcloudTalk/UserStatusMessageSwiftUIView.swift @@ -284,6 +284,7 @@ struct UserStatusMessageSwiftUIView: View { } // Period + // TODO: Use calendar here... if clearAtTime != nil && clearAtType == "period" { switch clearAtTime { case "14400": @@ -292,6 +293,8 @@ struct UserStatusMessageSwiftUIView: View { return NSLocalizedString("an hour", comment: "") case "1800": return NSLocalizedString("30 minutes", comment: "") + case "900": + return NSLocalizedString("15 minutes", comment: "") default: return clearAtTime! } diff --git a/NextcloudTalk/UserStatusOptionsSwiftUI.swift b/NextcloudTalk/UserStatusOptionsSwiftUI.swift index da0eef38e..075ca6ce8 100644 --- a/NextcloudTalk/UserStatusOptionsSwiftUI.swift +++ b/NextcloudTalk/UserStatusOptionsSwiftUI.swift @@ -82,6 +82,10 @@ struct UserStatusOptionsSwiftUI: View { awayOption.identifier = kUserStatusAway awayOption.title = NCUserStatus.readableUserStatus(fromUserStatus: kUserStatusAway) + let busyOption = DetailedOption() + busyOption.identifier = kUserStatusBusy + busyOption.title = NCUserStatus.readableUserStatus(fromUserStatus: kUserStatusBusy) + let dndOption = DetailedOption() dndOption.identifier = kUserStatusDND dndOption.title = NCUserStatus.readableUserStatus(fromUserStatus: kUserStatusDND) @@ -92,8 +96,14 @@ struct UserStatusOptionsSwiftUI: View { invisibleOption.title = NCUserStatus.readableUserStatus(fromUserStatus: kUserStatusInvisible) invisibleOption.subtitle = NSLocalizedString("Appear offline", comment: "") + let activeAccount: TalkAccount = NCDatabaseManager.sharedInstance().activeAccount() + let serverCapabilities = NCDatabaseManager.sharedInstance().serverCapabilities(forAccountId: activeAccount.accountId) + options.append(onlineOption) options.append(awayOption) + if let serverCapabilities, serverCapabilities.userStatusSupportsBusy { + options.append(busyOption) + } options.append(dndOption) options.append(invisibleOption) } diff --git a/NextcloudTalk/en.lproj/Localizable.strings b/NextcloudTalk/en.lproj/Localizable.strings index 628c4df54..a2b1d4e0c 100644 --- a/NextcloudTalk/en.lproj/Localizable.strings +++ b/NextcloudTalk/en.lproj/Localizable.strings @@ -79,6 +79,9 @@ /* First step in scanning QR code instructions */ "1. Access your server in a web browser" = "1. Access your server in a web browser"; +/* No comment provided by engineer. */ +"15 minutes" = "15 minutes"; + /* Second step in scanning QR code instructions */ "2. Go to Settings > Security > Create new app password" = "2. Go to Settings > Security > Create new app password"; @@ -442,6 +445,9 @@ /* No comment provided by engineer. */ "Browse poll drafts" = "Browse poll drafts"; +/* No comment provided by engineer. */ +"Busy" = "Busy"; + /* No comment provided by engineer. */ "Cached files" = "Cached files";