Marino Faggiana vor 6 Jahren
Ursprung
Commit
ea815e1745

+ 3 - 2
iOSClient/Activity/NCActivity.storyboard

@@ -30,7 +30,7 @@
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="wordWrap" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="fcO-YL-MuT">
-                                                    <rect key="frame" x="90" y="0.0" width="275" height="19.666666666666668"/>
+                                                    <rect key="frame" x="88" y="0.0" width="277" height="19.666666666666668"/>
                                                     <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="15"/>
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
@@ -95,8 +95,8 @@
                                                 <constraint firstItem="LQ8-cO-794" firstAttribute="top" secondItem="i35-U4-bEk" secondAttribute="top" id="3fU-rp-D7s"/>
                                                 <constraint firstItem="xNG-sf-PnA" firstAttribute="top" secondItem="i35-U4-bEk" secondAttribute="top" constant="5" id="4EB-59-y1Y"/>
                                                 <constraint firstItem="xNG-sf-PnA" firstAttribute="leading" secondItem="i35-U4-bEk" secondAttribute="leading" constant="20" id="CRN-18-SeU"/>
-                                                <constraint firstItem="fcO-YL-MuT" firstAttribute="leading" secondItem="LQ8-cO-794" secondAttribute="trailing" constant="10" id="MOQ-dS-mwp"/>
                                                 <constraint firstAttribute="bottom" secondItem="KpO-no-BMl" secondAttribute="bottom" id="ULe-Tt-dBj"/>
+                                                <constraint firstItem="fcO-YL-MuT" firstAttribute="leading" secondItem="xNG-sf-PnA" secondAttribute="trailing" constant="48" id="am5-CT-0kZ" userLabel="Subject.leading = Icon.trailing + 50"/>
                                                 <constraint firstItem="LQ8-cO-794" firstAttribute="leading" secondItem="xNG-sf-PnA" secondAttribute="trailing" constant="10" id="aqp-Wu-9Hk"/>
                                                 <constraint firstItem="fcO-YL-MuT" firstAttribute="top" secondItem="i35-U4-bEk" secondAttribute="top" id="faC-by-km5"/>
                                                 <constraint firstItem="KpO-no-BMl" firstAttribute="leading" secondItem="i35-U4-bEk" secondAttribute="leading" constant="50" id="l0Y-89-eTm"/>
@@ -110,6 +110,7 @@
                                             <outlet property="collectionView" destination="KpO-no-BMl" id="xvR-CA-cZx"/>
                                             <outlet property="icon" destination="xNG-sf-PnA" id="hxb-Vr-oQX"/>
                                             <outlet property="subject" destination="fcO-YL-MuT" id="L4q-rj-l04"/>
+                                            <outlet property="subjectTrailingConstraint" destination="am5-CT-0kZ" id="PeK-M5-hHW"/>
                                         </connections>
                                     </tableViewCell>
                                 </prototypes>

+ 42 - 19
iOSClient/Activity/NCActivity.swift

@@ -150,7 +150,8 @@ class NCActivity: UIViewController, UITableViewDataSource, UITableViewDelegate,
 
             cell.idActivity = activity.idActivity
             cell.account = activity.account
