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
Vasilis
2022-02-04 11:07:52 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9d57bec4340d1d3cab736692f24732453b1529fd
9d57bec4
1 parent
1b204c41
fixes for bearer
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
WarplySDKFrameworkIOS/Warply/Warply.m
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
WarplySDKFrameworkIOS/Warply/Warply.m
View file @
9d57bec
...
...
@@ -713,9 +713,30 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
NSDictionary
*
dict
=
[
NSDictionary
alloc
];
dict
=
[
error
userInfo
];
NSString
*
errorCode
=
[
dict
objectForKey
:
@"NSLocalizedDescription"
];
if
([
errorCode
isEqual
:
@"Request failed: unauthorized (401)"
])
{
[
self
refreshToken
:
^
(
NSDictionary
*
response
)
{
[
self
sendContext8
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
if
(
success
)
{
success
(
contextResponse
);
}
}
failureBlock
:^
(
NSError
*
error
)
{
if
(
failure
)
{
failure
(
error
);
}
}];
}
failureBlock
:
^
(
NSError
*
error
)
{
if
(
failure
)
{
[
_db
executeUpdate
:
@"DROP TABLE requestVariables"
];
failure
(
error
);
}
NSLog
(
@"Error at token %@"
,
error
);
}];
}
NSLog
(
@"Error at change password %@"
,
error
);
}
}];
}
...
...
@@ -3047,17 +3068,20 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
if
(
failureBlock
)
failureBlock
(
error
);
};
FMResultSet
*
accessTokenSet
=
[
_db
executeQuery
:
@"SELECT access_token FROM requestVariables WHERE id = 1;"
];
NSString
*
accessToken
=
[
NSString
alloc
];
while
([
accessTokenSet
next
])
{
accessToken
=
[[
accessTokenSet
resultDictionary
][
@"access_token"
]
stringValue
];
}
_httpClient
.
responseSerializer
=
[
AFJSONResponseSerializer
serializer
];
_httpClient
.
requestSerializer
=
[
AFJSONRequestSerializer
serializer
];
//Set HTTP Headers
time_t
timestamp
=
(
time_t
)
[[
NSDate
date
]
timeIntervalSince1970
];
NSString
*
accessToken
=
[
NSString
alloc
];
if
([
_db
tableExists
:
@"requestVariables"
]
==
YES
)
{
FMResultSet
*
accessTokenSet
=
[
_db
executeQuery
:
@"SELECT access_token FROM requestVariables WHERE id = 1;"
];
while
([
accessTokenSet
next
])
{
accessToken
=
[[
accessTokenSet
resultDictionary
][
@"access_token"
]
stringValue
];
}
[
_httpClient
.
requestSerializer
setValue
:[
@"Bearer "
stringByAppendingString
:
accessToken
]
forHTTPHeaderField
:
@"Authorization"
];
}
[
_httpClient
.
requestSerializer
setValue
:
_webId
forHTTPHeaderField
:
@"loyalty-web-id"
];
[
_httpClient
.
requestSerializer
setValue
:[
NSString
stringWithFormat
:
@"%lu"
,
timestamp
]
forHTTPHeaderField
:
@"loyalty-date"
];
[
_httpClient
.
requestSerializer
setValue
:[[
NSString
stringWithFormat
:
@"%@%lu"
,
_apiKey
,
timestamp
]
SHA256Sum
]
forHTTPHeaderField
:
@"loyalty-signature"
];
...
...
@@ -3178,19 +3202,20 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
if
(
failureBlock
)
failureBlock
(
error
);
};
_httpClient
.
responseSerializer
=
[
AFJSONResponseSerializer
serializer
];
_httpClient
.
requestSerializer
=
[
AFJSONRequestSerializer
serializer
];
//Set HTTP Headers
time_t
timestamp
=
(
time_t
)
[[
NSDate
date
]
timeIntervalSince1970
];
NSString
*
accessToken
=
[
NSString
alloc
];
if
([
_db
tableExists
:
@"requestVariables"
]
==
YES
)
{
FMResultSet
*
accessTokenSet
=
[
_db
executeQuery
:
@"SELECT access_token FROM requestVariables WHERE id = 1;"
];
while
([
accessTokenSet
next
])
{
accessToken
=
[[
accessTokenSet
resultDictionary
][
@"access_token"
]
stringValue
];
}
}
_httpClient
.
responseSerializer
=
[
AFJSONResponseSerializer
serializer
];
_httpClient
.
requestSerializer
=
[
AFJSONRequestSerializer
serializer
];
//Set HTTP Headers
time_t
timestamp
=
(
time_t
)
[[
NSDate
date
]
timeIntervalSince1970
];
[
_httpClient
.
requestSerializer
setValue
:[
@"Bearer "
stringByAppendingString
:
accessToken
]
forHTTPHeaderField
:
@"Authorization"
];
}
[
_httpClient
.
requestSerializer
setValue
:
_webId
forHTTPHeaderField
:
@"loyalty-web-id"
];
[
_httpClient
.
requestSerializer
setValue
:[
NSString
stringWithFormat
:
@"%lu"
,
timestamp
]
forHTTPHeaderField
:
@"loyalty-date"
];
[
_httpClient
.
requestSerializer
setValue
:[[
NSString
stringWithFormat
:
@"%@%lu"
,
_apiKey
,
timestamp
]
SHA256Sum
]
forHTTPHeaderField
:
@"loyalty-signature"
];
...
...
@@ -3648,7 +3673,6 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2)
//Set HTTP Headers
time_t
timestamp
=
(
time_t
)
[[
NSDate
date
]
timeIntervalSince1970
];
// [_httpClient.requestSerializer setValue:[@"Bearer " stringByAppendingString:accessToken] forHTTPHeaderField:@"Authorization"];
[
_httpClient
.
requestSerializer
setValue
:
_webId
forHTTPHeaderField
:
@"loyalty-web-id"
];
[
_httpClient
.
requestSerializer
setValue
:[
NSString
stringWithFormat
:
@"%lu"
,
timestamp
]
forHTTPHeaderField
:
@"loyalty-date"
];
[
_httpClient
.
requestSerializer
setValue
:[[
NSString
stringWithFormat
:
@"%@%lu"
,
_apiKey
,
timestamp
]
SHA256Sum
]
forHTTPHeaderField
:
@"loyalty-signature"
];
...
...
WarplySDKFrameworkIOS/WarplySDKFrameworkIOS.xcworkspace/xcuserdata/billskouras.xcuserdatad/UserInterfaceState.xcuserstate
View file @
9d57bec
No preview for this file type
Please
register
or
login
to post a comment