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 17:08:21 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9450082b1c4f04c2e3ae5f4eea416b20895acbb6
9450082b
1 parent
b97c23a7
update OldCouponsView
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
42 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/OldCouponsView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/manos.xcuserdatad/UserInterfaceState.xcuserstate
View file @
9450082
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/OldCouponsView.swift
View file @
9450082
...
...
@@ -79,13 +79,14 @@ extension OldCouponsView {
}
struct
couponItemView
:
View
{
var
item
:
NSDictionary
var
item
:
swiftApi
.
CouponItemModel
var
parentView
:
UIView
var
uiscreen
=
UIScreen
.
main
.
bounds
var
body
:
some
View
{
let
couponData
=
item
[
"coupon_data"
]
as?
[
String
:
Any
]
??
[
""
:
""
]
// let couponData = item["coupon_data"] as? [String: Any] ?? ["":""]
let
couponSetData
=
item
.
couponset_data
Button
{
// Coupon Action
...
...
@@ -101,7 +102,7 @@ extension OldCouponsView {
HStack
(
alignment
:
.
center
)
{
ImageView
(
withURL
:
item
[
"img_preview"
]
as?
String
??
""
,
width
:
self
.
uiscreen
.
width
*
0.15
,
isFill
:
false
)
ImageView
(
withURL
:
couponSetData
?
.
img_preview
??
""
,
width
:
self
.
uiscreen
.
width
*
0.15
,
isFill
:
false
)
VLine
()
.
stroke
(
style
:
StrokeStyle
(
lineWidth
:
1
,
dash
:
[
5
]))
...
...
@@ -110,7 +111,7 @@ extension OldCouponsView {
.
padding
(
.
leading
,
10
)
VStack
(
alignment
:
.
leading
,
spacing
:
5.0
)
{
Text
(
item
[
"name"
]
as?
String
??
""
)
Text
(
couponSetData
?
.
name
??
""
)
.
fontWeight
(
.
medium
)
.
font
(
.
system
(
size
:
16
))
.
foregroundColor
(
Color
(
red
:
0.22745098039215686
,
green
:
0.3215686274509804
,
blue
:
0.4
))
...
...
@@ -118,14 +119,14 @@ extension OldCouponsView {
// .lineLimit(1)
HStack
(
alignment
:
.
center
)
{
Text
((
couponData
[
"discount"
]
as?
String
??
""
)
+
"€"
)
Text
((
item
.
discount
??
""
)
+
"€"
)
.
fontWeight
(
.
bold
)
.
font
(
.
system
(
size
:
35
))
.
foregroundColor
(
Color
(
red
:
0.22745098039215686
,
green
:
0.3215686274509804
,
blue
:
0.4
))
.
multilineTextAlignment
(
.
leading
)
.
lineLimit
(
1
)
// Text(
item["short_description"] as? String
?? "")
// Text(
couponSetData?.short_description
?? "")
// .fontWeight(.medium)
// .font(.system(size: 11))
// .foregroundColor(Color(red: 0.3803921568627451, green: 0.44313725490196076, blue: 0.5058823529411764))
...
...
@@ -133,7 +134,7 @@ extension OldCouponsView {
// .lineLimit(3)
}
Text
(
"Εξαργυρώθηκε την "
+
OldCouponsView
.
couponsContainer
.
convertDateFormat
(
inputDate
:
couponData
[
"expiration"
]
as?
String
??
""
))
Text
(
"Εξαργυρώθηκε την "
+
(
item
.
expiration
??
""
))
.
fontWeight
(
.
medium
)
.
font
(
.
system
(
size
:
11
))
.
foregroundColor
(
Color
(
red
:
0.3803921568627451
,
green
:
0.44313725490196076
,
blue
:
0.5058823529411764
))
...
...
@@ -169,22 +170,22 @@ extension OldCouponsView {
}
struct
couponsContainer
:
View
{
@State
var
coupons
:
Array
<
NSDictionary
>
=
[]
@State
var
coupons
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
@State
var
parentView
:
UIView
var
uiscreen
=
UIScreen
.
main
.
bounds
static
func
convertDateFormat
(
inputDate
:
String
)
->
String
{
let
dateFormatter
=
DateFormatter
()
dateFormatter
.
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
""
}
}
//
static func convertDateFormat(inputDate: String) -> String {
//
let dateFormatter = DateFormatter()
//
dateFormatter.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
{
VStack
(
alignment
:
.
center
,
spacing
:
self
.
uiscreen
.
height
*
0.03
)
{
...
...
@@ -206,10 +207,20 @@ extension OldCouponsView {
struct
OldCouponsView
:
View
{
var
parentView
:
UIView
var
coupons
:
Array
<
NSDictionary
>
=
DataModel
()
.
getOldCoupons
var
coupons
:
Array
<
swiftApi
.
CouponItemModel
>
=
[]
var
uiscreen
=
UIScreen
.
main
.
bounds
init
(
parentView
:
UIView
)
{
//initializer method
let
instanceOfMySwiftApi
=
swiftApi
()
let
couponsData
=
instanceOfMySwiftApi
.
getOldCoupons
()
self
.
coupons
=
couponsData
self
.
parentView
=
parentView
}
func
goBack
(){
for
subview
in
parentView
.
subviews
{
if
(
subview
.
tag
==
9
)
{
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
View file @
9450082
...
...
@@ -6,7 +6,6 @@
//
import
Foundation
import
SwiftUI
public
class
swiftApi
{
...
...
@@ -26,22 +25,10 @@ public class swiftApi {
}
public
func
setCCMSLoyaltyCampaigns
(
campaigns
:
Array
<
LoyaltyContextualOfferModel
>
)
{
public
func
setCCMSLoyaltyCampaigns
(
campaigns
:
Array
<
Dictionary
<
String
,
String
>
>
)
{
}
public
class
LoyaltyContextualOfferModel
{
var
sessionId
:
String
var
eligibleAssets
:
Array
<
String
>
var
id
:
String
init
(
sessionId
:
String
,
eligibleAssets
:
Array
<
String
>
,
id
:
String
)
{
self
.
sessionId
=
sessionId
self
.
eligibleAssets
=
eligibleAssets
self
.
id
=
id
}
}
public
class
CouponSetItemModel
{
let
uuid
:
String
?
let
admin_name
:
String
?
...
...
@@ -271,6 +258,10 @@ public class swiftApi {
return
CouponsDataModel
()
.
getData
}
public
func
getOldCoupons
()
->
Array
<
CouponItemModel
>
{
return
CouponsDataModel
()
.
getOldCoupons
}
public
class
CampaignItemModel
{
let
index_url
:
String
?
let
logo_url
:
String
?
...
...
@@ -339,12 +330,4 @@ public class swiftApi {
public
func
getCampaigns
()
->
Array
<
CampaignItemModel
>
{
return
CampaignDataModel
()
.
getData
}
public
func
openCoupon
(
parent
:
UIView
,
coupon
:
CouponSetItemModel
)
->
UIViewController
{
return
UIHostingController
(
rootView
:
CouponView
(
parentView
:
parent
,
coupon
:
coupon
))
}
public
func
openCouponBarcode
(
parent
:
UIView
,
coupon
:
CouponSetItemModel
)
->
UIViewController
{
return
UIHostingController
(
rootView
:
CouponBarcodeView
(
parentView
:
parent
,
coupon
:
coupon
))
}
}
...
...
Please
register
or
login
to post a comment