Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9f257b6
Version 4.2.0
lsirac Jun 26, 2018
2631d09
Adds continue as guest (#1375)
lsirac Jun 29, 2018
0c13d77
Speed up full build (#1386)
SUPERCILEX Jul 4, 2018
a108176
Translations for continue as guest (#1390)
samtstern Jul 9, 2018
71fa34a
Save phone verification ID across process deaths (#1393)
SUPERCILEX Jul 18, 2018
c387047
Fix GitHub provider NPE when no perms are supplied (#1405)
SUPERCILEX Aug 6, 2018
4cd8b74
Update deps
SUPERCILEX Aug 27, 2018
79ee9c1
Fix most Javadoc warnings
SUPERCILEX Aug 27, 2018
6776cf7
Optimize build performance
SUPERCILEX Aug 27, 2018
74d09c6
Minor fixes
SUPERCILEX Aug 27, 2018
ae3e3ad
Update deps (#1419)
samtstern Aug 27, 2018
a8c0f47
Fix most Javadoc warnings (#1420)
samtstern Aug 27, 2018
a0c4f48
Merge branch 'version-4.2.0-dev' into perf
SUPERCILEX Aug 27, 2018
a83aa37
Fix more incorrect API usages
SUPERCILEX Aug 27, 2018
2274696
Optimize build performance (#1422)
samtstern Aug 27, 2018
3ea184a
Add nullability annotations to all modules except for auth
SUPERCILEX Aug 28, 2018
0da111b
Rank providers by usability when picking top provider (#1362)
SUPERCILEX Aug 28, 2018
68be249
Split GitHub provider out into its own module (#1421)
SUPERCILEX Aug 29, 2018
98353a7
Add nullability annotations to all modules except for auth (#1326)
samtstern Aug 29, 2018
84bcc00
Fix Github tests
samtstern Aug 29, 2018
35d8a2f
Fix in tests, not public
samtstern Aug 29, 2018
152f694
Fix Github tests (#1426)
samtstern Aug 29, 2018
8949483
Publicly usable lint checks (#1427)
samtstern Sep 4, 2018
bd98b15
Anonymous linking smart lock fix
samtstern Sep 6, 2018
933a04f
Delete commented line
samtstern Sep 6, 2018
38883b7
Anonymous Upgrade + SmartLock fix (#1437)
samtstern Sep 6, 2018
43912a7
Merge branch 'master' into version-4.2.0-dev
samtstern Sep 12, 2018
982f204
Avoid error when canceling google signin (#1443)
diedu89 Sep 12, 2018
8cb1ed7
Style fixes
samtstern Sep 12, 2018
780e744
Version 4.2.0
samtstern Sep 12, 2018
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
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,19 @@ libraries.
```groovy
dependencies {
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.firebaseui:firebase-ui-database:4.2.0'

// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:4.1.0'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.0'

// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'

// FirebaseUI for Firebase Auth (GitHub provider)
implementation 'com.firebaseui:firebase-ui-auth-github:4.2.0'

// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
implementation 'com.firebaseui:firebase-ui-storage:4.2.0'
}
```

Expand Down Expand Up @@ -102,15 +105,15 @@ versions. This means that FirebaseUI has independent dependencies on each of the
For best results, your app should depend on a version of each dependency with the same major
version number as the version used by FirebaseUI.

As of version `4.1.0`, FirebaseUI has the following dependency versions:
As of version `4.2.0`, FirebaseUI has the following dependency versions:

| Library | Version |
|----------------------|--------------------------------|
| `firebase-auth` | 16.0.1 |
| `play-services-auth` | 15.0.1 |
| `firebase-database` | 16.0.1 |
| `firebase-firestore` | 17.0.1 |
| `firebase-storage` | 16.0.1 |
| `firebase-auth` | 16.0.3 |
| `play-services-auth` | 16.0.0 |
| `firebase-database` | 16.0.2 |
| `firebase-firestore` | 17.1.0 |
| `firebase-storage` | 16.0.2 |

### Upgrading dependencies

Expand Down
4 changes: 3 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
}

buildTypes {
getByName("release") {
named("release").configure {
// For the purposes of the sample, allow testing of a proguarded release build
// using the debug key
signingConfig = signingConfigs["debug"]
Expand All @@ -32,6 +32,7 @@ dependencies {
implementation(Config.Libs.Support.multidex)

implementation(project(":auth"))
implementation(project(":auth-github"))
implementation(project(":firestore"))
implementation(project(":database"))
implementation(project(":storage"))
Expand All @@ -55,6 +56,7 @@ dependencies {
implementation(Config.Libs.Misc.butterKnife)
annotationProcessor(Config.Libs.Misc.butterKnifeCompiler)
debugImplementation(Config.Libs.Misc.leakCanary)
debugImplementation(Config.Libs.Misc.leakCanaryFragments)
releaseImplementation(Config.Libs.Misc.leakCanaryNoop)
testImplementation(Config.Libs.Misc.leakCanaryNoop)
}
Expand Down
10 changes: 1 addition & 9 deletions app/src/main/java/com/firebase/uidemo/FirebaseUIDemo.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
package com.firebase.uidemo;

import android.content.Context;
import android.support.multidex.MultiDexApplication;
import android.support.v7.app.AppCompatDelegate;

import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;

public class FirebaseUIDemo extends MultiDexApplication {
private RefWatcher mRefWatcher;

static {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
}

public static RefWatcher getRefWatcher(Context context) {
return ((FirebaseUIDemo) context.getApplicationContext()).mRefWatcher;
}

@Override
public void onCreate() {
super.onCreate();
Expand All @@ -26,6 +18,6 @@ public void onCreate() {
// You should not init your app in this process.
return;
}
mRefWatcher = LeakCanary.install(this);
LeakCanary.install(this);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Log;
Expand Down Expand Up @@ -52,7 +53,7 @@ public class AnonymousUpgradeActivity extends AppCompatActivity {
private AuthCredential mPendingCredential;

@Override
protected void onCreate(Bundle savedInstanceState) {
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_anonymous_upgrade);
ButterKnife.bind(this);
Expand Down Expand Up @@ -82,7 +83,6 @@ public void startAuthUI() {
Intent intent = AuthUI.getInstance().createSignInIntentBuilder()
.setLogo(R.drawable.firebase_auth_120dp)
.setAvailableProviders(providers)
.setIsSmartLockEnabled(false)
.enableAnonymousUsersAutoUpgrade()
.build();
startActivityForResult(intent, RC_SIGN_IN);
Expand Down Expand Up @@ -127,7 +127,7 @@ public void onComplete(@NonNull Task<Void> task) {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
IdpResponse response = IdpResponse.fromResultIntent(data);
Expand All @@ -137,12 +137,13 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
if (resultCode == RESULT_OK) {
setStatus("Signed in as " + getUserIdentifier(FirebaseAuth.getInstance().getCurrentUser()));
} else if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) {
setStatus("Merge conflict: user already exists.");
mResolveMergeButton.setEnabled(true);
mPendingCredential = response.getCredentialForLinking();
} else {
if (response.getError().getErrorCode() == ErrorCodes.ANONYMOUS_UPGRADE_MERGE_CONFLICT) {
setStatus("Merge conflict: user already exists.");
mResolveMergeButton.setEnabled(true);
mPendingCredential = response.getCredentialForLinking();
}
Toast.makeText(this, "Auth error, see logs", Toast.LENGTH_SHORT).show();
Log.w(TAG, "Error: " + response.getError().getMessage(), response.getError());
}

updateUI();
Expand Down
20 changes: 13 additions & 7 deletions app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.github_provider) CheckBox mUseGitHubProvider;
@BindView(R.id.email_provider) CheckBox mUseEmailProvider;
@BindView(R.id.phone_provider) CheckBox mUsePhoneProvider;
@BindView(R.id.anonymous_provider) CheckBox mUseAnonymousProvider;

@BindView(R.id.default_theme) RadioButton mDefaultTheme;
@BindView(R.id.green_theme) RadioButton mGreenTheme;
Expand Down Expand Up @@ -103,7 +104,8 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.allow_new_email_accounts) CheckBox mAllowNewEmailAccounts;
@BindView(R.id.require_name) CheckBox mRequireName;

public static Intent createIntent(Context context) {
@NonNull
public static Intent createIntent(@NonNull Context context) {
return new Intent(context, AuthUiActivity.class);
}

Expand Down Expand Up @@ -177,7 +179,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
}

@OnClick(R.id.sign_in)
public void signIn(View view) {
public void signIn() {
startActivityForResult(
AuthUI.getInstance().createSignInIntentBuilder()
.setTheme(getSelectedTheme())
Expand All @@ -192,7 +194,7 @@ public void signIn(View view) {
}

@OnClick(R.id.sign_in_silent)
public void silentSignIn(View view) {
public void silentSignIn() {
AuthUI.getInstance().silentSignIn(this, getSelectedProviders())
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
Expand All @@ -207,7 +209,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == RC_SIGN_IN) {
handleSignInResponse(resultCode, data);
Expand All @@ -224,8 +226,8 @@ protected void onResume() {
}
}

private void handleSignInResponse(int resultCode, Intent data) {
final IdpResponse response = IdpResponse.fromResultIntent(data);
private void handleSignInResponse(int resultCode, @Nullable Intent data) {
IdpResponse response = IdpResponse.fromResultIntent(data);

// Successfully signed in
if (resultCode == RESULT_OK) {
Expand All @@ -249,7 +251,7 @@ private void handleSignInResponse(int resultCode, Intent data) {
}
}

private void startSignedInActivity(IdpResponse response) {
private void startSignedInActivity(@Nullable IdpResponse response) {
startActivity(SignedInActivity.createIntent(this, response));
}

Expand Down Expand Up @@ -319,6 +321,10 @@ private List<IdpConfig> getSelectedProviders() {
selectedProviders.add(new IdpConfig.PhoneBuilder().build());
}

if (mUseAnonymousProvider.isChecked()) {
selectedProviders.add(new IdpConfig.AnonymousBuilder().build());
}

return selectedProviders;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ public class SignedInActivity extends AppCompatActivity {
@BindView(R.id.user_enabled_providers) TextView mEnabledProviders;
@BindView(R.id.user_is_new) TextView mIsNewUser;

public static Intent createIntent(Context context, IdpResponse idpResponse) {
@NonNull
public static Intent createIntent(@NonNull Context context, @Nullable IdpResponse response) {
return new Intent().setClass(context, SignedInActivity.class)
.putExtra(ExtraConstants.IDP_RESPONSE, idpResponse);
.putExtra(ExtraConstants.IDP_RESPONSE, response);
}

@Override
Expand Down Expand Up @@ -164,7 +165,7 @@ private void populateProfile(@Nullable IdpResponse response) {

List<String> providers = new ArrayList<>();
if (user.getProviderData().isEmpty()) {
providers.add("Anonymous");
providers.add(getString(R.string.providers_anonymous));
} else {
for (UserInfo info : user.getProviderData()) {
switch (info.getProviderId()) {
Expand Down
16 changes: 14 additions & 2 deletions app/src/main/java/com/firebase/uidemo/database/AbstractChat.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
package com.firebase.uidemo.database;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

/**
* Common interface for chat messages, helps share code between RTDB and Firestore examples.
*/
public abstract class AbstractChat {

@Nullable
public abstract String getName();

public abstract void setName(@Nullable String name);

@Nullable
public abstract String getMessage();

public abstract void setMessage(@Nullable String message);

@NonNull
public abstract String getUid();

public abstract void setUid(@NonNull String uid);

@Override
public abstract int hashCode();
public abstract boolean equals(@Nullable Object obj);

@Override
public abstract boolean equals(Object obj);
public abstract int hashCode();

}
12 changes: 7 additions & 5 deletions app/src/main/java/com/firebase/uidemo/database/ChatHolder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import android.graphics.PorterDuff;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.RotateDrawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.support.v7.widget.RecyclerView;
import android.view.Gravity;
Expand All @@ -26,7 +28,7 @@ public class ChatHolder extends RecyclerView.ViewHolder {
private final int mGreen300;
private final int mGray300;

public ChatHolder(View itemView) {
public ChatHolder(@NonNull View itemView) {
super(itemView);
mNameField = itemView.findViewById(R.id.name_text);
mTextField = itemView.findViewById(R.id.message_text);
Expand All @@ -38,19 +40,19 @@ public ChatHolder(View itemView) {
mGray300 = ContextCompat.getColor(itemView.getContext(), R.color.material_gray_300);
}

public void bind(AbstractChat chat) {
public void bind(@NonNull AbstractChat chat) {
setName(chat.getName());
setText(chat.getMessage());
setMessage(chat.getMessage());

FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
setIsSender(currentUser != null && chat.getUid().equals(currentUser.getUid()));
}

private void setName(String name) {
private void setName(@Nullable String name) {
mNameField.setText(name);
}

private void setText(String text) {
private void setMessage(@Nullable String text) {
mTextField.setText(text);
}

Expand Down
Loading