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
Vasilis
2022-04-18 17:11:37 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f263c9445eb9416b1d4cd543ae741391f9bb9d7d
f263c944
1 parent
fdea74c7
addition of getinbox2 in sdk
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
105 additions
and
15 deletions
WarplySDKFrameworkIOS/Warply/Warply.h
WarplySDKFrameworkIOS/Warply/Warply.m
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
WarplySDKFrameworkIOS/Warply/Warply.h
View file @
f263c94
...
...
@@ -285,6 +285,9 @@ WL_VERSION_INTERFACE()
-
(
BOOL
)
getInboxWithSuccessBlock
:(
void
(
^
)(
NSArray
*
list
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
BOOL
)
getInbox2WithSuccessBlock
:(
void
(
^
)(
NSArray
*
list
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getProductsWithSuccessBlock
:(
NSString
*
)
filter
:
(
void
(
^
)(
NSMutableArray
*
params
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
sendContactWithSuccessBlock
:(
NSString
*
)
name
andEmail
:(
NSString
*
)
email
andMsisdn
:
msisdn
andMessage
:
message
:
(
void
(
^
)(
NSMutableArray
*
params
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
WarplySDKFrameworkIOS/Warply/Warply.m
View file @
f263c94
...
...
@@ -430,6 +430,30 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
return
[
self
isRegistrationValid
];
}
-
(
BOOL
)
getInbox2WithSuccessBlock
:
(
void
(
^
)(
NSArray
*
list
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
if
(
self
.
allOffers
.
count
>
0
)
{
success
(
self
.
allOffers
);
}
else
{
NSDictionary
*
postDictionary
=
@{
@"offers"
:
@{
@"action"
:
@"get_inbox"
}};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
([
contextResponse
valueForKey
:
@"MAPP_OFFER"
]);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
return
[
self
isRegistrationValid
];
}
-
(
void
)
getProductsWithSuccessBlock
:
(
NSString
*
)
filter
:
(
void
(
^
)(
NSMutableArray
*
params
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
if
(
filter
==
nil
)
{
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
View file @
f263c94
No preview for this file type
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/CouponsView.swift
View file @
f263c94
...
...
@@ -50,6 +50,67 @@ class DataModel {
}
}
struct
UrlImageView
:
View
{
@ObservedObject
var
urlImageModel
:
UrlImageModel
init
(
urlString
:
String
?)
{
urlImageModel
=
UrlImageModel
(
urlString
:
urlString
)
}
var
body
:
some
View
{
Image
(
uiImage
:
urlImageModel
.
image
??
UrlImageView
.
defaultImage
!
)
.
resizable
()
.
scaledToFill
()
}
static
var
defaultImage
=
UIImage
(
systemName
:
"photo"
)
}
class
UrlImageModel
:
ObservableObject
{
@Published
var
image
:
UIImage
?
var
urlString
:
String
?
init
(
urlString
:
String
?)
{
self
.
urlString
=
urlString
loadImage
()
}
func
loadImage
()
{
loadImageFromUrl
()
}
func
loadImageFromUrl
()
{
guard
let
urlString
=
urlString
else
{
return
}
let
url
=
URL
(
string
:
urlString
)
!
let
task
=
URLSession
.
shared
.
dataTask
(
with
:
url
,
completionHandler
:
getImageFromResponse
(
data
:
response
:
error
:))
task
.
resume
()
}
func
getImageFromResponse
(
data
:
Data
?,
response
:
URLResponse
?,
error
:
Error
?)
{
guard
error
==
nil
else
{
print
(
"Error:
\(
error
!
)
"
)
return
}
guard
let
data
=
data
else
{
print
(
"No data found"
)
return
}
DispatchQueue
.
main
.
async
{
guard
let
loadedImage
=
UIImage
(
data
:
data
)
else
{
return
}
self
.
image
=
loadedImage
}
}
}
extension
CouponsView
{
struct
headerView
:
View
{
...
...
@@ -69,26 +130,28 @@ extension CouponsView {
}
}
struct
couponView
:
View
{
@Binding
var
result
:
NSDictionary
var
result
:
NSDictionary
var
index
:
Int
var
uiscreen
=
UIScreen
.
main
.
bounds
var
body
:
some
View
{
ZStack
{
URLImage
(
url
:
URL
(
string
:
result
[
"img_preview"
]
as!
String
?
??
""
))
// .resizable()
.
frame
(
width
:
self
.
uiscreen
.
height
*
0.04
,
height
:
self
.
uiscreen
.
height
*
0.04
)
.
cornerRadius
(
CGFloat
(
self
.
uiscreen
.
height
*
0.02
))
// .offset(x: -self.uiscreen.width / 2 + self.uiscreen.width * 0.14, y: -self.uiscreen.height * 0.07)
UrlImageView
(
urlString
:
result
[
"img_preview"
]
as?
String
)
.
frame
(
width
:
self
.
uiscreen
.
height
*
0.25
,
height
:
self
.
uiscreen
.
height
*
0.05
,
alignment
:
.
leading
)
.
offset
(
x
:
self
.
uiscreen
.
width
*
0.05
,
y
:
self
.
uiscreen
.
height
*
0.06
)
}
// .background(
// Image("coupons_container", bundle: Bundle(for: MyEmptyClass.self))
// .resizable()
//// .edgesIgnoringSafeArea(.all)
// .frame(width: UIScreen.main.bounds.width * 0.8, height: UIScreen.main.bounds.height * 0.17)
// )
.
background
(
Image
(
"coupons_container"
,
bundle
:
Bundle
(
for
:
MyEmptyClass
.
self
))
.
resizable
()
.
offset
(
x
:
self
.
uiscreen
.
width
*
0.05
,
y
:
(
CGFloat
(
index
+
1
)
*
self
.
uiscreen
.
height
*
0.06
)
+
CGFloat
(
index
)
*
self
.
uiscreen
.
height
*
0.17
)
.
padding
()
.
frame
(
width
:
UIScreen
.
main
.
bounds
.
width
*
0.9
,
height
:
UIScreen
.
main
.
bounds
.
height
*
0.17
,
alignment
:
.
topLeading
)
)
}
}
...
...
@@ -107,8 +170,8 @@ struct CouponsView: View {
ScrollView
{
VStack
{
if
(
data
.
count
)
>
0
{
ForEach
(
data
,
id
:
\
.
self
)
{
result
in
couponView
(
result
:
result
)
ForEach
(
Array
(
zip
(
data
.
indices
,
data
)),
id
:
\
.
0
)
{
index
,
result
in
couponView
(
result
:
result
,
index
:
index
)
}
}
}
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
View file @
f263c94
...
...
@@ -117,7 +117,7 @@ NSString *LANG;
__block
NSArray
*
in
=
[
NSMutableArray
alloc
];
__block
BOOL
isRunLoopNested
=
NO
;
__block
BOOL
isOperationCompleted
=
NO
;
[[
Warply
sharedService
]
getInboxWithSuccessBlock
:
^
(
NSArray
*
inbox
)
{
[[
Warply
sharedService
]
getInbox
2
WithSuccessBlock
:
^
(
NSArray
*
inbox
)
{
in
=
inbox
;
isOperationCompleted
=
YES
;
if
(
isRunLoopNested
)
{
...
...
Please
register
or
login
to post a comment