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
2023-04-06 13:13:48 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
56291b52cb6bb2cc5b6c8d21b75fb2fb5f851d39
56291b52
1 parent
4bf14d84
market history fixes
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
150 additions
and
43 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisHeaderMessageViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisItemViewCell.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/MarketHistoryViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/MarketLoyaltyAnalysisViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
56291b5
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisHeaderMessageViewCell.swift
View file @
56291b5
...
...
@@ -33,33 +33,9 @@ class AnalysisHeaderMessageViewCell: UITableViewCell {
messageLabel
.
layer
.
borderWidth
=
1.0
messageLabel
.
layer
.
borderColor
=
UIColor
(
rgb
:
0x1DA6B9
)
.
cgColor
messageLabel
.
layer
.
cornerRadius
=
5
let
totalCouponDiscount
=
Float
(
round
(
100
*
loyaltyBadge
.
_value
)
/
100
)
var
totalCouponDiscountString
=
"0"
totalCouponDiscountString
=
String
(
format
:
"%.2f"
,
totalCouponDiscount
)
.
replacingOccurrences
(
of
:
"."
,
with
:
","
,
options
:
.
literal
,
range
:
nil
)
// messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
let
coupNormalText1
=
"Μέχρι τώρα έχεις κερδίσει "
let
coupBoldText
=
totalCouponDiscountString
+
"€"
let
coupNormalText2
=
" σε προσφορές από "
let
coupBoldText2
=
String
(
loyaltyBadge
.
_couponCount
)
let
coupNormalText3
=
" κουπόνια!"
let
attrRegular
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Regular"
,
size
:
17
)
??
UIFont
.
systemFont
(
ofSize
:
16
)]
let
attrBold
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
17
)
??
UIFont
.
boldSystemFont
(
ofSize
:
16
)]
let
coupAttributedString
=
NSMutableAttributedString
(
string
:
coupNormalText1
,
attributes
:
attrRegular
)
let
coupBoldString
=
NSMutableAttributedString
(
string
:
coupBoldText
,
attributes
:
attrBold
)
let
coupNormalString2
=
NSMutableAttributedString
(
string
:
coupNormalText2
,
attributes
:
attrRegular
)
let
coupBoldString2
=
NSMutableAttributedString
(
string
:
coupBoldText2
,
attributes
:
attrBold
)
let
coupNormalString3
=
NSMutableAttributedString
(
string
:
coupNormalText3
,
attributes
:
attrRegular
)
// messageLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
coupAttributedString
.
append
(
coupBoldString
)
coupAttributedString
.
append
(
coupNormalString2
)
coupAttributedString
.
append
(
coupBoldString2
)
coupAttributedString
.
append
(
coupNormalString3
)
messageLabel
.
attributedText
=
coupAttributedString
}
}
...
...
@@ -71,11 +47,72 @@ extension AnalysisHeaderMessageViewCell {
}
else
{
emptyLabel
.
isHidden
=
true
}
if
(
isMarket
==
true
)
{
itemImage
.
image
=
UIImage
(
named
:
"ic_history_market"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
let
oldUnifiedCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
swiftApi
()
.
getOldUnifiedCouponList
()
let
oldUnifiedCouponListLength
=
oldUnifiedCouponList
.
count
var
unifiedCouponsDiscount
:
Float
=
0.0
for
coupon
in
oldUnifiedCouponList
{
if
let
discountFloat
=
Float
(
coupon
.
discount
??
"0.0"
)
{
unifiedCouponsDiscount
+=
discountFloat
}
}
let
totalCouponDiscount
=
Float
(
round
(
100
*
unifiedCouponsDiscount
)
/
100
)
var
totalCouponDiscountString
=
"0"
totalCouponDiscountString
=
String
(
format
:
"%.2f"
,
totalCouponDiscount
)
.
replacingOccurrences
(
of
:
"."
,
with
:
","
,
options
:
.
literal
,
range
:
nil
)
let
coupNormalText1
=
"Μέχρι τώρα έχεις κερδίσει "
let
coupBoldText
=
totalCouponDiscountString
+
"€"
let
coupNormalText2
=
" σε προσφορές από "
let
coupBoldText2
=
String
(
oldUnifiedCouponListLength
)
let
coupNormalText3
=
" κουπόνια!"
let
attrRegular
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Regular"
,
size
:
17
)
??
UIFont
.
systemFont
(
ofSize
:
16
)]
let
attrBold
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
17
)
??
UIFont
.
boldSystemFont
(
ofSize
:
16
)]
let
coupAttributedString
=
NSMutableAttributedString
(
string
:
coupNormalText1
,
attributes
:
attrRegular
)
let
coupBoldString
=
NSMutableAttributedString
(
string
:
coupBoldText
,
attributes
:
attrBold
)
let
coupNormalString2
=
NSMutableAttributedString
(
string
:
coupNormalText2
,
attributes
:
attrRegular
)
let
coupBoldString2
=
NSMutableAttributedString
(
string
:
coupBoldText2
,
attributes
:
attrBold
)
let
coupNormalString3
=
NSMutableAttributedString
(
string
:
coupNormalText3
,
attributes
:
attrRegular
)
coupAttributedString
.
append
(
coupBoldString
)
coupAttributedString
.
append
(
coupNormalString2
)
coupAttributedString
.
append
(
coupBoldString2
)
coupAttributedString
.
append
(
coupNormalString3
)
messageLabel
.
attributedText
=
coupAttributedString
}
else
{
itemImage
.
image
=
UIImage
(
named
:
"ic_gift_circle_2"
,
in
:
MyEmptyClass
.
resourceBundle
(),
compatibleWith
:
nil
)
let
totalCouponDiscount
=
Float
(
round
(
100
*
loyaltyBadge
.
_value
)
/
100
)
var
totalCouponDiscountString
=
"0"
totalCouponDiscountString
=
String
(
format
:
"%.2f"
,
totalCouponDiscount
)
.
replacingOccurrences
(
of
:
"."
,
with
:
","
,
options
:
.
literal
,
range
:
nil
)
let
coupNormalText1
=
"Μέχρι τώρα έχεις κερδίσει "
let
coupBoldText
=
totalCouponDiscountString
+
"€"
let
coupNormalText2
=
" σε προσφορές από "
let
coupBoldText2
=
String
(
loyaltyBadge
.
_couponCount
)
let
coupNormalText3
=
" κουπόνια!"
let
attrRegular
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Regular"
,
size
:
17
)
??
UIFont
.
systemFont
(
ofSize
:
16
)]
let
attrBold
=
[
NSAttributedString
.
Key
.
font
:
UIFont
(
name
:
"PFSquareSansPro-Bold"
,
size
:
17
)
??
UIFont
.
boldSystemFont
(
ofSize
:
16
)]
let
coupAttributedString
=
NSMutableAttributedString
(
string
:
coupNormalText1
,
attributes
:
attrRegular
)
let
coupBoldString
=
NSMutableAttributedString
(
string
:
coupBoldText
,
attributes
:
attrBold
)
let
coupNormalString2
=
NSMutableAttributedString
(
string
:
coupNormalText2
,
attributes
:
attrRegular
)
let
coupBoldString2
=
NSMutableAttributedString
(
string
:
coupBoldText2
,
attributes
:
attrBold
)
let
coupNormalString3
=
NSMutableAttributedString
(
string
:
coupNormalText3
,
attributes
:
attrRegular
)
coupAttributedString
.
append
(
coupBoldString
)
coupAttributedString
.
append
(
coupNormalString2
)
coupAttributedString
.
append
(
coupBoldString2
)
coupAttributedString
.
append
(
coupNormalString3
)
messageLabel
.
attributedText
=
coupAttributedString
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/AnalysisItemViewCell.swift
View file @
56291b5
...
...
@@ -118,4 +118,42 @@ extension AnalysisItemViewCell {
// subtitleLabel.text = htmlText.htmlToString
}
func
configureCell
(
item
:
swiftApi
.
CouponItemModel
,
isMarket
:
Bool
)
{
// COUPONSET: desc, img_preview, name, terms, merchant_uuid
// COUPON: coupon, expiration, discount, status
// MERCHANT: _img_preview,_admin_name
// let merchantList:Array<swiftApi.MerchantModel> = swiftApi().getMerchantList()
// let couponSetData: swiftApi.CouponSetItemModel? = item.couponset_data
//
// titleLabel.text = ""
//
// for merchant in merchantList {
// if (merchant._uuid == couponSetData?.merchant_uuid) {
// // itemImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache())
// self.postImageURL = merchant._img_preview
// titleLabel.text = merchant._admin_name
// break;
// }
// }
titleLabel
.
text
=
item
.
name
self
.
postImageURL
=
item
.
image
dateLabel
.
text
=
item
.
redeemed
??
""
let
priceFloat
=
Float
(
round
(
100
*
(
Float
(
item
.
discount
??
"0.0"
)
??
0.0
))
/
100
)
var
priceString
=
"0"
priceString
=
String
(
format
:
"%.2f"
,
priceFloat
)
.
replacingOccurrences
(
of
:
"."
,
with
:
","
,
options
:
.
literal
,
range
:
nil
)
priceLabel
.
text
=
priceString
+
"€"
subtitleLabel
.
text
=
"Έκπτωτικό κουπόνι"
// subtitleLabel.text = couponSetData?.short_description ?? ""
// OR
// let htmlText = couponSetData?.inner_text ?? ""
// subtitleLabel.text = htmlText.htmlToString
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
56291b5
...
...
@@ -524,7 +524,7 @@
<scene
sceneID=
"Unf-jQ-yhe"
>
<objects>
<tableViewController
storyboardIdentifier=
"MarketSharingHistoryViewController"
id=
"R2a-Tw-n8n"
customClass=
"MarketSharingHistoryViewController"
customModule=
"SwiftWarplyFramework"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<tableView
key=
"view"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"
default
"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"-1"
estimatedSectionHeaderHeight=
"-1"
sectionFooterHeight=
"-1"
estimatedSectionFooterHeight=
"-1"
id=
"CQc-tP-sD3"
>
<tableView
key=
"view"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"
none
"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"-1"
estimatedSectionHeaderHeight=
"-1"
sectionFooterHeight=
"-1"
estimatedSectionFooterHeight=
"-1"
id=
"CQc-tP-sD3"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
...
...
@@ -746,7 +746,7 @@
<scene
sceneID=
"33f-Co-X5F"
>
<objects>
<tableViewController
storyboardIdentifier=
"MarketHistoryViewController"
id=
"iFj-6f-ytl"
customClass=
"MarketHistoryViewController"
customModule=
"SwiftWarplyFramework"
customModuleProvider=
"target"
sceneMemberID=
"viewController"
>
<tableView
key=
"view"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"
default
"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"-1"
estimatedSectionHeaderHeight=
"-1"
sectionFooterHeight=
"-1"
estimatedSectionFooterHeight=
"-1"
id=
"Ruu-TU-GVv"
>
<tableView
key=
"view"
clipsSubviews=
"YES"
contentMode=
"scaleToFill"
alwaysBounceVertical=
"YES"
dataMode=
"prototypes"
style=
"plain"
separatorStyle=
"
none
"
rowHeight=
"-1"
estimatedRowHeight=
"-1"
sectionHeaderHeight=
"-1"
estimatedSectionHeaderHeight=
"-1"
sectionFooterHeight=
"-1"
estimatedSectionFooterHeight=
"-1"
id=
"Ruu-TU-GVv"
>
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"414"
height=
"896"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<color
key=
"backgroundColor"
systemColor=
"systemBackgroundColor"
/>
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MarketHistoryViewController.swift
View file @
56291b5
...
...
@@ -9,7 +9,7 @@ import UIKit
class
MarketHistoryViewController
:
AnalysisChildViewController
{
var
loading
:
Bool
=
false
var
items
:
Array
<
swiftApi
.
CouponItemModel
>
=
swiftApi
()
.
getOldCouponList
()
var
items
:
Array
<
swiftApi
.
CouponItemModel
>
=
swiftApi
()
.
getOld
Unified
CouponList
()
var
showMore
=
false
// TODO: remove this when configuring model
...
...
@@ -38,7 +38,7 @@ class MarketHistoryViewController: AnalysisChildViewController {
showLoading
()
items
=
swiftApi
()
.
getOldCouponList
()
items
=
swiftApi
()
.
getOld
Unified
CouponList
()
self
.
showMore
=
(
self
.
items
.
count
>
3
)
...
...
@@ -131,7 +131,7 @@ class MarketHistoryViewController: AnalysisChildViewController {
}
let
cell
=
tableView
.
dequeueReusableCell
(
withIdentifier
:
"AnalysisItemViewCell"
,
for
:
indexPath
)
as!
SwiftWarplyFramework
.
AnalysisItemViewCell
cell
.
configureCell
(
item
:
items
[
indexPath
.
row
])
cell
.
configureCell
(
item
:
items
[
indexPath
.
row
]
,
isMarket
:
true
)
return
cell
}
...
...
@@ -142,7 +142,7 @@ class MarketHistoryViewController: AnalysisChildViewController {
}
if
(
self
.
showMore
&&
indexPath
.
row
==
3
)
{
self
.
items
=
swiftApi
()
.
getOldCouponList
()
self
.
items
=
swiftApi
()
.
getOld
Unified
CouponList
()
self
.
showMore
=
false
self
.
tableView
.
reloadData
()
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MarketLoyaltyAnalysisViewController.swift
View file @
56291b5
...
...
@@ -118,7 +118,7 @@ import SwiftEventBus
if
(
index
==
1
)
{
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"LoyaltyHistoryScreen:"
+
"TabShared"
))
let
analysisVC
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"
SharingHistoryViewController"
)
as!
SwiftWarplyFramework
.
SharingHistoryViewController
let
analysisVC
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"
MarketSharingHistoryViewController"
)
as!
SwiftWarplyFramework
.
Market
SharingHistoryViewController
analysisVC
.
index
=
index
;
return
analysisVC
;
...
...
@@ -126,7 +126,7 @@ import SwiftEventBus
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"LoyaltyHistoryScreen:"
+
"TabExpired"
))
let
analysisVC
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"
HistoryViewController"
)
as!
SwiftWarplyFramework
.
HistoryViewController
let
analysisVC
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"
MarketHistoryViewController"
)
as!
SwiftWarplyFramework
.
Market
HistoryViewController
analysisVC
.
index
=
index
;
return
analysisVC
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/WalletViewController.swift
View file @
56291b5
...
...
@@ -523,13 +523,10 @@ import SwiftEventBus
}
func
updateMarketBadge
()
{
for
uniCoupon
in
self
.
unifiedCoupons
{
for
coupon
in
uniCoupon
.
_coupons
{
if
(
coupon
.
status
==
1
)
{
if
let
discountFloat
=
Float
(
coupon
.
discount
??
"0.0"
)
{
unifiedCouponsDiscount
+=
discountFloat
}
}
unifiedCouponsDiscount
=
0.0
for
coupon
in
swiftApi
()
.
getOldUnifiedCouponList
()
{
if
let
discountFloat
=
Float
(
coupon
.
discount
??
"0.0"
)
{
unifiedCouponsDiscount
+=
discountFloat
}
}
...
...
@@ -642,6 +639,18 @@ import SwiftEventBus
@IBAction
func
marketBadgeButtonAction
(
_
sender
:
Any
)
{
print
(
"Market Badge pressed!"
)
// TODO: add action - open marketHistory after check
if
(
self
.
unifiedCouponsDiscount
>
0.0
)
{
// let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
// firebaseEvent._eventName = "did_tap_deals_for_you_badge"
// firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
// SwiftEventBus.post("firebase", sender: firebaseEvent)
// swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "LoyaltyBanner"))
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"MarketLoyaltyAnalysisViewController"
)
as!
SwiftWarplyFramework
.
MarketLoyaltyAnalysisViewController
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
}
}
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
56291b5
...
...
@@ -18,6 +18,7 @@ public struct GlobalVariables {
static
var
oldCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
couponSetList
:
Array
<
swiftApi
.
CouponSetItemModel
>
=
[]
static
var
unifiedCouponList
:
Array
<
swiftApi
.
UnifiedCouponModel
>
=
[]
static
var
oldUnifiedCouponList
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
static
var
loyaltyBadge
:
swiftApi
.
LoyaltyBadgeModel
=
swiftApi
.
LoyaltyBadgeModel
()
static
var
consumer
:
swiftApi
.
ProfileModel
?
static
var
consumerInternal
:
swiftApi
.
ProfileModel
?
...
...
@@ -153,6 +154,16 @@ public class swiftApi {
}
public
func
setOldUnifiedCouponList
(
_
coupons
:
Array
<
CouponItemModel
>
)
{
GlobalVariables
.
oldUnifiedCouponList
=
coupons
}
public
func
getOldUnifiedCouponList
()
->
Array
<
CouponItemModel
>
{
return
GlobalVariables
.
oldUnifiedCouponList
}
public
func
startTrackingSteps
(
_
getStepsCallback
:
@escaping
(
_
steps
:
Int
)
->
Void
)
->
Void
{
if
(
GlobalVariables
.
trackingStepsEnabled
==
false
)
{
...
...
@@ -6852,6 +6863,7 @@ public class swiftApi {
func
getUnifiedCallback
(
_
responseData
:
[
AnyHashable
:
Any
]?)
->
Void
{
var
unifiedCouponsArray
:
Array
<
UnifiedCouponModel
>
=
[]
var
oldUnifiedCouponsArray
:
Array
<
CouponItemModel
>
=
[]
if
let
responseDataDictionary
=
responseData
as?
[
String
:
AnyObject
]
{
...
...
@@ -6868,14 +6880,25 @@ public class swiftApi {
if
let
itemDictionary
=
item
{
if
let
itemDictionaryStauts
=
itemDictionary
[
"status"
]
as?
String
{
if
(
itemDictionaryStauts
==
"active"
)
{
let
tempCampaign
=
UnifiedCouponModel
(
dictionary
:
itemDictionary
)
unifiedCouponsArray
.
append
(
tempCampaign
)
let
tempUniCoupon
=
UnifiedCouponModel
(
dictionary
:
itemDictionary
)
unifiedCouponsArray
.
append
(
tempUniCoupon
)
}
// Old Unified Coupons
let
tempUniCoupon
=
UnifiedCouponModel
(
dictionary
:
itemDictionary
)
for
item
in
tempUniCoupon
.
_coupons
{
if
(
item
.
status
==
0
)
{
oldUnifiedCouponsArray
.
append
(
item
)
}
}
}
}
}
swiftApi
()
.
setUnifiedCouponList
(
unifiedCouponsArray
)
swiftApi
()
.
setOldUnifiedCouponList
(
oldUnifiedCouponsArray
)
successCallback
(
unifiedCouponsArray
)
}
}
else
{
...
...
Please
register
or
login
to post a comment