Skip to content
Merged
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
6 changes: 4 additions & 2 deletions NextcloudTalk/AddParticipantsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down
10 changes: 6 additions & 4 deletions NextcloudTalk/AutoCompletionTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions NextcloudTalk/AvatarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
10 changes: 6 additions & 4 deletions NextcloudTalk/ContactsTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 5 additions & 3 deletions NextcloudTalk/NCChatTitleView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion NextcloudTalk/NCDatabaseManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions NextcloudTalk/NCUserStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -29,6 +30,7 @@ extern NSString * const kUserStatusOffline;
+ (NSString *)readableUserStatusFromUserStatus:(NSString *)userStatus;
+ (UIImage *)getOnlineSFIcon;
+ (UIImage *)getAwaySFIcon;
+ (UIImage *)getBusySFIcon;
+ (UIImage *)getDoNotDisturbSFIcon;
+ (UIImage *)getInvisibleSFIcon;
- (NSString *)readableUserStatus;
Expand Down
15 changes: 13 additions & 2 deletions NextcloudTalk/NCUserStatus.m
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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]) {
Expand All @@ -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
Expand Down Expand Up @@ -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]) {
Expand All @@ -142,6 +152,7 @@ - (BOOL)hasVisibleStatusIcon
{
return [_status isEqualToString:kUserStatusOnline] ||
[_status isEqualToString:kUserStatusAway] ||
[_status isEqualToString:kUserStatusBusy] ||
[_status isEqualToString:kUserStatusDND] ||
[_status isEqualToString:kUserStatusInvisible];
}
Expand Down
10 changes: 8 additions & 2 deletions NextcloudTalk/NCUserStatusExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions NextcloudTalk/ServerCapabilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions NextcloudTalk/UserStatusMessageSwiftUIView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ struct UserStatusMessageSwiftUIView: View {
}

// Period
// TODO: Use calendar here...
if clearAtTime != nil && clearAtType == "period" {
switch clearAtTime {
case "14400":
Expand All @@ -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!
}
Expand Down
10 changes: 10 additions & 0 deletions NextcloudTalk/UserStatusOptionsSwiftUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
}
Expand Down
Loading
Loading