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-07-12 16:42:35 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
154a5428d928717dade92556c5c18671a8aa7bc0
154a5428
1 parent
0cec9243
update ProfileModel
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
154a542
...
...
@@ -1006,6 +1006,9 @@ public class swiftApi {
public
let
optin_segmentation
:
Bool
?
public
let
optin_sms_segmentation
:
Bool
?
// profile_metadata
public
let
badge
:
String
?
public
init
()
{
self
.
ack_optin
=
false
...
...
@@ -1043,6 +1046,8 @@ public class swiftApi {
self
.
optin_segmentation
=
false
self
.
optin_sms_segmentation
=
false
// profile_metadata
self
.
badge
=
""
}
public
init
(
dictionary
:
[
String
:
Any
])
{
...
...
@@ -1064,7 +1069,6 @@ public class swiftApi {
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
?
??
""
...
...
@@ -1082,6 +1086,28 @@ public class swiftApi {
self
.
optin_segmentation
=
optin
?[
"segmentation"
]
as?
Bool
?
??
false
self
.
optin_sms_segmentation
=
optin
?[
"sms_segmentation"
]
as?
Bool
?
??
false
// profile_metadata
let
profile_metadata_json
=
dictionary
[
"profile_metadata"
]
as
AnyObject
var
profile_metadata_parsed
:[
String
:
Any
]
let
json
=
profile_metadata_json
.
data
(
using
:
String
.
Encoding
.
utf8
.
rawValue
)
do
{
if
let
jsonArray
=
try
JSONSerialization
.
jsonObject
(
with
:
json
!
,
options
:
.
allowFragments
)
as?
[
String
:
AnyObject
]
{
profile_metadata_parsed
=
jsonArray
;
self
.
profile_metadata
=
profile_metadata_parsed
as?
[
String
:
Any
]?
??
[
String
:
Any
]()
self
.
badge
=
profile_metadata_parsed
[
"badge"
]
as?
String
?
??
""
}
else
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
print
(
error
)
}
}
}
...
...
Please
register
or
login
to post a comment