Skip to content

Revert failed fixes for #1416 #1482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
package com.firebase.ui.auth.data.model;

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.DrawableRes;
Expand Down Expand Up @@ -88,15 +87,7 @@ public FlowParameters(
* Extract FlowParameters from an Intent.
*/
public static FlowParameters fromIntent(Intent intent) {
//this is required to fix #1416 - ClassNotFound for FlowParameters
Bundle bundle = intent.getBundleExtra(ExtraConstants.FLOW_BUNDLE);
return bundle.getParcelable(ExtraConstants.FLOW_PARAMS);
}

public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putParcelable(ExtraConstants.FLOW_PARAMS, this);
return bundle;
return intent.getParcelableExtra(ExtraConstants.FLOW_PARAMS);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ protected static Intent createBaseIntent(
Intent intent = new Intent(
checkNotNull(context, "context cannot be null"),
checkNotNull(target, "target activity cannot be null"))
.putExtra(ExtraConstants.FLOW_BUNDLE,
checkNotNull(flowParams, "flowParams cannot be null").toBundle());
.putExtra(ExtraConstants.FLOW_PARAMS,
checkNotNull(flowParams, "flowParams cannot be null"));
intent.setExtrasClassLoader(AuthUI.class.getClassLoader());
return intent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public final class ExtraConstants {
public static final String FLOW_BUNDLE = "extra_flow_bundle";
public static final String FLOW_PARAMS = "extra_flow_params";
public static final String IDP_RESPONSE = "extra_idp_response";
public static final String USER = "extra_user";
Expand Down
10 changes: 6 additions & 4 deletions auth/src/test/java/com/firebase/ui/auth/AuthUITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ public void setUp() {

@Test
public void testCreateStartIntent_shouldHaveEmailAsDefaultProvider() {
FlowParameters flowParameters = FlowParameters.fromIntent(mAuthUi
FlowParameters flowParameters = mAuthUi
.createSignInIntentBuilder()
.build());
.build()
.getParcelableExtra(ExtraConstants.FLOW_PARAMS);
assertEquals(1, flowParameters.providers.size());
assertEquals(EmailAuthProvider.PROVIDER_ID,
flowParameters.providers.get(0).getProviderId());
Expand All @@ -63,15 +64,16 @@ public void testCreateStartIntent_shouldOnlyAllowOneInstanceOfAnIdp() {

@Test
public void testCreatingStartIntent() {
FlowParameters flowParameters = FlowParameters.fromIntent(mAuthUi
FlowParameters flowParameters = mAuthUi
.createSignInIntentBuilder()
.setAvailableProviders(Arrays.asList(
new IdpConfig.EmailBuilder().build(),
new IdpConfig.GoogleBuilder().build(),
new IdpConfig.FacebookBuilder().build(),
new IdpConfig.AnonymousBuilder().build()))
.setTosAndPrivacyPolicyUrls(TestConstants.TOS_URL, TestConstants.PRIVACY_URL)
.build());
.build()
.getParcelableExtra(ExtraConstants.FLOW_PARAMS);

assertEquals(4, flowParameters.providers.size());
assertEquals(TestHelper.MOCK_APP.getName(), flowParameters.appName);
Expand Down