Skip to content

Commit

Permalink
fix(EN-5880) : fix Autolink labels
Browse files Browse the repository at this point in the history
  • Loading branch information
clemPerrousset committed Mar 28, 2023
1 parent 8cf0d7e commit 9c6a6dd
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 31 deletions.
8 changes: 5 additions & 3 deletions entourage/Scenes/Conversations/ConversationListMainCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
//

import UIKit
import ActiveLabel

class ConversationListMainCell: UITableViewCell {


@IBOutlet weak var ui_image: UIImageView!
@IBOutlet weak var ui_username: UILabel!
@IBOutlet weak var ui_detail_message: UILabel!
@IBOutlet weak var ui_detail_message: ActiveLabel!
@IBOutlet weak var ui_role: UILabel!
@IBOutlet weak var ui_view_separator: UIView!

Expand Down Expand Up @@ -46,8 +47,9 @@ class ConversationListMainCell: UITableViewCell {
ui_username.text = message.title
ui_role.text = message.getRolesWithPartnerFormated()
if let _message = message.getLastMessage {
ui_detail_message.setTextWithLinksDetected(_message) { url in
delegate.showWebUrl(url:url)
ui_detail_message.text = _message
ui_detail_message.handleURLTap { url in
delegate.showWebUrl(url: url)
}
}
ui_detail_message.text = message.getLastMessage
Expand Down
8 changes: 5 additions & 3 deletions entourage/Scenes/Events/Cells/Feed/EventDetailFullCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import UIKit
import MapKit
import ActiveLabel

class EventDetailFullCell: UITableViewCell {

Expand Down Expand Up @@ -45,7 +46,7 @@ class EventDetailFullCell: UITableViewCell {
@IBOutlet weak var ui_mapview: MKMapView!

@IBOutlet weak var ui_lbl_about_title: UILabel!
@IBOutlet weak var ui_lbl_about_desc: UILabel!
@IBOutlet weak var ui_lbl_about_desc: ActiveLabel!

@IBOutlet weak var ui_view_organised_by: UIView!

Expand Down Expand Up @@ -238,8 +239,9 @@ class EventDetailFullCell: UITableViewCell {
ui_lbl_nb_members.text = membersCount

if let _desc = event.descriptionEvent {
ui_lbl_about_desc.setTextWithLinksDetected(_desc) { url in
delegate.showWebviewUrl(url:url)
ui_lbl_about_desc.text = _desc
ui_lbl_about_desc.handleURLTap { url in
delegate.showWebviewUrl(url: url)
}
}

Expand Down
7 changes: 6 additions & 1 deletion entourage/Scenes/Events/Cells/Feed/EventDetailFullCell.xib
Original file line number Diff line number Diff line change
Expand Up @@ -509,11 +509,16 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="749" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gsf-dy-SH5">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="749" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Gsf-dy-SH5" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="626" width="350" height="0.0"/>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="URLColor">
<color key="value" name="orange_app"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
</subviews>
<color key="backgroundColor" name="BeigeClair"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import UIKit
import SDWebImage
import ActiveLabel

class EventDetailTopFullCell: UITableViewCell {

Expand All @@ -31,7 +32,7 @@ class EventDetailTopFullCell: UITableViewCell {
@IBOutlet weak var ui_lbl_bt_join: UILabel!

@IBOutlet weak var ui_lbl_about_title: UILabel!
@IBOutlet weak var ui_lbl_about_desc: UILabel!
@IBOutlet weak var ui_lbl_about_desc: ActiveLabel!

@IBOutlet weak var ui_taglist_view: TagListView!

Expand Down Expand Up @@ -147,7 +148,8 @@ class EventDetailTopFullCell: UITableViewCell {

ui_title.text = event.title
if let _desc = event.descriptionEvent {
ui_lbl_about_desc?.setTextWithLinksDetected(_desc, andLinkHandler: { url in
ui_lbl_about_desc.text = _desc
ui_lbl_about_desc?.handleURLTap({ url in
delegate.showWebUrl(url: url)
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,11 +380,16 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CsR-kO-usD">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CsR-kO-usD" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="418.5" width="350" height="20.5"/>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="URLColor">
<color key="value" name="orange_app"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" translatesAutoresizingMaskIntoConstraints="NO" id="fuU-Rj-r2w" customClass="TagListView" customModule="Ent_Beta" customModuleProvider="target">
<rect key="frame" x="28" y="463" width="350" height="12"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,9 @@ class NeighborhoodDetailTopCell: UITableViewCell {
ui_lbl_nb_members.text = membersCount

ui_title.text = neighborhood.name
//ui_lbl_about_desc?.text = neighborhood.aboutGroup
if let _desc = neighborhood.aboutGroup{
ui_lbl_about_desc?.setTextWithLinksDetected(_desc, andLinkHandler: { url in
delegate.showWebUrl(url: url)
})

ui_lbl_about_desc?.text = neighborhood.aboutGroup
ui_lbl_about_desc?.handleURLTap { url in
delegate.showWebUrl(url: url)
}

let currentUserId = UserDefaults.currentUser?.sid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,19 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N82-O7-OMh">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="&quot; Bio bio bio &quot;" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N82-O7-OMh" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="195" width="350" height="20.5"/>
<accessibility key="accessibilityConfiguration">
<accessibilityTraits key="traits" link="YES" staticText="YES"/>
</accessibility>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="15"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="URLColor">
<color key="value" name="orange_app"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<view contentMode="scaleToFill" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" translatesAutoresizingMaskIntoConstraints="NO" id="WJR-9r-zef" customClass="TagListView" customModule="Ent_Beta" customModuleProvider="target">
<rect key="frame" x="28" y="463" width="350" height="12"/>
Expand Down Expand Up @@ -216,7 +224,7 @@
<outlet property="ui_img_member_1" destination="kgu-jq-UzZ" id="YI6-09-eXm"/>
<outlet property="ui_img_member_2" destination="U06-G4-gRW" id="F2o-uc-rPI"/>
<outlet property="ui_img_member_3" destination="201-cp-giC" id="vIJ-aY-qBC"/>
<outlet property="ui_lbl_about_desc" destination="N82-O7-OMh" id="t3B-2C-nco"/>
<outlet property="ui_lbl_about_desc" destination="N82-O7-OMh" id="uFH-ar-9Rp"/>
<outlet property="ui_lbl_about_title" destination="H48-1Z-fiF" id="jg4-V8-fzC"/>
<outlet property="ui_lbl_bt_join" destination="RpC-Az-CBT" id="PTd-WV-lg5"/>
<outlet property="ui_lbl_nb_members" destination="gft-nF-t80" id="HP0-US-cHX"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import UIKit
import ActiveLabel

class NeighborhoodPostCell: UITableViewCell {
@IBOutlet weak var ui_view_container: UIView!
Expand All @@ -15,7 +16,7 @@ class NeighborhoodPostCell: UITableViewCell {

@IBOutlet weak var ui_date: UILabel!

@IBOutlet weak var ui_comment: UILabel!
@IBOutlet weak var ui_comment: ActiveLabel!

@IBOutlet weak var ui_comments_nb: UILabel!

Expand Down Expand Up @@ -82,21 +83,20 @@ class NeighborhoodPostCell: UITableViewCell {
ui_username.text = message.user?.displayName
ui_date.text = message.createdDateFormatted
ui_comment.text = message.content
if let _content = message.content {
ui_comment.setTextWithLinksDetected(_content) { url in
delegate.showWebviewUrl(url: url)
}
ui_comment.handleURLTap { url in
// Ouvrez le lien dans Safari, par exemple
delegate.showWebviewUrl(url: url)
}

if let _status = message.status {
if _status == "deleted" {
ui_comment.text = "deleted_post_text".localized
ui_comment.textColor = UIColor.appGrey151
ui_btn_signal_post.isHidden = true
}else{
ui_comment.text = message.content
ui_comment.textColor = .black
ui_btn_signal_post.isHidden = false

ui_comment.text = message.content
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<action selector="action_show_user:" destination="cgn-YR-w6m" eventType="touchUpInside" id="siV-7C-S2v"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4rs-dT-shb">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4rs-dT-shb" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="70" width="291.66666666666669" height="48.666666666666657"/>
<string key="text">Bienvenue à toi cher danseur !
Nous sommes prêt pour les beaux jours ! :-)</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<action selector="action_show_user:" destination="bPP-EV-zW9" eventType="touchUpInside" id="dgD-gX-cMQ"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="253" verticalCompressionResistancePriority="753" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YJs-gC-gEm">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="253" verticalCompressionResistancePriority="753" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="YJs-gC-gEm" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="75" width="292" height="41"/>
<string key="text">Bienvenue à toi cher danseur !
Nous sommes prêt pour les beaux jours ! :-)</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,18 @@
<action selector="action_show_user:" destination="Quf-te-xTQ" eventType="touchUpInside" id="4di-iz-OqO"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cU0-C4-PYr">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cU0-C4-PYr" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="28" y="70" width="292" height="41"/>
<string key="text">Bienvenue à toi cher danseur !
Nous sommes prêt pour les beaux jours ! :-)</string>
<fontDescription key="fontDescription" name="NunitoSans-Regular" family="Nunito Sans" pointSize="15"/>
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="URLColor">
<color key="value" name="orange_app"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="252" verticalCompressionResistancePriority="752" text="x commentaires" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dwy-yw-Hbe">
<rect key="frame" x="281.5" y="128" width="92.5" height="18"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class NeighborhoodMessageCell: UITableViewCell {

deletedImage = UIImage(named: "ic_deleted_comment")
deletedImageView = UIImageView(image: deletedImage)
deletedImageView?.frame = CGRect(x: 15, y: 15, width: 15, height: 15) // Définir la taille de l'image
deletedImageView?.frame = CGRect(x: 16, y: 16, width: 15, height: 15) // Définir la taille de l'image
deletedImageView?.tintColor = UIColor.gray // Changer la couleur de l'image en gris


Expand Down
7 changes: 6 additions & 1 deletion entourage/Storyboards/Messages.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,16 @@
<color key="textColor" name="orange_app"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blabla" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VSX-1z-7hS">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Blabla" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="VSX-1z-7hS" customClass="ActiveLabel" customModule="ActiveLabel">
<rect key="frame" x="94" y="53.5" width="37" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="gris_sombre_40"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="URLColor">
<color key="value" name="orange_app"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="1" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HsN-gm-L3v">
<rect key="frame" x="360" y="43" width="18" height="18"/>
Expand Down
Loading

0 comments on commit 9c6a6dd

Please sign in to comment.