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-11-01 13:17:24 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
680e2dfc2b31cb9b02d3195e1d83784a996edbe4
680e2dfc
1 parent
2d12eaaa
ShareViewController CouponSharing optimizations
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
10 deletions
SwiftWarplyFramework/SwiftWarplyFramework/ShareViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/ShareViewController.swift
View file @
680e2df
...
...
@@ -285,17 +285,22 @@ import SwiftEventBus
if
(
response
?
.
getStatus
==
1
)
{
self
.
showSuccessDialog
(
"Συγχαρητήρια!"
,
"Μόλις έκανες δώρο ένα κουπόνι!"
)
swiftApi
()
.
getCouponsAsync
(
getCouponsCallback
,
failureCallback
:
{
errorCode
in
})
func
getCouponsCallback
(
_
couponsData
:
Array
<
swiftApi
.
CouponItemModel
>
?)
->
Void
{
if
(
couponsData
!=
nil
)
{
DispatchQueue
.
main
.
async
{
if
let
tempCoupon
=
self
.
coupon
{
swiftApi
()
.
removeCouponItem
(
couponArg
:
tempCoupon
)
SwiftEventBus
.
post
(
"coupons_fetched"
)
}
}
else
{
}
}
// swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
// func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
// if (couponsData != nil) {
// DispatchQueue.main.async {
// SwiftEventBus.post("coupons_fetched")
// }
// } else {
// }
// }
}
else
if
(
response
?
.
getStatus
==
4
)
{
self
.
showDialog
(
"Αποτυχία"
,
response
?
.
getMsg
??
""
)
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
680e2df
...
...
@@ -9259,11 +9259,16 @@ public class swiftApi {
}
public
func
addCouponItem
(
newCoupon
:
CouponItemModel
)
{
var
tempCouponList
=
getCouponList
()
var
tempCouponList
=
swiftApi
()
.
getCouponList
()
tempCouponList
.
append
(
newCoupon
)
swiftApi
()
.
setCouponList
(
tempCouponList
)
}
public
func
removeCouponItem
(
couponArg
:
CouponItemModel
)
{
let
tempCouponList
=
swiftApi
()
.
getCouponList
()
.
filter
{
$0
.
coupon
!=
couponArg
.
coupon
}
swiftApi
()
.
setCouponList
(
tempCouponList
)
}
public
func
removeCampaignItem
(
campaignArg
:
CampaignItemModel
)
{
let
allCampaigns
=
swiftApi
()
.
getAllCampaignList
()
.
filter
{
$0
.
session_uuid
!=
campaignArg
.
session_uuid
}
swiftApi
()
.
setUniqueCampaignList
(
allCampaigns
)
...
...
Please
register
or
login
to post a comment