本文整理匯總了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;
}
}