Showing
11 changed files
with
167 additions
and
3 deletions
No preview for this file type
| ... | @@ -13,6 +13,7 @@ | ... | @@ -13,6 +13,7 @@ |
| 13 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; }; | 13 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; }; |
| 14 | 1EB5F4C828536FD60016F36E /* StepsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C728536FD60016F36E /* StepsViewController.swift */; }; | 14 | 1EB5F4C828536FD60016F36E /* StepsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C728536FD60016F36E /* StepsViewController.swift */; }; |
| 15 | 1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */; }; | 15 | 1EB5F4CA285370C90016F36E /* LoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */; }; |
| 16 | + 1EBE97212865EE460080EFF7 /* MFYInboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */; }; | ||
| 16 | 1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; }; | 17 | 1EBF5F072840E13F00B8B17F /* SwiftEventBus in Frameworks */ = {isa = PBXBuildFile; productRef = 1EBF5F062840E13F00B8B17F /* SwiftEventBus */; }; |
| 17 | 7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; }; | 18 | 7630AD9A6242D60846D6750C /* Pods_SwiftWarplyFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */; }; |
| 18 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; | 19 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; |
| ... | @@ -149,6 +150,7 @@ | ... | @@ -149,6 +150,7 @@ |
| 149 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; }; | 150 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; }; |
| 150 | 1EB5F4C728536FD60016F36E /* StepsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewController.swift; sourceTree = "<group>"; }; | 151 | 1EB5F4C728536FD60016F36E /* StepsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepsViewController.swift; sourceTree = "<group>"; }; |
| 151 | 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; }; | 152 | 1EB5F4C9285370C90016F36E /* LoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyAnalysisViewController.swift; sourceTree = "<group>"; }; |
| 153 | + 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFYInboxTableViewCell.swift; sourceTree = "<group>"; }; | ||
| 152 | A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; }; | 154 | A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; }; |
| 153 | B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; }; | 155 | B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; }; |
| 154 | C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWarplyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; | 156 | C0D5F56DD4E5371A50AD2D87 /* Pods_SwiftWarplyFramework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SwiftWarplyFramework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; |
| ... | @@ -340,6 +342,7 @@ | ... | @@ -340,6 +342,7 @@ |
| 340 | E6A77863282933E50045BBA8 /* DetailsViewController.swift */, | 342 | E6A77863282933E50045BBA8 /* DetailsViewController.swift */, |
| 341 | E6A778DE282933E60045BBA8 /* GiftsViewController.swift */, | 343 | E6A778DE282933E60045BBA8 /* GiftsViewController.swift */, |
| 342 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */, | 344 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */, |
| 345 | + 1EBE97202865EE460080EFF7 /* MFYInboxTableViewCell.swift */, | ||
| 343 | E6A778DB282933E60045BBA8 /* MFYViewController.swift */, | 346 | E6A778DB282933E60045BBA8 /* MFYViewController.swift */, |
| 344 | E6A7785F282933E40045BBA8 /* WalletViewController.swift */, | 347 | E6A7785F282933E40045BBA8 /* WalletViewController.swift */, |
| 345 | E6A77A31282BA9C60045BBA8 /* CampaignViewController.swift */, | 348 | E6A77A31282BA9C60045BBA8 /* CampaignViewController.swift */, |
| ... | @@ -791,6 +794,7 @@ | ... | @@ -791,6 +794,7 @@ |
| 791 | E6A778ED282933E60045BBA8 /* WLCustomNativeCollectionViewCell.m in Sources */, | 794 | E6A778ED282933E60045BBA8 /* WLCustomNativeCollectionViewCell.m in Sources */, |
| 792 | E6A7790D282933E60045BBA8 /* WLLocationManager.m in Sources */, | 795 | E6A7790D282933E60045BBA8 /* WLLocationManager.m in Sources */, |
| 793 | E6A7793D282933E70045BBA8 /* AFURLResponseSerialization.m in Sources */, | 796 | E6A7793D282933E70045BBA8 /* AFURLResponseSerialization.m in Sources */, |
| 797 | + 1EBE97212865EE460080EFF7 /* MFYInboxTableViewCell.swift in Sources */, | ||
| 794 | E6A778FD282933E60045BBA8 /* WLInboxItem.m in Sources */, | 798 | E6A778FD282933E60045BBA8 /* WLInboxItem.m in Sources */, |
| 795 | E6A778EE282933E60045BBA8 /* WLNativeAdsTableMode.m in Sources */, | 799 | E6A778EE282933E60045BBA8 /* WLNativeAdsTableMode.m in Sources */, |
| 796 | E6A778DF282933E60045BBA8 /* WarplyReactMethods.m in Sources */, | 800 | E6A778DF282933E60045BBA8 /* WarplyReactMethods.m in Sources */, | ... | ... |
No preview for this file type
| 1 | +// | ||
| 2 | +// MFYInboxTableViewCell.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Manos Chorianopoulos on 24/6/22. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | + | ||
| 10 | +@objc public class MFYInboxTableViewCell: UITableViewCell { | ||
| 11 | + @IBOutlet weak var inboxView: UIView! | ||
| 12 | + @IBOutlet weak var campaignImage: UIImageView! | ||
| 13 | + @IBOutlet weak var newBadgeImage: UIImageView! | ||
| 14 | + @IBOutlet weak var campaignTitleLabel: UILabel! | ||
| 15 | + @IBOutlet weak var curvedBgImage: UIImageView! | ||
| 16 | + @IBOutlet weak var subtitleLabel: UILabel! | ||
| 17 | + @IBOutlet weak var descriptionLabel: UILabel! | ||
| 18 | + | ||
| 19 | + public override func awakeFromNib() { | ||
| 20 | + super.awakeFromNib() | ||
| 21 | + | ||
| 22 | + inboxView.layer.cornerRadius = 5.0 | ||
| 23 | + inboxView.clipsToBounds = true | ||
| 24 | + | ||
| 25 | + newBadgeImage.image = UIImage(named: "new_icon", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil) | ||
| 26 | + curvedBgImage.image = UIImage(named: "curved_bg_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil) | ||
| 27 | + | ||
| 28 | + newBadgeImage.isHidden = true | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public override func setSelected(_ selected: Bool, animated: Bool) { | ||
| 32 | + super.setSelected(selected, animated: animated) | ||
| 33 | + | ||
| 34 | + // Configure the view for the selected state | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public override func layoutSubviews() { | ||
| 38 | + super.layoutSubviews() | ||
| 39 | + //set the values for top,left,bottom,right margins | ||
| 40 | + let margins = UIEdgeInsets(top: 0, left: 0, bottom: 10, right: 0) | ||
| 41 | + contentView.frame = contentView.frame.inset(by: margins) | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + func configureCell(campaign: swiftApi.CampaignItemModel) { | ||
| 46 | + campaignImage.load(link: campaign.logo_url ?? "", placeholder: UIImage(), cache: URLCache()) | ||
| 47 | + | ||
| 48 | + campaignTitleLabel.text = campaign.title ?? "" | ||
| 49 | + subtitleLabel.text = campaign.subtitle ?? "" | ||
| 50 | + descriptionLabel.text = campaign.message ?? "" | ||
| 51 | + | ||
| 52 | + if (campaign.is_new ?? false) { | ||
| 53 | + newBadgeImage.isHidden = false | ||
| 54 | + } | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | +} |
| ... | @@ -9,9 +9,87 @@ import Foundation | ... | @@ -9,9 +9,87 @@ import Foundation |
| 9 | import UIKit | 9 | import UIKit |
| 10 | 10 | ||
| 11 | @objc public class MFYViewController: UIViewController { | 11 | @objc public class MFYViewController: UIViewController { |
| 12 | - public override func viewWillAppear(_ animated: Bool) { | 12 | + @IBOutlet weak var mainView: UIView! |
| 13 | - super.viewWillAppear(animated) | 13 | + @IBOutlet weak var tableView: UITableView! |
| 14 | + | ||
| 15 | + public var campaigns:Array<swiftApi.CampaignItemModel> = [] | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + public override func viewDidLoad() { | ||
| 19 | + super.viewDidLoad() | ||
| 20 | + | ||
| 21 | + getCampaignsRequest() | ||
| 22 | + | ||
| 14 | setBackButton() | 23 | setBackButton() |
| 15 | - setNavigationTitle("More for you") | 24 | + setNavigationTitle("MORE for YOU") |
| 25 | + | ||
| 26 | + tableView.delegate = self | ||
| 27 | + tableView.dataSource = self | ||
| 28 | + | ||
| 29 | + tableView.clipsToBounds = true | ||
| 30 | + tableView.layer.cornerRadius = 30 | ||
| 31 | + tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
| 32 | + tableView.contentInset.top = 50 | ||
| 33 | + | ||
| 34 | + // Add Top left corner radius | ||
| 35 | + mainView.clipsToBounds = true | ||
| 36 | + mainView.layer.cornerRadius = 30 | ||
| 37 | + mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
| 38 | + mainView.backgroundColor = UIColor(red: 0.22, green: 0.32, blue: 0.40, alpha: 1.00) | ||
| 39 | + | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + func getCampaignsRequest() { | ||
| 44 | + swiftApi().getCampaignsAsync(getCampaignsCallback) | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | ||
| 48 | + if (campaignsData != nil) { | ||
| 49 | + | ||
| 50 | + self.campaigns = campaignsData?.filter { $0.offer_category == "more_for_you" } ?? [] | ||
| 51 | + | ||
| 52 | + DispatchQueue.main.async { | ||
| 53 | + self.tableView.reloadData() | ||
| 54 | + swiftApi().setUniqueCampaignList(campaignsData ?? []) | ||
| 55 | + } | ||
| 56 | + } else { | ||
| 57 | + self.campaigns = [] | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +// MARK: - TableView | ||
| 63 | +extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ||
| 64 | + | ||
| 65 | + public func numberOfSections(in tableView: UITableView) -> Int { | ||
| 66 | + return 1 | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 70 | + return self.campaigns.count | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 74 | + return 220.0 + 10.0 | ||
| 75 | +// return UITableViewAutomaticDimension | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 79 | + let cell = tableView.dequeueReusableCell(withIdentifier: "MFYInboxTableViewCellId", for: indexPath) as! MFYInboxTableViewCell | ||
| 80 | + | ||
| 81 | + cell.configureCell(campaign: campaigns[indexPath.row]) | ||
| 82 | + | ||
| 83 | + return cell | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 87 | + | ||
| 88 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 89 | + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! CampaignViewController | ||
| 90 | + let url = swiftApi().constructCampaignUrl(campaigns[indexPath.row]) | ||
| 91 | + vc.campaignUrl = url | ||
| 92 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 16 | } | 93 | } |
| 94 | + | ||
| 17 | } | 95 | } | ... | ... |
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/Media.xcassets/curved_bg_white.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "filename" : "curved_bg_white.png", | ||
| 5 | + "idiom" : "universal", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "filename" : "curved_bg_white-1.png", | ||
| 10 | + "idiom" : "universal", | ||
| 11 | + "scale" : "2x" | ||
| 12 | + }, | ||
| 13 | + { | ||
| 14 | + "filename" : "curved_bg_white-2.png", | ||
| 15 | + "idiom" : "universal", | ||
| 16 | + "scale" : "3x" | ||
| 17 | + } | ||
| 18 | + ], | ||
| 19 | + "info" : { | ||
| 20 | + "author" : "xcode", | ||
| 21 | + "version" : 1 | ||
| 22 | + } | ||
| 23 | +} |
3.3 KB
3.3 KB
3.3 KB
| ... | @@ -391,6 +391,7 @@ public class swiftApi { | ... | @@ -391,6 +391,7 @@ public class swiftApi { |
| 391 | public let session_uuid: String? | 391 | public let session_uuid: String? |
| 392 | public let subcategory: String? | 392 | public let subcategory: String? |
| 393 | public let is_new: Bool? | 393 | public let is_new: Bool? |
| 394 | + public let message: String? | ||
| 394 | 395 | ||
| 395 | init(dictionary: [String: Any]) { | 396 | init(dictionary: [String: Any]) { |
| 396 | self.index_url = dictionary["index_url"] as? String? ?? "" | 397 | self.index_url = dictionary["index_url"] as? String? ?? "" |
| ... | @@ -400,6 +401,7 @@ public class swiftApi { | ... | @@ -400,6 +401,7 @@ public class swiftApi { |
| 400 | self.subtitle = dictionary["subtitle"] as? String? ?? "" | 401 | self.subtitle = dictionary["subtitle"] as? String? ?? "" |
| 401 | self.session_uuid = dictionary["session_uuid"] as? String? ?? "" | 402 | self.session_uuid = dictionary["session_uuid"] as? String? ?? "" |
| 402 | self.is_new = dictionary["is_new"] as? Bool? ?? false | 403 | self.is_new = dictionary["is_new"] as? Bool? ?? false |
| 404 | + self.message = dictionary["message"] as? String? ?? "" | ||
| 403 | 405 | ||
| 404 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] | 406 | // let extra_fields = dictionary["extra_fields"] as? [String: Any]? ?? ["":""] |
| 405 | let extra_fields = dictionary["extra_fields"] as AnyObject | 407 | let extra_fields = dictionary["extra_fields"] as AnyObject | ... | ... |
-
Please register or login to post a comment