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-13 17:54:05 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
03c7dafcfb8023d49aaabd52bbde4bc697000dca
03c7dafc
1 parent
b3c7a11d
MyRewardsViewController redesign
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
0 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manoschorianopoulos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.xib
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manoschorianopoulos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
03c7daf
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
03c7daf
...
...
@@ -10,6 +10,11 @@ import UIKit
@objc
public
class
MyRewardsViewController
:
UIViewController
{
@IBOutlet
weak
var
tableView
:
UITableView
!
@IBOutlet
weak
var
myCouponsView
:
UIView
!
@IBOutlet
weak
var
myCouponsLabel
:
UILabel
!
@IBOutlet
weak
var
myCouponsCountView
:
UIView
!
@IBOutlet
weak
var
myCouponsCountLabel
:
UILabel
!
@IBOutlet
weak
var
myCouponsButton
:
UIButton
!
// MARK: - Initializers
public
convenience
init
()
{
...
...
@@ -56,6 +61,8 @@ import UIKit
var
profileModel
:
ProfileModel
?
var
profileSection
:
SectionModel
?
var
activeCoupons
:
[
CouponItemModel
]
=
[]
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -82,6 +89,38 @@ import UIKit
loadProfile
()
// Load Profile
loadCampaigns
()
// Load campaigns
loadCouponSets
()
// Load couponsets
loadCoupons
()
setupUI
()
}
private
func
setupUI
()
{
self
.
myCouponsView
.
backgroundColor
=
UIColor
(
rgb
:
0x8F8F8F
)
self
.
myCouponsView
.
layer
.
cornerRadius
=
28
self
.
myCouponsView
.
layer
.
masksToBounds
=
true
self
.
myCouponsCountView
.
layer
.
borderWidth
=
2.0
self
.
myCouponsCountView
.
layer
.
borderColor
=
UIColor
(
rgb
:
0xFFFFFF
)
.
cgColor
self
.
myCouponsCountView
.
layer
.
cornerRadius
=
10.5
self
.
myCouponsLabel
.
text
=
"My coupons"
self
.
myCouponsLabel
.
font
=
UIFont
(
name
:
"PingLCG-Regular"
,
size
:
15
)
self
.
myCouponsLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
self
.
myCouponsLabel
.
frame
.
size
.
width
=
self
.
myCouponsLabel
.
intrinsicContentSize
.
width
self
.
myCouponsLabel
.
frame
.
size
.
height
=
self
.
myCouponsLabel
.
intrinsicContentSize
.
height
self
.
myCouponsCountLabel
.
text
=
"0"
self
.
myCouponsCountLabel
.
font
=
UIFont
(
name
:
"PingLCG-Bold"
,
size
:
14
)
self
.
myCouponsCountLabel
.
textColor
=
UIColor
(
rgb
:
0xFFFFFF
)
self
.
myCouponsCountLabel
.
frame
.
size
.
width
=
self
.
myCouponsCountLabel
.
intrinsicContentSize
.
width
self
.
myCouponsCountLabel
.
frame
.
size
.
height
=
self
.
myCouponsCountLabel
.
intrinsicContentSize
.
height
self
.
myCouponsButton
.
addTarget
(
self
,
action
:
#selector(
myCouponsButtonTapped
)
,
for
:
.
touchUpInside
)
}
@objc
private
func
myCouponsButtonTapped
()
{
// TODO: open CouponsVC
}
// NEW: Safe XIB registration method
...
...
@@ -219,6 +258,38 @@ import UIKit
}
}
// MARK: - Coupons Loading
private
func
loadCoupons
()
{
WarplySDK
.
shared
.
getCouponsUniversal
({
[
weak
self
]
couponsData
in
guard
let
self
=
self
else
{
return
}
if
let
coupons
=
couponsData
{
print
(
"✅ [MyRewardsVC] Fetched
\(
coupons
.
count
)
coupons"
)
let
tempActive
=
coupons
.
filter
{
$0
.
status
==
1
}
self
.
activeCoupons
=
tempActive
self
.
myCouponsCountLabel
.
text
=
String
(
tempActive
.
count
)
self
.
myCouponsCountLabel
.
frame
.
size
.
width
=
self
.
myCouponsCountLabel
.
intrinsicContentSize
.
width
self
.
myCouponsCountLabel
.
frame
.
size
.
height
=
self
.
myCouponsCountLabel
.
intrinsicContentSize
.
height
// Debug: Print coupon statuses
let
activeCount
=
tempActive
.
count
let
redeemedCount
=
coupons
.
filter
{
$0
.
status
==
0
}
.
count
let
expiredCount
=
coupons
.
filter
{
$0
.
status
==
-
1
}
.
count
print
(
" Active:
\(
activeCount
)
, Redeemed:
\(
redeemedCount
)
, Expired:
\(
expiredCount
)
"
)
}
else
{
self
.
activeCoupons
=
[]
print
(
"⚠️ [MyRewardsVC] No coupons received"
)
}
},
failureCallback
:
{
[
weak
self
]
errorCode
in
guard
let
self
=
self
else
{
return
}
print
(
"❌ [MyRewardsVC] Failed to fetch coupons, error:
\(
errorCode
)
"
)
self
.
activeCoupons
=
[]
})
}
// MARK: - Merchants Loading
private
func
loadMerchants
()
{
// Load merchants from WarplySDK (using enhanced getMerchants method)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.xib
View file @
03c7daf
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment