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-05-09 14:16:02 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5b39092a982eabfabc0b5c937a1c84874430a0ad
5b39092a
1 parent
7f342348
add getProfileAsync request and Profile Model
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
142 additions
and
0 deletions
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.h
View file @
5b39092
...
...
@@ -78,6 +78,8 @@
-
(
void
)
getCouponsWithSuccessBlock
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getCouponsetsAsync
:(
NSNumber
*
)
active
andVisible
:
(
NSNumber
*
)
visible
andUuids
:
(
NSArray
*
)
uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getInboxAsync
:(
void
(
^
)(
NSArray
*
list
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
verifyTicketAsync
:(
NSString
*
)
guid
:
(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
getProfileAsync
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
@end
#endif
/* MyApi_h */
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/MyApi.m
View file @
5b39092
...
...
@@ -1297,4 +1297,28 @@ CMPedometer *pedometer;
}
}];
}
-
(
void
)
verifyTicketAsync
:
(
NSString
*
)
guid
:
(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
verifyTicketWithSuccessBlock
:
guid
:
ticket
:^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
-
(
void
)
getProfileAsync
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
getProfileWithSuccessBlock
:
^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:
^
(
NSError
*
error
)
{
failure
(
error
);
}];
}
@end
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS/swiftApi.swift
View file @
5b39092
...
...
@@ -465,4 +465,120 @@ public class swiftApi {
// public func openSteps(parent: UIView) -> UIViewController {
// return UIHostingController(rootView: StepsView(parentView: parent))
// }
public
class
ProfileModel
{
let
ack_optin
:
Bool
?
let
billing_info
:
[
String
:
Any
]?
let
birthday
:
String
?
let
burnt_points
:
Double
?
let
company_name
:
String
?
let
consumer_metadata
:
[
String
:
Any
]?
let
display_name
:
String
?
let
email
:
String
?
let
firstname
:
String
?
let
gender
:
String
?
let
image_url
:
String
?
let
language
:
String
?
let
lastname
:
String
?
let
loyalty_id
:
String
?
let
msisdn
:
String
?
let
nameday
:
String
?
let
nickname
:
String
?
let
password_set
:
Bool
?
let
profile_metadata
:
[
String
:
Any
]?
let
redeemed_points
:
Double
?
let
retrieved_points
:
Double
?
let
salutation
:
String
?
let
subscribe
:
Bool
?
let
tags
:
[
String
:
Any
]?
let
tax_id
:
String
?
let
user_points
:
Double
?
let
uuid
:
String
?
let
verified
:
Bool
?
// optin
let
optin_newsletter
:
Bool
?
let
optin_sms
:
Bool
?
let
optin_segmentation
:
Bool
?
let
optin_sms_segmentation
:
Bool
?
init
(
dictionary
:
[
String
:
Any
])
{
self
.
ack_optin
=
dictionary
[
"ack_optin"
]
as?
Bool
?
??
false
self
.
billing_info
=
dictionary
[
"billing_info"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
self
.
birthday
=
dictionary
[
"birthday"
]
as?
String
?
??
""
self
.
burnt_points
=
dictionary
[
"burnt_points"
]
as?
Double
?
??
0.0
self
.
company_name
=
dictionary
[
"company_name"
]
as?
String
?
??
""
self
.
consumer_metadata
=
dictionary
[
"consumer_metadata"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
self
.
display_name
=
dictionary
[
"display_name"
]
as?
String
?
??
""
self
.
email
=
dictionary
[
"email"
]
as?
String
?
??
""
self
.
firstname
=
dictionary
[
"firstname"
]
as?
String
?
??
""
self
.
gender
=
dictionary
[
"gender"
]
as?
String
?
??
""
self
.
image_url
=
dictionary
[
"image_url"
]
as?
String
?
??
""
self
.
language
=
dictionary
[
"language"
]
as?
String
?
??
""
self
.
lastname
=
dictionary
[
"lastname"
]
as?
String
?
??
""
self
.
loyalty_id
=
dictionary
[
"loyalty_id"
]
as?
String
?
??
""
self
.
msisdn
=
dictionary
[
"msisdn"
]
as?
String
?
??
""
self
.
nameday
=
dictionary
[
"nameday"
]
as?
String
?
??
""
self
.
nickname
=
dictionary
[
"nickname"
]
as?
String
?
??
""
self
.
password_set
=
dictionary
[
"password_set"
]
as?
Bool
?
??
false
self
.
profile_metadata
=
dictionary
[
"profile_metadata"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
self
.
redeemed_points
=
dictionary
[
"redeemed_points"
]
as?
Double
?
??
0.0
self
.
retrieved_points
=
dictionary
[
"retrieved_points"
]
as?
Double
?
??
0.0
self
.
salutation
=
dictionary
[
"salutation"
]
as?
String
?
??
""
self
.
subscribe
=
dictionary
[
"subscribe"
]
as?
Bool
?
??
false
self
.
tags
=
dictionary
[
"tags"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
self
.
tax_id
=
dictionary
[
"tax_id"
]
as?
String
?
??
""
self
.
user_points
=
dictionary
[
"user_points"
]
as?
Double
?
??
0.0
self
.
uuid
=
dictionary
[
"uuid"
]
as?
String
?
??
""
self
.
verified
=
dictionary
[
"verified"
]
as?
Bool
?
??
false
// optin
let
optin
=
dictionary
[
"optin"
]
as?
[
String
:
Any
]?
??
[
""
:
""
]
self
.
optin_newsletter
=
optin
?[
"newsletter"
]
as?
Bool
?
??
false
self
.
optin_sms
=
optin
?[
"sms"
]
as?
Bool
?
??
false
self
.
optin_segmentation
=
optin
?[
"segmentation"
]
as?
Bool
?
??
false
self
.
optin_sms_segmentation
=
optin
?[
"sms_segmentation"
]
as?
Bool
?
??
false
}
}
public
class
ProfileDataModel
{
init
()
{
}
func
getProfileData
(
_
getProfileCallback
:
@escaping
(
_
profileData
:
ProfileModel
?)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
getProfileAsync
(
profileCallback
,
failureBlock
:
profileFailureCallback
)
func
profileCallback
(
_
profileData
:
[
AnyHashable
:
Any
]?)
->
Void
{
if
let
profileDataDictionary
=
profileData
as?
[
String
:
AnyObject
]
{
let
profileDataResult
=
(
profileDataDictionary
[
"result"
]
as?
[
String
:
Any
]
??
[
""
:
""
])
let
tempProfile
=
ProfileModel
(
dictionary
:
profileDataResult
)
getProfileCallback
(
tempProfile
);
}
else
{
getProfileCallback
(
nil
)
}
}
func
profileFailureCallback
(
_
error
:
Error
?)
->
Void
{
print
(
"getProfile error: "
)
getProfileCallback
(
nil
)
}
}
}
public
func
getProfileAsync
(
_
getProfileCallback
:
@escaping
(
_
profileData
:
ProfileModel
?)
->
Void
)
->
Void
{
ProfileDataModel
()
.
getProfileData
(
getProfileCallback
)
}
}
...
...
Please
register
or
login
to post a comment