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
2024-03-08 18:38:28 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0099187d2b3d43efb90fcec98fe930afeff2f57e
0099187d
1 parent
ed22f55a
inactive sm coupon fixes
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
22 deletions
SwiftWarplyFramework/SwiftWarplyFramework/LoyaltyHistoryViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/LoyaltyHistoryViewController.swift
View file @
0099187
...
...
@@ -161,17 +161,22 @@ import SwiftEventBus
func
matchOldSMCoupons
()
{
var
oldUnifiedCouponsArray
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
for
smCouponSet
in
swiftApi
()
.
getCouponSetsDealsList
()
{
for
oldCoupon
in
swiftApi
()
.
getAllOldCouponList
()
{
if
(
smCouponSet
.
uuid
!=
""
&&
oldCoupon
.
couponset_uuid
!=
""
&&
smCouponSet
.
uuid
==
oldCoupon
.
couponset_uuid
)
{
oldCoupon
.
setCouponSetData
(
smCouponSet
);
oldUnifiedCouponsArray
.
append
(
oldCoupon
);
break
;
}
}
}
// TODO: Check - Old implementation
// for smCouponSet in swiftApi().getCouponSetsDealsList() {
// for oldCoupon in swiftApi().getAllOldCouponList() {
// if (smCouponSet.uuid != "" && oldCoupon.couponset_uuid != "" && smCouponSet.uuid == oldCoupon.couponset_uuid) {
//
// oldCoupon.setCouponSetData(smCouponSet);
// oldUnifiedCouponsArray.append(oldCoupon);
//
// break;
// }
// }
// }
// TODO: DELETE - TEST
// oldUnifiedCouponsArray = swiftApi().getAllOldCouponList().filter({ return $0.couponset_data?.couponset_type == "supermarket" })
oldUnifiedCouponsArray
=
swiftApi
()
.
getSMOldCouponList
()
oldUnifiedCouponsArray
.
sort
(
by
:
{
let
date1
=
$0
.
redeemed_date
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
0099187
...
...
@@ -715,17 +715,22 @@ import SwiftEventBus
func
matchOldSMCoupons
()
{
var
oldUnifiedCouponsArray
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
for
smCouponSet
in
swiftApi
()
.
getCouponSetsDealsList
()
{
for
oldCoupon
in
swiftApi
()
.
getAllOldCouponList
()
{
if
(
smCouponSet
.
uuid
!=
""
&&
oldCoupon
.
couponset_uuid
!=
""
&&
smCouponSet
.
uuid
==
oldCoupon
.
couponset_uuid
)
{
oldCoupon
.
setCouponSetData
(
smCouponSet
);
oldUnifiedCouponsArray
.
append
(
oldCoupon
);
break
;
}
}
}
// TODO: Check - Old implementation
// for smCouponSet in swiftApi().getCouponSetsDealsList() {
// for oldCoupon in swiftApi().getAllOldCouponList() {
// if (smCouponSet.uuid != "" && oldCoupon.couponset_uuid != "" && smCouponSet.uuid == oldCoupon.couponset_uuid) {
//
// oldCoupon.setCouponSetData(smCouponSet);
// oldUnifiedCouponsArray.append(oldCoupon);
//
// break;
// }
// }
// }
// TODO: DELETE - TEST
// oldUnifiedCouponsArray = swiftApi().getAllOldCouponList().filter({ return $0.couponset_data?.couponset_type == "supermarket" })
oldUnifiedCouponsArray
=
swiftApi
()
.
getSMOldCouponList
()
oldUnifiedCouponsArray
.
sort
(
by
:
{
let
date1
=
$0
.
redeemed_date
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
0099187
...
...
@@ -16,6 +16,7 @@ public struct GlobalVariables {
static
var
dfyCoupons
:
Array
<
swiftApi
.
ActiveDFYCouponModel
>
=
[]
static
var
couponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
oldCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
smOldCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
allOldCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
couponSetList
:
Array
<
swiftApi
.
CouponSetItemModel
>
=
[]
static
var
couponsetsDealsList
:
Array
<
swiftApi
.
CouponSetItemModel
>
=
[]
// Supermarket couponsets
...
...
@@ -5345,6 +5346,37 @@ public class swiftApi {
return
GlobalVariables
.
oldCouponList
}
public
func
setSMOldCouponList
(
_
coupons
:
Array
<
CouponItemModel
>
)
{
// let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
var
oldCoupons
=
coupons
.
filter
({
return
$0
.
status
==
0
})
.
filter
({
return
$0
.
couponset_data
?
.
couponset_type
==
"supermarket"
})
// sort oldCoupons by redeemed date
// let dateFormatter = DateFormatter()
// dateFormatter.dateFormat = "dd/MM/yyyy"
oldCoupons
.
sort
(
by
:
{
// let date1 = dateFormatter.date(from: $0.redeemed ?? "")
// let date2 = dateFormatter.date(from: $1.redeemed ?? "")
let
date1
=
$0
.
redeemed_date
let
date2
=
$1
.
redeemed_date
if
((
date1
!=
nil
)
&&
(
date2
!=
nil
))
{
return
date1
!.
compare
(
date2
!
)
==
.
orderedDescending
}
else
{
return
false
}
})
GlobalVariables
.
smOldCouponList
=
oldCoupons
}
public
func
getSMOldCouponList
()
->
Array
<
CouponItemModel
>
{
return
GlobalVariables
.
smOldCouponList
}
public
func
setAllOldCouponList
(
_
coupons
:
Array
<
CouponItemModel
>
)
{
// let filteredCoupons = coupons.filter { CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: $0.discount ?? "")) }
var
oldCoupons
=
coupons
.
filter
({
return
$0
.
status
==
0
})
...
...
@@ -8422,6 +8454,8 @@ public class swiftApi {
swiftApi
()
.
setAllOldCouponList
(
couponsArray
)
// <==
swiftApi
()
.
setSMOldCouponList
(
couponsArray
)
let
noSMCoupons
=
couponsArray
.
filter
({
return
$0
.
couponset_data
?
.
couponset_type
!=
"supermarket"
})
swiftApi
()
.
setCouponList
(
noSMCoupons
)
...
...
Please
register
or
login
to post a comment