Showing
12 changed files
with
567 additions
and
8 deletions
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>1</integer> | 10 | + <integer>0</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
| ... | @@ -14,6 +14,8 @@ | ... | @@ -14,6 +14,8 @@ |
| 14 | 1E108A9628A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */; }; | 14 | 1E108A9628A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1E108A9128A3F9280008B8E7 /* pf_square_sans_pro_bold.ttf */; }; |
| 15 | 1E151F1829DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E151F1729DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift */; }; | 15 | 1E151F1829DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E151F1729DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift */; }; |
| 16 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */; }; | 16 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */; }; |
| 17 | + 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */; }; | ||
| 18 | + 1E15B9A429DDD211000A408D /* MarketHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */; }; | ||
| 17 | 1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; }; | 19 | 1E2966EA2837A21D00F83FAC /* RSBarcodes_Swift in Frameworks */ = {isa = PBXBuildFile; productRef = 1E2966E92837A21D00F83FAC /* RSBarcodes_Swift */; }; |
| 18 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; }; | 20 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E4410B028F5855000859F92 /* CampaignCategory.swift */; }; |
| 19 | 1E479FB329DD948B00C38193 /* WalletBadgesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */; }; | 21 | 1E479FB329DD948B00C38193 /* WalletBadgesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */; }; |
| ... | @@ -22,6 +24,7 @@ | ... | @@ -22,6 +24,7 @@ |
| 22 | 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; }; | 24 | 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */; }; |
| 23 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; }; | 25 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */; }; |
| 24 | 1EA771AC290977CA0030924C /* CopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA771AB290977CA0030924C /* CopyableLabel.swift */; }; | 26 | 1EA771AC290977CA0030924C /* CopyableLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EA771AB290977CA0030924C /* CopyableLabel.swift */; }; |
| 27 | + 1EAEFC7A29DDCAF500114A1C /* MarketLoyaltyAnalysisViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EAEFC7929DDCAF500114A1C /* MarketLoyaltyAnalysisViewController.swift */; }; | ||
| 25 | 1EB236AB28816B680063777A /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AA28816B680063777A /* ShareViewController.swift */; }; | 28 | 1EB236AB28816B680063777A /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AA28816B680063777A /* ShareViewController.swift */; }; |
| 26 | 1EB236AD28816C560063777A /* NumberPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AC28816C560063777A /* NumberPopupViewController.swift */; }; | 29 | 1EB236AD28816C560063777A /* NumberPopupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AC28816C560063777A /* NumberPopupViewController.swift */; }; |
| 27 | 1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */; }; | 30 | 1EB236AF28816CAC0063777A /* NumbersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */; }; |
| ... | @@ -182,6 +185,8 @@ | ... | @@ -182,6 +185,8 @@ |
| 182 | 1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; | 185 | 1E108A9728A3FA9B0008B8E7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; }; |
| 183 | 1E151F1729DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnifiedCouponsTableViewCell.swift; sourceTree = "<group>"; }; | 186 | 1E151F1729DAE48500951FA0 /* UnifiedCouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnifiedCouponsTableViewCell.swift; sourceTree = "<group>"; }; |
| 184 | 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveCodeTableViewCell.swift; sourceTree = "<group>"; }; | 187 | 1E151F1929DAE4D500951FA0 /* ActiveCodeTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActiveCodeTableViewCell.swift; sourceTree = "<group>"; }; |
| 188 | + 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketSharingHistoryViewController.swift; sourceTree = "<group>"; }; | ||
| 189 | + 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketHistoryViewController.swift; sourceTree = "<group>"; }; | ||
| 185 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; }; | 190 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CampaignCategory.swift; sourceTree = "<group>"; }; |
| 186 | 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletBadgesTableViewCell.swift; sourceTree = "<group>"; }; | 191 | 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletBadgesTableViewCell.swift; sourceTree = "<group>"; }; |
| 187 | 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; }; | 192 | 1E74838C28378AF40042A589 /* CouponBarcodeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponBarcodeViewController.swift; sourceTree = "<group>"; }; |
| ... | @@ -189,6 +194,7 @@ | ... | @@ -189,6 +194,7 @@ |
| 189 | 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; }; | 194 | 1EA1AF092835346A008998AA /* CouponsTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CouponsTableViewCell.swift; sourceTree = "<group>"; }; |
| 190 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; }; | 195 | 1EA2BB782865BFE8003F2AB0 /* InboxTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxTableViewCell.swift; sourceTree = "<group>"; }; |
| 191 | 1EA771AB290977CA0030924C /* CopyableLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyableLabel.swift; sourceTree = "<group>"; }; | 196 | 1EA771AB290977CA0030924C /* CopyableLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopyableLabel.swift; sourceTree = "<group>"; }; |
| 197 | + 1EAEFC7929DDCAF500114A1C /* MarketLoyaltyAnalysisViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MarketLoyaltyAnalysisViewController.swift; sourceTree = "<group>"; }; | ||
| 192 | 1EB236AA28816B680063777A /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; }; | 198 | 1EB236AA28816B680063777A /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; }; |
| 193 | 1EB236AC28816C560063777A /* NumberPopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberPopupViewController.swift; sourceTree = "<group>"; }; | 199 | 1EB236AC28816C560063777A /* NumberPopupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumberPopupViewController.swift; sourceTree = "<group>"; }; |
| 194 | 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersTableViewCell.swift; sourceTree = "<group>"; }; | 200 | 1EB236AE28816CAB0063777A /* NumbersTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NumbersTableViewCell.swift; sourceTree = "<group>"; }; |
| ... | @@ -452,6 +458,7 @@ | ... | @@ -452,6 +458,7 @@ |
| 452 | E6A77850282933340045BBA8 /* SwiftWarplyFramework */ = { | 458 | E6A77850282933340045BBA8 /* SwiftWarplyFramework */ = { |
| 453 | isa = PBXGroup; | 459 | isa = PBXGroup; |
| 454 | children = ( | 460 | children = ( |
| 461 | + 1E15B9A329DDD211000A408D /* MarketHistoryViewController.swift */, | ||
| 455 | 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */, | 462 | 1EBC75422922829D004FBE75 /* SpinnerViewController.swift */, |
| 456 | 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */, | 463 | 1ECA079028D9E3BA00D2BDE0 /* CSMButton.swift */, |
| 457 | 1E108A9728A3FA9B0008B8E7 /* Info.plist */, | 464 | 1E108A9728A3FA9B0008B8E7 /* Info.plist */, |
| ... | @@ -477,6 +484,8 @@ | ... | @@ -477,6 +484,8 @@ |
| 477 | E6A77A35282BB4CB0045BBA8 /* MakeItAPresentViewController.swift */, | 484 | E6A77A35282BB4CB0045BBA8 /* MakeItAPresentViewController.swift */, |
| 478 | E6A7785A282933E40045BBA8 /* Helpers */, | 485 | E6A7785A282933E40045BBA8 /* Helpers */, |
| 479 | E6A77861282933E50045BBA8 /* Main.storyboard */, | 486 | E6A77861282933E50045BBA8 /* Main.storyboard */, |
| 487 | + 1E15B9A129DDCF02000A408D /* MarketSharingHistoryViewController.swift */, | ||
| 488 | + 1EAEFC7929DDCAF500114A1C /* MarketLoyaltyAnalysisViewController.swift */, | ||
| 480 | 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */, | 489 | 1E479FB229DD948B00C38193 /* WalletBadgesTableViewCell.swift */, |
| 481 | 1EA771AB290977CA0030924C /* CopyableLabel.swift */, | 490 | 1EA771AB290977CA0030924C /* CopyableLabel.swift */, |
| 482 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */, | 491 | 1E4410B028F5855000859F92 /* CampaignCategory.swift */, |
| ... | @@ -917,6 +926,7 @@ | ... | @@ -917,6 +926,7 @@ |
| 917 | E6A7793E282933E70045BBA8 /* AFHTTPSessionManager.m in Sources */, | 926 | E6A7793E282933E70045BBA8 /* AFHTTPSessionManager.m in Sources */, |
| 918 | E6A77933282933E70045BBA8 /* UIButton+AFNetworking.m in Sources */, | 927 | E6A77933282933E70045BBA8 /* UIButton+AFNetworking.m in Sources */, |
| 919 | E6A77919282933E60045BBA8 /* Warply.m in Sources */, | 928 | E6A77919282933E60045BBA8 /* Warply.m in Sources */, |
| 929 | + 1E15B9A429DDD211000A408D /* MarketHistoryViewController.swift in Sources */, | ||
| 920 | E6A77953282933E70045BBA8 /* MFYViewController.swift in Sources */, | 930 | E6A77953282933E70045BBA8 /* MFYViewController.swift in Sources */, |
| 921 | E6A7794B282933E70045BBA8 /* FMDatabase.m in Sources */, | 931 | E6A7794B282933E70045BBA8 /* FMDatabase.m in Sources */, |
| 922 | E6A778EC282933E60045BBA8 /* WLNativeVideoTableViewCell.m in Sources */, | 932 | E6A778EC282933E60045BBA8 /* WLNativeVideoTableViewCell.m in Sources */, |
| ... | @@ -933,6 +943,7 @@ | ... | @@ -933,6 +943,7 @@ |
| 933 | E6A77925282933E70045BBA8 /* UIProgressView+AFNetworking.m in Sources */, | 943 | E6A77925282933E70045BBA8 /* UIProgressView+AFNetworking.m in Sources */, |
| 934 | E6A77944282933E70045BBA8 /* AFSecurityPolicy.m in Sources */, | 944 | E6A77944282933E70045BBA8 /* AFSecurityPolicy.m in Sources */, |
| 935 | 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */, | 945 | 1EA1AF0A2835346A008998AA /* CouponsTableViewCell.swift in Sources */, |
| 946 | + 1EAEFC7A29DDCAF500114A1C /* MarketLoyaltyAnalysisViewController.swift in Sources */, | ||
| 936 | E6A77A32282BA9C60045BBA8 /* CampaignViewController.swift in Sources */, | 947 | E6A77A32282BA9C60045BBA8 /* CampaignViewController.swift in Sources */, |
| 937 | E6A77917282933E60045BBA8 /* UIViewController+WLAdditions.m in Sources */, | 948 | E6A77917282933E60045BBA8 /* UIViewController+WLAdditions.m in Sources */, |
| 938 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */, | 949 | 1EA2BB792865BFE8003F2AB0 /* InboxTableViewCell.swift in Sources */, |
| ... | @@ -967,6 +978,7 @@ | ... | @@ -967,6 +978,7 @@ |
| 967 | 1ECA079128D9E3BA00D2BDE0 /* CSMButton.swift in Sources */, | 978 | 1ECA079128D9E3BA00D2BDE0 /* CSMButton.swift in Sources */, |
| 968 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */, | 979 | 1E4410B128F5855000859F92 /* CampaignCategory.swift in Sources */, |
| 969 | E6A7790B282933E60045BBA8 /* WLPushManager.m in Sources */, | 980 | E6A7790B282933E60045BBA8 /* WLPushManager.m in Sources */, |
| 981 | + 1E15B9A229DDCF02000A408D /* MarketSharingHistoryViewController.swift in Sources */, | ||
| 970 | A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */, | 982 | A079366E2885D07700064122 /* AnalysisChildViewController.swift in Sources */, |
| 971 | E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */, | 983 | E6A77950282933E70045BBA8 /* FMResultSet.m in Sources */, |
| 972 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */, | 984 | 1E151F1A29DAE4D500951FA0 /* ActiveCodeTableViewCell.swift in Sources */, | ... | ... |
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
| 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> |
| 8 | <dict> | 8 | <dict> |
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> |
| 10 | - <integer>0</integer> | 10 | + <integer>1</integer> |
| 11 | </dict> | 11 | </dict> |
| 12 | </dict> | 12 | </dict> |
| 13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
| ... | @@ -22,7 +22,7 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { | ... | @@ -22,7 +22,7 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { |
| 22 | super.awakeFromNib() | 22 | super.awakeFromNib() |
| 23 | 23 | ||
| 24 | // image | 24 | // image |
| 25 | - itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 25 | +// itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 26 | 26 | ||
| 27 | // title | 27 | // title |
| 28 | titleLabel.textColor = UIColor(rgb: 0x435563) | 28 | titleLabel.textColor = UIColor(rgb: 0x435563) |
| ... | @@ -64,7 +64,7 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { | ... | @@ -64,7 +64,7 @@ class AnalysisHeaderMessageViewCell: UITableViewCell { |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | extension AnalysisHeaderMessageViewCell { | 66 | extension AnalysisHeaderMessageViewCell { |
| 67 | - func configureCell(isEmpty: Bool) { | 67 | + func configureCell(isEmpty: Bool, isMarket: Bool) { |
| 68 | 68 | ||
| 69 | if (isEmpty == true) { | 69 | if (isEmpty == true) { |
| 70 | emptyLabel.isHidden = false | 70 | emptyLabel.isHidden = false |
| ... | @@ -72,5 +72,11 @@ extension AnalysisHeaderMessageViewCell { | ... | @@ -72,5 +72,11 @@ extension AnalysisHeaderMessageViewCell { |
| 72 | emptyLabel.isHidden = true | 72 | emptyLabel.isHidden = true |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | + if (isMarket == true) { | ||
| 76 | + itemImage.image = UIImage(named: "ic_history_market", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 77 | + } else { | ||
| 78 | + itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 79 | + } | ||
| 80 | + | ||
| 75 | } | 81 | } |
| 76 | } | 82 | } | ... | ... |
| ... | @@ -19,7 +19,7 @@ class AnalysisHeaderViewCell: UITableViewCell { | ... | @@ -19,7 +19,7 @@ class AnalysisHeaderViewCell: UITableViewCell { |
| 19 | super.awakeFromNib() | 19 | super.awakeFromNib() |
| 20 | 20 | ||
| 21 | // image | 21 | // image |
| 22 | - itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 22 | +// itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 23 | 23 | ||
| 24 | // title | 24 | // title |
| 25 | titleLabel.textColor = UIColor(rgb: 0x435563) | 25 | titleLabel.textColor = UIColor(rgb: 0x435563) |
| ... | @@ -28,7 +28,7 @@ class AnalysisHeaderViewCell: UITableViewCell { | ... | @@ -28,7 +28,7 @@ class AnalysisHeaderViewCell: UITableViewCell { |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | extension AnalysisHeaderViewCell { | 30 | extension AnalysisHeaderViewCell { |
| 31 | - func configureCell(isEmpty: Bool) { | 31 | + func configureCell(isEmpty: Bool, isMarket: Bool) { |
| 32 | 32 | ||
| 33 | if (isEmpty == true) { | 33 | if (isEmpty == true) { |
| 34 | emptyLabel.isHidden = false | 34 | emptyLabel.isHidden = false |
| ... | @@ -36,5 +36,11 @@ extension AnalysisHeaderViewCell { | ... | @@ -36,5 +36,11 @@ extension AnalysisHeaderViewCell { |
| 36 | emptyLabel.isHidden = true | 36 | emptyLabel.isHidden = true |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | + if (isMarket == true) { | ||
| 40 | + itemImage.image = UIImage(named: "ic_history_market", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 41 | + } else { | ||
| 42 | + itemImage.image = UIImage(named: "ic_gift_circle_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 43 | + } | ||
| 44 | + | ||
| 39 | } | 45 | } |
| 40 | } | 46 | } | ... | ... |
| ... | @@ -118,7 +118,7 @@ class HistoryViewController: AnalysisChildViewController { | ... | @@ -118,7 +118,7 @@ class HistoryViewController: AnalysisChildViewController { |
| 118 | if (indexPath.section == 0) { | 118 | if (indexPath.section == 0) { |
| 119 | if (hasMessage) { | 119 | if (hasMessage) { |
| 120 | let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | 120 | let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell |
| 121 | - cell.configureCell(isEmpty: items.count == 0) | 121 | + cell.configureCell(isEmpty: items.count == 0, isMarket: false) |
| 122 | return cell | 122 | return cell |
| 123 | } | 123 | } |
| 124 | 124 | ... | ... |
This diff could not be displayed because it is too large.
| 1 | +// | ||
| 2 | +// MarketHistoryViewController.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Manos Chorianopoulos on 5/4/23. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | + | ||
| 10 | +class MarketHistoryViewController: AnalysisChildViewController { | ||
| 11 | + var loading: Bool = false | ||
| 12 | + var items: Array<swiftApi.CouponItemModel> = swiftApi().getOldCouponList() | ||
| 13 | + var showMore = false | ||
| 14 | + | ||
| 15 | + // TODO: remove this when configuring model | ||
| 16 | + let hasMessage = true | ||
| 17 | + | ||
| 18 | + // lifecycle | ||
| 19 | + override func viewDidLoad() { | ||
| 20 | + | ||
| 21 | + super.viewDidLoad() | ||
| 22 | + | ||
| 23 | + self.tableView.delegate = self | ||
| 24 | + self.tableView.dataSource = self | ||
| 25 | + | ||
| 26 | + self.refreshControl = UIRefreshControl() | ||
| 27 | + self.refreshControl?.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) | ||
| 28 | + | ||
| 29 | + handleRefresh(self.refreshControl!) | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + // mvp | ||
| 33 | + @objc func load() { | ||
| 34 | + | ||
| 35 | + if (loading) { | ||
| 36 | + return; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + showLoading() | ||
| 40 | + | ||
| 41 | + items = swiftApi().getOldCouponList() | ||
| 42 | + | ||
| 43 | + self.showMore = (self.items.count > 3) | ||
| 44 | + | ||
| 45 | + if (self.showMore == true) { | ||
| 46 | + self.items = Array(self.items[0...2]) | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + showContent() | ||
| 50 | + self.tableView.reloadData() | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + private func showLoading() { | ||
| 54 | + | ||
| 55 | + loading = true | ||
| 56 | + if (self.refreshControl!.isRefreshing) { | ||
| 57 | + return; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + self.refreshControl!.beginRefreshing() | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + private func showError() { | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + private func showContent() { | ||
| 67 | + | ||
| 68 | + loading = false | ||
| 69 | + self.refreshControl!.endRefreshing() | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + // private | ||
| 73 | + func responseCallback (_ data: Array<swiftApi.CouponItemModel>?) -> Void { | ||
| 74 | + | ||
| 75 | + self.items = data! | ||
| 76 | + self.showMore = (self.items.count > 3) | ||
| 77 | + | ||
| 78 | + if (self.showMore == true) { | ||
| 79 | + self.items = Array(self.items[0...2]) | ||
| 80 | + } | ||
| 81 | + showContent() | ||
| 82 | + DispatchQueue.main.async { | ||
| 83 | + self.tableView.reloadData() | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @objc func handleRefresh(_ refreshControl: UIRefreshControl) { | ||
| 88 | + | ||
| 89 | + self.perform(_: #selector(load), with: nil, afterDelay: 0.5) | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + // MARK: - Table view data source | ||
| 93 | + override func numberOfSections(in tableView: UITableView) -> Int { | ||
| 94 | + return 2 | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 98 | + if (section == 0) { | ||
| 99 | + return 1 | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + if (self.showMore == true) { | ||
| 103 | + return 4 | ||
| 104 | + } | ||
| 105 | + return items.count | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 109 | + if (indexPath.section == 0) { | ||
| 110 | + return hasMessage ? (items.count > 0 ? 380.0 : 480.0) : 280 | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + return 140.0 | ||
| 114 | + } | ||
| 115 | + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 116 | + | ||
| 117 | + // header | ||
| 118 | + if (indexPath.section == 0) { | ||
| 119 | + if (hasMessage) { | ||
| 120 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | ||
| 121 | + cell.configureCell(isEmpty: items.count == 0, isMarket: true) | ||
| 122 | + return cell | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + if (self.showMore && indexPath.row == 3) { | ||
| 129 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisMoreViewCell | ||
| 130 | + return cell | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell | ||
| 134 | + cell.configureCell(item: items[indexPath.row]) | ||
| 135 | + | ||
| 136 | + return cell | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 140 | + if (indexPath.section == 0) { | ||
| 141 | + return | ||
| 142 | + } | ||
| 143 | + | ||
| 144 | + if (self.showMore && indexPath.row == 3) { | ||
| 145 | + self.items = swiftApi().getOldCouponList() | ||
| 146 | + self.showMore = false | ||
| 147 | + self.tableView.reloadData() | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | +} |
| 1 | +// | ||
| 2 | +// MarketLoyaltyAnalysisViewController.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Manos Chorianopoulos on 5/4/23. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | +import SwiftEventBus | ||
| 10 | + | ||
| 11 | +@objc public class MarketLoyaltyAnalysisViewController: UIViewController { | ||
| 12 | + | ||
| 13 | + @IBOutlet weak var leftButton: UIButton! | ||
| 14 | + @IBOutlet weak var rightButton: UIButton! | ||
| 15 | + @IBOutlet weak var leftLineView: UIView! | ||
| 16 | + @IBOutlet weak var rightLineView: UIView! | ||
| 17 | + @IBOutlet weak var contentView: UIView! | ||
| 18 | + | ||
| 19 | + var pageController: UIPageViewController! | ||
| 20 | + var tabSelected = 0 | ||
| 21 | + | ||
| 22 | + var timerHistory: DispatchSourceTimer? | ||
| 23 | + var seconds: Int = 0 | ||
| 24 | + | ||
| 25 | + public override func viewDidLoad() { | ||
| 26 | + super.viewDidLoad() | ||
| 27 | + | ||
| 28 | + self.hidesBottomBarWhenPushed = true | ||
| 29 | + | ||
| 30 | + // setup view | ||
| 31 | + setBackButton() | ||
| 32 | + setNavigationTitle("Ανάλυση") | ||
| 33 | + | ||
| 34 | + // tab | ||
| 35 | + leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | ||
| 36 | + leftButton.setTitle("Εξαργυρωμένα", for:.normal) | ||
| 37 | + leftButton.backgroundColor = . clear | ||
| 38 | + leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 39 | + | ||
| 40 | + rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14) | ||
| 41 | + rightButton.setTitle("Μοιρασμένα δώρα", for:.normal) | ||
| 42 | + rightButton.backgroundColor = . clear | ||
| 43 | + rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 44 | + | ||
| 45 | + leftLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
| 46 | + rightLineView.applyGradient(colours: [UIColor(rgb: 0x1DA6B9), UIColor(rgb: 0xB2CE69)], gradient: GradientOrientation.horizontal, cornerRadius: 0.0) | ||
| 47 | + | ||
| 48 | + leftLineView.isHidden = false | ||
| 49 | + rightLineView.isHidden = true | ||
| 50 | + | ||
| 51 | + // pages | ||
| 52 | + pageController = UIPageViewController(transitionStyle:.scroll, navigationOrientation:.horizontal) | ||
| 53 | + pageController.dataSource = self; | ||
| 54 | + pageController.delegate = self; | ||
| 55 | + | ||
| 56 | + pageController.view.frame = contentView.bounds; | ||
| 57 | + addChild(pageController) | ||
| 58 | + contentView.addSubview(pageController.view) | ||
| 59 | + pageController .didMove(toParent: self) | ||
| 60 | + | ||
| 61 | + let analysisVC = self.viewControllerAt(0) | ||
| 62 | + pageController.setViewControllers([analysisVC!], direction:.forward, animated:false) | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public override func viewWillAppear(_ animated: Bool) { | ||
| 66 | + super.viewWillAppear(animated) | ||
| 67 | + | ||
| 68 | + swiftApi().logTrackersEvent("screen", "LoyaltyHistoryScreen") | ||
| 69 | + | ||
| 70 | + self.startTimer() | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public override func viewWillDisappear(_ animated: Bool) { | ||
| 74 | + super.viewWillDisappear(animated) | ||
| 75 | + | ||
| 76 | + self.stopTimer() | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + // MARK: - Functions | ||
| 80 | + func startTimer() { | ||
| 81 | + print("========= GiftsCalculator Timer Started! =========") | ||
| 82 | + | ||
| 83 | + let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".history.timer") | ||
| 84 | + timerHistory = DispatchSource.makeTimerSource(queue: queue) | ||
| 85 | + timerHistory!.schedule(deadline: .now(), repeating: .seconds(1)) | ||
| 86 | + timerHistory!.setEventHandler { [weak self] in | ||
| 87 | + // do whatever stuff you want on the background queue here here | ||
| 88 | + print("========= GiftsCalculator interval! =========") | ||
| 89 | + | ||
| 90 | + DispatchQueue.main.async { | ||
| 91 | + // update your model objects and/or UI here | ||
| 92 | + self?.seconds = (self?.seconds ?? 0) + 1 | ||
| 93 | + | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + timerHistory!.resume() | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + func stopTimer() { | ||
| 100 | + print("========= GiftsCalculator Timer Stopped! =========") | ||
| 101 | + timerHistory?.cancel() | ||
| 102 | + timerHistory = nil | ||
| 103 | + | ||
| 104 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
| 105 | + firebaseEvent._eventName = "time_spent_on_loyalty_sdk" | ||
| 106 | + firebaseEvent.setParameter = ("name", "GiftsCalculator") | ||
| 107 | + firebaseEvent.setParameter = ("seconds", String(seconds)) | ||
| 108 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
| 109 | + | ||
| 110 | + seconds = 0 | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + //////////////////////////////////////////////////////////////////////////////// | ||
| 114 | + private func viewControllerAt(_ index:Int) -> AnalysisChildViewController? | ||
| 115 | + { | ||
| 116 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 117 | + | ||
| 118 | + if (index == 1) { | ||
| 119 | + swiftApi().logTrackersEvent("click", ("LoyaltyHistoryScreen:" + "TabShared")) | ||
| 120 | + | ||
| 121 | + let analysisVC = storyboard.instantiateViewController(withIdentifier:"SharingHistoryViewController") as! SwiftWarplyFramework.SharingHistoryViewController | ||
| 122 | + analysisVC.index = index; | ||
| 123 | + | ||
| 124 | + return analysisVC; | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + swiftApi().logTrackersEvent("click", ("LoyaltyHistoryScreen:" + "TabExpired")) | ||
| 128 | + | ||
| 129 | + let analysisVC = storyboard.instantiateViewController(withIdentifier:"HistoryViewController") as! SwiftWarplyFramework.HistoryViewController | ||
| 130 | + analysisVC.index = index; | ||
| 131 | + | ||
| 132 | + return analysisVC; | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + // MARK: - Handlers | ||
| 136 | + @IBAction func handleLeft() { | ||
| 137 | + if (tabSelected != 0) { | ||
| 138 | + self.tabSelected = 0 | ||
| 139 | + | ||
| 140 | + UIView.animate(withDuration: 2.0, delay: 0.0) { | ||
| 141 | + | ||
| 142 | + self.leftLineView.isHidden = false | ||
| 143 | + self.rightLineView.isHidden = true | ||
| 144 | + | ||
| 145 | + self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | ||
| 146 | + self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14) | ||
| 147 | + | ||
| 148 | + self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 149 | + self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 150 | + } | ||
| 151 | + let analysisVC = self.viewControllerAt(0) | ||
| 152 | + pageController.setViewControllers([analysisVC!], direction:.reverse, animated:true) | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + @IBAction func handleRight() { | ||
| 157 | + if (tabSelected != 1) { | ||
| 158 | + self.tabSelected = 1 | ||
| 159 | + | ||
| 160 | + UIView.animate(withDuration: 2.0, delay: 0.0) { | ||
| 161 | + | ||
| 162 | + self.leftLineView.isHidden = true | ||
| 163 | + self.rightLineView.isHidden = false | ||
| 164 | + | ||
| 165 | + self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14) | ||
| 166 | + self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | ||
| 167 | + | ||
| 168 | + self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 169 | + self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 170 | + } | ||
| 171 | + let analysisVC = self.viewControllerAt(1) | ||
| 172 | + pageController.setViewControllers([analysisVC!], direction:.forward, animated:true) | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +// MARK: - PageViewController | ||
| 178 | +extension MarketLoyaltyAnalysisViewController: UIPageViewControllerDataSource, UIPageViewControllerDelegate { | ||
| 179 | + | ||
| 180 | + public func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { | ||
| 181 | + | ||
| 182 | + if let analysisVC = viewController as? AnalysisChildViewController { | ||
| 183 | + var index = analysisVC.index | ||
| 184 | + if (index == 0) { | ||
| 185 | + return nil; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + index -= 1; | ||
| 189 | + return viewControllerAt(index); | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + return nil; | ||
| 193 | + } | ||
| 194 | + | ||
| 195 | + public func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { | ||
| 196 | + | ||
| 197 | + if let analysisVC = viewController as? AnalysisChildViewController { | ||
| 198 | + var index = analysisVC.index | ||
| 199 | + if (index == 1) { | ||
| 200 | + return nil; | ||
| 201 | + } | ||
| 202 | + | ||
| 203 | + index += 1; | ||
| 204 | + return viewControllerAt(index); | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + return nil; | ||
| 208 | + } | ||
| 209 | + | ||
| 210 | + | ||
| 211 | + public func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { | ||
| 212 | + | ||
| 213 | + if (!completed) { | ||
| 214 | + return; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + | ||
| 218 | + if let childVCs = pageViewController.viewControllers as? [AnalysisChildViewController] { | ||
| 219 | + let currentIndex = childVCs[0].index | ||
| 220 | + if (currentIndex == 0) { | ||
| 221 | + self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | ||
| 222 | + self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14) | ||
| 223 | + self.leftButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 224 | + self.rightButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 225 | + self.tabSelected = 0 | ||
| 226 | + self.leftLineView.isHidden = false | ||
| 227 | + self.rightLineView.isHidden = true | ||
| 228 | + | ||
| 229 | + } else { | ||
| 230 | + self.leftButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Regular", size: 14) | ||
| 231 | + self.rightButton.titleLabel?.font = UIFont(name: "PFSquareSansPro-Bold", size: 14) | ||
| 232 | + self.rightButton.setTitleColor(UIColor(rgb: 0x2EAFB9), for:.normal) | ||
| 233 | + self.leftButton.setTitleColor(UIColor(rgb: 0x394A5B), for:.normal) | ||
| 234 | + self.tabSelected = 1 | ||
| 235 | + self.leftLineView.isHidden = true | ||
| 236 | + self.rightLineView.isHidden = false | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | +} |
| 1 | +// | ||
| 2 | +// MarketSharingHistoryViewController.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Manos Chorianopoulos on 5/4/23. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import UIKit | ||
| 9 | + | ||
| 10 | +class MarketSharingHistoryViewController: AnalysisChildViewController { | ||
| 11 | + | ||
| 12 | + var loading: Bool = false | ||
| 13 | + var items: Array<swiftApi.SharingCouponModel> = Array() | ||
| 14 | + var allItems: Array<swiftApi.SharingCouponModel> = Array() | ||
| 15 | + var showMore = false | ||
| 16 | + | ||
| 17 | + // TODO: remove this when configuring model | ||
| 18 | + let hasMessage = false | ||
| 19 | + | ||
| 20 | + // lifecycle | ||
| 21 | + override func viewDidLoad() { | ||
| 22 | + | ||
| 23 | + super.viewDidLoad() | ||
| 24 | + | ||
| 25 | + self.tableView.delegate = self | ||
| 26 | + self.tableView.dataSource = self | ||
| 27 | + | ||
| 28 | + self.refreshControl = UIRefreshControl() | ||
| 29 | + self.refreshControl?.addTarget(self, action: #selector(handleRefresh(_:)), for: .valueChanged) | ||
| 30 | + | ||
| 31 | + handleRefresh(self.refreshControl!) | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + // mvp | ||
| 35 | + @objc func load() { | ||
| 36 | + | ||
| 37 | + if (loading) { | ||
| 38 | + return; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + showLoading() | ||
| 42 | + | ||
| 43 | + swiftApi().getSharingHistoryAsync(responseCallback, failureCallback: {errorCode in }) | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + private func showLoading() { | ||
| 47 | + | ||
| 48 | + loading = true | ||
| 49 | + if (self.refreshControl!.isRefreshing) { | ||
| 50 | + return; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + self.refreshControl!.beginRefreshing() | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + private func showError() { | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + private func showContent() { | ||
| 60 | + | ||
| 61 | + loading = false | ||
| 62 | + self.refreshControl!.endRefreshing() | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + // private | ||
| 66 | + func responseCallback (_ data: Array<swiftApi.SharingCouponModel>?) -> Void { | ||
| 67 | + | ||
| 68 | + self.items = data! | ||
| 69 | + self.allItems = data! | ||
| 70 | + self.showMore = (self.items.count > 3) | ||
| 71 | + | ||
| 72 | + if (self.showMore == true) { | ||
| 73 | + self.items = Array(self.items[0...2]) | ||
| 74 | + } | ||
| 75 | + showContent() | ||
| 76 | + DispatchQueue.main.async { | ||
| 77 | + self.tableView.reloadData() | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @objc func handleRefresh(_ refreshControl: UIRefreshControl) { | ||
| 82 | + | ||
| 83 | + self.perform(_: #selector(load), with: nil, afterDelay: 0.5) | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + // MARK: - Table view data source | ||
| 87 | + override func numberOfSections(in tableView: UITableView) -> Int { | ||
| 88 | + return 2 | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 92 | + if (section == 0) { | ||
| 93 | + return 1; | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + if (self.showMore == true) { | ||
| 97 | + return 4 | ||
| 98 | + } | ||
| 99 | + return items.count | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 103 | + if (indexPath.section == 0) { | ||
| 104 | + return hasMessage ? 380.0 : (items.count > 0 ? 280 : 380) | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + return 140.0 | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 111 | + | ||
| 112 | + // header | ||
| 113 | + if (indexPath.section == 0) { | ||
| 114 | + if (hasMessage) { | ||
| 115 | + return tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderMessageViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderMessageViewCell | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | ||
| 119 | + cell.configureCell(isEmpty: items.count == 0, isMarket: true) | ||
| 120 | + return cell | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + if ((self.showMore == true) && (indexPath.row == 3)) { | ||
| 124 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisMoreViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisMoreViewCell | ||
| 125 | + return cell | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisItemViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisItemViewCell | ||
| 129 | + cell.configureCell(item: items[indexPath.row]) | ||
| 130 | + | ||
| 131 | + return cell | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 135 | + if (indexPath.section == 0) { | ||
| 136 | + return | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + if ((self.showMore == true) && (indexPath.row == 3)) { | ||
| 140 | + self.items = self.allItems | ||
| 141 | + self.showMore = false | ||
| 142 | + self.tableView.reloadData() | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | +} |
| ... | @@ -116,7 +116,7 @@ class SharingHistoryViewController: AnalysisChildViewController { | ... | @@ -116,7 +116,7 @@ class SharingHistoryViewController: AnalysisChildViewController { |
| 116 | } | 116 | } |
| 117 | 117 | ||
| 118 | let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell | 118 | let cell = tableView.dequeueReusableCell(withIdentifier: "AnalysisHeaderViewCell", for: indexPath) as! SwiftWarplyFramework.AnalysisHeaderViewCell |
| 119 | - cell.configureCell(isEmpty: items.count == 0) | 119 | + cell.configureCell(isEmpty: items.count == 0, isMarket: false) |
| 120 | return cell | 120 | return cell |
| 121 | } | 121 | } |
| 122 | 122 | ... | ... |
-
Please register or login to post a comment