Skip to content

Merge phone auth into version-2.0.0 #740

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 36 commits into from
Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a9b4c5f
Phone Auth UI
ashwinraghav May 3, 2017
8fdf168
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern May 3, 2017
2969232
Fixing (potential) NPE for phone accounts saved in smartlock
ashwinraghav May 3, 2017
3598ec6
Bug fixes
ashwinraghav May 8, 2017
e14973c
Description for auth strings to enable transations
ashwinraghav May 9, 2017
a6ec46f
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern May 9, 2017
f9fd1db
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern May 11, 2017
58c5f02
Update error strings to match spreadsheet.
May 11, 2017
4b0cdaa
Crash fix for app compat attribute lookup
ashwinraghav May 12, 2017
668da24
Merge "Crash fix for app compat attribute lookup" into phone-auth
ashwinraghav May 12, 2017
909aac5
Remove period from the end of sentences
May 12, 2017
2d6db67
Show keyboard in conf code screen
ashwinraghav May 12, 2017
09bf1d2
Set country selection to default locale
ashwinraghav May 13, 2017
c882020
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern May 13, 2017
505415c
Wiring in activity scoped phone number auth api
ashwinraghav May 15, 2017
bc672c4
Converting phone number from hint selector to e164 optimistically
ashwinraghav May 16, 2017
6ad03e7
Introducing additional parameters for smart lock
ashwinraghav May 19, 2017
79eafd7
Fix phone number button vector drawable.
isaisachen May 24, 2017
2531fd2
Merge "Fix phone number button vector drawable." into phone-auth
isaisachen May 24, 2017
97f0e06
Phone auth terms of service
ashwinraghav May 23, 2017
f47f706
Merge "Phone auth terms of service" into phone-auth
ashwinraghav May 24, 2017
6f20458
Increasing auto retrieval timeout to 2 mins
ashwinraghav May 24, 2017
47ef4a0
Removing unnecessary translations
ashwinraghav May 25, 2017
01f876d
Merge "Remove period from the end of sentences" into phone-auth
ashwinraghav May 25, 2017
cad63e9
Translations refinement
ashwinraghav May 25, 2017
46602c5
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern May 31, 2017
b61c950
Tweaking twitter deps
ashwinraghav Jun 1, 2017
696aa44
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern Jun 1, 2017
7e13be7
Provided scope for twitter and facebook sdk
ashwinraghav May 31, 2017
d340365
Merge "Merge branch 'version-2.0.0-dev' into phone-auth" into phone-auth
samtstern Jun 2, 2017
fbbd014
Fix case when only phone auth selected.
samtstern Jun 5, 2017
aa63079
Merge branch 'version-2.0.0-dev' into phone-auth
samtstern Jun 7, 2017
47c1a6c
Fix all lint and checkstyle violations
samtstern Jun 7, 2017
2217102
Fix more check failures
samtstern Jun 7, 2017
c8b5ed9
Fix test failures by working around Facebook SDK
samtstern Jun 8, 2017
f55c73b
Respond to SUPERCILEX review feedback
samtstern Jun 8, 2017
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
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ dependencies {
compile "com.google.firebase:firebase-database:$firebaseVersion"
compile "com.google.firebase:firebase-storage:$firebaseVersion"

compile('com.facebook.android:facebook-android-sdk:4.22.1')
compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }

// The following dependencies are not required to use the Firebase UI library.
// They are used to make some aspects of the demo app implementation simpler for
// demonstrative purposes, and you may find them useful in your own apps; YMMV.
Expand Down
21 changes: 17 additions & 4 deletions app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.email_provider)
CheckBox mUseEmailProvider;

@BindView(R.id.phone_provider)
CheckBox mUsePhoneProvider;

@BindView(R.id.google_provider)
CheckBox mUseGoogleProvider;

Expand Down Expand Up @@ -107,8 +110,11 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.no_logo)
RadioButton mNoLogo;

@BindView(R.id.smartlock_enabled)
CheckBox mEnableSmartLock;
@BindView(R.id.credential_selector_enabled)
CheckBox mEnableCredentialSelector;

@BindView(R.id.hint_selector_enabled)
CheckBox mEnableHintSelector;

