Skip to content

Version 2.1.0 #805

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 16 commits into from
Jul 17, 2017
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
1 change: 0 additions & 1 deletion .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ libraries.
```groovy
dependencies {
// FirebaseUI Database only
compile 'com.firebaseui:firebase-ui-database:2.0.1'
compile 'com.firebaseui:firebase-ui-database:2.1.0'

// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:2.0.1'
compile 'com.firebaseui:firebase-ui-auth:2.1.0'

// FirebaseUI Storage only
compile 'com.firebaseui:firebase-ui-storage:2.0.1'
compile 'com.firebaseui:firebase-ui-storage:2.1.0'

// Single target that includes all FirebaseUI libraries above
compile 'com.firebaseui:firebase-ui:2.0.1'
compile 'com.firebaseui:firebase-ui:2.1.0'
}
```

Expand All @@ -63,7 +63,7 @@ After the project is synchronized, we're ready to start using Firebase functiona
If you are using an old version of FirebaseUI and upgrading, please see the appropriate
migration guide:

* [Upgrade from 1.2.0 to 2.0.x](./docs/upgrade-to-2.0.md)
* [Upgrade from 1.2.0 to 2.x.x](./docs/upgrade-to-2.0.md)

## Dependencies

Expand Down Expand Up @@ -91,6 +91,7 @@ For convenience, here are some recent examples:

| FirebaseUI Version | Firebase/Play Services Version |
|--------------------|--------------------------------|
| 2.1.0 | 11.0.2 |
| 2.0.1 | 11.0.1 |
| 1.2.0 | 10.2.0 |
| 1.1.1 | 10.0.0 or 10.0.1 |
Expand Down
4 changes: 4 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ android {
signingConfig signingConfigs.debug
}
}

lintOptions {
disable 'MissingTranslation'
}
}

