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
2025-01-22 15:55:07 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0111a2407f4b30a273df5936d7e6d648ca49fc39
0111a240
1 parent
b8c6952d
add application data and fix jwt at logout
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletions
SwiftWarplyFramework/SwiftWarplyFramework/Warply/WLGlobals.h
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/WLGlobals.h
View file @
0111a24
...
...
@@ -76,6 +76,8 @@ extern NSString* VERIFY_URL;
#define WL_DEVICE_STATUS @"device_status"
#define WL_BEACON_ENABLED @"BEACON_ENABLED"
#define WL_BEACON_TIME_INTERVAL_TO_RESEND @"BEACON_TIME_INTERVAL_TO_RESEND"
#define WL_AUTHENTICATION @"AUTHENTICATION"
#define WL_IS_JWT_ENABLED @"isJWTEnabled"
///////////////////////////////////////////////////////////////////////////////
// Logging
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
0111a24
...
...
@@ -290,6 +290,9 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError *
_pendingOperationsQueue
.
maxConcurrentOperationCount
=
1
;
_DatabaseLock
=
@"Database-Lock"
;
// Get Application Data
[
self
getAppSettingsWithSuccessBlock
:
^
{}
failureBlock
:
^
(
NSError
*
error
)
{}];
}
return
self
;
}
...
...
@@ -1199,8 +1202,12 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
if
(
tableExist
==
YES
)
{
NSString
*
accessToken
=
@""
;
NSString
*
refreshToken
=
@""
;
NSString
*
clientId
=
@""
;
NSString
*
clientSecret
=
@""
;
accessToken
=
[
_sharedService
getAccessToken2
];
refreshToken
=
[
_sharedService
getRefreshToken
];
clientId
=
[
_sharedService
getClientId
];
clientSecret
=
[
_sharedService
getClientSecret
];
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
...
...
@@ -1208,6 +1215,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
[
data
setValue
:
accessToken
forKey
:
@"access_token"
];
[
data
setValue
:
refreshToken
forKey
:
@"refresh_token"
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
BOOL
isJWTEnabled
=
[
defaults
boolForKey
:
WL_IS_JWT_ENABLED
];
if
(
isJWTEnabled
)
{
[
data
setValue
:
accessToken
forKey
:
@"access_token"
];
[
data
setValue
:
refreshToken
forKey
:
@"refresh_token"
];
}
else
{
[
data
setValue
:
accessToken
forKey
:
@"token"
];
[
data
setValue
:
clientId
forKey
:
@"client_id"
];
[
data
setValue
:
clientSecret
forKey
:
@"client_secret"
];
}
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
data
options
:
0
error
:
NULL
];
[
self
sendContextLogout
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
...
...
@@ -6993,7 +7011,18 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
{
//Create REQUEST
// POST https://engage-stage.warp.ly/oauth/<app_uuid>/logout
NSMutableString
*
urlString
=
[
NSMutableString
stringWithFormat
:
@"%@/oauth/%@/logout"
,
_baseURL
,
_appUUID
];
// NSMutableString *urlString = [NSMutableString stringWithFormat:@"%@/oauth/%@/logout", _baseURL, _appUUID];
NSMutableString
*
urlString
=
[
NSMutableString
string
];
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
BOOL
isJWTEnabled
=
[
defaults
boolForKey
:
WL_IS_JWT_ENABLED
];
if
(
isJWTEnabled
)
{
// /user/v5/{appUuid}/logout
urlString
=
[
NSMutableString
stringWithFormat
:
@"%@/user/v5/%@/logout"
,
_baseURL
,
_appUUID
];
}
else
{
urlString
=
[
NSMutableString
stringWithFormat
:
@"%@/oauth/%@/logout"
,
_baseURL
,
_appUUID
];
}
WLLOG
(
@"[WARP Trace] HTTP URL: %@"
,
urlString
);
...
...
@@ -8263,6 +8292,18 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg
NSLog
(
@"Beacon scanning is disabled"
);
}
if
([
applicationVariables
objectForKey
:
WL_AUTHENTICATION
])
{
NSString
*
authValue
=
[
applicationVariables
objectForKey
:
WL_AUTHENTICATION
];
if
(
authValue
&&
[
authValue
isEqualToString
:
@"JWT"
])
{
// AUTHENTICATION key exists and its value is "JWT"
[
defaults
setBool
:
YES
forKey
:
WL_IS_JWT_ENABLED
];
}
else
{
[
defaults
setBool
:
NO
forKey
:
WL_IS_JWT_ENABLED
];
}
}
else
{
[
defaults
setBool
:
NO
forKey
:
WL_IS_JWT_ENABLED
];
}
[
defaults
setObject
:[
NSDate
date
]
forKey
:
@"lastFeaturesUpdateTimestamp"
];
//Check for device status
...
...
Please
register
or
login
to post a comment