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
2022-04-29 16:35:12 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7259ed6f3e5c1eb17eb1582ee653cc14e698366c
7259ed6f
1 parent
d1374492
update CouponsView request
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
17 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
7259ed6
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
View file @
7259ed6
...
...
@@ -13,8 +13,16 @@ import UIKit
class
DataModel
{
var
data
:
Array
<
NSDictionary
>
=
[]
var
data2
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
init
()
{
//initializer method
let
instanceOfMySwiftApi
=
swiftApi
()
let
couponsData
=
instanceOfMySwiftApi
.
getCoupons
()
self
.
data2
=
couponsData
let
instanceOfMyApi
=
MyApi
()
let
couponSets
=
instanceOfMyApi
.
getCouponSets
(
withActive
:
true
,
andVisible
:
true
,
andUuids
:
nil
)
let
coupons
=
instanceOfMyApi
.
getCoupons
()
as
AnyObject
?
...
...
@@ -48,6 +56,12 @@ class DataModel {
}
}
var
getData2
:
Array
<
swiftApi
.
CouponItemModel
>
{
get
{
// getter
return
data2
}
}
var
getData
:
Array
<
NSDictionary
>
{
get
{
// getter
return
data
.
filter
({
...
...
@@ -143,7 +157,7 @@ extension CouponsView {
}
struct
couponView
:
View
{
var
result
:
NSDictionary
var
result
:
swiftApi
.
CouponItemModel
var
index
:
Int
var
parentView
:
UIView
...
...
@@ -154,19 +168,20 @@ extension CouponsView {
}
static
func
convertDateFormat
(
inputDate
:
String
)
->
String
{
let
olD
ateFormatter
=
DateFormatter
()
olD
ateFormatter
.
dateFormat
=
"yyyy-MM-dd hh:mm:ss"
let
oldDate
=
olDateFormatter
.
date
(
from
:
inputDate
)
let
convertDateFormatter
=
DateFormatter
()
convertDateFormatter
.
dateFormat
=
"dd/MM/yyyy"
return
convertDateFormatter
.
string
(
from
:
oldDate
!
)
let
d
ateFormatter
=
DateFormatter
()
d
ateFormatter
.
dateFormat
=
"yyyy-MM-dd hh:mm:ss"
if
let
date
=
dateFormatter
.
date
(
from
:
inputDate
)
{
dateFormatter
.
dateFormat
=
"dd/MM/yyyy"
let
resultString
=
dateFormatter
.
string
(
from
:
date
)
return
resultString
}
else
{
return
""
}
}
var
body
:
some
View
{
let
couponData
=
result
[
"coupon_data"
]
as?
[
String
:
Any
]
??
[
""
:
""
]
// let couponData = result["coupon_data"] as? [String: Any] ?? ["":""]
let
couponSetData
=
result
.
couponset_data
VStack
(
alignment
:
.
leading
)
{
...
...
@@ -181,7 +196,7 @@ extension CouponsView {
couponBarcodeViewController
.
didMove
(
toParent
:
UIHostingController
(
rootView
:
self
))
}
label
:
{
HStack
(
alignment
:
.
center
)
{
ImageView
(
withURL
:
result
[
"img_preview"
]
as!
String
)
ImageView
(
withURL
:
couponSetData
?
.
img_preview
??
""
)
.
frame
(
maxWidth
:
self
.
uiscreen
.
width
*
0.15
)
.
padding
(
.
leading
,
self
.
uiscreen
.
width
*
0.055
)
VLine
()
...
...
@@ -193,17 +208,17 @@ extension CouponsView {
.
padding
(
.
bottom
,
self
.
uiscreen
.
height
*
0.0075
)
Spacer
()
VStack
{
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
result
[
"name"
]
as?
String
??
""
))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
couponSetData
?
.
name
??
""
))
.
fontWeight
(
.
medium
)
.
foregroundColor
(
Color
(
red
:
0.22745098039215686
,
green
:
0.3215686274509804
,
blue
:
0.4
))
.
frame
(
maxWidth
:
self
.
uiscreen
.
width
*
0.35
,
maxHeight
:
.
infinity
,
alignment
:
.
leading
)
.
font
(
.
system
(
size
:
15
))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
couponData
[
"discount"
]
as?
String
??
""
))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
result
.
discount
??
""
))
.
fontWeight
(
.
bold
)
.
foregroundColor
(
Color
(
red
:
0.22745098039215686
,
green
:
0.3215686274509804
,
blue
:
0.4
))
.
frame
(
maxWidth
:
self
.
uiscreen
.
width
*
0.35
,
maxHeight
:
self
.
uiscreen
.
height
*
0.05
,
alignment
:
.
leading
)
.
font
(
.
system
(
size
:
47
))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
"Ισχύει εώς "
+
CouponsView
.
couponView
.
convertDateFormat
(
inputDate
:
couponData
[
"expiration"
]
as?
String
??
""
)))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
"Ισχύει εώς "
+
(
result
.
expiration
??
""
)))
.
fontWeight
(
.
medium
)
.
foregroundColor
(
Color
(
red
:
0.3803921568627451
,
green
:
0.44313725490196076
,
blue
:
0.5058823529411764
))
.
frame
(
maxWidth
:
self
.
uiscreen
.
width
*
0.35
,
maxHeight
:
.
infinity
,
alignment
:
.
leading
)
...
...
@@ -213,7 +228,7 @@ extension CouponsView {
.
padding
(
.
top
,
self
.
uiscreen
.
height
*
0.03
)
.
padding
(
.
bottom
,
self
.
uiscreen
.
height
*
0.03
)
VStack
{
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
result
[
"short_description"
]
as!
String
))
Text
(
CouponsView
.
couponView
.
localizedWithParameter
(
parameter
:
couponSetData
?
.
short_description
??
""
))
.
fontWeight
(
.
medium
)
.
foregroundColor
(
Color
(
red
:
0.3803921568627451
,
green
:
0.44313725490196076
,
blue
:
0.5058823529411764
))
.
frame
(
maxWidth
:
self
.
uiscreen
.
width
*
0.22
,
maxHeight
:
self
.
uiscreen
.
height
*
0.10
)
...
...
@@ -239,12 +254,22 @@ extension CouponsView {
@available(iOS 13.0.0, *)
struct
CouponsView
:
View
{
var
data
:
Array
<
NSDictionary
>
=
DataModel
()
.
getData
// var data:Array<swiftApi.CouponItemModel> = []
var
data
:
Array
<
swiftApi
.
CouponItemModel
>
=
DataModel
()
.
getData2
var
parentView
:
UIView
var
uiscreen
=
UIScreen
.
main
.
bounds
// init() { //initializer method
//
// let instanceOfMySwiftApi = swiftApi()
// let couponsData = instanceOfMySwiftApi.getCoupons()
//
// self.data = couponsData
// }
func
goBack
(){
for
subview
in
parentView
.
subviews
{
if
(
subview
.
tag
==
1
)
{
...
...
Please
register
or
login
to post a comment