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
2024-04-03 17:53:40 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c961b2aa2d72385baf31ba7c24043ef9813cdbe9
c961b2aa
1 parent
74b3c285
jwt changes logout
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
99 additions
and
27 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.h
View file @
c961b2a
...
...
@@ -50,7 +50,8 @@
-
(
NSMutableArray
*
)
getTagsCategories
;
-
(
NSMutableArray
*
)
getTags
;
-
(
NSDictionary
*
)
login
:(
NSString
*
)
id
password
:(
NSString
*
)
password
loginType
:(
NSString
*
)
loginType
;
-
(
NSDictionary
*
)
logout
;
// - (NSDictionary *)logout;
-
(
void
)
logout
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
NSDictionary
*
)
register
:(
NSString
*
)
id
password
:(
NSString
*
)
password
name
:(
NSString
*
)
name
email
:(
NSString
*
)
email
segmentation
:(
NSNumber
*
)
segmentation
newsletter
:(
NSNumber
*
)
newsletter
;
-
(
NSDictionary
*
)
registerAutoLogin
:(
NSString
*
)
id
password
:(
NSString
*
)
password
name
:(
NSString
*
)
name
email
:(
NSString
*
)
email
segmentation
:(
NSNumber
*
)
segmentation
newsletter
:(
NSNumber
*
)
newsletter
loginType
:(
NSString
*
)
loginType
;
-
(
NSDictionary
*
)
refreshToken
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
c961b2a
...
...
@@ -638,10 +638,23 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
return
resp
;
}
-
(
NSDictionary
*
)
logout
{
NSDictionary
*
response
=
[
NSDictionary
alloc
];
response
=
[[
Warply
sharedService
]
logout
];
return
response
;
// - (NSDictionary *)logout {
// NSDictionary *response = [NSDictionary alloc];
// response = [[Warply sharedService] logout];
// return response;
// }
-
(
void
)
logout
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
[[
Warply
sharedService
]
logout
:
^
(
NSDictionary
*
response
)
{
if
(
success
)
{
success
(
response
);
}
}
failureBlock
:
^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
-
(
NSDictionary
*
)
register
:
(
NSString
*
)
id
password
:
(
NSString
*
)
password
name
:
(
NSString
*
)
name
email
:
(
NSString
*
)
email
segmentation
:
(
NSNumber
*
)
segmentation
newsletter
:
(
NSNumber
*
)
newsletter
{
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.h
View file @
c961b2a
...
...
@@ -325,7 +325,9 @@ WL_VERSION_INTERFACE()
-
(
void
)
loginWithSuccessBlock
:(
NSString
*
)
id
andPassword
:(
NSString
*
)
password
andLoginType
:(
NSString
*
)
loginType
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
NSDictionary
*
)
logout
;
// - (NSDictionary*)logout;
-
(
void
)
logout
:(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:(
void
(
^
)(
NSError
*
error
))
failure
;
-
(
void
)
webAuthorizeWithSuccessBlock
:(
NSDictionary
*
)
contextResponse
andId
:(
NSString
*
)
id
andLoginType
:(
NSString
*
)
loginType
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
;
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
c961b2a
This diff is collapsed. Click to expand it.
SwiftWarplyFramework/SwiftWarplyFramework/swiftApi.swift
View file @
c961b2a
...
...
@@ -7590,40 +7590,95 @@ public class swiftApi {
}
public
func
logout
(
_
logoutCallback
:
@escaping
(
_
responseData
:
VerifyTicketResponseModel
?)
->
Void
)
->
Void
{
//
public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void {
let
instanceOfMyApi
=
MyApi
()
let
responseData
=
instanceOfMyApi
.
logout
()
as
[
AnyHashable
:
Any
]?
//
let instanceOfMyApi = MyApi()
//
let responseData = instanceOfMyApi.logout() as [AnyHashable: Any]?
if
let
responseDataDictionary
=
responseData
as?
[
String
:
Any
]
{
//
if let responseDataDictionary = responseData as? [String: Any] {
let
tempResponse
=
VerifyTicketResponseModel
(
dictionary
:
responseDataDictionary
)
//
let tempResponse = VerifyTicketResponseModel(dictionary: responseDataDictionary)
if
(
tempResponse
.
getStatus
==
1
)
{
let
dynatraceEvent
=
swiftApi
.
LoyaltySDKDynatraceEventModel
()
dynatraceEvent
.
_eventName
=
"custom_success_logout_loyalty"
dynatraceEvent
.
_parameters
=
nil
SwiftEventBus
.
post
(
"dynatrace"
,
sender
:
dynatraceEvent
)
//
if (tempResponse.getStatus == 1) {
//
let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
//
dynatraceEvent._eventName = "custom_success_logout_loyalty"
//
dynatraceEvent._parameters = nil
//
SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
swiftApi
()
.
setUserTag
(
""
)
swiftApi
()
.
setUserNonTelco
(
false
)
swiftApi
()
.
setCCMSLoyaltyCampaigns
(
campaigns
:
[])
//
swiftApi().setUserTag("")
//
swiftApi().setUserNonTelco(false)
//
swiftApi().setCCMSLoyaltyCampaigns(campaigns: [])
let
accessToken
=
instanceOfMyApi
.
getAccessTokenM
()
print
(
"=================== TOKEN DELETED ========================="
)
print
(
"Bearer: "
,
accessToken
)
print
(
"=================== TOKEN DELETED ========================="
)
}
else
{
// let accessToken = instanceOfMyApi.getAccessTokenM()
// print("=================== TOKEN DELETED =========================")
// print("Bearer: ", accessToken)
// print("=================== TOKEN DELETED =========================")
// } else {
// let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
// dynatraceEvent._eventName = "custom_error_logout_loyalty"
// dynatraceEvent._parameters = nil
// SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
// }
// logoutCallback(tempResponse);
// } else {
// let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
// dynatraceEvent._eventName = "custom_error_logout_loyalty"
// dynatraceEvent._parameters = nil
// SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
// logoutCallback(nil)
// }
// }
public
func
logout
(
_
logoutCallback
:
@escaping
(
_
responseData
:
VerifyTicketResponseModel
?)
->
Void
)
->
Void
{
let
instanceOfMyApi
=
MyApi
()
instanceOfMyApi
.
logout
(
successCallback
,
failureBlock
:
failureCallback
)
func
successCallback
(
_
responseData
:
[
AnyHashable
:
Any
]?)
->
Void
{
if
let
responseDataDictionary
=
responseData
as?
[
String
:
Any
]
{
let
tempResponse
=
VerifyTicketResponseModel
(
dictionary
:
responseDataDictionary
)
if
(
tempResponse
.
getStatus
==
1
)
{
let
dynatraceEvent
=
swiftApi
.
LoyaltySDKDynatraceEventModel
()
dynatraceEvent
.
_eventName
=
"custom_success_logout_loyalty"
dynatraceEvent
.
_parameters
=
nil
SwiftEventBus
.
post
(
"dynatrace"
,
sender
:
dynatraceEvent
)
swiftApi
()
.
setUserTag
(
""
)
swiftApi
()
.
setUserNonTelco
(
false
)
swiftApi
()
.
setCCMSLoyaltyCampaigns
(
campaigns
:
[])
let
accessToken
=
instanceOfMyApi
.
getAccessTokenM
()
print
(
"=================== TOKEN DELETED ========================="
)
print
(
"Bearer: "
,
accessToken
)
print
(
"=================== TOKEN DELETED ========================="
)
}
else
{
let
dynatraceEvent
=
swiftApi
.
LoyaltySDKDynatraceEventModel
()
dynatraceEvent
.
_eventName
=
"custom_error_logout_loyalty"
dynatraceEvent
.
_parameters
=
nil
SwiftEventBus
.
post
(
"dynatrace"
,
sender
:
dynatraceEvent
)
}
logoutCallback
(
tempResponse
);
}
else
{
let
dynatraceEvent
=
swiftApi
.
LoyaltySDKDynatraceEventModel
()
dynatraceEvent
.
_eventName
=
"custom_error_logout_loyalty"
dynatraceEvent
.
_parameters
=
nil
SwiftEventBus
.
post
(
"dynatrace"
,
sender
:
dynatraceEvent
)
}
logoutCallback
(
tempResponse
);
logoutCallback
(
nil
)
}
}
}
else
{
func
failureCallback
(
_
error
:
Error
?)
->
Void
{
let
dynatraceEvent
=
swiftApi
.
LoyaltySDKDynatraceEventModel
()
dynatraceEvent
.
_eventName
=
"custom_error_logout_loyalty"
dynatraceEvent
.
_parameters
=
nil
...
...
@@ -7631,6 +7686,7 @@ public class swiftApi {
logoutCallback
(
nil
)
}
}
...
...
Please
register
or
login
to post a comment