tipsi / tipsi-twitter

React native module for twitter API
MIT License
29 stars 10 forks source link

Picture url? #15

Open bisht2ankit opened 7 years ago

bisht2ankit commented 7 years ago

Can we get user's profile pic url?

isnifer commented 7 years ago

Hi @ankitbisht143! We need to check it and add if available

emnsen commented 6 years ago

Hi @ankitbisht143 ,

Yes, you can.

Change the lines 118-124 of the TPSTwitterModule.m file as below;

                TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser];
                NSURLRequest *request = [client URLRequestWithMethod:@"GET"
                                                                 URL:@"https://api.twitter.com/1.1/account/verify_credentials.json"
                                                          parameters:@{@"include_email": @"true", @"skip_status": @"true"}
                                                               error:nil];
                [client sendTwitterRequest:request completion:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
                    NSError *jsonError;
                    NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
                    NSDictionary *body = @{
                                           @"auth_token": session.authToken,
                                           @"auth_token_secret": session.authTokenSecret,
                                           @"data": json
                                           };
                    resolve(body);
                }];

You can get the same response as https://api.twitter.com/1.1/account/verify_credentials.json.