Java Code Examples for com.facebook.widget.WebDialog#Builder

The following examples show how to use com.facebook.widget.WebDialog#Builder . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AuthorizationClient.java    From platform-friends-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 2
Source File: AuthorizationClient.java    From Klyph with MIT License 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 3
Source File: AuthorizationClient.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 4
Source File: AuthorizationClient.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    String applicationId = request.getApplicationId();
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, TextUtils.join(",", request.getPermissions()));
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if necessary
        Utility.clearFacebookCookies(context);
    }

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

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 5
Source File: AuthorizationClient.java    From KlyphMessenger with MIT License 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 6
Source File: AuthorizationClient.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    String applicationId = request.getApplicationId();
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, TextUtils.join(",", request.getPermissions()));
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if necessary
        Utility.clearFacebookCookies(context);
    }

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

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 7
Source File: AuthorizationClient.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    String applicationId = request.getApplicationId();
    Bundle parameters = new Bundle();
    if (!Utility.isNullOrEmpty(request.getPermissions())) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_SCOPE, TextUtils.join(",", request.getPermissions()));
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
    } else {
        // The call to clear cookies will create the first instance of CookieSyncManager if necessary
        Utility.clearFacebookCookies(context);
    }

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

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 8
Source File: AuthorizationClient.java    From android-skeleton-project with MIT License 4 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setIsRerequest(request.isRerequest())
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 9
Source File: AuthorizationClient.java    From FacebookImageShareIntent with MIT License 4 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setIsRerequest(request.isRerequest())
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 10
Source File: AuthorizationClient.java    From Abelana-Android with Apache License 2.0 4 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

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

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setIsRerequest(request.isRerequest())
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}
 
Example 11
Source File: AuthorizationClient.java    From facebook-api-android-maven with Apache License 2.0 4 votes vote down vote up
@Override
boolean tryAuthorize(final AuthorizationRequest request) {
    applicationId = request.getApplicationId();
    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);
    }

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

    String previousToken = request.getPreviousAccessToken();
    if (!Utility.isNullOrEmpty(previousToken) && (previousToken.equals(loadCookieToken()))) {
        parameters.putString(ServerProtocol.DIALOG_PARAM_ACCESS_TOKEN, previousToken);
        // 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(context);
        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 = getE2E();
    addLoggingExtra(ServerProtocol.DIALOG_PARAM_E2E, e2e);

    WebDialog.Builder builder =
            new AuthDialogBuilder(getStartActivityDelegate().getActivityContext(), applicationId, parameters)
                    .setE2E(e2e)
                    .setIsRerequest(request.isRerequest())
                    .setOnCompleteListener(listener);
    loginDialog = builder.build();
    loginDialog.show();

    return true;
}