本文整理汇总了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);
}
}
}
}
示例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);
}
}
示例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));
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}