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

Team mention support #1966

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 4 additions & 0 deletions NextcloudTalk.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
1FEDE3CE257D43AB00853F79 /* NCMessageFileParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FEDE3CC257D43AB00853F79 /* NCMessageFileParameter.m */; };
1FEDE3CF257D43AB00853F79 /* NCMessageFileParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FEDE3CC257D43AB00853F79 /* NCMessageFileParameter.m */; };
1FEDE3D0257D43AB00853F79 /* NCMessageFileParameter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FEDE3CC257D43AB00853F79 /* NCMessageFileParameter.m */; };
1FEF49B62D4D3C37001B400A /* UnitNCMessageParameterTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FEF49B52D4D3C37001B400A /* UnitNCMessageParameterTest.swift */; };
1FF1360F2BFB4F8C006A6101 /* NCRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF1360E2BFB4F8C006A6101 /* NCRoom.swift */; };
1FF136102BFB4F8C006A6101 /* NCRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF1360E2BFB4F8C006A6101 /* NCRoom.swift */; };
1FF136112BFB4F8C006A6101 /* NCRoom.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1FF1360E2BFB4F8C006A6101 /* NCRoom.swift */; };
Expand Down Expand Up @@ -856,6 +857,7 @@
1FEDE3C5257D439500853F79 /* NCChatFileController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCChatFileController.h; sourceTree = "<group>"; };
1FEDE3CC257D43AB00853F79 /* NCMessageFileParameter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NCMessageFileParameter.m; sourceTree = "<group>"; };
1FEDE3CD257D43AB00853F79 /* NCMessageFileParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCMessageFileParameter.h; sourceTree = "<group>"; };
1FEF49B52D4D3C37001B400A /* UnitNCMessageParameterTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitNCMessageParameterTest.swift; sourceTree = "<group>"; };
1FF1360E2BFB4F8C006A6101 /* NCRoom.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCRoom.swift; sourceTree = "<group>"; };
1FF136142BFB74C3006A6101 /* NCChatMessage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCChatMessage.swift; sourceTree = "<group>"; };
1FF2FD5B2AB99CCB000C9905 /* BroadcastUploadExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = BroadcastUploadExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1541,6 +1543,7 @@
1FBC3BE42B61ACD5003909E0 /* UnitBaseChatViewControllerTest.swift */,
1FB7B9842BE2EE020093CE98 /* UnitChatViewControllerTest.swift */,
1FF4DAA52C08D81D00C1B952 /* UnitNCChatMessageTest.swift */,
1FEF49B52D4D3C37001B400A /* UnitNCMessageParameterTest.swift */,
);
path = Chat;
sourceTree = "<group>";
Expand Down Expand Up @@ -2821,6 +2824,7 @@
1F6D8C412B2F26D5004376B8 /* TestConstants.swift in Sources */,
1FB7B9872BE441450093CE98 /* UIViewExtensions.swift in Sources */,
1FBC3BE52B61ACD5003909E0 /* UnitBaseChatViewControllerTest.swift in Sources */,
1FEF49B62D4D3C37001B400A /* UnitNCMessageParameterTest.swift in Sources */,
1F8AAC622C596308004DA20A /* UnitSignalingSettings.swift in Sources */,
1F0B0A772BA26BE10073FF8D /* UnitMentionSuggestionTest.swift in Sources */,
1F6D8C432B2F26EE004376B8 /* Helpers.swift in Sources */,
Expand Down
9 changes: 8 additions & 1 deletion NextcloudTalk/AvatarManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ import SDWebImage
return UIImage(named: "group-avatar", in: nil, compatibleWith: traitCollection)
}

public func getTeamAvatar(with style: UIUserInterfaceStyle) -> UIImage? {
let traitCollection = UITraitCollection(userInterfaceStyle: style)
return UIImage(named: "team-avatar", in: nil, compatibleWith: traitCollection)
}

public func getMailAvatar(with style: UIUserInterfaceStyle) -> UIImage? {
let traitCollection = UITraitCollection(userInterfaceStyle: style)
return UIImage(named: "mail-avatar", in: nil, compatibleWith: traitCollection)
Expand Down Expand Up @@ -86,8 +91,10 @@ import SDWebImage

if actorType == NCAttendeeTypeEmail || actorType == NCAttendeeTypeGuest {
image = self.getGuestsAvatar(withDisplayName: actorDisplayName ?? "", withStyle: style)
} else if actorType == NCAttendeeTypeGroup || actorType == NCAttendeeTypeCircle {
} else if actorType == NCAttendeeTypeGroup {
image = self.getGroupAvatar(with: style)
} else if actorType == NCAttendeeTypeCircle || actorType == NCAttendeeTypeTeams {
image = self.getTeamAvatar(with: style)
} else if actorType == "deleted_users" {
image = self.getDeletedUserAvatar()
} else {
Expand Down
8 changes: 7 additions & 1 deletion NextcloudTalk/BaseChatViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1127,7 +1127,13 @@ import SwiftUI
// that manually here, so mentions are correctly removed while editing.
// The same needs to happen for "mentionId" -> userId with a prefixed "@"
parameter.mentionDisplayName = "@\(paramaterDisplayName)"
parameter.mentionId = "@\(parameterId)"

if parameter.mentionId == nil {
// Fallback for servers that do not return "mention-id" in message parameters.
// This will not work correctly in some cases (e.g. teams)
parameter.mentionId = "@\(parameterId)"
}

self.mentionsDict[key] = parameter
}
}
Expand Down
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.
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.

This file was deleted.

This file was deleted.

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
Loading