UIViewAlterView fullscreen

- (void)requestChatCreationForUsers:(NSArray *)recipients
{
    _alertView = [[UIAlertView alloc] initWithTitle:@"Chat Loading..."
                                            message:@"Please wait loading"
                                           delegate:nil
                                  cancelButtonTitle:nil
                                  otherButtonTitles:nil];
    [_alertView show];
    CVAPIRequest* request = [[CVAPIRequest alloc] initWithAPIPath:@"/svc/contacts/checkExistingChats"];
    NSMutableArray* contactKeys = [NSMutableArray array];
    for (id obj in recipients) {
        if ([obj isKindOfClass:[NSDictionary class]]) {
            [contactKeys addObject:[obj objectForKey:@"key"]];
        }
    }
    if ([contactKeys count] == 0) {
        return;
    }
    NSDictionary* param = @{@"contactKeys" : contactKeys};
       [request setParamString:[param jsonValue]];
    CVAPIListModel* model = [[CVAPIListModel alloc] init];
    [model sendRequest:request completion:^(NSDictionary* apiResult, NSError* error) {
        if ([apiResult isDragonAPIResultOK]) {
            NSArray* existChats = [apiResult objectForKey:@"tasks"];
            if ([existChats count] > 0) {
                [_alertView dismissWithClickedButtonIndex:0 animated:YES];
                IPhoneMVChatEditWithExistViewController* chatVC = [[IPhoneMVChatEditWithExistViewController alloc] initWithContacts:recipients chats:existChats];
                [chatVC pushToStack];
            } else {
                [self createNewChat:recipients];
            }
        }
    }];
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s