Java 类com.facebook.Session.OpenRequest 实例源码

项目:guitar_guy    文件:FacebookProfileConnector.java   
@Override
public void connect(Activity activity)
{
    Session session = Session.getActiveSession();

    // TODO: I think we should validate the session here, but to what
    // extent?

    MadFacebookStatusCallback statusCallback =
            new MadFacebookStatusCallback();

    // Check if the session is already open.
    if (!session.isOpened() && !session.isClosed())
    {
        OpenRequest openRequest = new OpenRequest(activity);
        session.openForRead(openRequest
                .setCallback(statusCallback));
    }
    else
    {
        Session.openActiveSession(activity, true,
                statusCallback);
    }

}
项目:QuizUpWinner    文件:FacebookFragment.java   
private void openSession(String paramString, List<String> paramList, SessionLoginBehavior paramSessionLoginBehavior, int paramInt, SessionAuthorizationType paramSessionAuthorizationType)
{
  if (this.sessionTracker != null)
  {
    Session localSession1 = this.sessionTracker.getSession();
    Object localObject = localSession1;
    if ((localSession1 == null) || (((Session)localObject).getState().isClosed()))
    {
      Session localSession2 = new Session.Builder(getActivity()).setApplicationId(paramString).build();
      Session.setActiveSession(localSession2);
      localObject = localSession2;
    }
    if (!((Session)localObject).isOpened())
    {
      Session.OpenRequest localOpenRequest = new Session.OpenRequest(this).setPermissions(paramList).setLoginBehavior(paramSessionLoginBehavior).setRequestCode(paramInt);
      if (SessionAuthorizationType.PUBLISH.equals(paramSessionAuthorizationType))
      {
        ((Session)localObject).openForPublish(localOpenRequest);
        return;
      }
      ((Session)localObject).openForRead(localOpenRequest);
    }
  }
}
项目:Social-Share-Utils    文件:Facebook.java   
/**
 * Get an opened Facebook user session. The method checks whether the uid
 * param is an ID of a user or page and always returns the session of user.
 * 
 * @param uid
 *            ID of a user or page who shares the post
 * @return user's session
 */
