Java 类com.facebook.internal.SessionAuthorizationType 实例源码

项目:AndroidBackendlessChat    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:chat-sdk-android-push-firebase    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:yelo-android    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:yelo-android    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:yelo-android    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:BrillaMXAndroid    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:BrillaMXAndroid    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:BrillaMXAndroid    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:aquaplay    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:TP-Formation-Android    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:TP-Formation-Android    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:TP-Formation-Android    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:AutoTimeHelper    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:AutoTimeHelper    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:AutoTimeHelper    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:snake-game-aws    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:BrainStudio    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:BrainStudio    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:BrainStudio    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:QuizUpWinner    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest paramNewPermissionsRequest, SessionAuthorizationType paramSessionAuthorizationType)
{
  validatePermissions(paramNewPermissionsRequest, paramSessionAuthorizationType);
  validateLoginBehavior(paramNewPermissionsRequest);
  if (paramNewPermissionsRequest != null)
  {
    synchronized (this.lock)
    {
      if (this.pendingAuthorizationRequest != null)
        throw new UnsupportedOperationException("Session: an attempt was made to request new permissions for a session that has a pending request.");
      if (this.state.isOpened())
      {
        this.pendingAuthorizationRequest = paramNewPermissionsRequest;
      }
      else
      {
        if (this.state.isClosed())
          throw new UnsupportedOperationException("Session: an attempt was made to request new permissions for a session that has been closed.");
        throw new UnsupportedOperationException("Session: an attempt was made to request new permissions for a session that is not currently open.");
      }
    }
    paramNewPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
    addCallback(paramNewPermissionsRequest.getCallback());
    authorize(paramNewPermissionsRequest);
  }
}
项目:QuizUpWinner    文件:Session.java   
private void validatePermissions(AuthorizationRequest paramAuthorizationRequest, SessionAuthorizationType paramSessionAuthorizationType)
{
  if ((paramAuthorizationRequest == null) || (Utility.isNullOrEmpty(paramAuthorizationRequest.getPermissions())))
  {
    if (SessionAuthorizationType.PUBLISH.equals(paramSessionAuthorizationType))
      throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
    return;
  }
  Iterator localIterator = paramAuthorizationRequest.getPermissions().iterator();
  while (localIterator.hasNext())
  {
    String str = (String)localIterator.next();
    if (isPublishPermission(str))
    {
      if (SessionAuthorizationType.READ.equals(paramSessionAuthorizationType))
        throw new FacebookException(String.format("Cannot pass a publish or manage permission (%s) to a request for read authorization", new Object[] { str }));
    }
    else
      SessionAuthorizationType.PUBLISH.equals(paramSessionAuthorizationType);
  }
}
项目:Nefete    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:MisterWok    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:DualRunner    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:UbiNomadLib    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:bladedroid    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:Shorcial    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:ClassParticipation2    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:p2psafety    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            switch (this.state) {
                case OPENED:
                case OPENED_TOKEN_UPDATED:
                    pendingRequest = newPermissionsRequest;
                    break;
                default:
                    throw new UnsupportedOperationException(
                            "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        authorize(newPermissionsRequest);
    }
}
项目:Team-Alice    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:CampusFeedv2    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:ClassParticipation2    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
项目:smartenit    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:smartenit    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:kaorisan    文件:Session.java   
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            switch (this.state) {
                case OPENED:
                case OPENED_TOKEN_UPDATED:
                    pendingRequest = newPermissionsRequest;
                    break;
                default:
                    throw new UnsupportedOperationException(
                            "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        authorize(newPermissionsRequest);
    }
}
项目:kaorisan    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:PetTinder    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:localhost-android    文件:Session.java   
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
项目:DualRunner    文件:FacebookFragment.java   
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
项目:AndroidBackendlessChat    文件:LoginButton.java   
public void setReadPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.PUBLISH.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setReadPermissions after setPublishPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.READ, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.READ;
    }
}