Created
September 2, 2017 13:22
-
-
Save kevinpiac/05dbfa6f185af898b5b465fa33710d1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)onMessageAction:(NSString *)message | |
{ | |
@autoreleasepool { | |
NSArray *request = [message componentsSeparatedByString:@":"]; | |
if (request.count >= 3) | |
{ | |
NSString *clientId = request[1]; | |
NSString *action = request[2]; | |
NSString *response; | |
[logTool logDataFromNSString:[NSString stringWithFormat:@"request: %@", request]]; | |
if ([action isEqualToString:@"add_friend"]) | |
response = [tweakRequest createFriendAdditionRequestWithAuthToken: request[3] username: request[4]]; | |
else if ([action isEqualToString:@"friends"]) | |
response = [tweakRequest createFriendsRequestWithAuthToken: request[3] username: request[4]]; | |
else if ([action isEqualToString:@"upload"]) | |
response = [tweakRequest createUploadRequestWithAuthToken: request[3] username: request[4] mediaId: request[5] mediaType: request[6]]; | |
else if ([action isEqualToString:@"post_story"]) | |
response = [tweakRequest createPostStoryRequestWithAuthToken: request[3] username: request[4] mediaId: request[5] mediaType: request[6] storyTimestamp: request[7]]; | |
// TRUNCATED | |
[self sendMessage:[NSString stringWithFormat:@"2:response:%@:%@", clientId, response]]; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment