Last active
August 29, 2017 06:09
-
-
Save adarshmishra/0335d78878a2a55647cb84482d5ab92d to your computer and use it in GitHub Desktop.
Applozic Chat
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)launchGroupOfTwoWithClientId:(NSString*)clientGroupId | |
withMetaData:(NSMutableDictionary*)metadata | |
andWithUser:(NSString *)userId | |
andFromViewController:(UIViewController *)viewController | |
{ | |
ALChannelService * channelService = [[ALChannelService alloc] init]; | |
ALChannel *alChannel = [channelService fetchChannelWithClientChannelKey:clientGroupId]; | |
if (alChannel){ | |
[self launchChatForUserWithDisplayName:nil withGroupId:alChannel.key | |
andwithDisplayName:nil andFromViewController:viewController]; | |
} | |
else | |
{ | |
[channelService getChannelInformation:nil orClientChannelKey:clientGroupId withCompletion:^(ALChannel *alChannel) { | |
if(alChannel.key){ | |
[self launchChatForUserWithDisplayName:nil withGroupId:alChannel.key | |
andwithDisplayName:nil andFromViewController:viewController]; | |
}else{ | |
//Create new one channel and launch:;; | |
[channelService createChannel:clientGroupId orClientChannelKey:clientGroupId andMembersList:@[userId] | |
andImageLink:nil channelType:GROUP_OF_TWO | |
andMetaData:metadata withCompletion:^(ALChannel *alChannelInRespose, NSError *error) { | |
NSLog(@" group of two id %@", alChannelInRespose.key); | |
[self launchChatForUserWithDisplayName:nil withGroupId:alChannelInRespose.key | |
andwithDisplayName:nil andFromViewController:viewController]; | |
}]; | |
} | |
}]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment