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-11-07 15:25:19 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d49c24842ee9c128ef1dd518bd9d66e9cdf0606d
d49c2484
1 parent
a9741df2
fix initialize error
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
234 additions
and
9 deletions
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
SwiftWarplyFramework/SwiftWarplyFramework/MyApi.m
View file @
d49c248
...
...
@@ -289,11 +289,27 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify";
-
(
NSDictionary
*
)
provideInfoForCampaign
{
NSMutableDictionary
*
info
=
[[
NSMutableDictionary
alloc
]
init
];
// info[@"web_id"] = [Warply sharedService].webId;
info
[
@"web_id"
]
=
[
WLKeychain
getStringForKey
:
@"NBWebID"
];
@try
{
info
[
@"app_uuid"
]
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
// info[@"api_key"] = self.warply.apiKey;
info
[
@"api_key"
]
=
[
WLKeychain
getStringForKey
:
@"NBAPIKey"
];
info
[
@"web_id"
]
=
[
WLKeychain
getStringForKey
:
@"NBWebID"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
info
[
@"app_uuid"
]
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
info
[
@"api_key"
]
=
[
defaults
stringForKey
:
@"NBAPIKeyUD"
];
info
[
@"web_id"
]
=
[
defaults
stringForKey
:
@"NBWebIDUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
// info[@"web_id"] = [Warply sharedService].webId;
// info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"];
// info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"];
// info[@"api_key"] = self.warply.apiKey;
// info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"];
Warply
*
warplyInstance
=
[[
Warply
alloc
]
init
];
info
[
@"access_token"
]
=
[
warplyInstance
getAccessToken
];
info
[
@"refresh_token"
]
=
[
warplyInstance
getRefreshToken
];
...
...
SwiftWarplyFramework/SwiftWarplyFramework/Warply/Warply.m
View file @
d49c248
...
...
@@ -287,10 +287,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError *
_appUUID
=
[
anAppUUID
copy
];
//Save new value
if
((
_appUUID
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_appUUID
.
length
>
0
))
if
((
_appUUID
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_appUUID
.
length
>
0
))
{
// [WLKeychain setString:_appUUID forKey:@"NBAPPUuid"];
@try
{
[
WLKeychain
setString
:
_appUUID
forKey
:
@"NBAPPUuid"
];
else
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain set appUUID error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
_appUUID
forKey
:
@"NBAPPUuidUD"
];
}
else
{
// [WLKeychain deleteStringForKey:@"NBAPPUuid"];
@try
{
[
WLKeychain
deleteStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain delete appUUID error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
@""
forKey
:
@"NBAPPUuidUD"
];
}
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -302,10 +328,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError *
_apiKey
=
[
anAPIKey
copy
];
//Save new value
if
((
_apiKey
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_apiKey
.
length
>
0
))
if
((
_apiKey
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_apiKey
.
length
>
0
))
{
// [WLKeychain setString:_apiKey forKey:@"NBAPIKey"];
@try
{
[
WLKeychain
setString
:
_apiKey
forKey
:
@"NBAPIKey"
];
else
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain set APIKey error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
_apiKey
forKey
:
@"NBAPIKeyUD"
];
}
else
{
// [WLKeychain deleteStringForKey:@"NBAPIKey"];
@try
{
[
WLKeychain
deleteStringForKey
:
@"NBAPIKey"
];
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain delete APIKey error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
@""
forKey
:
@"NBAPIKeyUD"
];
}
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -317,10 +369,34 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError *
_webId
=
[
aWebID
copy
];
//Save new value
if
((
_webId
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_webId
.
length
>
0
))
if
((
_webId
!=
(
NSString
*
)[
NSNull
null
])
&&
(
_webId
.
length
>
0
))
{
// [WLKeychain setString:_webId forKey:@"NBWebID"];
@try
{
[
WLKeychain
setString
:
_webId
forKey
:
@"NBWebID"
];
else
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain set WebID error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
_webId
forKey
:
@"NBWebIDUD"
];
}
else
{
// [WLKeychain deleteStringForKey:@"NBWebID"];
@try
{
[
WLKeychain
deleteStringForKey
:
@"NBWebID"
];
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain delete WebID error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
@""
forKey
:
@"NBWebIDUD"
];
}
}
///////////////////////////////////////////////////////////////////////////////
...
...
@@ -820,9 +896,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
loginWithSuccessBlock
:
(
NSString
*
)
id
andPassword
:
(
NSString
*
)
password
andLoginType
:
(
NSString
*
)
loginType
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
webId
=
[
NSString
alloc
];
// webId = [WLKeychain getStringForKey:@"NBWebID"];
@try
{
webId
=
[
WLKeychain
getStringForKey
:
@"NBWebID"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
webId
=
[
defaults
stringForKey
:
@"NBWebIDUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSDictionary
*
postDictionary
=
@{
@"id"
:
id
,
@"password"
:
password
,
@"channel"
:
@"mobile"
,
@"app_uuid"
:
appUuid
};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext3
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
...
...
@@ -906,9 +1006,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
registerWithSuccessBlock
:
(
NSString
*
)
id
andPassword
:
(
NSString
*
)
password
andName
:
(
NSString
*
)
name
andEmail
:
(
NSString
*
)
email
andSegmentation
:
(
NSNumber
*
)
segmentation
andNewsletter
:
(
NSNumber
*
)
newsletter
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
webId
=
[
NSString
alloc
];
// webId = [WLKeychain getStringForKey:@"NBWebID"];
@try
{
webId
=
[
WLKeychain
getStringForKey
:
@"NBWebID"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
webId
=
[
defaults
stringForKey
:
@"NBWebIDUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSDictionary
*
postDictionary
=
@{
@"id"
:
id
,
@"password"
:
password
,
@"name"
:
name
,
@"email"
:
email
,
@"channel"
:
@"mobile"
,
@"app_uuid"
:
appUuid
,
@"web_id"
:
webId
,
@"optin"
:
@{
@"segmentation"
:
segmentation
,
@"newsletter"
:
newsletter
}
};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext6
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
...
...
@@ -1643,7 +1767,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
verifyTicketWithSuccessBlock
:
(
NSString
*
)
guid
:
(
NSString
*
)
ticket
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSDictionary
*
postDictionary
=
@{
@"guid"
:
guid
,
@"app_uuid"
:
appUuid
,
@"ticket"
:
ticket
};
NSData
*
jsonData
=
[
NSJSONSerialization
dataWithJSONObject
:
postDictionary
options
:
0
error
:
NULL
];
[
self
sendContext10
:
jsonData
successBlock
:
^
(
NSDictionary
*
contextResponse
)
{
...
...
@@ -2103,7 +2239,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
forgotPasswordWithIdWithSuccessBlock
:
(
NSString
*
)
id
andConfCode
:
(
NSString
*
)
confCode
andOtpUuid
:
(
NSString
*
)
otpUuid
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
data
setValue
:
@"mobile"
forKey
:
@"channel"
];
...
...
@@ -2132,7 +2280,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
requestOtpWithMsisdnWithSuccessBlock
:
(
NSString
*
)
msisdn
andScope
:
(
NSString
*
)
scope
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
data
setValue
:
@"mobile"
forKey
:
@"channel"
];
...
...
@@ -2157,7 +2317,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
resetPasswordWithPasswordWithSuccessBlock
:
(
NSString
*
)
password
andConfCode
:
(
NSString
*
)
confCode
andOtpUuid
:
(
NSString
*
)
otpUuid
andConfToken
:
(
NSString
*
)
confToken
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
data
setValue
:
@"mobile"
forKey
:
@"channel"
];
...
...
@@ -2190,7 +2362,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION)
-
(
void
)
retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock
:
(
NSArray
*
)
categories
andDefaultShown
:
(
NSNumber
*
)
defaultShown
andCenter
:
(
NSNumber
*
)
center
andTags
:
(
NSArray
*
)
tags
andUuid
:
(
NSString
*
)
uuid
andDistance
:
(
NSNumber
*
)
distance
parent_uuids
:
(
NSArray
*
)
parent_uuids
:
(
void
(
^
)(
NSDictionary
*
response
))
success
failureBlock
:
(
void
(
^
)(
NSError
*
error
))
failure
{
NSString
*
appUuid
=
[
NSString
alloc
];
// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"];
@try
{
appUuid
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
appUuid
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
NSMutableDictionary
*
data
=
[[
NSMutableDictionary
alloc
]
init
];
[
data
setValue
:
@YES
forKey
:
@"active"
];
...
...
@@ -5965,15 +6149,40 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg
if
([
defaults
boolForKey
:
@"NBAppUninstalled"
]
==
NO
)
{
[
defaults
setBool
:
YES
forKey
:
@"NBAppUninstalled"
];
[
defaults
synchronize
];
@try
{
[
WLKeychain
deleteStringForKey
:
@"NBAPPUuid"
];
[
WLKeychain
deleteStringForKey
:
@"NBWebID"
];
[
WLKeychain
deleteStringForKey
:
@"NBAPIKey"
];
}
@catch
(
NSException
*
exception
)
{
NSLog
(
@"WLKeychain delete error: %@"
,
exception
.
reason
);
}
@finally
{
// NSLog(@"Finally condition");
}
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
[
defaults
setObject
:
@""
forKey
:
@"NBAPPUuidUD"
];
[
defaults
setObject
:
@""
forKey
:
@"NBWebIDUD"
];
[
defaults
setObject
:
@""
forKey
:
@"NBAPIKeyUD"
];
return
;
}
@try
{
self
.
appUUID
=
[
WLKeychain
getStringForKey
:
@"NBAPPUuid"
];
self
.
apiKey
=
[
WLKeychain
getStringForKey
:
@"NBAPIKey"
];
self
.
webId
=
[
WLKeychain
getStringForKey
:
@"NBWebID"
];
}
@catch
(
NSException
*
exception
)
{
NSUserDefaults
*
defaults
=
[
NSUserDefaults
standardUserDefaults
];
self
.
appUUID
=
[
defaults
stringForKey
:
@"NBAPPUuidUD"
];
self
.
apiKey
=
[
defaults
stringForKey
:
@"NBAPIKeyUD"
];
self
.
webId
=
[
defaults
stringForKey
:
@"NBWebIDUD"
];
}
@finally
{
// NSLog(@"Finally condition");
}
}
///////////////////////////////////////////////////////////////////////////////
...
...
Please
register
or
login
to post a comment