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:38:01 +0300
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
3ca97918a2fac7ba1aae0fd3174ef7b999cf4d1c
3ca97918
2 parents
bfd3499c
f716060e
Merge branch 'master' of
https://git.warp.ly/open-source/warply_sdk_framework
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
19 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponBarcodeView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
View file @
3ca9791
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponBarcodeView.swift
View file @
3ca9791
...
...
@@ -77,7 +77,7 @@ extension CouponBarcodeView {
}
struct
couponContainer
:
View
{
@State
var
coupon
:
Dictionary
<
String
,
Any
>
@State
var
coupon
:
swiftApi
.
CouponItemModel
// @State var couponset:CouponSetItemModel
var
uiscreen
=
UIScreen
.
main
.
bounds
...
...
@@ -98,8 +98,8 @@ extension CouponBarcodeView {
func
constructBarcode
()
->
String
?
{
// EAN 13 barcode construction
let
couponData
=
coupon
[
"coupon_data"
]
as?
[
String
:
Any
]
??
[
""
:
""
]
let
couponString
=
coupon
Data
[
"coupon"
]
as?
String
??
""
let
couponData
=
coupon
.
couponset_data
let
couponString
=
coupon
.
coupon
??
""
if
(
!
couponString
.
isEmpty
)
{
var
checkDigit
=
0
;
...
...
@@ -132,17 +132,17 @@ extension CouponBarcodeView {
var
body
:
some
View
{
let
couponData
=
coupon
[
"coupon_data"
]
as?
[
String
:
Any
]
??
[
""
:
""
]
let
couponData
=
coupon
.
couponset_data
let
barcodeString
=
constructBarcode
()
??
""
GeometryReader
{
geometry
in
ScrollView
(
showsIndicators
:
false
)
{
VStack
(
alignment
:
.
leading
)
{
ImageView
(
withURL
:
coupon
[
"img_preview"
]
as?
String
??
""
)
ImageView
(
withURL
:
coupon
Data
?
.
img_preview
??
""
)
VStack
(
alignment
:
.
leading
)
{
Text
(
coupon
[
"name"
]
as?
String
??
""
)
Text
(
coupon
.
name
!
)
.
fontWeight
(
.
bold
)
.
font
(
.
system
(
size
:
16
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -151,7 +151,7 @@ extension CouponBarcodeView {
.
padding
(
.
top
,
self
.
uiscreen
.
height
*
0.04
)
.
frame
(
maxHeight
:
.
infinity
)
Text
(
coupon
[
"short_description"
]
as?
String
??
""
)
Text
(
coupon
Data
?
.
short_description
!
??
""
)
.
fontWeight
(
.
regular
)
.
font
(
.
system
(
size
:
14
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -170,7 +170,7 @@ extension CouponBarcodeView {
VStack
(
alignment
:
.
center
)
{
VStack
{
Text
(
coupon
Data
[
"coupon"
]
as?
String
??
""
)
Text
(
coupon
.
coupon
!
)
.
fontWeight
(
.
bold
)
.
font
(
.
system
(
size
:
27
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -185,7 +185,7 @@ extension CouponBarcodeView {
}
.
frame
(
maxWidth
:
.
infinity
)
if
(
CharacterSet
.
decimalDigits
.
isSuperset
(
of
:
CharacterSet
(
charactersIn
:
coupon
Data
[
"coupon"
]
as?
String
??
""
)))
{
if
(
CharacterSet
.
decimalDigits
.
isSuperset
(
of
:
CharacterSet
(
charactersIn
:
coupon
.
coupon
??
""
)))
{
VStack
(
alignment
:
.
center
)
{
VStack
{}
.
frame
(
height
:
1
)
...
...
@@ -233,7 +233,7 @@ extension CouponBarcodeView {
Text
(
"Το κουπόνι ισχύει έως "
+
CouponBarcodeView
.
couponContainer
.
convertDateFormat
(
inputDate
:
couponData
[
"expiration"
]
as?
String
??
""
))
Text
(
"Το κουπόνι ισχύει έως "
+
CouponBarcodeView
.
couponContainer
.
convertDateFormat
(
inputDate
:
couponData
?
.
expiration
??
""
))
.
fontWeight
(
.
medium
)
.
font
(
.
system
(
size
:
14
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -348,7 +348,7 @@ extension CouponBarcodeView {
@available(iOS 13.0.0, *)
struct
CouponBarcodeView
:
View
{
var
parentView
:
UIView
var
coupon
:
Dictionary
<
String
,
Any
>
var
coupon
:
swiftApi
.
CouponItemModel
@State
var
couponset
:
CouponSetItemModel
?
var
uiscreen
=
UIScreen
.
main
.
bounds
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponView.swift
View file @
3ca9791
...
...
@@ -48,7 +48,7 @@ extension CouponView {
}
struct
couponContainer
:
View
{
@State
var
coupon
:
Dictionary
<
String
,
Any
>
@State
var
coupon
:
swiftApi
.
CouponSetItemModel
// @State var couponset:CouponSetItemModel
var
uiscreen
=
UIScreen
.
main
.
bounds
...
...
@@ -58,9 +58,9 @@ extension CouponView {
ScrollView
(
showsIndicators
:
false
)
{
VStack
(
alignment
:
.
leading
)
{
ImageView
(
withURL
:
coupon
[
"img_preview"
]
as?
String
??
""
)
ImageView
(
withURL
:
coupon
.
img_preview
as?
String
??
""
)
Text
(
coupon
[
"name"
]
as?
String
??
""
)
Text
(
coupon
.
name
as?
String
??
""
)
.
fontWeight
(
.
bold
)
.
font
(
.
system
(
size
:
16
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -68,7 +68,7 @@ extension CouponView {
.
padding
(
.
horizontal
)
.
padding
(
.
top
,
self
.
uiscreen
.
height
*
0.04
)
Text
(
coupon
[
"short_description"
]
as?
String
??
""
)
Text
(
coupon
.
short_description
as?
String
??
""
)
.
fontWeight
(
.
regular
)
.
font
(
.
system
(
size
:
14
))
.
foregroundColor
(
Color
(
red
:
0.2549019607843137
,
green
:
0.3333333333333333
,
blue
:
0.39215686274509803
))
...
...
@@ -152,7 +152,7 @@ extension CouponView {
@available(iOS 13.0.0, *)
struct
CouponView
:
View
{
var
parentView
:
UIView
var
coupon
:
Dictionary
<
String
,
Any
>
var
coupon
:
swiftApi
.
CouponSetItemModel
@State
var
couponset
:
CouponSetItemModel
?
var
uiscreen
=
UIScreen
.
main
.
bounds
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
View file @
3ca9791
...
...
@@ -187,13 +187,13 @@ extension CouponsView {
VStack
(
alignment
:
.
leading
)
{
Button
{
// GiftItem Action
let
instanceOfMy
Api
=
My
Api
()
let
couponBarcodeViewController
=
instanceOfMy
Api
.
openCouponBarcode
(
parentView
,
coupon
:
result
as!
[
String
:
Any
])
!
let
instanceOfMy
SwiftApi
=
swift
Api
()
let
couponBarcodeViewController
=
instanceOfMy
SwiftApi
.
openCouponBarcode
(
parent
:
parentView
,
coupon
:
result
)
couponBarcodeViewController
.
view
.
tag
=
7
// addChild(couponsViewController)
couponBarcodeViewController
.
view
.
frame
=
parentView
.
frame
parentView
.
addSubview
(
couponBarcodeViewController
.
view
)
couponBarcodeViewController
.
didMove
(
toParent
:
UIHostingController
(
rootView
:
self
))
//
couponBarcodeViewController.didMove(toParent: UIHostingController(rootView: self))
}
label
:
{
HStack
(
alignment
:
.
center
)
{
ImageView
(
withURL
:
couponSetData
?
.
img_preview
??
""
)
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
View file @
3ca9791
...
...
@@ -6,6 +6,7 @@
//
import
Foundation
import
SwiftUI
public
class
swiftApi
{
...
...
@@ -330,4 +331,12 @@ 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
:
CouponItemModel
)
->
UIViewController
{
return
UIHostingController
(
rootView
:
CouponBarcodeView
(
parentView
:
parent
,
coupon
:
coupon
))
}
}
...
...
Please
register
or
login
to post a comment