Manos Chorianopoulos

fix attributedStrings crushing

......@@ -45,8 +45,8 @@ class AnalysisHeaderMessageViewCell: UITableViewCell {
let coupBoldText2 = String(loyaltyBadge._couponCount)
let coupNormalText3 = " κουπόνια!"
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Regular", size: 17)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Bold", size: 17)]
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)]
let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular)
let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold)
......
......@@ -948,46 +948,46 @@
</view>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="CouponsTableViewCellId" id="PUP-z1-zvb" customClass="CouponsTableViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="707.5" width="414" height="44"/>
<rect key="frame" x="0.0" y="707.5" width="414" height="105"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="PUP-z1-zvb" id="dt2-2B-okP">
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="105"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FsY-Dp-PUQ">
<rect key="frame" x="10" y="0.0" width="394" height="44"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="FsY-Dp-PUQ">
<rect key="frame" x="10" y="0.0" width="394" height="105"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="vZ4-HF-lwK">
<rect key="frame" x="0.0" y="0.0" width="394" height="44"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="vZ4-HF-lwK">
<rect key="frame" x="0.0" y="0.0" width="394" height="105"/>
</imageView>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f2f-Lm-to3">
<rect key="frame" x="20" y="10" width="79" height="24"/>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="f2f-Lm-to3">
<rect key="frame" x="20" y="10" width="79" height="85"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zth-sP-rUI">
<rect key="frame" x="104" y="5" width="10" height="34"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zth-sP-rUI">
<rect key="frame" x="104" y="5" width="10" height="95"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="0jX-bF-I3k"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BAb-kn-pw0">
<rect key="frame" x="119" y="15" width="255" height="0.0"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BAb-kn-pw0">
<rect key="frame" x="119" y="15" width="255" height="17"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="17"/>
<color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<stackView opaque="NO" contentMode="scaleToFill" ambiguous="YES" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="RJe-Li-bx3">
<rect key="frame" x="119" y="20" width="255" height="4"/>
<stackView opaque="NO" contentMode="scaleToFill" spacing="5" translatesAutoresizingMaskIntoConstraints="NO" id="RJe-Li-bx3">
<rect key="frame" x="119" y="37" width="255" height="31"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wBw-w0-bGt">
<rect key="frame" x="0.0" y="0.0" width="127.5" height="4"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wBw-w0-bGt">
<rect key="frame" x="0.0" y="0.0" width="127.5" height="31"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Bold" family="PF Square Sans Pro" pointSize="31"/>
<color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yd2-ue-tBk">
<rect key="frame" x="132.5" y="0.0" width="122.5" height="4"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Yd2-ue-tBk">
<rect key="frame" x="132.5" y="0.0" width="122.5" height="31"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="12"/>
<color key="textColor" red="0.3803921569" green="0.4431372549" blue="0.50588235290000005" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -998,8 +998,8 @@
<constraint firstItem="wBw-w0-bGt" firstAttribute="width" secondItem="RJe-Li-bx3" secondAttribute="width" multiplier="0.5" id="amQ-Xa-Dxm"/>
</constraints>
</stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EEj-3C-9Td">
<rect key="frame" x="119" y="29" width="255" height="0.0"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EEj-3C-9Td">
<rect key="frame" x="119" y="78" width="255" height="12"/>
<fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="12"/>
<color key="textColor" red="0.3803921569" green="0.4431372549" blue="0.50588235290000005" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......
......@@ -132,8 +132,8 @@ import SwiftEventBus
let boldText = totalCouponValueString + "€"
let normalText2 = " με το DEALS for YOU!"
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Regular", size: 17)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Bold", size: 17)]
let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PFSquareSansPro-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)]
let attributedString = NSMutableAttributedString(string:normalText1, attributes:attrRegular)
let boldString = NSMutableAttributedString(string: boldText, attributes:attrBold)
......@@ -262,8 +262,6 @@ import SwiftEventBus
dfyLogoImageTopSpace.constant = 0
}
print("======= 1 =======")
myPresentsLabel.text = "Τα δώρα μου"
if (coupons.count > 0) {
myPresentsLabel.isHidden = false
......@@ -279,7 +277,6 @@ import SwiftEventBus
emptyView.isHidden = true
}
print("======= 2 =======")
}
public override func viewWillAppear(_ animated: Bool) {
......