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

项目:kognitivo    文件:WebViewLoginMethodHandler.java   
@Override
public WebDialog build() {
    Bundle parameters = getParameters();
    parameters.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, REDIRECT_URI);
    parameters.putString(ServerProtocol.DIALOG_PARAM_CLIENT_ID, getApplicationId());
    parameters.putString(ServerProtocol.DIALOG_PARAM_E2E, e2e);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE,
            ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RETURN_SCOPES,
            ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);

    // Set the re-request auth type for requests
    if (isRerequest) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_AUTH_TYPE,
                ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
    }

    return new WebDialog(getContext(), OAUTH_DIALOG, parameters, getTheme(), getListener());
}
项目:Move-Alarm_ORCA    文件:WebViewLoginMethodHandler.java   
@Override
public WebDialog build() {
    Bundle parameters = getParameters();
    parameters.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, REDIRECT_URI);
    parameters.putString(ServerProtocol.DIALOG_PARAM_CLIENT_ID, getApplicationId());
    parameters.putString(ServerProtocol.DIALOG_PARAM_E2E, e2e);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE,
            ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RETURN_SCOPES,
            ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);

    // Set the re-request auth type for requests
    if (isRerequest) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_AUTH_TYPE,
                ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
    }

    return new WebDialog(getContext(), OAUTH_DIALOG, parameters, getTheme(), getListener());
}
项目:SocioBlood    文件:WebViewLoginMethodHandler.java   
@Override
public WebDialog build() {
    Bundle parameters = getParameters();
    parameters.putString(ServerProtocol.DIALOG_PARAM_REDIRECT_URI, REDIRECT_URI);
    parameters.putString(ServerProtocol.DIALOG_PARAM_CLIENT_ID, getApplicationId());
    parameters.putString(ServerProtocol.DIALOG_PARAM_E2E, e2e);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE,
            ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN_AND_SIGNED_REQUEST);
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_RETURN_SCOPES,
            ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);

    // Set the re-request auth type for requests
    if (isRerequest) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_AUTH_TYPE,
                ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
    }

    return new WebDialog(getContext(), OAUTH_DIALOG, parameters, getTheme(), getListener());
}
项目:kognitivo    文件:WebViewLoginMethodHandler.java   
@Override
boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        String scope = TextUtils.join(",", request.getPermissions());
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
        addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null
            && (previousTokenString.equals(loadCookieToken()))) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                previousTokenString);
        // Don't log the actual access token, just its presence or absence.
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if
        // necessary
        Utility.clearFacebookCookies(loginClient.getActivity());
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
        @Override
        public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
        }
    };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder = new AuthDialogBuilder(
            fragmentActivity,
            request.getApplicationId(),
            parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setOnCompleteListener(listener)
            .setTheme(FacebookSdk.getWebDialogTheme());
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(),
            FacebookDialogFragment.TAG);

    return true;
}
项目:Move-Alarm_ORCA    文件:WebViewLoginMethodHandler.java   
@Override
boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        String scope = TextUtils.join(",", request.getPermissions());
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
        addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null
            && (previousTokenString.equals(loadCookieToken()))) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                previousTokenString);
        // Don't log the actual access token, just its presence or absence.
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if
        // necessary
        Utility.clearFacebookCookies(loginClient.getActivity());
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
        @Override
        public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
        }
    };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder = new AuthDialogBuilder(
            fragmentActivity,
            request.getApplicationId(),
            parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setOnCompleteListener(listener);
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(),
            FacebookDialogFragment.TAG);

    return true;
}
项目:SocioBlood    文件:WebViewLoginMethodHandler.java   
@Override
boolean tryAuthorize(final LoginClient.Request request) {
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        String scope = TextUtils.join(",", request.getPermissions());
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
        addLoggingExtra(ServerProtocol.DIALOG_PARAM_SCOPE, scope);
    }

    DefaultAudience audience = request.getDefaultAudience();
    parameters.putString(
            ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, audience.getNativeProtocolAudience());

    AccessToken previousToken = AccessToken.getCurrentAccessToken();
    String previousTokenString = previousToken != null ? previousToken.getToken() : null;
    if (previousTokenString != null
            && (previousTokenString.equals(loadCookieToken()))) {
        parameters.putString(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                previousTokenString);
        // Don't log the actual access token, just its presence or absence.
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_YES);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if
        // necessary
        Utility.clearFacebookCookies(loginClient.getActivity());
        addLoggingExtra(
                ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN,
                AppEventsConstants.EVENT_PARAM_VALUE_NO);
    }

    WebDialog.OnCompleteListener listener = new WebDialog.OnCompleteListener() {
        @Override
        public void onComplete(Bundle values, FacebookException error) {
            onWebDialogComplete(request, values, error);
        }
    };

    e2e = LoginClient.getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    FragmentActivity fragmentActivity = loginClient.getActivity();
    WebDialog.Builder builder = new AuthDialogBuilder(
            fragmentActivity,
            request.getApplicationId(),
            parameters)
            .setE2E(e2e)
            .setIsRerequest(request.isRerequest())
            .setOnCompleteListener(listener);
    loginDialog = builder.build();

    FacebookDialogFragment dialogFragment = new FacebookDialogFragment();
    dialogFragment.setRetainInstance(true);
    dialogFragment.setDialog(loginDialog);
    dialogFragment.show(fragmentActivity.getSupportFragmentManager(),
            FacebookDialogFragment.TAG);

    return true;
}