dependencies {
Expand Down
28 changes: 15 additions & 13 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,50 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.firebase.uidemo">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

<application
android:name=".auth.LeakCatcher"
android:name=".auth.FirebaseUIDemo"
android:label="@string/app_name"
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:supportsRtl="false"
tools:ignore="GoogleAppIndexingWarning">

<activity android:name=".ChooserActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.shortcuts"
android:resource="@xml/shortcuts"/>
android:resource="@xml/shortcuts" />
</activity>

<!-- Chat demo -->
<activity
android:name=".database.ChatActivity"
android:label="@string/name_chat"/>
android:label="@string/name_chat" />
<activity
android:name=".database.ChatIndexActivity"
android:label="@string/name_chat"/>
android:label="@string/name_chat" />

<!-- Auth UI demo -->
<activity
android:name=".auth.AuthUiActivity"
android:label="@string/name_auth_ui"/>
android:label="@string/name_auth_ui" />
<activity
android:name=".auth.SignedInActivity"
android:label="@string/name_auth_ui"/>
android:label="@string/name_auth_ui" />

<!-- Storage UI demo-->
<activity
android:name=".storage.ImageActivity"
android:label="@string/name_image"/>
android:label="@string/name_image" />

</application>

</manifest>
34 changes: 16 additions & 18 deletions app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ public class AuthUiActivity extends AppCompatActivity {
@BindView(R.id.google_scope_youtube_data)
CheckBox mGoogleScopeYoutubeData;

public static Intent createIntent(Context context) {
Intent in = new Intent();
in.setClass(context, AuthUiActivity.class);
return in;
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -150,7 +156,7 @@ public void onCreate(Bundle savedInstanceState) {
return;
}

if (!isGoogleConfigured()) {
if (isGoogleMisconfigured()) {
mUseGoogleProvider.setChecked(false);
mUseGoogleProvider.setEnabled(false);
mUseGoogleProvider.setText(R.string.google_label_missing_config);
Expand All @@ -165,7 +171,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
});
}

if (!isFacebookConfigured()) {
if (isFacebookMisconfigured()) {
mUseFacebookProvider.setChecked(false);
mUseFacebookProvider.setEnabled(false);
mUseFacebookProvider.setText(R.string.facebook_label_missing_config);
Expand All @@ -180,13 +186,13 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
});
}

if (!isTwitterConfigured()) {
if (isTwitterMisconfigured()) {
mUseTwitterProvider.setChecked(false);
mUseTwitterProvider.setEnabled(false);
mUseTwitterProvider.setText(R.string.twitter_label_missing_config);
}

if (!isGoogleConfigured() || !isFacebookConfigured() || !isTwitterConfigured()) {
if (isGoogleMisconfigured() || isFacebookMisconfigured() || isTwitterMisconfigured()) {
showSnackbar(R.string.configuration_required);
}
}
Expand Down Expand Up @@ -359,25 +365,23 @@ private String getSelectedPrivacyPolicyUrl() {
}

@MainThread
private boolean isGoogleConfigured() {
return !UNCHANGED_CONFIG_VALUE.equals(
getString(R.string.default_web_client_id));
private boolean isGoogleMisconfigured() {
return UNCHANGED_CONFIG_VALUE.equals(getString(R.string.default_web_client_id));
}

@MainThread
private boolean isFacebookConfigured() {
return !UNCHANGED_CONFIG_VALUE.equals(
getString(R.string.facebook_application_id));
private boolean isFacebookMisconfigured() {
return UNCHANGED_CONFIG_VALUE.equals(getString(R.string.facebook_application_id));
}

@MainThread
private boolean isTwitterConfigured() {
private boolean isTwitterMisconfigured() {
List<String> twitterConfigs = Arrays.asList(
getString(R.string.twitter_consumer_key),
getString(R.string.twitter_consumer_secret)
);

return !twitterConfigs.contains(UNCHANGED_CONFIG_VALUE);
return twitterConfigs.contains(UNCHANGED_CONFIG_VALUE);
}

@MainThread
Expand Down Expand Up @@ -408,10 +412,4 @@ private List<String> getGooglePermissions() {
}
return result;
}

public static Intent createIntent(Context context) {
Intent in = new Intent();
in.setClass(context, AuthUiActivity.class);
return in;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@

import android.app.Application;
import android.content.Context;
import android.support.v7.app.AppCompatDelegate;

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

public class LeakCatcher extends Application {
public class FirebaseUIDemo extends Application {
private RefWatcher mRefWatcher;

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

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

@Override
Expand Down
23 changes: 11 additions & 12 deletions app/src/main/java/com/firebase/uidemo/auth/SignedInActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ public class SignedInActivity extends AppCompatActivity {

private SignedInConfig mSignedInConfig;

public static Intent createIntent(
Context context,
IdpResponse idpResponse,
SignedInConfig signedInConfig) {
Intent startIntent = idpResponse == null ? new Intent() : idpResponse.toIntent();

return startIntent.setClass(context, SignedInActivity.class)
.putExtra(EXTRA_SIGNED_IN_CONFIG, signedInConfig);
}

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -220,8 +230,7 @@ private void populateIdpToken() {

@MainThread
private void showSnackbar(@StringRes int errorMessageRes) {
Snackbar.make(mRootView, errorMessageRes, Snackbar.LENGTH_LONG)
.show();
Snackbar.make(mRootView, errorMessageRes, Snackbar.LENGTH_LONG).show();
}

static final class SignedInConfig implements Parcelable {
Expand Down Expand Up @@ -283,14 +292,4 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(isHintSelectorEnabled ? 1 : 0);
}
}

public static Intent createIntent(
Context context,
IdpResponse idpResponse,
SignedInConfig signedInConfig) {
Intent startIntent = idpResponse == null ? new Intent() : idpResponse.toIntent();

return startIntent.setClass(context, SignedInActivity.class)
.putExtra(EXTRA_SIGNED_IN_CONFIG, signedInConfig);
}
}
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<string name="desc_image">Demonstrates displaying an image from Cloud Storage using Glide.</string>

<!-- strings for Auth UI demo activities -->
<eat-comment/>
<eat-comment />
<string name="launch_title">FirebaseUI Auth Demo</string>
<string name="sign_in">Start</string>
<string name="green_theme">Green Theme</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
Expand Down
22 changes: 21 additions & 1 deletion auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Gradle, add the dependency:
```groovy
dependencies {
// ...
compile 'com.firebaseui:firebase-ui-auth:2.0.1'
compile 'com.firebaseui:firebase-ui-auth:2.1.0'

// Required only if Facebook login support is required
compile('com.facebook.android:facebook-android-sdk:4.22.1')
Expand All @@ -56,6 +56,26 @@ dependencies {
}
```

As of version `2.1.0` FirebaseUI includes translations for all string resources. In order to
ensure that you only get the translations relevant to your application, we recommend changing the
`resConfigs` of your application module:

```groovy
android {

// ...

defaultConfig {
// ...
resConfigs "auto"
}

}
```

See the [Android documentation](https://developer.android.com/studio/build/shrink-code.html#unused-alt-resources)
for more information.

### Identity provider configuration

In order to use either Google, Facebook or Twitter accounts with your app, ensure that
Expand Down
4 changes: 4 additions & 0 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ android {
}
}

lintOptions {
disable 'UnusedQuantity'
}

testOptions {
unitTests.all {
testLogging {
Expand Down
Loading