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()
}
}
}
......
......@@ -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()
}
}
}
......