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-19 15:27:35 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
adde00afb7a52d8b2c9eab450b022c29f200f128
adde00af
1 parent
3224067d
new coupons api fixes
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
11 deletions
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOfferCollectionViewCell/MyRewardsOfferCollectionViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/ProfileCouponTableViewCell/ProfileCouponTableViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/models/Coupon.swift
SwiftWarplyFramework/SwiftWarplyFramework/models/Merchant.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponsetViewController/CouponsetViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/cells/MyRewardsOfferCollectionViewCell/MyRewardsOfferCollectionViewCell.swift
View file @
adde00a
...
...
@@ -106,7 +106,7 @@ public class MyRewardsOfferCollectionViewCell: UICollectionViewCell {
func
configureCell
(
data
:
CouponSetItemModel
)
{
// Use coupon set preview image
self
.
postImageURL
=
data
.
_img_preview
self
.
postImageURL
=
data
.
_
app_
img_preview
// Default to not favorite for coupon sets
favoriteImage
.
image
=
UIImage
(
named
:
"favorite_empty"
,
in
:
Bundle
.
frameworkResourceBundle
,
compatibleWith
:
nil
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/cells/ProfileCouponTableViewCell/ProfileCouponTableViewCell.swift
View file @
adde00a
...
...
@@ -138,7 +138,7 @@ public class ProfileCouponTableViewCell: UITableViewCell {
logoImageView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
logoImageView
.
layer
.
cornerRadius
=
10.0
if
let
merchantImgPreview
=
data
.
merchant_details
?
.
_img_preview
,
!
merchantImgPreview
.
isEmpty
{
if
let
merchantImgPreview
=
data
.
merchant_details
?
.
_
app_
img_preview
,
!
merchantImgPreview
.
isEmpty
{
self
.
logoImageURL
=
merchantImgPreview
}
else
{
logoImage
.
image
=
nil
...
...
SwiftWarplyFramework/SwiftWarplyFramework/models/Coupon.swift
View file @
adde00a
...
...
@@ -90,6 +90,9 @@ public class CouponSetItemModel {
private
var
regions
:
[
String
]?
private
var
show_as_banner
:
[
String
:
Any
]?
private
var
tagging
:
[
String
:
Any
]?
private
var
segment
:
String
?
private
var
hide_condition
:
String
?
private
var
extra_fields
:
[
String
:
Any
]?
// Bound merchant data for performance
private
var
merchant
:
MerchantModel
?
...
...
@@ -175,7 +178,17 @@ public class CouponSetItemModel {
self
.
offer_category
=
dictionary
[
"offer_category"
]
as?
String
?
??
""
// getCouponSetsNew fields
self
.
score
=
dictionary
[
"score"
]
as?
String
if
let
scoreInt
=
dictionary
[
"score"
]
as?
Int
{
self
.
score
=
String
(
scoreInt
)
}
else
if
let
scoreDouble
=
dictionary
[
"score"
]
as?
Double
{
self
.
score
=
String
(
scoreDouble
)
}
else
{
self
.
score
=
dictionary
[
"score"
]
as?
String
}
self
.
segment
=
dictionary
[
"segment"
]
as?
String
self
.
hide_condition
=
dictionary
[
"hide_condition"
]
as?
String
if
let
lockedInt
=
dictionary
[
"locked"
]
as?
Int
{
self
.
locked
=
lockedInt
==
1
}
else
{
...
...
@@ -212,6 +225,11 @@ public class CouponSetItemModel {
self
.
expiration
=
""
}
// Parse merchant_details if present
if
let
merchantDetails
=
dictionary
[
"merchant_details"
]
as?
[
String
:
Any
]
{
self
.
merchant
=
MerchantModel
(
dictionary
:
merchantDetails
)
}
// img Example
// img = "[\"https://warply.s3.amazonaws.com/applications/f83dfde1145e4c2da69793abb2f579af/couponset/00833266674d4a95b21dc4bf06995548/logo.png\"]";
...
...
@@ -240,6 +258,7 @@ public class CouponSetItemModel {
// {"shop_availability":"[{\"merchant_uuid\": \"9742752bcf904a269707c40b286e66de\", \"product_url\": \"https://www.ab.gr/el/eshop/Galaktokomika-Fytika-Rofimata-and-Eidi-Psygeioy/Gala-and-Fytika-Rofimata/Fytika-Rofimata/Fytiko-Rofima-Amygdalo-Choris-Prosthiki-Zacharis-1lt/p/7438640\"}]"}
if
let
extra_fields
=
dictionary
[
"extra_fields"
]
as?
[
String
:
Any
]
{
self
.
extra_fields
=
extra_fields
if
let
shopAvailabilityString
=
extra_fields
[
"shop_availability"
]
as?
String
{
// Convert the cleaned string to JSON data
if
let
shopData
=
shopAvailabilityString
.
data
(
using
:
.
utf8
)
{
...
...
@@ -312,7 +331,7 @@ public class CouponSetItemModel {
public
var
_category
:
String
{
get
{
return
self
.
category
??
""
}
}
public
var
_offer_category
:
String
{
get
{
return
self
.
offer_category
??
""
}
}
// getCouponSetsNew field
accessor
s
// getCouponSetsNew fields
public
var
_score
:
String
?
{
get
{
return
self
.
score
}
set
{
self
.
score
=
newValue
}
}
public
var
_locked
:
Bool
{
get
{
return
self
.
locked
??
false
}
}
public
var
_app_img_preview
:
String
{
get
{
return
self
.
app_img_preview
??
""
}
}
...
...
@@ -323,8 +342,11 @@ public class CouponSetItemModel {
public
var
_regions
:
[
String
]?
{
get
{
return
self
.
regions
}
}
public
var
_show_as_banner
:
[
String
:
Any
]?
{
get
{
return
self
.
show_as_banner
}
}
public
var
_tagging
:
[
String
:
Any
]?
{
get
{
return
self
.
tagging
}
}
public
var
_segment
:
String
{
get
{
return
self
.
segment
??
""
}
}
public
var
_hide_condition
:
String
?
{
get
{
return
self
.
hide_condition
}
}
public
var
_extra_fields
:
[
String
:
Any
]?
{
get
{
return
self
.
extra_fields
}
}
// Bound merchant data accessor
// Bound merchant data accessor
public
var
_merchant
:
MerchantModel
?
{
get
{
return
self
.
merchant
}
set
(
newValue
)
{
self
.
merchant
=
newValue
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/models/Merchant.swift
View file @
adde00a
...
...
@@ -37,6 +37,7 @@ public class MerchantModel {
private
var
created
:
String
?
private
var
parent
:
String
?
private
var
img_preview
:
String
?
private
var
preview_img
:
String
?
private
var
admin_name
:
String
?
private
var
sorting
:
Int
?
private
var
body
:
String
?
...
...
@@ -48,6 +49,8 @@ public class MerchantModel {
private
var
hidden
:
Bool
?
private
var
show_map
:
Bool
?
private
var
eshop
:
Bool
?
private
var
app_img_preview
:
String
?
private
var
app_imgs
:
[
String
]?
// NEW FIELDS - Missing from API response
// Image array - multiple merchant images
...
...
@@ -103,6 +106,7 @@ public class MerchantModel {
self
.
created
=
""
self
.
parent
=
""
self
.
img_preview
=
""
self
.
preview_img
=
""
self
.
admin_name
=
""
self
.
sorting
=
0
self
.
body
=
""
...
...
@@ -114,6 +118,8 @@ public class MerchantModel {
self
.
hidden
=
false
self
.
show_map
=
false
self
.
eshop
=
false
self
.
app_img_preview
=
""
self
.
app_imgs
=
[]
// New fields - initialize with appropriate defaults
self
.
img
=
[]
...
...
@@ -185,6 +191,7 @@ public class MerchantModel {
// parent_uuid key used by stores endpoint; fallback to parent for merchants
self
.
parent
=
dictionary
[
"parent_uuid"
]
as?
String
??
dictionary
[
"parent"
]
as?
String
??
""
self
.
img_preview
=
dictionary
[
"img_preview"
]
as?
String
?
??
""
self
.
preview_img
=
dictionary
[
"preview_img"
]
as?
String
?
??
""
self
.
admin_name
=
dictionary
[
"admin_name"
]
as?
String
?
??
""
self
.
sorting
=
dictionary
[
"sorting"
]
as?
Int
?
??
0
self
.
body
=
dictionary
[
"body"
]
as?
String
?
??
""
...
...
@@ -204,6 +211,9 @@ public class MerchantModel {
self
.
eshop
=
false
}
self
.
app_img_preview
=
dictionary
[
"app_img_preview"
]
as?
String
??
""
self
.
app_imgs
=
dictionary
[
"app_imgs"
]
as?
[
String
]
??
[]
// Parse NEW FIELDS - with safe type handling
// Parse img array safely
...
...
@@ -396,6 +406,11 @@ public class MerchantModel {
set
(
newValue
)
{
self
.
img_preview
=
newValue
}
}
public
var
_preview_img
:
String
{
get
{
return
self
.
preview_img
??
""
}
set
(
newValue
)
{
self
.
preview_img
=
newValue
}
}
public
var
_admin_name
:
String
{
get
{
return
self
.
admin_name
??
""
}
set
(
newValue
)
{
self
.
admin_name
=
newValue
}
...
...
@@ -451,6 +466,16 @@ public class MerchantModel {
set
(
newValue
)
{
self
.
eshop
=
newValue
}
}
public
var
_app_img_preview
:
String
{
get
{
return
self
.
app_img_preview
??
""
}
set
(
newValue
)
{
self
.
app_img_preview
=
newValue
}
}
public
var
_app_imgs
:
[
String
]
{
get
{
return
self
.
app_imgs
??
[]
}
set
(
newValue
)
{
self
.
app_imgs
=
newValue
}
}
// MARK: - NEW FIELD ACCESSORS
// Image array accessor
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponViewController/CouponViewController.swift
View file @
adde00a
...
...
@@ -78,7 +78,7 @@ import UIKit
}
couponImage
.
backgroundColor
=
UIColor
(
rgb
:
0x
00A3E033
)
couponImage
.
backgroundColor
=
UIColor
(
rgb
:
0x
CCE9FB
)
infoView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
infoView
.
layer
.
cornerRadius
=
10.0
...
...
@@ -159,7 +159,7 @@ import UIKit
websiteButton
.
layer
.
cornerRadius
=
websiteButton
.
bounds
.
height
/
2
couponImage
.
addDashedBorder
(
color
:
UIColor
(
rgb
:
0x
00A3E033
),
color
:
UIColor
(
rgb
:
0x
CCE9FB
),
lineWidth
:
1
,
dash
:
3
,
gap
:
3
...
...
@@ -202,7 +202,7 @@ import UIKit
merchantNameLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
15
)
merchantNameLabel
.
textColor
=
UIColor
(
rgb
:
0x9BA1A6
)
merchantNameLabel
.
text
=
coupon
.
couponset_data
?
.
_merchant
?
.
_name
merchantNameLabel
.
text
=
coupon
.
merchant_details
?
.
_name
// Title — from couponset_data name
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
24
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/CouponsetViewController/CouponsetViewController.swift
View file @
adde00a
...
...
@@ -90,7 +90,7 @@ import UIKit
}
couponImage
.
backgroundColor
=
UIColor
(
rgb
:
0x
00A3E033
)
couponImage
.
backgroundColor
=
UIColor
(
rgb
:
0x
CCE9FB
)
infoView
.
backgroundColor
=
UIColor
(
rgb
:
0xFFFFFF
)
infoView
.
layer
.
cornerRadius
=
10.0
...
...
@@ -139,7 +139,7 @@ import UIKit
redeemButton
.
layer
.
cornerRadius
=
redeemButton
.
bounds
.
height
/
2
couponImage
.
addDashedBorder
(
color
:
UIColor
(
rgb
:
0x
00A3E033
),
color
:
UIColor
(
rgb
:
0x
CCE9FB
),
lineWidth
:
1
,
dash
:
3
,
gap
:
3
...
...
@@ -279,7 +279,7 @@ import UIKit
merchantNameLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
15
)
merchantNameLabel
.
textColor
=
UIColor
(
rgb
:
0x9BA1A6
)
merchantNameLabel
.
text
=
couponset
.
_merchant
?
.
_name
merchantNameLabel
.
text
=
couponset
.
_merchant
_admin
_name
titleLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
24
)
titleLabel
.
textColor
=
UIColor
(
rgb
:
0x000F1E
)
...
...
Please
register
or
login
to post a comment