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-28 09:38:17 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
be4503c39861d65c971bf1adef09e7d9d2c1c817
be4503c3
1 parent
c716aba4
added getMerchants requests at MyRewardsVC
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
14 deletions
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
be4503c
...
...
@@ -43,6 +43,9 @@ import UIKit
// Coupon sets data
var
couponSets
:
[
CouponSetItemModel
]
=
[]
// Merchants data
var
merchants
:
[
MerchantModel
]
=
[]
// Profile data
var
profileModel
:
ProfileModel
?
var
profileSection
:
SectionModel
?
...
...
@@ -151,27 +154,57 @@ import UIKit
self
.
couponSets
=
couponSets
// Create coupon sets section with real data
if
!
self
.
couponSets
.
isEmpty
{
let
couponSetsSection
=
SectionModel
(
sectionType
:
.
myRewardsHorizontalCouponsets
,
title
:
"Προσφορές"
,
items
:
self
.
couponSets
,
itemType
:
.
couponSets
)
self
.
sections
.
append
(
couponSetsSection
)
}
// Load merchants after getting coupon sets
self
.
loadMerchants
()
// Reload table view with new sections
DispatchQueue
.
main
.
async
{
self
.
tableView
.
reloadData
()
}
}
failureCallback
:
{
[
weak
self
]
errorCode
in
print
(
"Failed to load coupon sets:
\(
errorCode
)
"
)
// No sections added on failure - table will be empty
}
}
// MARK: - Merchants Loading
private
func
loadMerchants
()
{
// Load merchants from WarplySDK (using enhanced getMerchants method)
WarplySDK
.
shared
.
getMerchants
{
[
weak
self
]
merchants
in
guard
let
self
=
self
,
let
merchants
=
merchants
else
{
// If merchants fail to load, still create coupon sets section without filtering
self
?
.
createCouponSetsSection
()
return
}
self
.
merchants
=
merchants
print
(
"✅ [MyRewardsViewController] Loaded
\(
merchants
.
count
)
merchants"
)
// For now, create the coupon sets section without filtering
// Later this will be enhanced to filter by merchant categories
self
.
createCouponSetsSection
()
}
failureCallback
:
{
[
weak
self
]
errorCode
in
print
(
"Failed to load merchants:
\(
errorCode
)
"
)
// If merchants fail, still show coupon sets without filtering
self
?
.
createCouponSetsSection
()
}
}
private
func
createCouponSetsSection
()
{
// Create coupon sets section with real data
if
!
self
.
couponSets
.
isEmpty
{
let
couponSetsSection
=
SectionModel
(
sectionType
:
.
myRewardsHorizontalCouponsets
,
title
:
"Προσφορές"
,
items
:
self
.
couponSets
,
itemType
:
.
couponSets
)
self
.
sections
.
append
(
couponSetsSection
)
}
// Reload table view with new sections
DispatchQueue
.
main
.
async
{
self
.
tableView
.
reloadData
()
}
}
// MARK: - Profile Loading
public
func
loadProfile
()
{
// Always attempt to load profile, regardless of authentication status
...
...
Please
register
or
login
to post a comment