Manos Chorianopoulos

redesign History

......@@ -11,9 +11,13 @@ class AnalysisHeaderMessageViewCell: UITableViewCell {
// attributes
@IBOutlet weak var itemImage: UIImageView!
@IBOutlet weak var messageLabelView: UIView!
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var emptyLabel: UILabel!
@IBOutlet weak var emptyLabelHeight: NSLayoutConstraint!
@IBOutlet weak var emptyLabelTopSpace: NSLayoutConstraint!
@IBOutlet weak var emptyLabelBottomSpace: NSLayoutConstraint!
public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge()
......@@ -25,14 +29,15 @@ class AnalysisHeaderMessageViewCell: UITableViewCell {
// itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
// title
titleLabel.textColor = UIColor(rgb: 0x435563)
titleLabel.textColor = UIColor(rgb: 0x212121)
titleLabel.text = "Αναλυτικά:"
// message
messageLabel.textColor = UIColor(rgb: 0x435563)
messageLabel.layer.borderWidth = 1.0
messageLabel.layer.borderColor = UIColor(rgb: 0x1DA6B9).cgColor
messageLabel.layer.cornerRadius = 5
messageLabel.textColor = UIColor(rgb: 0x212121)
messageLabelView.layer.borderWidth = 1.0
messageLabelView.layer.borderColor = UIColor(rgb: 0xE6E6E6).cgColor
messageLabelView.layer.cornerRadius = 16.5
messageLabelView.backgroundColor = .white
// messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
......@@ -44,8 +49,14 @@ extension AnalysisHeaderMessageViewCell {
if (isEmpty == true) {
emptyLabel.isHidden = false
emptyLabelHeight.constant = 18.5
emptyLabelTopSpace.constant = 30.0
emptyLabelBottomSpace.constant = 10.0
} else {
emptyLabel.isHidden = true
emptyLabelHeight.constant = 0.0
emptyLabelTopSpace.constant = 0.0
emptyLabelBottomSpace.constant = 0.0
}
if (isMarket == true) {
......@@ -71,8 +82,8 @@ extension AnalysisHeaderMessageViewCell {
let coupBoldText2 = String(oldUnifiedCouponListLength)
let coupNormalText3 = " κουπόνια!"
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 attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)]
let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular)
let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold)
......@@ -99,8 +110,8 @@ extension AnalysisHeaderMessageViewCell {
let coupBoldText2 = String(loyaltyBadge._couponCount)
let coupNormalText3 = " κουπόνια!"
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 attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16)]
let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16)]
let coupAttributedString = NSMutableAttributedString(string:coupNormalText1, attributes:attrRegular)
let coupBoldString = NSMutableAttributedString(string: coupBoldText, attributes:attrBold)
......
......@@ -38,16 +38,16 @@ class AnalysisItemViewCell: UITableViewCell {
super.awakeFromNib()
// date
dateLabel.textColor = UIColor(rgb: 0x435563)
dateLabel.textColor = UIColor(rgb: 0x212121)
// title
titleLabel.textColor = UIColor(rgb: 0x435563)
titleLabel.textColor = UIColor(rgb: 0x212121)
// price
priceLabel.textColor = UIColor(rgb: 0x435563)
priceLabel.textColor = UIColor(rgb: 0x212121)
// subtitle
subtitleLabel.textColor = UIColor(rgb: 0x8B97A3)
subtitleLabel.textColor = UIColor(rgb: 0x9D9D9C)
}
}
......
......@@ -106,11 +106,13 @@ class HistoryViewController: AnalysisChildViewController {
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if (indexPath.section == 0) {
return hasMessage ? (items.count > 0 ? 380.0 : 480.0) : 280
}
return 140.0
// if (indexPath.section == 0) {
//// return hasMessage ? (items.count > 0 ? 380.0 : 480.0) : 280
// return hasMessage ? UITableView.automaticDimension : 280
// }
//
//// return 140.0
return UITableView.automaticDimension
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
......@@ -147,4 +149,97 @@ class HistoryViewController: AnalysisChildViewController {
self.tableView.reloadData()
}
}
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if (section == 0){
return nil
} else if (section == 1) {
if (self.items.count > 0) {
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 50))
let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height))
viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00)
viewBorder.layer.cornerRadius = 16.5
viewBorder.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius
let viewInner = UIView(frame: CGRect(x: 1, y: 1, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1))
viewInner.backgroundColor = .white
viewInner.layer.cornerRadius = 16.5
viewInner.layer.maskedCorners = [ .layerMinXMinYCorner, .layerMaxXMinYCorner] // Top left, bottom right corner radius
let titleLabel = UILabel(frame: CGRect(x: 20, y: 20, width: viewInner.frame.width - 40, height: 20))
titleLabel.font = UIFont(name: "BTCosmo-Bold", size: 20)
titleLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
titleLabel.text = "Αναλυτικά"
view.addSubview(viewBorder)
viewBorder.addSubview(viewInner)
viewInner.addSubview(titleLabel)
return view
} else {
return nil
}
} else {
return nil
}
}
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if (section == 0) {
return 0.0
} else if (section == 1) {
if (self.items.count > 0) {
return 50.0
} else {
return 0.0
}
} else {
return 0.0
}
}
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// return CGFloat.leastNormalMagnitude
if (section == 1 && self.items.count > 0) {
return 20.0
} else {
return 0.0
}
}
override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if (section == 1) {
if (self.items.count > 0) {
let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 30))
let viewBorder = UIView(frame: CGRect(x: 10, y: 0, width: view.frame.width-20, height: view.frame.height))
viewBorder.backgroundColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00)
viewBorder.layer.cornerRadius = 16.5
viewBorder.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius
let viewInner = UIView(frame: CGRect(x: 1, y: 0, width: viewBorder.frame.width-2, height: viewBorder.frame.height-1))
viewInner.backgroundColor = .white
viewInner.layer.cornerRadius = 16.5
viewInner.layer.maskedCorners = [ .layerMinXMaxYCorner, .layerMaxXMaxYCorner] // bottom left, bottom right corner radius
view.addSubview(viewBorder)
viewBorder.addSubview(viewInner)
return view
} else {
return nil
}
} else {
return nil
}
}
}
......
......@@ -31,18 +31,18 @@ import SwiftEventBus
setNavigationTitle("Ανάλυση")
// tab
leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14)
leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
leftButton.setTitle("Εξαργυρωμένα", for:.normal)
leftButton.backgroundColor = . clear
leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal)
rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14)
rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SemiBold", size: 15)
rightButton.setTitle("Μοιρασμένα δώρα", for:.normal)
rightButton.backgroundColor = . clear
rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal)
rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal)
leftLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0)
rightLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0)
// leftLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0)
// rightLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0)
leftLineView.isHidden = false
rightLineView.isHidden = true
......@@ -141,11 +141,11 @@ import SwiftEventBus
self.leftLineView.isHidden = false
self.rightLineView.isHidden = true
self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14)
self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14)
self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SemiBold", size: 15)
self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal)
self.leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal)
self.rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal)
}
let analysisVC = self.viewControllerAt(0)
pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true)
......@@ -161,11 +161,11 @@ import SwiftEventBus
self.leftLineView.isHidden = true
self.rightLineView.isHidden = false
self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14)
self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14)
self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SemiBold", size: 15)
self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal)
self.rightButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal)
self.leftButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal)
}
let analysisVC = self.viewControllerAt(1)
pageController.setViewControllers([analysisVC!], direction:.forward, animated:true)
......@@ -213,23 +213,22 @@ extension LoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageV
return;
}
if let childVCs = pageViewController.viewControllers as? [AnalysisChildViewController] {
let currentIndex = childVCs[0].index
if (currentIndex == 0) {
self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14)
self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14)
self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal)
self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-SemiBold", size: 15)
self.leftButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal)
self.rightButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal)
self.tabSelected = 0
self.leftLineView.isHidden = false
self.rightLineView.isHidden = true
} else {
self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14)
self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14)
self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal)
self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal)
self.leftButton.titleLabel?.font = UIFont(name: "PeridotPE-SemiBold", size: 15)
self.rightButton.titleLabel?.font = UIFont(name: "PeridotPE-Bold", size: 15)
self.rightButton.setTitleColor(UIColor(rgb: 0x212121), for:.normal)
self.leftButton.setTitleColor(UIColor(rgb: 0x848484), for:.normal)
self.tabSelected = 1
self.leftLineView.isHidden = true
self.rightLineView.isHidden = false
......
......@@ -5417,11 +5417,11 @@ public class swiftApi {
}
}
// Example "date": "Thu, Jun 23 2022 16:24:44",
// Example "date": "Mon, 28 Nov 2022 10:58:13 GMT"
let dateString = dictionary["date"] as? String? ?? ""
let dateFormatter = DateFormatter()
dateFormatter.locale = Locale(identifier: "en_US_POSSIX")
dateFormatter.dateFormat = "E, MMM dd yyyy HH:mm:ss"
dateFormatter.dateFormat = "E, dd MMM yyyy HH:mm:ss 'GMT'"
if let date = dateFormatter.date(from: dateString ?? "") {
dateFormatter.dateFormat = "dd/MM/yyyy"
let resultString = dateFormatter.string(from: date)
......