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-09-20 16:17:00 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4bb005ca9d45fd30cbef9029b690a72f844ac016
4bb005ca
1 parent
e0e6ee5b
fix getProfile crash
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
29 deletions
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
4bb005c
...
...
@@ -1826,34 +1826,51 @@ public class swiftApi {
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
?
??
""
self
.
msisdnList
=
profile_metadata_parsed
[
"msisdnList"
]
as?
Array
<
String
>
?
??
[]
self
.
answered
=
profile_metadata_parsed
[
"answered"
]
as?
Bool
?
??
false
self
.
nonTelco
=
profile_metadata_parsed
[
"nonTelco"
]
as?
Bool
?
??
false
if
let
profile_metadata_json
=
dictionary
[
"profile_metadata"
]
as?
AnyObject
{
if
((
!
(
profile_metadata_json
is
NSNull
))
&&
(
profile_metadata_json
!=
nil
))
{
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
?
??
""
self
.
msisdnList
=
profile_metadata_parsed
[
"msisdnList"
]
as?
Array
<
String
>
?
??
[]
self
.
answered
=
profile_metadata_parsed
[
"answered"
]
as?
Bool
?
??
false
self
.
nonTelco
=
profile_metadata_parsed
[
"nonTelco"
]
as?
Bool
?
??
false
}
else
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
self
.
nonTelco
=
false
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
self
.
nonTelco
=
false
print
(
error
)
}
}
else
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
self
.
nonTelco
=
false
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
}
else
{
self
.
profile_metadata
=
[
String
:
Any
]()
self
.
badge
=
""
self
.
msisdnList
=
[]
self
.
answered
=
false
self
.
nonTelco
=
false
print
(
error
)
}
}
...
...
@@ -4730,25 +4747,35 @@ public class swiftApi {
self
.
date
=
""
}
let
transaction_metadata_json
=
dictionary
[
"transaction_metadata"
]
as
AnyObject
var
transaction_metadata_parsed
:[
String
:
Any
]
let
json
=
transaction_metadata_json
.
data
(
using
:
String
.
Encoding
.
utf8
.
rawValue
)
do
{
if
let
jsonArray
=
try
JSONSerialization
.
jsonObject
(
with
:
json
!
,
options
:
.
allowFragments
)
as?
[
String
:
AnyObject
]
{
transaction_metadata_parsed
=
jsonArray
;
self
.
receiver_msisdn
=
transaction_metadata_parsed
[
"receiver_msisdn"
]
as?
String
?
??
""
self
.
sender_msisdn
=
transaction_metadata_parsed
[
"sender_msisdn"
]
as?
String
?
??
""
if
let
transaction_metadata_json
=
dictionary
[
"transaction_metadata"
]
as?
AnyObject
{
if
((
!
(
transaction_metadata_json
is
NSNull
))
&&
(
transaction_metadata_json
!=
nil
))
{
var
transaction_metadata_parsed
:[
String
:
Any
]
let
json
=
transaction_metadata_json
.
data
(
using
:
String
.
Encoding
.
utf8
.
rawValue
)
do
{
if
let
jsonArray
=
try
JSONSerialization
.
jsonObject
(
with
:
json
!
,
options
:
.
allowFragments
)
as?
[
String
:
AnyObject
]
{
transaction_metadata_parsed
=
jsonArray
;
self
.
receiver_msisdn
=
transaction_metadata_parsed
[
"receiver_msisdn"
]
as?
String
?
??
""
self
.
sender_msisdn
=
transaction_metadata_parsed
[
"sender_msisdn"
]
as?
String
?
??
""
}
else
{
self
.
receiver_msisdn
=
""
self
.
sender_msisdn
=
""
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
self
.
receiver_msisdn
=
""
self
.
sender_msisdn
=
""
print
(
error
)
}
}
else
{
self
.
receiver_msisdn
=
""
self
.
sender_msisdn
=
""
print
(
"bad json"
)
}
}
catch
let
error
as
NSError
{
}
else
{
self
.
receiver_msisdn
=
""
self
.
sender_msisdn
=
""
print
(
error
)
}
}
...
...
Please
register
or
login
to post a comment