Skip to content

Commit

Permalink
Revert failed fixes for #1416 (#1482)
Browse files Browse the repository at this point in the history
  • Loading branch information
samtstern committed Oct 15, 2018
1 parent b5658c8 commit bc7b87d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
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

0 comments on commit bc7b87d

Please sign in to comment.