|
@@ -29,22 +29,24 @@ extension UIViewController {
|
|
fileprivate func handleProfileAction(_ action: NCHovercard.Action, for userId: String) {
|
|
fileprivate func handleProfileAction(_ action: NCHovercard.Action, for userId: String) {
|
|
switch action.appId {
|
|
switch action.appId {
|
|
case "email":
|
|
case "email":
|
|
- guard let url = action.hyperlinkUrl,
|
|
|
|
- url.scheme == "mailto",
|
|
|
|
- let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
|
|
|
|
|
+ guard
|
|
|
|
+ let url = action.hyperlinkUrl,
|
|
|
|
+ url.scheme == "mailto",
|
|
|
|
+ let components = URLComponents(url: url, resolvingAgainstBaseURL: false)
|
|
|
|
+ else {
|
|
NCContentPresenter.shared.showGenericError(description: "_cannot_send_mail_error_")
|
|
NCContentPresenter.shared.showGenericError(description: "_cannot_send_mail_error_")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
-
|
|
|
|
sendEmail(to: components.path)
|
|
sendEmail(to: components.path)
|
|
|
|
+
|
|
case "spreed":
|
|
case "spreed":
|
|
- let appDelegate = UIApplication.shared.delegate as! AppDelegate
|
|
|
|
- if let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(appDelegate.urlBase)&user=\(appDelegate.userId)&withUser=\(userId)"),
|
|
|
|
- UIApplication.shared.canOpenURL(talkUrl) {
|
|
|
|
- UIApplication.shared.open(talkUrl)
|
|
|
|
- } else if let url = action.hyperlinkUrl {
|
|
|
|
- UIApplication.shared.open(url)
|
|
|
|
- } else { fallthrough }
|
|
|
|
|
|
+ guard
|
|
|
|
+ let appDelegate = UIApplication.shared.delegate as? AppDelegate,
|
|
|
|
+ let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(appDelegate.urlBase)&user=\(appDelegate.userId)&withUser=\(userId)"),
|
|
|
|
+ UIApplication.shared.canOpenURL(talkUrl)
|
|
|
|
+ else { fallthrough /* default: open web link in browser */ }
|
|
|
|
+ UIApplication.shared.open(talkUrl)
|
|
|
|
+
|
|
default:
|
|
default:
|
|
guard let url = action.hyperlinkUrl, UIApplication.shared.canOpenURL(url) else {
|
|
guard let url = action.hyperlinkUrl, UIApplication.shared.canOpenURL(url) else {
|
|
NCContentPresenter.shared.showGenericError(description: "_open_url_error_")
|
|
NCContentPresenter.shared.showGenericError(description: "_open_url_error_")
|
|
@@ -53,7 +55,7 @@ extension UIViewController {
|
|
UIApplication.shared.open(url, options: [:])
|
|
UIApplication.shared.open(url, options: [:])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
func showProfileMenu(userId: String) {
|
|
func showProfileMenu(userId: String) {
|
|
|
|
|
|
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
|
|
guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { return }
|
|
@@ -61,15 +63,13 @@ extension UIViewController {
|
|
guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion23 else { return }
|
|
guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion23 else { return }
|
|
|
|
|
|
NCCommunication.shared.getHovercard(for: userId) { (card, errCode, err) in
|
|
NCCommunication.shared.getHovercard(for: userId) { (card, errCode, err) in
|
|
- guard let card = card else {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ guard let card = card else { return }
|
|
|
|
+
|
|
let personHeader = NCMenuAction(
|
|
let personHeader = NCMenuAction(
|
|
title: card.displayName,
|
|
title: card.displayName,
|
|
icon: NCUtility.shared.loadUserImage(for: userId, displayName: card.displayName, urlBase: appDelegate.urlBase),
|
|
icon: NCUtility.shared.loadUserImage(for: userId, displayName: card.displayName, urlBase: appDelegate.urlBase),
|
|
action: nil)
|
|
action: nil)
|
|
-
|
|
|
|
|
|
+
|
|
let actions = card.actions.map { action -> NCMenuAction in
|
|
let actions = card.actions.map { action -> NCMenuAction in
|
|
var image = UIImage()
|
|
var image = UIImage()
|
|
if let url = URL(string: action.icon),
|
|
if let url = URL(string: action.icon),
|