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-29 17:32:03 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1a77e950920f5b13a36e9f142684f28fa53607ff
1a77e950
1 parent
dc271913
fix couponSets categorization
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
NETWORK_TESTING_AUTHORIZATION.md
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
NETWORK_TESTING_AUTHORIZATION.md
View file @
1a77e95
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/screens/MyRewardsViewController/MyRewardsViewController.swift
View file @
1a77e95
...
...
@@ -234,6 +234,30 @@ import UIKit
var
categorySections
:
[
SectionModel
]
=
[]
var
processedCouponSets
:
Set
<
String
>
=
[]
// Track processed coupon sets to avoid duplicates
// Extract promoted couponsets for "Top offers" section
let
promotedCouponSets
=
couponSets
.
filter
{
$0
.
_promoted
}
print
(
"🌟 [MyRewardsViewController] Found
\(
promotedCouponSets
.
count
)
promoted couponsets"
)
// Create "Top offers" section if we have promoted couponsets
if
!
promotedCouponSets
.
isEmpty
{
// Bind merchant data to promoted couponsets
for
couponSet
in
promotedCouponSets
{
if
let
merchant
=
merchants
.
first
(
where
:
{
$0
.
_uuid
==
couponSet
.
_merchant_uuid
})
{
couponSet
.
_merchant
=
merchant
print
(
" 🔗 Bound merchant '
\(
merchant
.
_name
)
' to promoted coupon set '
\(
couponSet
.
_name
)
'"
)
}
}
let
topOffersSection
=
SectionModel
(
sectionType
:
.
myRewardsHorizontalCouponsets
,
title
:
"Top offers"
,
items
:
promotedCouponSets
,
itemType
:
.
couponSets
)
categorySections
.
append
(
topOffersSection
)
print
(
" ✅ Created 'Top offers' section with
\(
promotedCouponSets
.
count
)
items"
)
}
print
(
"🔄 [MyRewardsViewController] Processing categories for filtering..."
)
for
category
in
merchantCategories
{
...
...
@@ -283,6 +307,8 @@ import UIKit
}
}
// COMMENTED OUT: Don't show unmatched couponsets - only show categorized ones
/*
// Handle any remaining unmatched coupon sets
let unmatchedCouponSets = couponSets.filter { couponSet in
!processedCouponSets.contains(couponSet._uuid)
...
...
@@ -307,16 +333,18 @@ import UIKit
)
categorySections.append(unmatchedSection)
}
*/
// Sort sections by title for consistent ordering
// Sort sections by title for consistent ordering
, but keep "Top offers" at the top
categorySections
.
sort
{
section1
,
section2
in
let
title1
=
section1
.
title
??
""
let
title2
=
section2
.
title
??
""
// Put "
Άλλες Προσφορές" at the end
if
title1
==
"
Άλλες Προσφορές"
{
return
fals
e
}
if
title2
==
"
Άλλες Προσφορές"
{
return
tru
e
}
// Put "
Top offers" at the beginning
if
title1
==
"
Top offers"
{
return
tru
e
}
if
title2
==
"
Top offers"
{
return
fals
e
}
// All other sections sorted alphabetically
return
title1
.
localizedCaseInsensitiveCompare
(
title2
)
==
.
orderedAscending
}
...
...
Please
register
or
login
to post a comment