com.facebook.SessionDefaultAudience Java Examples

The following examples show how to use com.facebook.SessionDefaultAudience. 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: UserSettingsFragmentTests.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@MediumTest
@LargeTest
public void testCanSetParametersViaLayout() throws Throwable {
    TestActivity activity = getActivity();
    assertNotNull(activity);

    final UserSettingsFragment fragment = activity.getFragment();
    assertNotNull(fragment);

    assertEquals(SessionLoginBehavior.SUPPRESS_SSO, fragment.getLoginBehavior());
    assertEquals(SessionDefaultAudience.EVERYONE, fragment.getDefaultAudience());
    List<String> permissions = fragment.getPermissions();
    assertEquals(2, permissions.size());
    assertEquals("read_1", permissions.get(0));
}
 
Example #2
Source File: UserSettingsFragmentTests.java    From FacebookImageShareIntent with MIT License 5 votes vote down vote up
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportFragmentManager().executePendingTransactions();
    UserSettingsFragment fragment = getFragment();
    fragment.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
    fragment.setReadPermissions("read_1", "read_2");
    fragment.setDefaultAudience(SessionDefaultAudience.EVERYONE);
}
 
Example #3
Source File: NativeProtocol.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
public static Intent createProxyAuthIntent(Context context, String applicationId, List<String> permissions,
        String e2e, boolean isRerequest, SessionDefaultAudience defaultAudience) {
    for (NativeAppInfo appInfo : facebookAppInfoList) {
        Intent intent = new Intent()
                .setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY)
                .putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId);

        if (!Utility.isNullOrEmpty(permissions)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions));
        }
        if (!Utility.isNullOrEmpty(e2e)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e);
        }

        intent.putExtra(ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE, ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_RETURN_SCOPES, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, defaultAudience.getNativeProtocolAudience());

        if (!Settings.getPlatformCompatibilityEnabled()) {
            // Override the API Version for Auth
            intent.putExtra(ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE, ServerProtocol.GRAPH_API_VERSION);

            // Only set the rerequest auth type for non legacy requests
            if (isRerequest) {
                intent.putExtra(ServerProtocol.DIALOG_PARAM_AUTH_TYPE, ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
            }
        }

        intent = validateActivityIntent(context, intent, appInfo);

        if (intent != null) {
            return intent;
        }
    }
    return null;
}
 
Example #4
Source File: NativeProtocol.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
public static Intent createProxyAuthIntent(Context context, String applicationId, List<String> permissions,
        String e2e, boolean isRerequest, SessionDefaultAudience defaultAudience) {
    for (NativeAppInfo appInfo : facebookAppInfoList) {
        Intent intent = new Intent()
                .setClassName(appInfo.getPackage(), FACEBOOK_PROXY_AUTH_ACTIVITY)
                .putExtra(FACEBOOK_PROXY_AUTH_APP_ID_KEY, applicationId);

        if (!Utility.isNullOrEmpty(permissions)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_PERMISSIONS_KEY, TextUtils.join(",", permissions));
        }
        if (!Utility.isNullOrEmpty(e2e)) {
            intent.putExtra(FACEBOOK_PROXY_AUTH_E2E_KEY, e2e);
        }

        intent.putExtra(ServerProtocol.DIALOG_PARAM_RESPONSE_TYPE, ServerProtocol.DIALOG_RESPONSE_TYPE_TOKEN);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_RETURN_SCOPES, ServerProtocol.DIALOG_RETURN_SCOPES_TRUE);
        intent.putExtra(ServerProtocol.DIALOG_PARAM_DEFAULT_AUDIENCE, defaultAudience.getNativeProtocolAudience());

        if (!Settings.getPlatformCompatibilityEnabled()) {
            // Override the API Version for Auth
            intent.putExtra(ServerProtocol.DIALOG_PARAM_LEGACY_OVERRIDE, ServerProtocol.GRAPH_API_VERSION);

            // Only set the rerequest auth type for non legacy requests
            if (isRerequest) {
                intent.putExtra(ServerProtocol.DIALOG_PARAM_AUTH_TYPE, ServerProtocol.DIALOG_REREQUEST_AUTH_TYPE);
            }
        }

        intent = validateActivityIntent(context, intent, appInfo);

        if (intent != null) {
            return intent;
        }
    }
    return null;
}
 
Example #5
Source File: LoginButton.java    From Klyph with MIT License 4 votes vote down vote up
public void setDefaultAudience(SessionDefaultAudience defaultAudience) {
    this.defaultAudience = defaultAudience;
}
 
Example #6
Source File: LoginButton.java    From Klyph with MIT License 4 votes vote down vote up
public SessionDefaultAudience getDefaultAudience() {
    return defaultAudience;
}
 
Example #7
Source File: LoginButton.java    From KlyphMessenger with MIT License 4 votes vote down vote up
public void setDefaultAudience(SessionDefaultAudience defaultAudience) {
    this.defaultAudience = defaultAudience;
}
 
Example #8
Source File: LoginButton.java    From KlyphMessenger with MIT License 4 votes vote down vote up
public SessionDefaultAudience getDefaultAudience() {
    return defaultAudience;
}
 
Example #9
Source File: LoginButton.java    From Klyph with MIT License 2 votes vote down vote up
/**
 * Sets the default audience to use when the session is opened.
 * This value is only useful when specifying write permissions for the native
 * login dialog.
 *
 * @param defaultAudience the default audience value to use
 */
public void setDefaultAudience(SessionDefaultAudience defaultAudience) {
    properties.setDefaultAudience(defaultAudience);
}
 
Example #10
Source File: LoginButton.java    From Klyph with MIT License 2 votes vote down vote up
/**
 * Gets the default audience to use when the session is opened.
 * This value is only useful when specifying write permissions for the native
 * login dialog.
 *
 * @return the default audience value to use
 */
public SessionDefaultAudience getDefaultAudience() {
    return properties.getDefaultAudience();
}
 
Example #11
Source File: LoginButton.java    From KlyphMessenger with MIT License 2 votes vote down vote up
/**
 * Sets the default audience to use when the session is opened.
 * This value is only useful when specifying write permissions for the native
 * login dialog.
 *
 * @param defaultAudience the default audience value to use
 */
public void setDefaultAudience(SessionDefaultAudience defaultAudience) {
    properties.setDefaultAudience(defaultAudience);
}
 
Example #12
Source File: LoginButton.java    From KlyphMessenger with MIT License 2 votes vote down vote up
/**
 * Gets the default audience to use when the session is opened.
 * This value is only useful when specifying write permissions for the native
 * login dialog.
 *
 * @return the default audience value to use
 */
public SessionDefaultAudience getDefaultAudience() {
    return properties.getDefaultAudience();
}