diff options
Diffstat (limited to 'iOSClient/Menu/UIViewController+Menu.swift')
-rw-r--r-- | iOSClient/Menu/UIViewController+Menu.swift | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/iOSClient/Menu/UIViewController+Menu.swift b/iOSClient/Menu/UIViewController+Menu.swift index e30a16263..b61ca8173 100644 --- a/iOSClient/Menu/UIViewController+Menu.swift +++ b/iOSClient/Menu/UIViewController+Menu.swift @@ -23,11 +23,11 @@ import Foundation import SVGKit -import NCCommunication +import NextcloudKit import UIKit extension UIViewController { - fileprivate func handleProfileAction(_ action: NCCHovercard.Action, for userId: String) { + fileprivate func handleProfileAction(_ action: NKHovercard.Action, for userId: String) { switch action.appId { case "email": guard @@ -35,7 +35,8 @@ extension UIViewController { url.scheme == "mailto", let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else { - NCContentPresenter.shared.showError(description: "_cannot_send_mail_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_cannot_send_mail_error_") + NCContentPresenter.shared.showError(error: error) return } sendEmail(to: components.path) @@ -50,7 +51,8 @@ extension UIViewController { default: guard let url = action.hyperlinkUrl, UIApplication.shared.canOpenURL(url) else { - NCContentPresenter.shared.showError(description: "_open_url_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_open_url_error_") + NCContentPresenter.shared.showError(error: error) return } UIApplication.shared.open(url, options: [:]) @@ -63,8 +65,8 @@ extension UIViewController { let serverVersionMajor = NCManageDatabase.shared.getCapabilitiesServerInt(account: appDelegate.account, elements: NCElementsJSON.shared.capabilitiesVersionMajor) guard serverVersionMajor >= NCGlobal.shared.nextcloudVersion23 else { return } - NCCommunication.shared.getHovercard(for: userId) { card, _, _ in - guard let card = card else { return } + NextcloudKit.shared.getHovercard(for: userId) { account, card, data, _ in + guard let card = card, account == appDelegate.account else { return } let personHeader = NCMenuAction( title: card.displayName, @@ -75,11 +77,11 @@ extension UIViewController { action: nil) let actions = card.actions.map { action -> NCMenuAction in - var image = NCUtility.shared.loadImage(named: "user", color: NCBrandColor.shared.label) + var image = NCUtility.shared.loadImage(named: "user", color: .label) if let url = URL(string: action.icon), let svgSource = SVGKSourceURL.source(from: url), let svg = SVGKImage(source: svgSource) { - image = svg.uiImage.imageColor(NCBrandColor.shared.label) + image = svg.uiImage.withTintColor(.label, renderingMode: .alwaysOriginal) } return NCMenuAction( title: action.title, @@ -94,7 +96,8 @@ extension UIViewController { func sendEmail(to email: String) { guard MFMailComposeViewController.canSendMail() else { - NCContentPresenter.shared.showError(description: "_cannot_send_mail_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_cannot_send_mail_error_") + NCContentPresenter.shared.showError(error: error) return } @@ -108,7 +111,8 @@ extension UIViewController { func presentMenu(with actions: [NCMenuAction]) { guard !actions.isEmpty else { return } guard let menuViewController = NCMenu.makeNCMenu(with: actions) else { - NCContentPresenter.shared.showError(description: "_internal_generic_error_") + let error = NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_internal_generic_error_") + NCContentPresenter.shared.showError(error: error) return } |