@BindView(R.id.allow_new_email_accounts)
CheckBox mAllowNewEmailAccounts;
Expand Down Expand Up @@ -194,7 +200,8 @@ public void signIn(View view) {
.setAvailableProviders(getSelectedProviders())
.setTosUrl(getSelectedTosUrl())
.setPrivacyPolicyUrl(getSelectedPrivacyPolicyUrl())
.setIsSmartLockEnabled(mEnableSmartLock.isChecked())
.setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(),
mEnableHintSelector.isChecked())
.setAllowNewEmailAccounts(mAllowNewEmailAccounts.isChecked())
.build(),
RC_SIGN_IN);
Expand Down Expand Up @@ -252,7 +259,8 @@ private void startSignedInActivity(IdpResponse response) {
getSelectedTheme(),
getSelectedProviders(),
getSelectedTosUrl(),
mEnableSmartLock.isChecked())));
mEnableCredentialSelector.isChecked(),
mEnableHintSelector.isChecked())));
}

@MainThread
Expand Down Expand Up @@ -324,6 +332,11 @@ private List<IdpConfig> getSelectedProviders() {
selectedProviders.add(new IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build());
}

if (mUsePhoneProvider.isChecked()) {
selectedProviders.add(
new IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build());
}

return selectedProviders;
}

