Skip to content

Commit

Permalink
Merge pull request #36 from agilebits/kevin/make-convenience-method-f…
Browse files Browse the repository at this point in the history
…or-handling-url

Make Convenience Method for handling url from string
  • Loading branch information
kevinbhayes committed Aug 17, 2017
2 parents 26c54d7 + afc7fd4 commit 3ac03de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions AgileCloudSDK/AgileCloudSDK/CKMediator.h
Expand Up @@ -24,5 +24,6 @@ extern NSString *const kAgileCloudSDKInitializedNotification;
- (void)login;

- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
- (void)handleGetURLString:(NSString *)urlString; // for handling URL from where the NSAppleEventDescriptor is not available - kevin 2017-07-24

@end
7 changes: 6 additions & 1 deletion AgileCloudSDK/AgileCloudSDK/CKMediator.m
Expand Up @@ -150,7 +150,12 @@ - (void)saveSessionToken:(NSString *)token {

- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent {
MediatorDebugLog(CKLOG_LEVEL_INFO, @"Received Callback URL");
NSURLComponents *urlComponents = [NSURLComponents componentsWithString:[[event paramDescriptorForKeyword:keyDirectObject] stringValue]];
NSString *urlString = [[event paramDescriptorForKeyword:keyDirectObject] stringValue];
[self handleGetURLString:urlString];
}

- (void)handleGetURLString:(NSString *)urlString {
NSURLComponents *urlComponents = [NSURLComponents componentsWithString:urlString];
NSArray *queryItems = urlComponents.queryItems;
for (NSURLQueryItem *queryItem in queryItems) {
if ([queryItem.name isEqualToString:@"ckSession"]) {
Expand Down

0 comments on commit 3ac03de

Please sign in to comment.