当前位置: 首页>>代码示例>>Java>>正文


Java SessionAuthorizationType类代码示例

本文整理汇总了Java中com.facebook.internal.SessionAuthorizationType的典型用法代码示例。如果您正苦于以下问题:Java SessionAuthorizationType类的具体用法?Java SessionAuthorizationType怎么用?Java SessionAuthorizationType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SessionAuthorizationType类属于com.facebook.internal包,在下文中一共展示了SessionAuthorizationType类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openSession

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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);
            }
        }
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:23,代码来源:FacebookFragment.java

示例2: requestNewPermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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);
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:27,代码来源:Session.java

示例3: validatePermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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));
            }
        }
    }
}
 
开发者ID:yeloapp,项目名称:yelo-android,代码行数:26,代码来源:Session.java

示例4: requestNewPermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:27,代码来源:Session.java

示例5: validatePermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:22,代码来源:Session.java

示例6: requestNewPermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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);
    }
}
 
开发者ID:42cc,项目名称:p2psafety,代码行数:26,代码来源:Session.java

示例7: setReadPermissions

import com.facebook.internal.SessionAuthorizationType; //导入依赖的package包/类
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;
    }
}
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:11,代码来源:LoginButton.java


注:本文中的com.facebook.internal.SessionAuthorizationType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。