Expand Down
21 changes: 16 additions & 5 deletions app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ public class SignedInActivity extends AppCompatActivity {
@BindView(R.id.user_display_name)
TextView mUserDisplayName;


@BindView(R.id.user_phone_number)
TextView mUserPhoneNumber;

@BindView(R.id.user_enabled_providers)
TextView mEnabledProviders;

Expand Down Expand Up @@ -157,6 +161,8 @@ private void populateProfile() {

mUserEmail.setText(
TextUtils.isEmpty(user.getEmail()) ? "No email" : user.getEmail());
mUserPhoneNumber.setText(
TextUtils.isEmpty(user.getPhoneNumber()) ? "No phone number" : user.getPhoneNumber());
mUserDisplayName.setText(
TextUtils.isEmpty(user.getDisplayName()) ? "No display name" : user.getDisplayName());

Expand Down Expand Up @@ -223,18 +229,21 @@ static final class SignedInConfig implements Parcelable {
int theme;
List<IdpConfig> providerInfo;
String tosUrl;
boolean isSmartLockEnabled;
boolean isCredentialSelectorEnabled;
boolean isHintSelectorEnabled;

SignedInConfig(int logo,
int theme,
List<IdpConfig> providerInfo,
String tosUrl,
boolean isSmartLockEnabled) {
boolean isCredentialSelectorEnabled,
boolean isHintSelectorEnabled) {
this.logo = logo;
this.theme = theme;
this.providerInfo = providerInfo;
this.tosUrl = tosUrl;
this.isSmartLockEnabled = isSmartLockEnabled;
this.isCredentialSelectorEnabled = isCredentialSelectorEnabled;
this.isHintSelectorEnabled = isHintSelectorEnabled;
}

SignedInConfig(Parcel in) {
Expand All @@ -243,7 +252,8 @@ static final class SignedInConfig implements Parcelable {
providerInfo = new ArrayList<>();
in.readList(providerInfo, IdpConfig.class.getClassLoader());
tosUrl = in.readString();
isSmartLockEnabled = in.readInt() != 0;
isCredentialSelectorEnabled = in.readInt() != 0;
isHintSelectorEnabled = in.readInt() != 0;
}

public static final Creator<SignedInConfig> CREATOR = new Creator<SignedInConfig>() {
Expand All @@ -269,7 +279,8 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(theme);
dest.writeList(providerInfo);
dest.writeString(tosUrl);
dest.writeInt(isSmartLockEnabled ? 1 : 0);
dest.writeInt(isCredentialSelectorEnabled ? 1 : 0);
dest.writeInt(isHintSelectorEnabled ? 1 : 0);
}
}

Expand Down
18 changes: 16 additions & 2 deletions app/src/main/res/layout/auth_ui_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@
android:checked="true"
android:text="@string/email_label"/>

<CheckBox
android:id="@+id/phone_provider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/phone_label"/>

<TextView
style="@style/Base.TextAppearance.AppCompat.Subhead"
android:layout_width="wrap_content"
Expand Down Expand Up @@ -257,11 +264,18 @@
android:text="@string/other_options_header"/>

<CheckBox
android:id="@+id/smartlock_enabled"
android:id="@+id/credential_selector_enabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/enable_credential_selector"/>

<CheckBox
android:id="@+id/hint_selector_enabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/enable_smartlock"/>
android:text="@string/enable_hint_selector"/>

<CheckBox
android:id="@+id/allow_new_email_accounts"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/layout/signed_in_layout.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
android:layout_height="wrap_content"
android:textIsSelectable="true"/>

<TextView
android:id="@+id/user_phone_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"/>

<TextView
android:id="@+id/user_display_name"
android:layout_width="wrap_content"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<string name="no_logo_label">None</string>
<string name="auth_providers_header">Use auth providers:</string>
<string name="email_label">Email</string>
<string name="phone_label">Phone</string>
<string name="facebook_label">Facebook</string>
<string name="facebook_label_missing_config">Facebook - configuration missing</string>
<string name="twitter_label">Twitter</string>
Expand All @@ -49,7 +50,6 @@
<string name="default_theme">Default theme</string>
<string name="configuration_required">Configuration is required - see README.md</string>
<string name="other_options_header">Other Options:</string>
<string name="enable_smartlock">Enable SmartLock for Passwords</string>
<string name="rational_image_perm">This sample will read an image from local storage to upload to Cloud Storage.</string>
<string name="anonymous_auth_failed_msg">Anonymous authentication failed, various components of the demo will not work. Make sure your device is online and that Anonymous Auth is configured in your Firebase project(https://console.firebase.google.com/project/_/authentication/providers)</string>
<string name="extra_google_scopes">Example extra Google scopes</string>
Expand All @@ -71,4 +71,6 @@
<!-- strings for database demo activities -->
<string name="start_chatting">No messages. Start chatting at the bottom!</string>
<string name="signed_in">Signed In</string>
<string name="enable_credential_selector">Enable Smart Lock\'s credential selector</string>
<string name="enable_hint_selector">Enable Smart Lock\'s hint selector</string>
</resources>
6 changes: 6 additions & 0 deletions auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ Gradle, add the dependency:
dependencies {
// ...
compile 'com.firebaseui:firebase-ui-auth:1.2.0'

// Required only if Facebook login support is required
compile('com.facebook.android:facebook-android-sdk:4.22.1')

// Required only if Twitter login support is required
compile("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }
}
```

Expand Down
2 changes: 2 additions & 0 deletions auth/auth-proguard.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-dontwarn com.twitter.**
-dontwarn com.facebook.**
8 changes: 4 additions & 4 deletions auth/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
apply from: '../library/quality/quality.gradle'

android {
Expand All @@ -18,7 +17,7 @@ android {
manifestPlaceholders = [enableFbLogging: true]

minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
consumerProguardFiles getDefaultProguardFile('proguard-android.txt'), 'auth-proguard.pro'
}

debug {
Expand All @@ -44,8 +43,8 @@ dependencies {
compile "com.google.firebase:firebase-auth:$firebaseVersion"
compile "com.google.android.gms:play-services-auth:$firebaseVersion"

compile 'com.facebook.android:facebook-android-sdk:4.23.0'
compile("com.twitter.sdk.android:twitter:2.3.2@aar") { transitive = true }
provided 'com.facebook.android:facebook-android-sdk:4.23.0'
provided("com.twitter.sdk.android:twitter-core:3.0.0@aar") { transitive = true }

// The following libraries are needed to prevent incompatibilities with the facebook
// library when updating com.android.support libraries:
Expand All @@ -57,6 +56,7 @@ dependencies {
testCompile 'org.robolectric:robolectric:3.2.2'
// See https://github.com/robolectric/robolectric/issues/1932#issuecomment-219796474
testCompile 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
testCompile 'com.facebook.android:facebook-android-sdk:4.23.0'
}

javadoc.exclude([
Expand Down
13 changes: 11 additions & 2 deletions auth/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.firebase.ui.auth">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Expand Down Expand Up @@ -39,6 +40,12 @@
android:label="@string/sign_in_default"
android:exported="false"/>

<activity
android:name=".ui.phone.PhoneVerificationActivity"
android:label="@string/sign_in_with_phone_number"
android:windowSoftInputMode="stateAlwaysVisible"
android:exported="false"/>

<activity
android:name=".ui.accountlink.WelcomeBackIdpPrompt"
android:label="@string/title_welcome_back_idp_prompt"
Expand All @@ -57,11 +64,13 @@
<activity
android:name="com.facebook.FacebookActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"/>
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
tools:ignore="MissingRegistered" />

<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
android:exported="true"
tools:ignore="MissingRegistered">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

Expand Down
Loading