From 8c1b7bbd2d3fd92af3a05205a46c7cfca330786d Mon Sep 17 00:00:00 2001 From: Iva Horn Date: Wed, 6 Nov 2024 16:10:46 +0100 Subject: [PATCH] Affects #2845: Reveal found calendar events and contacts in the web user interface. --- ...lectionViewCommon+CollectionViewDelegate.swift | 15 ++++++++++++--- iOSClient/NCGlobal.swift | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift index 9eb00f7326..e3a580f0dd 100644 --- a/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift +++ b/iOSClient/Main/Collection Common/NCCollectionViewCommon+CollectionViewDelegate.swift @@ -28,9 +28,14 @@ import NextcloudKit extension NCCollectionViewCommon: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { guard let metadata = self.dataSource.getMetadata(indexPath: indexPath), - !metadata.isInvalidated, - (metadata.name == global.appName || metadata.name == NCGlobal.shared.talkName) - else { return } + !metadata.isInvalidated + else { + return + } + + guard [global.appName, global.calendarName, global.contactsName, global.talkName].contains(metadata.name) else { + return + } if isEditMode { if let index = fileSelect.firstIndex(of: metadata.ocId) { @@ -57,6 +62,10 @@ extension NCCollectionViewCommon: UICollectionViewDelegate { } } + if [global.calendarName, global.contactsName].contains(metadata.name) { + NCViewer().view(viewController: self, metadata: metadata, image: nil) + } + if metadata.directory { pushMetadata(metadata) } else { diff --git a/iOSClient/NCGlobal.swift b/iOSClient/NCGlobal.swift index ab0f5beff8..56ea9dab7e 100644 --- a/iOSClient/NCGlobal.swift +++ b/iOSClient/NCGlobal.swift @@ -52,6 +52,8 @@ class NCGlobal: NSObject { // let appName = "files" let appScheme = "nextcloud" + let calendarName = "calendar" + let contactsName = "contacts" let talkName = "talk-message" let spreedName = "spreed" let twoFactorNotificatioName = "twofactor_nextcloud_notification"