Search in sources :

Example 1 with ContinueUrlBuilder

use of com.firebase.ui.auth.util.data.ContinueUrlBuilder in project FirebaseUI-Android by firebase.

the class EmailLinkSignInHandlerTest method initializeHandlerWithSessionInfo.

private void initializeHandlerWithSessionInfo(@Nullable String sessionId, @Nullable String anonymousUserId, @Nullable String providerId, boolean forceSameDevice) {
    FlowParameters testParams = TestHelper.getFlowParameters(new ArrayList<String>());
    ContinueUrlBuilder continueUrlBuilder = new ContinueUrlBuilder(CONTINUE_URL);
    continueUrlBuilder.appendSessionId(sessionId);
    continueUrlBuilder.appendAnonymousUserId(anonymousUserId);
    continueUrlBuilder.appendProviderId(providerId);
    continueUrlBuilder.appendForceSameDeviceBit(forceSameDevice);
    testParams.emailLink = EMAIL_LINK + continueUrlBuilder.build();
    mHandler.initializeForTesting(testParams, mMockAuth, null);
}
Also used : FlowParameters(com.firebase.ui.auth.data.model.FlowParameters) ContinueUrlBuilder(com.firebase.ui.auth.util.data.ContinueUrlBuilder)

Example 2 with ContinueUrlBuilder

use of com.firebase.ui.auth.util.data.ContinueUrlBuilder in project FirebaseUI-Android by firebase.

the class ContinueUrlBuilderTest method testAppendParams_encodedLink_expectSuccess.

@Test
public void testAppendParams_encodedLink_expectSuccess() {
    String continueUrlBuilder = new ContinueUrlBuilder(ENCODED_EMAIL_LINK).appendSessionId(SESSION_ID).appendAnonymousUserId(ANONYMOUS_USER_ID).appendProviderId(PROVIDER_ID).appendForceSameDeviceBit(FORCE_SAME_DEVICE).build();
    EmailLinkParser parser = new EmailLinkParser(continueUrlBuilder);
    assertThat(parser.getSessionId()).isEqualTo(SESSION_ID);
    assertThat(parser.getAnonymousUserId()).isEqualTo(ANONYMOUS_USER_ID);
    assertThat(parser.getProviderId()).isEqualTo(PROVIDER_ID);
    assertThat(parser.getForceSameDeviceBit()).isEqualTo(FORCE_SAME_DEVICE);
}
Also used : ContinueUrlBuilder(com.firebase.ui.auth.util.data.ContinueUrlBuilder) EmailLinkParser(com.firebase.ui.auth.util.data.EmailLinkParser) Test(org.junit.Test)

Example 3 with ContinueUrlBuilder

use of com.firebase.ui.auth.util.data.ContinueUrlBuilder in project FirebaseUI-Android by firebase.

the class ContinueUrlBuilderTest method testAppendParams_decodedLink_expectSuccess.

@Test
public void testAppendParams_decodedLink_expectSuccess() {
    String continueUrlBuilder = new ContinueUrlBuilder(DECODED_EMAIL_LINK).appendSessionId(SESSION_ID).appendAnonymousUserId(ANONYMOUS_USER_ID).appendProviderId(PROVIDER_ID).appendForceSameDeviceBit(FORCE_SAME_DEVICE).build();
    EmailLinkParser parser = new EmailLinkParser(continueUrlBuilder);
    assertThat(parser.getSessionId()).isEqualTo(SESSION_ID);
    assertThat(parser.getAnonymousUserId()).isEqualTo(ANONYMOUS_USER_ID);
    assertThat(parser.getProviderId()).isEqualTo(PROVIDER_ID);
    assertThat(parser.getForceSameDeviceBit()).isEqualTo(FORCE_SAME_DEVICE);
}
Also used : ContinueUrlBuilder(com.firebase.ui.auth.util.data.ContinueUrlBuilder) EmailLinkParser(com.firebase.ui.auth.util.data.EmailLinkParser) Test(org.junit.Test)

Example 4 with ContinueUrlBuilder

use of com.firebase.ui.auth.util.data.ContinueUrlBuilder in project FirebaseUI-Android by firebase.

the class EmailLinkSendEmailHandler method addSessionInfoToActionCodeSettings.

private ActionCodeSettings addSessionInfoToActionCodeSettings(@NonNull ActionCodeSettings actionCodeSettings, @NonNull String sessionId, @NonNull String anonymousUserId, @Nullable IdpResponse response, boolean forceSameDevice) {
    String continueUrl = actionCodeSettings.getUrl();
    ContinueUrlBuilder continueUrlBuilder = new ContinueUrlBuilder(continueUrl);
    continueUrlBuilder.appendSessionId(sessionId);
    continueUrlBuilder.appendAnonymousUserId(anonymousUserId);
    continueUrlBuilder.appendForceSameDeviceBit(forceSameDevice);
    if (response != null) {
        continueUrlBuilder.appendProviderId(response.getProviderType());
    }
    return ActionCodeSettings.newBuilder().setUrl(continueUrlBuilder.build()).setHandleCodeInApp(true).setAndroidPackageName(actionCodeSettings.getAndroidPackageName(), actionCodeSettings.getAndroidInstallApp(), actionCodeSettings.getAndroidMinimumVersion()).setIOSBundleId(actionCodeSettings.getIOSBundle()).build();
}
Also used : ContinueUrlBuilder(com.firebase.ui.auth.util.data.ContinueUrlBuilder)

Aggregations

ContinueUrlBuilder (com.firebase.ui.auth.util.data.ContinueUrlBuilder)4 EmailLinkParser (com.firebase.ui.auth.util.data.EmailLinkParser)2 Test (org.junit.Test)2 FlowParameters (com.firebase.ui.auth.data.model.FlowParameters)1