private Session getUserSession(String uid) {
    Session session;
    if (!StaticUtilities.isFBPage(uid))
        session = StaticUtilities.getFBSessionForUser(uid);
    else
        session = StaticUtilities.getFBSessionForUser(StaticUtilities
                .getPageOwnerID(uid));
    if (session == null || !session.isOpened())
        session.openForPublish(new OpenRequest(act));

    if (!session.isOpened())
        throw new IllegalStateException("Couldn't open Facebook session");

    return session;
}
项目:aquaplay    文件:FB.java   
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions) {
    OpenRequest req = new OpenRequest(getActivity());
    req.setCallback(callback);
    req.setPermissions(permissions);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);

    return req;
}
项目:QuizUpWinner    文件:Facebook.java   
private void authorize(Activity paramActivity, String[] paramArrayOfString, int paramInt, SessionLoginBehavior paramSessionLoginBehavior, final DialogListener paramDialogListener)
{
  checkUserSession("authorize");
  this.pendingOpeningSession = new Session.Builder(paramActivity).setApplicationId(this.mAppId).setTokenCachingStrategy(getTokenCache()).build();
  this.pendingAuthorizationActivity = paramActivity;
  String[] arrayOfString;
  if (paramArrayOfString != null)
    arrayOfString = paramArrayOfString;
  else
    arrayOfString = new String[0];
  this.pendingAuthorizationPermissions = arrayOfString;
  Session.StatusCallback local1 = new Session.StatusCallback()
  {
    public void call(Session paramAnonymousSession, SessionState paramAnonymousSessionState, Exception paramAnonymousException)
    {
      Facebook.this.onSessionCallback(paramAnonymousSession, paramAnonymousSessionState, paramAnonymousException, paramDialogListener);
    }
  };
  Session.OpenRequest localOpenRequest = new Session.OpenRequest(paramActivity).setCallback(local1).setLoginBehavior(paramSessionLoginBehavior).setRequestCode(paramInt).setPermissions(Arrays.asList(this.pendingAuthorizationPermissions));
  Session localSession = this.pendingOpeningSession;
  boolean bool;
  if (this.pendingAuthorizationPermissions.length > 0)
    bool = true;
  else
    bool = false;
  openSession(localSession, localOpenRequest, bool);
}
项目:QuizUpWinner    文件:Facebook.java   
private void openSession(Session paramSession, Session.OpenRequest paramOpenRequest, boolean paramBoolean)
{
  paramOpenRequest.setIsLegacy(true);
  if (paramBoolean)
  {
    paramSession.openForPublish(paramOpenRequest);
    return;
  }
  paramSession.openForRead(paramOpenRequest);
}
项目:DualRunner    文件:FBLogin.java   
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions, Activity activity) {
    OpenRequest req = new OpenRequest(activity);
    req.setCallback(callback);
    req.setPermissions(permissions);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);

    return req;
}
项目:android_socialmedia    文件:MainActivity.java   
private Session openActiveSession(Activity activity, boolean allowLoginUI, StatusCallback callback,
        List<String> permissions) {
    OpenRequest openRequest = new OpenRequest(activity).setPermissions(permissions).setCallback(callback);
    Session session = new Session.Builder(activity).build();
    if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState()) || allowLoginUI) {
        Session.setActiveSession(session);
        session.openForPublish(openRequest);
        return session;
    }
    return null;
}
项目:Free-D-Unity    文件:FB.java   
private static OpenRequest getOpenRequest(StatusCallback callback, List<String> permissions) {
    OpenRequest req = new OpenRequest(getActivity());
    req.setCallback(callback);
    req.setPermissions(permissions);
    req.setDefaultAudience(SessionDefaultAudience.FRIENDS);

    return req;
}
项目:QuizUpWinner    文件:Facebook.java   
@Deprecated
public final Session getSession()
{
  while (true)
  {
    String str;
    Session localSession2;
    synchronized (this.lock)
    {
      if (this.userSetSession != null)
      {
        Session localSession7 = this.userSetSession;
        return localSession7;
      }
      if ((this.session != null) || (!this.sessionInvalidated))
      {
        Session localSession1 = this.session;
        return localSession1;
      }
      str = this.accessToken;
      localSession2 = this.session;
    }
    if (str == null)
      return null;
    List localList;
    if (localSession2 != null)
      localList = localSession2.getPermissions();
    else if (this.pendingAuthorizationPermissions != null)
      localList = Arrays.asList(this.pendingAuthorizationPermissions);
    else
      localList = Collections.emptyList();
    Session localSession3 = new Session.Builder(this.pendingAuthorizationActivity).setApplicationId(this.mAppId).setTokenCachingStrategy(getTokenCache()).build();
    if (localSession3.getState() != SessionState.CREATED_TOKEN_LOADED)
      return null;
    Session.OpenRequest localOpenRequest = new Session.OpenRequest(this.pendingAuthorizationActivity).setPermissions(localList);
    boolean bool;
    if (!localList.isEmpty())
      bool = true;
    else
      bool = false;
    openSession(localSession3, localOpenRequest, bool);
    Session localSession4;
    Session localSession5;
    synchronized (this.lock)
    {
      if (!this.sessionInvalidated)
      {
        Session localSession6 = this.session;
        localSession4 = null;
        localSession5 = null;
        if (localSession6 != null);
      }
      else
      {
        localSession4 = this.session;
        this.session = localSession3;
        localSession5 = localSession3;
        this.sessionInvalidated = false;
      }
    }
    if (localSession4 != null)
      localSession4.close();
    if (localSession5 != null)
      return localSession5;
  }
}