Skip to content

Commit

Permalink
remove unused facebook sdk code
Browse files Browse the repository at this point in the history
Signed-off-by: Umair Khan <[email protected]>
  • Loading branch information
omerjerk committed Apr 26, 2015
1 parent 187c0b7 commit 96b272d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 145 deletions.
107 changes: 0 additions & 107 deletions app/src/main/java/in/tosc/studddin/externalapi/FacebookApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,6 @@ public void onCompleted(
parameters.putString("fields", "name,id,cover,email,birthday");
request.setParameters(parameters);
request.executeAsync();
/*
LoginClient.Request.newMeRequest(session, new LoginClient.Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser gu, Response response) {
if (gu != null) {
Log.d(TAG, "json = " + response.getGraphObject().getInnerJSONObject().toString());
JSONObject responseObject = response.getGraphObject().getInnerJSONObject();
USER_ID = gu.getId();
try {
FbDataBundle.putString(ParseTables.Users.EMAIL, responseObject.getString("email"));
FbDataBundle.putString(ParseTables.Users.NAME, gu.getName());
FbDataBundle.putString(ParseTables.Users.USERNAME, gu.getUsername());
FbDataBundle.putString(ParseTables.Users.CITY, "" + gu.getLocation().getLocation().getCity());
} catch (Exception e) {
// e.printStackTrace();
}
FbDataBundle.putString(ParseTables.Users.DOB, gu.getBirthday());
fgdc.gotData(FbDataBundle);
}
}
}).executeAsync();*/
return;
}

Expand All @@ -98,93 +77,7 @@ public void onCompleted(Response response) {
});
r.executeAsync();*/
}
/*
public static void getProfilePicture(final FbGotProfilePictureCallback listener) {
Log.d(TAG, "getting profile picture");
Bundle bundle = new Bundle();
bundle.putString("fields", "picture");
new Request(session, "me", bundle,
HttpMethod.GET, new Request.Callback() {
@Override
public void onCompleted(final Response response) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
String objectId = response.getGraphObject().getInnerJSONObject().getString("id");
String sUrl = "https://graph.facebook.com/" + objectId + "/picture??width=300&&height=300";
Bitmap bitmap = Utilities.downloadBitmap(sUrl);
listener.gotProfilePicture(bitmap);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}.execute();
}
}).executeAsync();
}
public static Bitmap getProfileAndWait() {
Bundle bundle = new Bundle();
bundle.putString("fields", "picture");
Request request = new Request(session, "me", bundle, HttpMethod.GET);
Response response = Request.executeAndWait(request);

try {
String objectId = response.getGraphObject().getInnerJSONObject().getString("id");
String sUrl = "https://graph.facebook.com/" + objectId + "/picture??width=300&&height=300";
Bitmap bitmap = Utilities.downloadBitmap(sUrl);
return bitmap;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
public static void getCoverPicture(final FbGotCoverPictureCallback listener) {
Log.d(TAG, "getting cover picture");
Bundle bundle = new Bundle();
bundle.putString("fields", "cover");
new Request(session, "me", bundle,
HttpMethod.GET, new Request.Callback() {
@Override
public void onCompleted(final Response response) {
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... params) {
try {
String sUrl = response.getGraphObject().getInnerJSONObject().getJSONObject("cover").getString("source");
Bitmap bitmap = Utilities.downloadBitmap(sUrl);
listener.gotCoverPicture(bitmap);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
}.execute();
}
}).executeAsync();
}
public static Bitmap getCoverAndWait() {
Log.d(TAG, "Getting cover photo");
Bundle bundle = new Bundle();
bundle.putString("fields", "cover");
Response response = Request.executeAndWait(request);
try {
Log.d(TAG, "response = " + response.getRawResponse());
Log.d(TAG, "error = " + response.getError());
String sUrl = response.getGraphObject().getInnerJSONObject().getJSONObject("cover").getString("source");
Bitmap bitmap = Utilities.downloadBitmap(sUrl);
return bitmap;
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
*/
public interface FbGotDataCallback {
public void gotData(Bundle b);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,6 @@ public void doFacebookSignOn(View v) {

List<String> permissions = Arrays.asList(
"public_profile", "email", "user_birthday", "user_location");
/*
List<String> permissions = Arrays.asList("public_profile", "user_friends",
ParseFacebookUtils.Permissions.User.EMAIL,
ParseFacebookUtils.Permissions.User.ABOUT_ME,
ParseFacebookUtils.Permissions.User.RELATIONSHIPS,
ParseFacebookUtils.Permissions.User.BIRTHDAY,
ParseFacebookUtils.Permissions.User.LOCATION,
ParseFacebookUtils.Permissions.User.PHOTOS); */
ParseFacebookUtils.logInWithReadPermissionsInBackground(getActivity(), permissions, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
Expand All @@ -268,31 +259,9 @@ public void done(ParseUser user, ParseException err) {

if (user.isNew() || (!fullyRegistered)) {
Log.w(TAG, "User signed up and logged in through Facebook!");
/*
Log.w(TAG,
"FBSHIT \n" +
ParseFacebookUtils.getSession().getAccessToken() + " \n" +
ParseFacebookUtils.getFacebook().getAppId()
);*/
FacebookApi.getFacebookData(new FacebookApi.FbGotDataCallback() {
@Override
public void gotData(final Bundle bundle) {
/*
final SignupDataFragment fragment = showSignupDataFragment(bundle);
FacebookApi.getProfilePicture(new FacebookApi.FbGotProfilePictureCallback() {
@Override
public void gotProfilePicture(Bitmap profilePicture) {
fragment.bitmapReady = true;
fragment.profileBitmap = profilePicture;
fragment.setProfilePicture();
}
});
FacebookApi.getCoverPicture(new FacebookApi.FbGotCoverPictureCallback() {
@Override
public void gotCoverPicture(Bitmap coverPicture) {
fragment.setCoverPicture(coverPicture);
}
});*/
new PushUserIntoParse().execute(bundle);
new FetchUserPhotos(new FetchUserPhotos.PhotosFetcher() {
@Override
Expand All @@ -317,13 +286,6 @@ public Bitmap downloadProfilePhoto() {
});
} else {
Log.w(TAG, "User logged in through Facebook!");
/*
Log.w(TAG,
"FB \n" +
ParseFacebookUtils.getSession().getAccessToken() + " \n" +
ParseFacebookUtils.getSession().getAccessToken() + " \n" +
ParseFacebookUtils.getFacebook().getAppId()
);*/
SignupDataFragment.goToMainActivity(getActivity());
}
}
Expand Down

0 comments on commit 96b272d

Please sign in to comment.