Use color-element in mentions.

Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Ivan Sein 2020-11-18 13:11:40 +01:00
Родитель 8b20ff00e3
Коммит e2cb882fe0
3 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@ -44,6 +44,7 @@ extern BOOL const customNavigationLogo;
+ (UIColor *)brandTextColor;
+ (UIColor *)themeColor;
+ (UIColor *)themeTextColor;
+ (UIColor *)elementColor;
+ (NSString *)navigationLogoImageName;
+ (UIColor *)placeholderColor;
+ (UIStatusBarStyle)statusBarStyleForBrandColor;

Просмотреть файл

@ -87,6 +87,19 @@ BOOL const useServerThemimg = YES;
return textColor;
}
+ (UIColor *)elementColor
{
UIColor *elementColor = [NCUtils colorFromHexString:brandColorHex];
// Do not check if using server theming or not for now
// We could check it once we calculate color element locally
TalkAccount *activeAccount = [[NCDatabaseManager sharedInstance] activeAccount];
ServerCapabilities *serverCapabilities = [[NCDatabaseManager sharedInstance] serverCapabilitiesForAccountId:activeAccount.accountId];
if (serverCapabilities && ![serverCapabilities.colorElement isEqualToString:@""]) {
elementColor = [NCUtils colorFromHexString:serverCapabilities.colorElement];
}
return elementColor;
}
+ (NSString *)navigationLogoImageName
{
NSString *imageName = @"navigationLogo";

Просмотреть файл

@ -199,7 +199,7 @@ NSInteger const kChatMessageGroupTimeDifference = 30;
//Set color for mentions
if ([param.type isEqualToString:@"user"] || [param.type isEqualToString:@"guest"] || [param.type isEqualToString:@"call"]) {
UIColor *defaultColor = [UIColor darkGrayColor];
UIColor *highlightedColor = [NCAppBranding themeColor];
UIColor *highlightedColor = [NCAppBranding elementColor];
[attributedMessage addAttribute:NSForegroundColorAttributeName value:(param.shouldBeHighlighted) ? highlightedColor : defaultColor range:param.range];
[attributedMessage addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:16.0f] range:param.range];
}