Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_sdk_framework
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
Manos Chorianopoulos
2026-03-20 10:56:12 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0ac4706fd4a4aad163f4cf6ded33ff6f73994623
0ac4706f
1 parent
8cb2c7b3
CategoryOffers fixes part2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
66 deletions
SwiftWarplyFramework/SwiftWarplyFramework/cells/CategoryOfferCollectionViewCell/CategoryOfferCollectionViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/CategoryOffersGridTableViewCell/CategoryOffersGridTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CategoryOffersViewController/CategoryOffersViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/CategoryOfferCollectionViewCell/CategoryOfferCollectionViewCell.swift
View file @
0ac4706
...
...
@@ -22,8 +22,10 @@ public class CategoryOfferCollectionViewCell: UICollectionViewCell {
var
postImageURL
:
String
?
{
didSet
{
if
let
url
=
postImageURL
{
self
.
bannerImage
.
image
=
UIImage
()
self
.
bannerImage
.
image
=
UIImage
()
// UIImage(named: "loading")
UIImage
.
loadImageUsingCacheWithUrlString
(
url
)
{
image
in
// set the image only when we are still displaying the content for the image we finished downloading
if
url
==
self
.
postImageURL
{
self
.
bannerImage
.
image
=
image
}
...
...
@@ -37,8 +39,10 @@ public class CategoryOfferCollectionViewCell: UICollectionViewCell {
var
logoImageURL
:
String
?
{
didSet
{
if
let
url
=
logoImageURL
{
self
.
logoImage
.
image
=
UIImage
()
self
.
logoImage
.
image
=
UIImage
()
// UIImage(named: "loading")
UIImage
.
loadImageUsingCacheWithUrlString
(
url
)
{
image
in
// set the image only when we are still displaying the content for the image we finished downloading
if
url
==
self
.
logoImageURL
{
self
.
logoImage
.
image
=
image
}
...
...
@@ -57,57 +61,28 @@ public class CategoryOfferCollectionViewCell: UICollectionViewCell {
parentView
.
layer
.
cornerRadius
=
12.0
parentView
.
clipsToBounds
=
true
logoImage
.
layer
.
cornerRadius
=
8.0
logoImage
.
clipsToBounds
=
true
logoImage
.
backgroundColor
=
UIColor
(
rgb
:
0xEEEEEE
)
discountView
.
layer
.
cornerRadius
=
17.0
discountView
.
clipsToBounds
=
true
}
func
configureCell
(
data
:
OfferModel
)
{
bannerImage
.
image
=
UIImage
(
named
:
data
.
bannerImage
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
discountLabel
.
text
=
data
.
discount
discountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
14
)
discountLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
discountView
.
backgroundColor
=
UIColor
(
rgb
:
0xCBCBCB
)
merchantNameLabel
.
text
=
data
.
title
merchantNameLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
12
)
merchantNameLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
titleLabel
.
text
=
data
.
title
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
15
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
subtitleLabel
.
text
=
data
.
description
subtitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
13
)
subtitleLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
expirationLabel
.
text
=
data
.
expirationDate
expirationLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
12
)
expirationLabel
.
textColor
=
UIColor
(
rgb
:
0x9BA1A6
)
logoImage
.
image
=
UIImage
(
named
:
data
.
merchantLogo
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
func
configureCell
(
data
:
CouponSetItemModel
)
{
// Use coupon set preview image
self
.
postImageURL
=
data
.
_app_img_preview
// Use coupon set discount
discountLabel
.
text
=
data
.
_discount
discountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
14
)
discountLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
// discountView.backgroundColor = UIColor(rgb: discountColor)
discountView
.
backgroundColor
=
UIColor
(
rgb
:
0xCBCBCB
)
// Merchant name
if
let
merchant
=
data
.
_merchant
{
merchantNameLabel
.
text
=
merchant
.
_admin_name
self
.
logoImageURL
=
merchant
.
_img_preview
}
else
{
merchantNameLabel
.
text
=
""
self
.
logoImageURL
=
nil
}
merchantNameLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
12
)
merchantNameLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
...
...
@@ -122,5 +97,12 @@ public class CategoryOfferCollectionViewCell: UICollectionViewCell {
expirationLabel
.
text
=
"until "
+
data
.
formattedEndDate
(
format
:
"dd-MM"
)
expirationLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
12
)
expirationLabel
.
textColor
=
UIColor
(
rgb
:
0x9BA1A6
)
// Use merchant logo from bound merchant data
if
let
merchant
=
data
.
_merchant
,
!
merchant
.
_img_preview
.
isEmpty
{
self
.
logoImageURL
=
merchant
.
_img_preview
}
else
{
self
.
logoImageURL
=
nil
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/cells/CategoryOffersGridTableViewCell/CategoryOffersGridTableViewCell.swift
View file @
0ac4706
...
...
@@ -88,45 +88,26 @@ extension CategoryOffersGridTableViewCell: UICollectionViewDataSource, UICollect
guard
let
data
=
self
.
data
,
let
items
=
data
.
items
,
indexPath
.
row
<
items
.
count
else
{
indexPath
.
row
<
items
.
count
,
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
else
{
return
cell
}
switch
data
.
itemType
{
case
.
couponSets
:
if
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
{
cell
.
configureCell
(
data
:
couponSet
)
}
default
:
if
let
offer
=
items
[
indexPath
.
row
]
as?
OfferModel
{
cell
.
configureCell
(
data
:
offer
)
}
}
cell
.
configureCell
(
data
:
couponSet
)
return
cell
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
guard
let
data
=
self
.
data
,
let
items
=
data
.
items
,
indexPath
.
row
<
items
.
count
else
{
indexPath
.
row
<
items
.
count
,
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
else
{
return
}
switch
data
.
itemType
{
case
.
couponSets
:
if
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
{
let
vc
=
CouponsetViewController
(
nibName
:
"CouponsetViewController"
,
bundle
:
Bundle
.
frameworkResourceBundle
)
vc
.
couponset
=
couponSet
parentViewController
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
default
:
if
let
offer
=
items
[
indexPath
.
row
]
as?
OfferModel
{
let
vc
=
CouponViewController
(
nibName
:
"CouponViewController"
,
bundle
:
Bundle
.
frameworkResourceBundle
)
vc
.
offer
=
offer
parentViewController
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
let
vc
=
SwiftWarplyFramework
.
CouponsetViewController
(
nibName
:
"CouponsetViewController"
,
bundle
:
Bundle
.
frameworkBundle
)
vc
.
couponset
=
couponSet
parentViewController
?
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
layout
collectionViewLayout
:
UICollectionViewLayout
,
sizeForItemAt
indexPath
:
IndexPath
)
->
CGSize
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CategoryOffersViewController/CategoryOffersViewController.swift
View file @
0ac4706
...
...
@@ -31,11 +31,11 @@ import UIKit
tableView
.
rowHeight
=
UITableView
.
automaticDimension
tableView
.
register
(
UINib
(
nibName
:
"CategoryOffersHeaderTableViewCell"
,
bundle
:
Bundle
.
framework
Resource
Bundle
),
UINib
(
nibName
:
"CategoryOffersHeaderTableViewCell"
,
bundle
:
Bundle
.
frameworkBundle
),
forCellReuseIdentifier
:
"CategoryOffersHeaderTableViewCell"
)
tableView
.
register
(
UINib
(
nibName
:
"CategoryOffersGridTableViewCell"
,
bundle
:
Bundle
.
framework
Resource
Bundle
),
UINib
(
nibName
:
"CategoryOffersGridTableViewCell"
,
bundle
:
Bundle
.
frameworkBundle
),
forCellReuseIdentifier
:
"CategoryOffersGridTableViewCell"
)
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
0ac4706
...
...
@@ -804,7 +804,7 @@ extension MyRewardsViewController: MyRewardsOffersScrollTableViewCellDelegate {
}
func
didSelectAllOffers
(
_
section
:
SectionModel
)
{
let
vc
=
CategoryOffersViewController
(
nibName
:
"CategoryOffersViewController"
,
bundle
:
Bundle
.
framework
Resource
Bundle
)
let
vc
=
CategoryOffersViewController
(
nibName
:
"CategoryOffersViewController"
,
bundle
:
Bundle
.
frameworkBundle
)
vc
.
sectionData
=
section
if
let
navigationController
=
self
.
navigationController
{
navigationController
.
pushViewController
(
vc
,
animated
:
true
)
...
...
Please
register
or
login
to post a comment