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
2025-07-21 14:18:41 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c1d78ae03c5b8a977336b81e44e3afed12f3455
2c1d78ae
1 parent
06b95440
MyRewardsVC fixes
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
247 additions
and
8 deletions
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOfferCollectionViewCell/MyRewardsOfferCollectionViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOffersScrollTableViewCell/MyRewardsOffersScrollTableViewCell.swift
SwiftWarplyFramework/Pods/Pods.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
2c1d78a
...
...
@@ -7,7 +7,7 @@
<key>
Pods-SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
0
</integer>
<integer>
1
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcodeproj/xcuserdata/manos.xcuserdatad/xcschemes/xcschememanagement.plist
View file @
2c1d78a
...
...
@@ -7,7 +7,7 @@
<key>
SwiftWarplyFramework.xcscheme_^#shared#^_
</key>
<dict>
<key>
orderHint
</key>
<integer>
1
</integer>
<integer>
0
</integer>
</dict>
</dict>
</dict>
...
...
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
2c1d78a
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOfferCollectionViewCell/MyRewardsOfferCollectionViewCell.swift
View file @
2c1d78a
...
...
@@ -64,4 +64,162 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
logoImage
.
image
=
UIImage
(
named
:
data
.
merchantLogo
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
// MARK: - New configureCell methods for different data types
func
configureCell
(
data
:
CampaignItemModel
)
{
// Use campaign's banner image if available
let
imageName
=
data
.
_banner_img_mobile
??
""
if
!
imageName
.
isEmpty
{
bannerImage
.
image
=
UIImage
(
named
:
imageName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
bannerImage
.
image
=
nil
}
// Default to not favorite for campaigns
favoriteImage
.
image
=
UIImage
(
named
:
"favorite_empty"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
// Use campaign category or type for discount display
discountLabel
.
text
=
data
.
_category
??
data
.
_campaign_type
??
""
discountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
discountLabel
.
textColor
=
UIColor
(
rgb
:
0xF2F2F2
)
// Default color for campaigns
discountView
.
backgroundColor
=
UIColor
(
rgb
:
0xEE417D
)
titleLabel
.
text
=
data
.
_title
??
""
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
subtitleLabel
.
text
=
data
.
_subtitle
??
""
subtitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
14
)
subtitleLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
// Use campaign expiration date
expirationLabel
.
text
=
data
.
_valid_until
??
""
expirationLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
13
)
expirationLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
// Use campaign logo
let
logoName
=
data
.
_logo_url
??
""
if
!
logoName
.
isEmpty
{
logoImage
.
image
=
UIImage
(
named
:
logoName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
logoImage
.
image
=
nil
}
}
func
configureCell
(
data
:
CouponSetItemModel
)
{
// Use coupon set preview image
let
imageName
=
data
.
img_preview
??
""
if
!
imageName
.
isEmpty
{
bannerImage
.
image
=
UIImage
(
named
:
imageName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
bannerImage
.
image
=
nil
}
// Default to not favorite for coupon sets
favoriteImage
.
image
=
UIImage
(
named
:
"favorite_empty"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
// Use coupon set discount
discountLabel
.
text
=
data
.
discount
??
""
discountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
discountLabel
.
textColor
=
UIColor
(
rgb
:
0xF2F2F2
)
// Color based on discount type
let
discountColor
:
UInt
=
{
switch
data
.
discount_type
{
case
"percentage"
:
return
0xFF6B35
case
"value"
:
return
0x28A745
case
"plus_one"
:
return
0x007AFF
default
:
return
0x6C757D
}
}()
discountView
.
backgroundColor
=
UIColor
(
rgb
:
discountColor
)
titleLabel
.
text
=
data
.
name
??
""
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
subtitleLabel
.
text
=
data
.
short_description
??
""
subtitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
14
)
subtitleLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
expirationLabel
.
text
=
data
.
expiration
??
""
expirationLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
13
)
expirationLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
// Use first image from img array if available
if
let
imgArray
=
data
.
img
,
!
imgArray
.
isEmpty
{
let
logoName
=
imgArray
[
0
]
if
!
logoName
.
isEmpty
{
logoImage
.
image
=
UIImage
(
named
:
logoName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
logoImage
.
image
=
nil
}
}
else
{
logoImage
.
image
=
nil
}
}
func
configureCell
(
data
:
CouponItemModel
)
{
// Use coupon image
let
imageName
=
data
.
image
??
""
if
!
imageName
.
isEmpty
{
bannerImage
.
image
=
UIImage
(
named
:
imageName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
bannerImage
.
image
=
nil
}
// Default to not favorite for coupons
favoriteImage
.
image
=
UIImage
(
named
:
"favorite_empty"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
// Use coupon discount
discountLabel
.
text
=
data
.
discount
??
""
discountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
discountLabel
.
textColor
=
UIColor
(
rgb
:
0xF2F2F2
)
// Color based on coupon status
let
statusColor
:
UInt
=
{
switch
data
.
status
{
case
1
:
return
0x28A745
// Active - green
case
0
:
return
0x6C757D
// Used - gray
default
:
return
0x007AFF
// Default - blue
}
}()
discountView
.
backgroundColor
=
UIColor
(
rgb
:
statusColor
)
titleLabel
.
text
=
data
.
name
??
""
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
17
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
subtitleLabel
.
text
=
data
.
short_description
??
""
subtitleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
14
)
subtitleLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
expirationLabel
.
text
=
data
.
expiration
??
""
expirationLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
13
)
expirationLabel
.
textColor
=
UIColor
(
rgb
:
0x00111B
)
// Use coupon set data image if available
if
let
couponSetData
=
data
.
couponset_data
,
let
imgArray
=
couponSetData
.
img
,
!
imgArray
.
isEmpty
{
let
logoName
=
imgArray
[
0
]
if
!
logoName
.
isEmpty
{
logoImage
.
image
=
UIImage
(
named
:
logoName
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
}
else
{
logoImage
.
image
=
nil
}
}
else
{
logoImage
.
image
=
nil
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOffersScrollTableViewCell/MyRewardsOffersScrollTableViewCell.swift
View file @
2c1d78a
...
...
@@ -145,21 +145,102 @@ extension MyRewardsOffersScrollTableViewCell: UICollectionViewDataSource, UIColl
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
numberOfItemsInSection
section
:
Int
)
->
Int
{
return
self
.
data
?
.
offers
.
c
ount
??
0
return
self
.
data
?
.
itemC
ount
??
0
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
cellForItemAt
indexPath
:
IndexPath
)
->
UICollectionViewCell
{
let
cell
=
collectionView
.
dequeueReusableCell
(
withReuseIdentifier
:
"MyRewardsOfferCollectionViewCell"
,
for
:
indexPath
)
as!
MyRewardsOfferCollectionViewCell
// cell.configureCell(offer: self.data?.offers[indexPath.row])
if
let
offer
=
self
.
data
?
.
offers
[
indexPath
.
row
]
{
cell
.
configureCell
(
data
:
offer
)
// Handle different item types with type checking
guard
let
data
=
self
.
data
,
let
items
=
data
.
items
,
indexPath
.
row
<
items
.
count
else
{
return
cell
}
switch
data
.
itemType
{
case
.
campaigns
:
if
let
campaign
=
items
[
indexPath
.
row
]
as?
CampaignItemModel
{
cell
.
configureCell
(
data
:
campaign
)
}
case
.
couponSets
:
if
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
{
cell
.
configureCell
(
data
:
couponSet
)
}
case
.
coupons
:
if
let
coupon
=
items
[
indexPath
.
row
]
as?
CouponItemModel
{
cell
.
configureCell
(
data
:
coupon
)
}
default
:
break
}
return
cell
;
}
public
func
collectionView
(
_
collectionView
:
UICollectionView
,
didSelectItemAt
indexPath
:
IndexPath
)
{
if
let
offer
=
self
.
data
?
.
offers
[
indexPath
.
row
]
{
delegate
?
.
didSelectOffer
(
offer
)
// Handle different item types with type checking
guard
let
data
=
self
.
data
,
let
items
=
data
.
items
,
indexPath
.
row
<
items
.
count
else
{
return
}
switch
data
.
itemType
{
case
.
campaigns
:
if
let
campaign
=
items
[
indexPath
.
row
]
as?
CampaignItemModel
{
// For now, we'll need to convert CampaignItemModel to OfferModel for delegate compatibility
// This maintains backward compatibility while using the new data structure
let
offer
=
OfferModel
(
category
:
campaign
.
_category
??
""
,
title
:
campaign
.
_title
??
""
,
description
:
campaign
.
_subtitle
??
""
,
discount
:
""
,
discountType
:
""
,
bannerImage
:
campaign
.
_banner_img_mobile
??
""
,
merchantLogo
:
campaign
.
_logo_url
??
""
,
expirationDate
:
""
,
color
:
0x000000
,
isFavorite
:
false
)
delegate
?
.
didSelectOffer
(
offer
)
}
case
.
couponSets
:
if
let
couponSet
=
items
[
indexPath
.
row
]
as?
CouponSetItemModel
{
// Convert CouponSetItemModel to OfferModel for delegate compatibility
let
offer
=
OfferModel
(
category
:
""
,
title
:
couponSet
.
_name
??
""
,
description
:
couponSet
.
_short_description
??
""
,
discount
:
""
,
discountType
:
""
,
bannerImage
:
""
,
merchantLogo
:
couponSet
.
_img_preview
??
""
,
expirationDate
:
""
,
color
:
0x000000
,
isFavorite
:
false
)
delegate
?
.
didSelectOffer
(
offer
)
}
case
.
coupons
:
if
let
coupon
=
items
[
indexPath
.
row
]
as?
CouponItemModel
{
// Convert CouponItemModel to OfferModel for delegate compatibility
let
offer
=
OfferModel
(
category
:
""
,
title
:
coupon
.
_name
??
""
,
description
:
coupon
.
_short_description
??
""
,
discount
:
""
,
discountType
:
""
,
bannerImage
:
""
,
merchantLogo
:
coupon
.
_img_preview
??
""
,
expirationDate
:
""
,
color
:
0x000000
,
isFavorite
:
false
)
delegate
?
.
didSelectOffer
(
offer
)
}
default
:
break
}
}
...
...
Please
register
or
login
to post a comment