Przeglądaj źródła

Merge pull request #1751 from nextcloud/fix/activities

Fix/activities
Marino Faggiana 3 lat temu
rodzic
commit
c5e737cc73

+ 21 - 15
iOSClient/Activity/NCActivity.swift

@@ -40,6 +40,7 @@ class NCActivity: UIViewController {
     var height: CGFloat = 0
 
     var metadata: tableMetadata?
+    var showCommetns: Bool = false
 
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
 
@@ -71,8 +72,12 @@ class NCActivity: UIViewController {
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterChangeTheming), object: nil)
         
         changeTheming()
-        
-        setupComments()
+
+        if showCommetns {
+            setupComments()
+        } else {
+            commentView.isHidden = true
+        }
     }
     
     func setupComments() {
@@ -360,29 +365,30 @@ extension NCActivity: UIScrollViewDelegate {
 extension NCActivity {
 
     func loadDataSource() {
-        
-        guard let metadata = self.metadata else { return }
+
         NCUtility.shared.startActivityIndicator(backgroundView: tableView, blurEffect: false)
         let reloadDispatch = DispatchGroup()
         self.allItems = []
         reloadDispatch.enter()
-        reloadDispatch.enter()
-
-        NCCommunication.shared.getComments(fileId: metadata.fileId) { (account, comments, errorCode, errorDescription) in
-            if errorCode == 0 && comments != nil {
-                NCManageDatabase.shared.addComments(comments!, account: metadata.account, objectId: metadata.fileId)
-                self.allItems += NCManageDatabase.shared.getComments(account: metadata.account, objectId: metadata.fileId)
-                reloadDispatch.leave()
-            } else {
-                if errorCode != NCGlobal.shared.errorResourceNotFound {
-                    NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
+        if showCommetns, let metadata = metadata {
+            reloadDispatch.enter()
+            
+            NCCommunication.shared.getComments(fileId: metadata.fileId) { (account, comments, errorCode, errorDescription) in
+                if errorCode == 0 && comments != nil {
+                    NCManageDatabase.shared.addComments(comments!, account: metadata.account, objectId: metadata.fileId)
+                    self.allItems += NCManageDatabase.shared.getComments(account: metadata.account, objectId: metadata.fileId)
+                    reloadDispatch.leave()
+                } else {
+                    if errorCode != NCGlobal.shared.errorResourceNotFound {
+                        NCContentPresenter.shared.messageNotification("_share_", description: errorDescription, delay: NCGlobal.shared.dismissAfterSecond, type: NCContentPresenter.messageType.error, errorCode: errorCode)
+                    }
                 }
             }
         }
         
         let activities = NCManageDatabase.shared.getActivity(
             predicate: NSPredicate(format: "account == %@", appDelegate.account),
-            filterFileId: metadata.fileId)
+            filterFileId: metadata?.fileId)
         self.allItems += activities.filter
         reloadDispatch.leave()
         

+ 3 - 3
iOSClient/Share/NCShare.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19162" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Ts3-RO-A9l">
     <device id="retina5_5" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19144"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -18,7 +18,7 @@
                         <viewLayoutGuide key="safeArea" id="EQO-kT-aOm"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                     </view>
-                    <navigationItem key="navigationItem" id="3f0-GZ-Z6m"/>
+                    <navigationItem key="navigationItem" largeTitleDisplayMode="never" id="3f0-GZ-Z6m"/>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="DIg-rR-e8m" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>

+ 4 - 2
iOSClient/Share/NCSharePaging.swift

@@ -6,6 +6,7 @@
 //  Copyright © 2019 Marino Faggiana. All rights reserved.
 //
 //  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//  Author Henrik Storch <henrik.storch@nextcloud.com>
 //
 //  This program is free software: you can redistribute it and/or modify
 //  it under the terms of the GNU General Public License as published by
@@ -149,12 +150,12 @@ class NCSharePaging: UIViewController {
 extension NCSharePaging: PagingViewControllerDelegate {
     
     func pagingViewController(_ pagingViewController: PagingViewController, willScrollToItem pagingItem: PagingItem, startingViewController: UIViewController, destinationViewController: UIViewController) {
-        
+
         guard
             let item = pagingItem as? PagingIndexItem,
             let itemIndex = NCGlobal.NCSharePagingIndex(rawValue: item.index)
         else { return }
-         
+
         if itemIndex == .activity && !activityEnabled {
             pagingViewController.contentInteraction = .none
         } else if itemIndex == .sharing && !sharingEnabled {
@@ -177,6 +178,7 @@ extension NCSharePaging: PagingViewControllerDataSource {
         case .activity:
             let viewController = UIStoryboard(name: "NCActivity", bundle: nil).instantiateInitialViewController() as! NCActivity
             viewController.height = height
+            viewController.showCommetns = true
             viewController.didSelectItemEnable = false
             viewController.metadata = metadata
             viewController.objectType = "files"