Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity/Comment cell fixes #3064

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions iOSClient/Activity/NCActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import UIKit
import SwiftRichString
import NextcloudKit
import SVGKit

class NCActivity: UIViewController, NCSharePagingContent {
@IBOutlet weak var viewContainerConstraint: NSLayoutConstraint!
Expand Down Expand Up @@ -150,10 +151,6 @@ extension NCActivity: UITableViewDelegate {
return 50
}

func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 80
}

func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50))
view.backgroundColor = .clear
Expand Down Expand Up @@ -223,7 +220,6 @@ extension NCActivity: UITableViewDataSource {
cell.indexPath = indexPath
cell.tableComments = comment
cell.delegate = self
cell.sizeToFit()

// Image
let fileName = NCSession.shared.getFileName(urlBase: metadata.urlBase, user: comment.actorId)
Expand All @@ -233,7 +229,7 @@ extension NCActivity: UITableViewDataSource {
cell.labelUser.textColor = NCBrandColor.shared.textColor
// Date
cell.labelDate.text = utility.dateDiff(comment.creationDateTime as Date)
cell.labelDate.textColor = .systemGray4
cell.labelDate.textColor = .lightGray
// Message
cell.labelMessage.text = comment.message
cell.labelMessage.textColor = NCBrandColor.shared.textColor
Expand All @@ -244,6 +240,8 @@ extension NCActivity: UITableViewDataSource {
cell.buttonMenu.isHidden = true
}

cell.sizeToFit()

return cell
}

Expand All @@ -264,11 +262,14 @@ extension NCActivity: UITableViewDataSource {

// icon
if !activity.icon.isEmpty {
activity.icon = activity.icon.replacingOccurrences(of: ".png", with: ".svg")
let fileNameIcon = (activity.icon as NSString).lastPathComponent
let fileNameLocalPath = utilityFileSystem.directoryUserData + "/" + fileNameIcon

if FileManager.default.fileExists(atPath: fileNameLocalPath) {
if let image = UIImage(contentsOfFile: fileNameLocalPath) {
let image = fileNameIcon.contains(".svg") ? SVGKImage(contentsOfFile: fileNameLocalPath)?.uiImage : UIImage(contentsOfFile: fileNameLocalPath)

if let image {
cell.icon.image = image.withTintColor(NCBrandColor.shared.textColor, renderingMode: .alwaysOriginal)
}
} else {
Expand Down
1 change: 0 additions & 1 deletion iOSClient/Networking/NCService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
//

import UIKit
import SVGKit
import NextcloudKit
import RealmSwift

Expand Down
1 change: 0 additions & 1 deletion iOSClient/Share/Advanced/NCShareNewUserAddComment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import UIKit
import NextcloudKit
import SVGKit

class NCShareNewUserAddComment: UIViewController, NCShareDetail {

Expand Down
35 changes: 18 additions & 17 deletions iOSClient/Share/NCShareCommentsCell.xib
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" rowHeight="68" id="qJF-Yc-gKE" customClass="NCShareCommentsCell" customModule="Nextcloud" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="600" height="68"/>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="cell" rowHeight="39" id="qJF-Yc-gKE" customClass="NCShareCommentsCell" customModule="Nextcloud" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="600" height="107"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="qJF-Yc-gKE" id="3Oe-gU-3Nk">
<rect key="frame" x="0.0" y="0.0" width="600" height="68"/>
<rect key="frame" x="0.0" y="0.0" width="600" height="107"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" contentMode="scaleAspectFill" translatesAutoresizingMaskIntoConstraints="NO" id="qDs-UG-Mn7" userLabel="ImageItem">
Expand All @@ -26,11 +26,11 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="user" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="otH-mT-7Z4" userLabel="labelTitle">
<rect key="frame" x="70" y="8.5" width="28.5" height="18"/>
<rect key="frame" x="70" y="8.5" width="33" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="iet-xr-SX6"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="15"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
Expand All @@ -53,17 +53,18 @@
<action selector="touchUpInsideMenu:" destination="qJF-Yc-gKE" eventType="touchUpInside" id="dx2-2Z-VfO"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QXZ-ax-nlQ">
<rect key="frame" x="70" y="23" width="510" height="18"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QXZ-ax-nlQ">
<rect key="frame" x="70" y="26" width="514" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="WZK-ND-Vl1"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="message" lineBreakMode="middleTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mNK-Zq-pFW" userLabel="labelTitle">
<rect key="frame" x="70" y="45" width="525" height="13"/>
<label opaque="NO" userInteractionEnabled="NO" tag="101" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" lineBreakMode="middleTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mNK-Zq-pFW" userLabel="labelTitle">
<rect key="frame" x="70" y="45" width="525" height="52"/>
<string key="text">messagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessagemessage</string>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="highlightedColor"/>
</label>
Expand All @@ -76,12 +77,12 @@
<constraint firstAttribute="trailing" secondItem="mNK-Zq-pFW" secondAttribute="trailing" constant="5" id="A2t-sl-Uer"/>
<constraint firstItem="qDs-UG-Mn7" firstAttribute="top" secondItem="3Oe-gU-3Nk" secondAttribute="top" constant="15" id="FAO-D8-MXo"/>
<constraint firstAttribute="bottom" secondItem="mNK-Zq-pFW" secondAttribute="bottom" constant="10" id="H9H-lE-Gg1"/>
<constraint firstItem="mNK-Zq-pFW" firstAttribute="top" secondItem="QXZ-ax-nlQ" secondAttribute="bottom" constant="4" id="KDw-qu-iO6"/>
<constraint firstItem="mNK-Zq-pFW" firstAttribute="top" secondItem="QXZ-ax-nlQ" secondAttribute="bottom" constant="1" id="KDw-qu-iO6"/>
<constraint firstItem="otH-mT-7Z4" firstAttribute="centerY" secondItem="qDs-UG-Mn7" secondAttribute="centerY" constant="-15" id="KO4-0R-wdL" userLabel="labelTitle.centerY = ImageItem.centerY"/>
<constraint firstItem="qDs-UG-Mn7" firstAttribute="leading" secondItem="3Oe-gU-3Nk" secondAttribute="leading" constant="20" id="KOm-wo-CBa"/>
<constraint firstAttribute="trailingMargin" secondItem="QXZ-ax-nlQ" secondAttribute="trailing" constant="4" id="Pku-hg-qKn"/>
<constraint firstAttribute="trailingMargin" secondItem="QXZ-ax-nlQ" secondAttribute="trailing" constant="-8" id="Pku-hg-qKn"/>
<constraint firstAttribute="trailingMargin" secondItem="J1z-RG-U4A" secondAttribute="trailing" constant="4" id="SgR-6b-z2c"/>
<constraint firstItem="QXZ-ax-nlQ" firstAttribute="top" secondItem="J1z-RG-U4A" secondAttribute="bottom" constant="-22" id="qj4-34-HW3"/>
<constraint firstItem="QXZ-ax-nlQ" firstAttribute="top" secondItem="J1z-RG-U4A" secondAttribute="bottom" constant="-19" id="qj4-34-HW3"/>
<constraint firstItem="J1z-RG-U4A" firstAttribute="centerY" secondItem="qDs-UG-Mn7" secondAttribute="centerY" constant="2.5" id="tIg-bm-Clb"/>
</constraints>
</tableViewCellContentView>
Expand All @@ -93,7 +94,7 @@
<outlet property="labelMessage" destination="mNK-Zq-pFW" id="oRf-8F-Pwu"/>
<outlet property="labelUser" destination="otH-mT-7Z4" id="Wf0-PX-Vrq"/>
</connections>
<point key="canvasLocation" x="97.599999999999994" y="266.26686656671666"/>
<point key="canvasLocation" x="112" y="227.13643178410797"/>
</tableViewCell>
</objects>
<resources>
Expand All @@ -102,10 +103,10 @@
<color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</systemColor>
<systemColor name="secondaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="tertiaryLabelColor">
<color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.29803921568627451" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.29803921570000003" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
Loading