-            
+            cell.avatar.image = nil
+
             // icon
             if activity.icon.count > 0 {
                 let fileNameIcon = (activity.icon as NSString).lastPathComponent
@@ -176,21 +177,31 @@ class NCActivity: UIViewController, UITableViewDataSource, UITableViewDelegate,
     
             // avatar
             if activity.user.count > 0 {
-                let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-" + activity.user + ".png"
-                if FileManager.default.fileExists(atPath: fileNameLocalPath) {
-                    if let image = UIImage(contentsOfFile: fileNameLocalPath) {
-                        cell.avatar.image = image
-                    }
+                
+                if activity.user == appDelegate.activeUserID {
+                    
+                    cell.subjectTrailingConstraint.constant = 10
+                    
                 } else {
-                    DispatchQueue.global().async {
-                        let url = self.appDelegate.activeUrl + k_avatar + activity.user + "/128"
-                        let encodedString = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
-                        if let data = try? Data(contentsOf: URL(string: encodedString!)!) {
-                            DispatchQueue.main.async {
-                                do {
-                                    try data.write(to: fileNameLocalPath.url, options: .atomic)
-                                } catch { return }
-                                cell.avatar.image = UIImage(data: data)
+                
+                    cell.subjectTrailingConstraint.constant = 50
+                    
+                    let fileNameLocalPath = CCUtility.getDirectoryUserData() + "/" + CCUtility.getStringUser(appDelegate.activeUser, activeUrl: appDelegate.activeUrl) + "-" + activity.user + ".png"
+                    if FileManager.default.fileExists(atPath: fileNameLocalPath) {
+                        if let image = UIImage(contentsOfFile: fileNameLocalPath) {
+                            cell.avatar.image = image
+                        }
+                    } else {
+                        DispatchQueue.global().async {
+                            let url = self.appDelegate.activeUrl + k_avatar + activity.user + "/128"
+                            let encodedString = url.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
+                            if let data = try? Data(contentsOf: URL(string: encodedString!)!) {
+                                DispatchQueue.main.async {
+                                    do {
+                                        try data.write(to: fileNameLocalPath.url, options: .atomic)
+                                    } catch { return }
+                                    cell.avatar.image = UIImage(data: data)
+                                }
                             }
                         }
                     }
@@ -237,7 +248,8 @@ class activityTableViewCell: UITableViewCell, UICollectionViewDelegate, UICollec
     @IBOutlet weak var icon: UIImageView!
     @IBOutlet weak var avatar: UIImageView!
     @IBOutlet weak var subject: UILabel!
-    
+    @IBOutlet weak var subjectTrailingConstraint: NSLayoutConstraint!
+
     var idActivity: Int = 0
     var account: String = ""
     var activityPreviews = [tableActivityPreview]()
@@ -294,6 +306,8 @@ class activityTableViewCell: UITableViewCell, UICollectionViewDelegate, UICollec
                                     if let image = UIImage(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(fileID, fileNameView: fileName)) {
                                         cell.imageView.image = image
                                     }
+                                } else {
+                                    print(errorCode)
                                 }
                             })
                         }
@@ -301,10 +315,19 @@ class activityTableViewCell: UITableViewCell, UICollectionViewDelegate, UICollec
                 }
                 
             } else {
-                if let imageNamePath = NCUtility.sharedInstance.convertSVGtoPNGWriteToUserData(svgUrlString: activityPreview.source, fileName: nil, width: 100, rewrite: false) {
-                    if let image = UIImage(contentsOfFile: imageNamePath) {
-                        cell.imageView.image = image
+                
+                if activityPreview.isMimeTypeIcon {
+                    DispatchQueue.global().async {
+                        if let imageNamePath = NCUtility.sharedInstance.convertSVGtoPNGWriteToUserData(svgUrlString: activityPreview.source, fileName: nil, width: 100, rewrite: false) {
+                            DispatchQueue.main.async {
+                                if let image = UIImage(contentsOfFile: imageNamePath) {
+                                    cell.imageView.image = image
+                                }
+                            }
+                        }
                     }
+                } else {
+                    
                 }
             }
             

+ 2 - 1
iOSClient/Library/OCCommunicationLib/OCWebDavClient/OCWebDAVClient.m

@@ -930,7 +930,8 @@ NSString const *OCWebDAVModificationDateKey	= @"modificationdate";
     _requestMethod = @"GET";
     
     since = 0;
-    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json&since=%ld", (long)since]];
+    //serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json&since=%ld", (long)since]];
+    serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"?format=json&limit=100"]];
     serverPath = [serverPath stringByAppendingString:[NSString stringWithFormat:@"&previews=true"]];
     
     NSMutableURLRequest *request = [self sharedRequestWithMethod:_requestMethod path:serverPath parameters:nil timeout:k_timeout_webdav];