Showing
3 changed files
with
28 additions
and
8 deletions
... | @@ -40,11 +40,21 @@ extension AnalysisItemViewCell { | ... | @@ -40,11 +40,21 @@ extension AnalysisItemViewCell { |
40 | let dateFormatter = DateFormatter() | 40 | let dateFormatter = DateFormatter() |
41 | dateFormatter.dateFormat = "dd-MM-yyyy" | 41 | dateFormatter.dateFormat = "dd-MM-yyyy" |
42 | 42 | ||
43 | -// dateLabel.text = dateFormatter.string(from: item.date) | 43 | + if let date = item.date { |
44 | + let dateString = dateFormatter.string(from: date) | ||
45 | + dateLabel.text = dateString | ||
46 | + } else { | ||
47 | + dateLabel.text = "" | ||
48 | + } | ||
49 | + | ||
44 | //itemImage.image = | 50 | //itemImage.image = |
45 | -// titleLabel.text = item.name | 51 | + titleLabel.text = item.name |
46 | -// priceLabel.text = String(format: "%.2f€", item.discount) | 52 | + priceLabel.text = String(format: "%.2f€", item.discount) |
47 | -// subtitleLabel.text = item.subtitle | ||
48 | 53 | ||
54 | + if ("sent" == item.sharingType) { | ||
55 | + subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι προς @%", "69740000000") | ||
56 | + } else if ("received" == item.sharingType) { | ||
57 | + subtitleLabel.text = String(format: "Εκπτωτικό κουπόνι από @%", "69740000000") | ||
58 | + } | ||
49 | } | 59 | } |
50 | } | 60 | } | ... | ... |
... | @@ -34,6 +34,7 @@ class SharingHistoryViewController: AnalysisChildViewController { | ... | @@ -34,6 +34,7 @@ class SharingHistoryViewController: AnalysisChildViewController { |
34 | } | 34 | } |
35 | 35 | ||
36 | showLoading() | 36 | showLoading() |
37 | + | ||
37 | // TODO: Implement API call | 38 | // TODO: Implement API call |
38 | } | 39 | } |
39 | 40 | ... | ... |
... | @@ -457,18 +457,27 @@ public class swiftApi { | ... | @@ -457,18 +457,27 @@ public class swiftApi { |
457 | public class SharingCouponModel: Codable { | 457 | public class SharingCouponModel: Codable { |
458 | public let transactionMetadata: String? | 458 | public let transactionMetadata: String? |
459 | public let sharingType: String? | 459 | public let sharingType: String? |
460 | - public let discount: String? | 460 | + public let discount: Float |
461 | - public let date: String? | 461 | + public let date: Date? |
462 | public let couponsetUuid: String? | 462 | public let couponsetUuid: String? |
463 | public let name: String? | 463 | public let name: String? |
464 | 464 | ||
465 | public init(dictionary: [String: Any]) { | 465 | public init(dictionary: [String: Any]) { |
466 | self.transactionMetadata = dictionary["transaction_metadata"] as? String? ?? "" | 466 | self.transactionMetadata = dictionary["transaction_metadata"] as? String? ?? "" |
467 | self.sharingType = dictionary["sharing_type"] as? String? ?? "" | 467 | self.sharingType = dictionary["sharing_type"] as? String? ?? "" |
468 | - self.discount = dictionary["discount"] as? String? ?? "" | 468 | + self.discount = dictionary["discount"] as? Float ?? 0.0 |
469 | - self.date = dictionary["date"] as? String? ?? "" | ||
470 | self.couponsetUuid = dictionary["couponsetUuid"] as? String? ?? "" | 469 | self.couponsetUuid = dictionary["couponsetUuid"] as? String? ?? "" |
471 | self.name = dictionary["name"] as? String? ?? "" | 470 | self.name = dictionary["name"] as? String? ?? "" |
471 | + | ||
472 | + let dateString = dictionary["date"] as? String? ?? "" | ||
473 | + | ||
474 | + let dateFormatter = DateFormatter() | ||
475 | + dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" | ||
476 | + if let date = dateFormatter.date(from: dateString ?? "") { | ||
477 | + self.date = date | ||
478 | + } else { | ||
479 | + self.date = nil | ||
480 | + } | ||
472 | } | 481 | } |
473 | } | 482 | } |
474 | 483 | ... | ... |
-
Please register or login to post a comment