Dimitris Togias

add analysis more table view cell

......@@ -26,6 +26,7 @@
1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; };
7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; };
A02F34052882B6E60086465F /* TelcoViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A02F34042882B6E60086465F /* TelcoViewController.swift */; };
A030E61128D79FA400788E05 /* AnalysisMoreViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A030E60F28D79FA400788E05 /* AnalysisMoreViewCell.swift */; };
A04D31DE288FF670000E43B5 /* HistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A04D31DD288FF670000E43B5 /* HistoryViewController.swift */; };
A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079366D2885D07700064122 /* AnalysisChildViewController.swift */; };
A07936702885D95600064122 /* AnalysisItemViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079366F2885D95600064122 /* AnalysisItemViewCell.swift */; };
......@@ -180,6 +181,7 @@
1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; };
1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFYInboxTableViewCell.swift; sourceTree = "<group>"; };
A02F34042882B6E60086465F /* TelcoViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TelcoViewController.swift; sourceTree = "<group>"; };
A030E60F28D79FA400788E05 /* AnalysisMoreViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisMoreViewCell.swift; sourceTree = "<group>"; };
A04D31DD288FF670000E43B5 /* HistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HistoryViewController.swift; sourceTree = "<group>"; };
A079366D2885D07700064122 /* AnalysisChildViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisChildViewController.swift; sourceTree = "<group>"; };
A079366F2885D95600064122 /* AnalysisItemViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisItemViewCell.swift; sourceTree = "<group>"; };
......@@ -396,6 +398,7 @@
A079366F2885D95600064122 /* AnalysisItemViewCell.swift */,
A079367B2885F2F500064122 /* AnalysisHeaderViewCell.swift */,
A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */,
A030E60F28D79FA400788E05 /* AnalysisMoreViewCell.swift */,
);
name = cells;
sourceTree = "<group>";
......@@ -888,6 +891,7 @@
A09DBCAE2888BA8100DD50B0 /* SharingHistoryViewController.swift in Sources */,
E6A778F2282933E60045BBA8 /* WLNativeAdCollectionViewCell.m in Sources */,
E6A77904282933E60045BBA8 /* WLEvent.m in Sources */,
A030E61128D79FA400788E05 /* AnalysisMoreViewCell.swift in Sources */,
E6A77927282933E70045BBA8 /* UIRefreshControl+AFNetworking.m in Sources */,
E6A77955282933E70045BBA8 /* ViewControllerExtensions.swift in Sources */,
A07936762885E9CC00064122 /* UIColorExtensions.swift in Sources */,
......
//
// AnalysisMoreViewCell.swift
// SwiftWarplyFramework
//
// Created by Manos Chorianopoulos on 18/9/22.
//
import UIKit
class AnalysisMoreViewCell: UITableViewCell {
@IBOutlet weak var titleLabel: UILabel!
// lifecycle
override func awakeFromNib() {
super.awakeFromNib()
// title
titleLabel.textColor = UIColor(rgb: 0x435563)
titleLabel.text = "Δες Περισσότερα"
}
}
......@@ -11,6 +11,7 @@ class HistoryViewController: AnalysisChildViewController {
var loading: Bool = false
var items: Array<swiftApi.CouponItemModel> = swiftApi().getOldCouponList()
var showMore = true
// TODO: remove this when configuring model
let hasMessage = true
......@@ -63,6 +64,7 @@ class HistoryViewController: AnalysisChildViewController {
func responseCallback (_ data: Array<swiftApi.CouponItemModel>?) -> Void {
self.items = data!
self.showMore = (self.items.count > 3)
showContent()
DispatchQueue.main.async {
self.tableView.reloadData()
......@@ -81,9 +83,12 @@ class HistoryViewController: AnalysisChildViewController {
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (section == 0) {
return 1;
return 1
}
if (self.showMore) {
return 4
}
return items.count
}
......@@ -108,9 +113,25 @@ class HistoryViewController: AnalysisChildViewController {
return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell
}
if (self.showMore && indexPath.row == 3) {
let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell
cell.configureCell(item: items[indexPath.row])
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.section == 0) {
return
}
if (self.showMore && indexPath.row == 3) {
self.showMore = false
self.tableView.reloadData()
}
}
}
......
......@@ -522,9 +522,46 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisItemViewCell" rowHeight="160" id="iNx-Id-iLB" customClass="AnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisMoreViewCell" rowHeight="160" id="rpm-JS-xpJ" customClass="AnalysisMoreViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="rpm-JS-xpJ" id="4bk-NG-9CV">
<rect key="frame" x="0.0" y="0.0" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="Ujy-Ns-gSY">
<rect key="frame" x="142.5" y="65" width="129" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Δες Περισσότερα" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jD8-wg-76D">
<rect key="frame" x="0.0" y="0.0" width="112" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_down_dark" translatesAutoresizingMaskIntoConstraints="NO" id="w3t-uo-L5p">
<rect key="frame" x="119" y="0.0" width="10" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="Vle-mG-72l"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="30" id="pZA-sa-b2o"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstItem="Ujy-Ns-gSY" firstAttribute="centerY" secondItem="4bk-NG-9CV" secondAttribute="centerY" id="tjs-LH-AbK"/>
<constraint firstItem="Ujy-Ns-gSY" firstAttribute="centerX" secondItem="4bk-NG-9CV" secondAttribute="centerX" id="zOh-rM-dnO"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="titleLabel" destination="jD8-wg-76D" id="K6c-qT-EMs"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisItemViewCell" rowHeight="160" id="iNx-Id-iLB" customClass="AnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="204.5" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="iNx-Id-iLB" id="X28-3l-fcy">
<rect key="frame" x="0.0" y="0.0" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -592,7 +629,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisHeaderViewCell" rowHeight="280" id="HMC-zK-06F" customClass="AnalysisHeaderViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="204.5" width="414" height="280"/>
<rect key="frame" x="0.0" y="364.5" width="414" height="280"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="HMC-zK-06F" id="RtV-Li-Dnj">
<rect key="frame" x="0.0" y="0.0" width="414" height="280"/>
......@@ -639,7 +676,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisHeaderMessageViewCell" rowHeight="380" id="oPh-jz-GSZ" customClass="AnalysisHeaderMessageViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="484.5" width="414" height="380"/>
<rect key="frame" x="0.0" y="644.5" width="414" height="380"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="oPh-jz-GSZ" id="8oK-tI-pLa">
<rect key="frame" x="0.0" y="0.0" width="414" height="380"/>
......@@ -2152,9 +2189,46 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisItemViewCell" rowHeight="160" id="mwO-Y9-Whd" customClass="AnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisMoreViewCell" rowHeight="160" id="y9v-uo-691" customClass="AnalysisMoreViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="44.5" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="y9v-uo-691" id="fs3-oQ-Zcn">
<rect key="frame" x="0.0" y="0.0" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="7" translatesAutoresizingMaskIntoConstraints="NO" id="0nn-Oo-hdD">
<rect key="frame" x="142.5" y="65" width="129" height="30"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Δες Περισσότερα" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Cnm-Dr-B1b">
<rect key="frame" x="0.0" y="0.0" width="112" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_down_dark" translatesAutoresizingMaskIntoConstraints="NO" id="eaQ-bR-n13">
<rect key="frame" x="119" y="0.0" width="10" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="ZyY-sN-Rx1"/>
</constraints>
</imageView>
</subviews>
<constraints>
<constraint firstAttribute="height" constant="30" id="83c-wF-2Vx"/>
</constraints>
</stackView>
</subviews>
<constraints>
<constraint firstItem="0nn-Oo-hdD" firstAttribute="centerY" secondItem="fs3-oQ-Zcn" secondAttribute="centerY" id="YfN-di-oHM"/>
<constraint firstItem="0nn-Oo-hdD" firstAttribute="centerX" secondItem="fs3-oQ-Zcn" secondAttribute="centerX" id="d2b-fG-qxB"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="titleLabel" destination="Cnm-Dr-B1b" id="ArG-JS-SA8"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisItemViewCell" rowHeight="160" id="mwO-Y9-Whd" customClass="AnalysisItemViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="204.5" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="mwO-Y9-Whd" id="4Lb-Ez-2D5">
<rect key="frame" x="0.0" y="0.0" width="414" height="160"/>
<autoresizingMask key="autoresizingMask"/>
......@@ -2222,7 +2296,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisHeaderViewCell" rowHeight="280" id="TXv-Qw-94X" customClass="AnalysisHeaderViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="204.5" width="414" height="280"/>
<rect key="frame" x="0.0" y="364.5" width="414" height="280"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TXv-Qw-94X" id="fmq-OF-USg">
<rect key="frame" x="0.0" y="0.0" width="414" height="280"/>
......@@ -2258,7 +2332,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="AnalysisHeaderMessageViewCell" rowHeight="380" id="9cE-DQ-oc7" customClass="AnalysisHeaderMessageViewCell" customModule="SwiftWarplyFramework" customModuleProvider="target">
<rect key="frame" x="0.0" y="484.5" width="414" height="380"/>
<rect key="frame" x="0.0" y="644.5" width="414" height="380"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="9cE-DQ-oc7" id="Kcf-Zv-eMe">
<rect key="frame" x="0.0" y="0.0" width="414" height="380"/>
......
......@@ -11,6 +11,7 @@ class SharingHistoryViewController: AnalysisChildViewController {
var loading: Bool = false
var items: Array<swiftApi.SharingCouponModel> = Array()
var showMore = true
// TODO: remove this when configuring model
let hasMessage = false
......@@ -61,6 +62,7 @@ class SharingHistoryViewController: AnalysisChildViewController {
func responseCallback (_ data: Array<swiftApi.SharingCouponModel>?) -> Void {
self.items = data!
self.showMore = (self.items.count > 3)
showContent()
DispatchQueue.main.async {
self.tableView.reloadData()
......@@ -82,6 +84,9 @@ class SharingHistoryViewController: AnalysisChildViewController {
return 1;
}
if (self.showMore) {
return 4
}
return items.count
}
......@@ -106,9 +111,25 @@ class SharingHistoryViewController: AnalysisChildViewController {
return cell
}
if (self.showMore && indexPath.row == 3) {
let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell
cell.configureCell(item: items[indexPath.row])
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (indexPath.section == 0) {
return
}
if (self.showMore && indexPath.row == 3) {
self.showMore = false
self.tableView.reloadData()
}
}
}
......