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-06-12 15:55:13 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5c2be3e209b2460258e448dc6705e674a31bf43a
5c2be3e2
1 parent
7cbd7316
Add market coupons inner view
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
16 deletions
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
SwiftWarplyFramework/SwiftWarplyFramework/CouponBarcodeViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponBarcodeViewController.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
5c2be3e
No preview for this file type
SwiftWarplyFramework/SwiftWarplyFramework/CouponBarcodeViewController.swift
View file @
5c2be3e
...
...
@@ -22,7 +22,11 @@ import AVFoundation
@IBOutlet
weak
var
merchantDescrTextView
:
UnselectableTappableTextView
!
@IBOutlet
weak
var
merchantDescrTextViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
merchantDescrTextViewTopSpace
:
NSLayoutConstraint
!
@IBOutlet
weak
var
couponCodeLabel
:
UILabel
!
@IBOutlet
weak
var
couponCodeLabelHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
couponView
:
UIView
!
@IBOutlet
weak
var
couponViewTopSpace
:
NSLayoutConstraint
!
@IBOutlet
weak
var
couponViewHeight
:
NSLayoutConstraint
!
@IBOutlet
weak
var
couponNumberLabel
:
CopyableLabel
!
@IBOutlet
weak
var
barcodeImage
:
UIImageView
!
@IBOutlet
weak
var
barcodeImageHeight
:
NSLayoutConstraint
!
...
...
@@ -59,6 +63,7 @@ import AVFoundation
public
var
coupon
:
swiftApi
.
CouponItemModel
?
public
var
isFromWallet
:
Bool
?
=
false
public
var
isMarket
:
Bool
?
=
false
public
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
...
...
@@ -95,17 +100,31 @@ import AVFoundation
// topBorderLine.heightAnchor.constraint(equalTo: topBorderLine.widthAnchor, multiplier: 1/aspectR)
// ])
// COUPONSET: desc, img_preview, name, terms
// COUPONSET: desc
ription
, img_preview, name, terms
// COUPON: coupon, expiration, discount, status
// OLD COUPON KEYS: coupon, expiration, discount, status
// NEW COUPON KEYS (from couponset): inner_text, merchant_uuid
// MISSING KEYS (from couponset): img_preview, name, short_description, terms
let
couponSetData
:
swiftApi
.
CouponSetItemModel
?
=
coupon
?
.
couponset_data
couponImage
.
load
(
link
:
couponSetData
?
.
img_preview
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
if
(
isMarket
==
true
)
{
couponImage
.
load
(
link
:
coupon
?
.
image
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
}
else
{
couponImage
.
load
(
link
:
couponSetData
?
.
img_preview
??
""
,
placeholder
:
UIImage
(),
cache
:
URLCache
())
}
couponImage
.
contentMode
=
.
scaleAspectFill
couponImageHeight
.
constant
=
255
//230 // 253 // self.uiscreen.height * 0.25
nameLabel
.
text
=
couponSetData
?
.
name
??
""
discriptionLabel
.
text
=
couponSetData
?
.
short_description
??
""
if
(
isMarket
==
true
)
{
nameLabel
.
text
=
coupon
?
.
name
??
""
discriptionLabel
.
text
=
coupon
?
.
short_description
??
""
}
else
{
nameLabel
.
text
=
couponSetData
?
.
name
??
""
discriptionLabel
.
text
=
couponSetData
?
.
short_description
??
""
}
merchantDescrTextView
.
text
=
""
merchantDescrTextViewTopSpace
.
constant
=
CGFloat
(
0
)
...
...
@@ -114,9 +133,15 @@ import AVFoundation
couponCodeLabelTopSpace
.
constant
=
CGFloat
(
35
)
let
merchantList
:
Array
<
swiftApi
.
MerchantModel
>
=
swiftApi
()
.
getMerchantList
()
var
merchantUuid
:
String
=
""
if
(
isMarket
==
true
)
{
merchantUuid
=
coupon
?
.
merchant_uuid
??
""
}
else
{
merchantUuid
=
couponSetData
?
.
merchant_uuid
??
""
}
for
merchant
in
merchantList
{
if
(
merchant
.
_uuid
==
couponSetData
?
.
merchant_u
uid
)
{
if
(
merchant
.
_uuid
==
merchantU
uid
)
{
let
htmlMerchDescrText
=
merchant
.
_body
if
(
htmlMerchDescrText
!=
""
)
{
...
...
@@ -146,6 +171,25 @@ import AVFoundation
couponNumberLabel
.
text
=
coupon
?
.
coupon
??
""
couponView
.
frame
=
CGRect
(
x
:
0.0
,
y
:
0.0
,
width
:
couponView
.
intrinsicContentSize
.
width
,
height
:
55
)
if
(
isMarket
==
true
)
{
couponCodeLabel
.
isHidden
=
true
couponCodeLabelHeight
.
constant
=
CGFloat
(
0
)
couponCodeLabelTopSpace
.
constant
=
CGFloat
(
0
)
couponView
.
isHidden
=
true
couponViewHeight
.
constant
=
CGFloat
(
0
)
couponViewTopSpace
.
constant
=
CGFloat
(
0
)
}
else
{
couponCodeLabel
.
isHidden
=
false
couponCodeLabelHeight
.
constant
=
CGFloat
(
20
)
couponCodeLabelTopSpace
.
constant
=
CGFloat
(
35
)
couponView
.
isHidden
=
true
couponViewHeight
.
constant
=
CGFloat
(
55
)
couponViewTopSpace
.
constant
=
CGFloat
(
20
)
}
let
barcodeString
=
constructBarcode
()
??
""
barcodeLabel
.
text
=
barcodeString
...
...
@@ -283,7 +327,13 @@ import AVFoundation
termsButton
.
titleEdgeInsets
=
UIEdgeInsets
(
top
:
0
,
left
:
0
,
bottom
:
0
,
right
:
5
);
termsButton
.
imageView
?
.
layer
.
transform
=
CATransform3DMakeScale
(
0.8
,
0.8
,
0.8
)
let
htmlText
=
couponSetData
?
.
terms
??
""
var
htmlText
=
""
if
(
isMarket
==
true
)
{
htmlText
=
coupon
?
.
terms
??
""
}
else
{
htmlText
=
couponSetData
?
.
terms
??
""
}
termsTextView
.
attributedText
=
htmlText
.
htmlToAttributedString
termsTextView
.
font
=
UIFont
(
name
:
"PeridotPE-Regular"
,
size
:
14
)
termsTextView
.
textColor
=
UIColor
(
red
:
0.13
,
green
:
0.13
,
blue
:
0.13
,
alpha
:
1.00
)
...
...
@@ -297,7 +347,9 @@ import AVFoundation
// Uncomment if Barcode Section is active again
// toggleTerms()
toggleBarcode
()
if
(
isMarket
==
false
)
{
toggleBarcode
()
}
// Logs
print
(
"Coupon: "
+
(
coupon
?
.
coupon
??
""
))
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Main.storyboard
View file @
5c2be3e
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/UnifiedCouponBarcodeViewController.swift
View file @
5c2be3e
...
...
@@ -181,18 +181,19 @@ extension UnifiedCouponBarcodeViewController: UITableViewDelegate, UITableViewDa
// SwiftEventBus.post("couponBarcodePressed", sender: coupons[indexPath.row])
// Logs
// let couponSetData: swiftApi.CouponSetItemModel? = coupons[indexPath.row].couponset_data
// print("Coupon clicked: " + (coupons[indexPath.row].coupon ?? ""))
// let couponSetData: swiftApi.CouponSetItemModel? =
self.coupon?._
coupons[indexPath.row].couponset_data
// print("Coupon clicked: " + (
self.coupon?._
coupons[indexPath.row].coupon ?? ""))
// print("Coupon Name clicked: " + (couponSetData?.name ?? ""))
// print("Coupon Description clicked: " + (couponSetData?.short_description ?? ""))
// print("Coupon Expiration clicked: " + (coupons[indexPath.row].expiration ?? ""))
// print("Coupon Expiration clicked: " + (
self.coupon?._
coupons[indexPath.row].expiration ?? ""))
// swiftApi().logTrackersEvent("click", ("Coupon:" + (couponSetData?
.name ?? "")))
swiftApi
()
.
logTrackersEvent
(
"click"
,
(
"Coupon:"
+
(
self
.
coupon
?
.
_coupons
[
indexPath
.
row
]
.
name
??
""
)))
// let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// let vc = storyboard.instantiateViewController(withIdentifier: "CouponBarcodeViewController") as! SwiftWarplyFramework.CouponBarcodeViewController
// vc.coupon = self.coupon?._coupons[indexPath.row]
// self.navigationController?.pushViewController(vc, animated: true)
let
storyboard
=
UIStoryboard
(
name
:
"Main"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
let
vc
=
storyboard
.
instantiateViewController
(
withIdentifier
:
"CouponBarcodeViewController"
)
as!
SwiftWarplyFramework
.
CouponBarcodeViewController
vc
.
coupon
=
self
.
coupon
?
.
_coupons
[
indexPath
.
row
]
vc
.
isMarket
=
true
self
.
navigationController
?
.
pushViewController
(
vc
,
animated
:
true
)
}
public
func
tableView
(
_
tableView
:
UITableView
,
viewForHeaderInSection
section
:
Int
)
->
UIView
?
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
5c2be3e
...
...
@@ -610,6 +610,8 @@ public class swiftApi {
// Market Coupon
public
let
inner_text
:
String
?
public
let
merchant_uuid
:
String
?
public
let
short_description
:
String
?
public
let
terms
:
String
?
public
init
(
dictionary
:
[
String
:
Any
])
{
...
...
@@ -626,6 +628,8 @@ public class swiftApi {
// Market Coupon
self
.
inner_text
=
dictionary
[
"inner_text"
]
as?
String
?
??
""
self
.
merchant_uuid
=
dictionary
[
"merchant_uuid"
]
as?
String
?
??
""
self
.
short_description
=
dictionary
[
"short_description"
]
as?
String
?
??
""
self
.
terms
=
dictionary
[
"terms"
]
as?
String
?
??
""
if
let
couponSetData
=
dictionary
[
"couponset_data"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
{
...
...
Please
register
or
login
to post a comment