use of com.facebook.Session in project Klyph by jonathangerbaud.
the class LoginButton method fetchUserInfo.
private void fetchUserInfo() {
if (fetchUserInfo) {
final Session currentSession = sessionTracker.getOpenSession();
if (currentSession != null) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == sessionTracker.getOpenSession()) {
user = me;
if (userInfoChangedCallback != null) {
userInfoChangedCallback.onUserInfoFetched(user);
}
}
if (response.getError() != null) {
handleError(response.getError().getException());
}
}
});
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
if (userInfoChangedCallback != null) {
userInfoChangedCallback.onUserInfoFetched(user);
}
}
}
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class LoginButton method initializeActiveSessionWithCachedToken.
private boolean initializeActiveSessionWithCachedToken(Context context) {
if (context == null) {
return false;
}
Session session = Session.getActiveSession();
if (session != null) {
return session.isOpened();
}
String applicationId = Utility.getMetadataApplicationId(context);
if (applicationId == null) {
return false;
}
return Session.openActiveSessionFromCache(context) != null;
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class UserTimeline method handleNewPostClick.
private void handleNewPostClick() {
pendingAnnounce = false;
Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingAnnounce = true;
((IFbPermissionWorker) getActivity()).requestPublishPermissions(this, PERMISSIONS);
return;
}
if (getIntentParam() == KlyphBundleExtras.USER_ID) {
if (getElementId().equals(KlyphSession.getSessionUserId())) {
Intent intent = new Intent(getActivity(), PostActivity.class);
intent.putExtra(getIntentParam(), getElementId());
startActivityForResult(intent, POST_CODE);
} else {
publishFeedDialog();
}
} else {
Intent intent = new Intent(getActivity(), PostActivity.class);
intent.putExtra(getIntentParam(), getElementId());
startActivityForResult(intent, POST_CODE);
}
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class StreamFragment method handleDeleteCommentAction.
private void handleDeleteCommentAction(Comment comment) {
pendingDeleteComment = false;
pendingComment = comment;
Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingDeleteComment = true;
requestPublishPermissions(session);
return;
}
askDeleteComment(comment);
pendingComment = null;
}
use of com.facebook.Session in project Klyph by jonathangerbaud.
the class StreamFragment method handleDeleteAction.
private void handleDeleteAction() {
pendingDelete = false;
Session session = Session.getActiveSession();
List<String> permissions = session.getPermissions();
if (!permissions.containsAll(PERMISSIONS)) {
pendingDelete = true;
requestPublishPermissions(session);
return;
}
askDelete();
}
Aggregations