Skip to content

Commit 46602c5

Browse files
committed
Merge branch 'version-2.0.0-dev' into phone-auth
Change-Id: I6d2bedb15d96f39e3d3e71682e33388fa41f3439
2 parents cad63e9 + cea4ec1 commit 46602c5

File tree

18 files changed

+277
-103
lines changed

18 files changed

+277
-103
lines changed

README.md

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ A compatible FirebaseUI client is also available for [iOS](https://github.com/fi
1010

1111
## Table of Contents
1212

13-
1. [Installation](#installation)
1413
1. [Usage](#usage)
14+
1. [Installation](#installation)
15+
1. [Dependencies](#dependencies)
1516
1. [Sample App](#sample-app)
1617
1. [Contributing](#contributing)
1718

19+
## Usage
20+
21+
FirebaseUI has separate modules for using Firebase Database, Auth, and Storage. To
22+
get started, see the individual instructions for each module:
23+
24+
* [firebase-ui-database](database/README.md)
25+
* [firebase-ui-auth](auth/README.md)
26+
* [firebase-ui-storage](storage/README.md)
27+
1828
## Installation
1929

2030
FirebaseUI is published as a collection of libraries separated by the
@@ -47,6 +57,8 @@ required.
4757

4858
After the project is synchronized, we're ready to start using Firebase functionality in our app.
4959

60+
## Dependencies
61+
5062
### Compatibility with Firebase / Google Play Services Libraries
5163

5264
FirebaseUI libraries have the following transitive dependencies on the Firebase SDK:
@@ -67,29 +79,52 @@ in `common/constants.gradle`. If you are using any dependencies in your app of
6779
`compile 'com.google.firebase:firebase-*:x.y.z'` or `compile 'com.google.android.gms:play-services-*:x.y.z'`
6880
you need to make sure that you use the same version that your chosen version of FirebaseUI requires.
6981

70-
For convenience, here are some examples:
82+
For convenience, here are some recent examples:
7183

7284
| FirebaseUI Version | Firebase/Play Services Version |
7385
|--------------------|--------------------------------|
7486
| 1.2.0 | 10.2.0 |
7587
| 1.1.1 | 10.0.0 or 10.0.1 |
7688
| 1.0.1 | 10.0.0 or 10.0.1 |
7789
| 1.0.0 | 9.8.0 |
78-
| 0.6.2 | 9.8.0 |
79-
| 0.6.1 | 9.6.1 |
80-
| 0.6.0 | 9.6.0 |
81-
| 0.5.3 | 9.4.0 |
82-
| 0.4.4 | 9.4.0 |
83-
| 0.4.3 | 9.2.1 |
84-
| 0.4.2 | 9.2.0 |
85-
| 0.4.1 | 9.0.2 |
86-
| 0.4.0 | 9.0.0 |
8790

88-
## Usage
8991

90-
* [firebase-ui-database](database/README.md)
91-
* [firebase-ui-auth](auth/README.md)
92-
* [firebase-ui-storage](storage/README.md)
92+
## Upgrading dependencies
93+
94+
If you would like to use a newer version of one of FirebaseUI's transitive dependencies, such
95+
as Firebase, Play services, or the Android support libraries you need add explicit
96+
`compile` declarations in your `build.gradle` for all of FirebaseUI's dependencies at the version
97+
you want to use. For example if you want to use Play services/Firebase version `FOO` and support
98+
libraries version `BAR` add the following extra lines for each FirebaseUI module you're using:
99+
100+
Auth:
101+
102+
```groovy
103+
compile "com.google.firebase:firebase-auth:$FOO"
104+
compile "com.google.android.gms:play-services-auth:$FOO"
105+
106+
compile "com.android.support:design:$BAR"
107+
compile "com.android.support:customtabs:$BAR"
108+
compile "com.android.support:cardview-v7:$BAR"
109+
```
110+
111+
Database:
112+
113+
```groovy
114+
compile "com.google.firebase:firebase-database:$FOO"
115+
116+
compile "com.android.support:recyclerview-v7:$BAR"
117+
compile "com.android.support:support-v4:$BAR"
118+
```
119+
120+
Storage:
121+
122+
```groovy
123+
compile "com.google.firebase:firebase-storage:$FOO"
124+
125+
compile "com.android.support:appcompat-v7:$BAR"
126+
compile "com.android.support:palette-v7:$BAR"
127+
```
93128

94129
## Sample App
95130

app/src/main/java/com/firebase/uidemo/auth/AuthUiActivity.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public class AuthUiActivity extends AppCompatActivity {
5252
private static final String UNCHANGED_CONFIG_VALUE = "CHANGE-ME";
5353
private static final String GOOGLE_TOS_URL = "https://www.google.com/policies/terms/";
5454
private static final String FIREBASE_TOS_URL = "https://firebase.google.com/terms/";
55+
private static final String GOOGLE_PRIVACY_POLICY_URL = "https://www.google.com/policies/privacy/";
56+
private static final String FIREBASE_PRIVACY_POLICY_URL = "https://firebase.google.com/terms/analytics/#7_privacy";
5557
private static final int RC_SIGN_IN = 100;
5658

5759
@BindView(R.id.default_theme)
@@ -87,6 +89,12 @@ public class AuthUiActivity extends AppCompatActivity {
8789
@BindView(R.id.firebase_tos)
8890
RadioButton mUseFirebaseTos;
8991

92+
@BindView(R.id.google_privacy)
93+
RadioButton mUseGooglePrivacyPolicy;
94+
95+
@BindView(R.id.firebase_privacy)
96+
RadioButton mUseFirebasePrivacyPolicy;
97+
9098
@BindView(R.id.sign_in)
9199
Button mSignIn;
92100

@@ -126,8 +134,8 @@ public class AuthUiActivity extends AppCompatActivity {
126134
@BindView(R.id.google_scope_drive_file)
127135
CheckBox mGoogleScopeDriveFile;
128136

129-
@BindView(R.id.google_scope_games)
130-
CheckBox mGoogleScopeGames;
137+
@BindView(R.id.google_scope_youtube_data)
138+
CheckBox mGoogleScopeYoutubeData;
131139

132140
@Override
133141
public void onCreate(Bundle savedInstanceState) {
@@ -191,6 +199,7 @@ public void signIn(View view) {
191199
.setLogo(getSelectedLogo())
192200
.setAvailableProviders(getSelectedProviders())
193201
.setTosUrl(getSelectedTosUrl())
202+
.setPrivacyPolicyUrl(getSelectedPrivacyPolicyUrl())
194203
.setIsSmartLockEnabled(mEnableCredentialSelector.isChecked(),
195204
mEnableHintSelector.isChecked())
196205
.setAllowNewEmailAccounts(mAllowNewEmailAccounts.isChecked())
@@ -258,7 +267,7 @@ private void startSignedInActivity(IdpResponse response) {
258267
private void setGoogleScopesEnabled(boolean enabled) {
259268
mGoogleScopesLabel.setEnabled(enabled);
260269
mGoogleScopeDriveFile.setEnabled(enabled);
261-
mGoogleScopeGames.setEnabled(enabled);
270+
mGoogleScopeYoutubeData.setEnabled(enabled);
262271
}
263272

264273
@MainThread
@@ -340,6 +349,15 @@ private String getSelectedTosUrl() {
340349
return FIREBASE_TOS_URL;
341350
}
342351

352+
@MainThread
353+
private String getSelectedPrivacyPolicyUrl() {
354+
if (mUseGooglePrivacyPolicy.isChecked()) {
355+
return GOOGLE_PRIVACY_POLICY_URL;
356+
}
357+
358+
return FIREBASE_PRIVACY_POLICY_URL;
359+
}
360+
343361
@MainThread
344362
private boolean isGoogleConfigured() {
345363
return !UNCHANGED_CONFIG_VALUE.equals(
@@ -382,8 +400,8 @@ private List<String> getFacebookPermissions() {
382400
@MainThread
383401
private List<String> getGooglePermissions() {
384402
List<String> result = new ArrayList<>();
385-
if (mGoogleScopeGames.isChecked()) {
386-
result.add(Scopes.GAMES);
403+
if (mGoogleScopeYoutubeData.isChecked()) {
404+
result.add("https://www.googleapis.com/auth/youtube.readonly");
387405
}
388406
if (mGoogleScopeDriveFile.isChecked()) {
389407
result.add(Scopes.DRIVE_FILE);

app/src/main/res/layout/auth_ui_layout.xml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,34 @@
147147

148148
</RadioGroup>
149149

150+
<TextView
151+
style="@style/Base.TextAppearance.AppCompat.Subhead"
152+
android:layout_width="wrap_content"
153+
android:layout_height="wrap_content"
154+
android:layout_marginBottom="8dp"
155+
android:layout_marginTop="16dp"
156+
android:text="@string/privacy_policy_header"/>
157+
158+
<RadioGroup
159+
android:layout_width="wrap_content"
160+
android:layout_height="wrap_content"
161+
android:orientation="vertical">
162+
163+
<RadioButton
164+
android:id="@+id/google_privacy"
165+
android:layout_width="wrap_content"
166+
android:layout_height="wrap_content"
167+
android:checked="true"
168+
android:text="@string/google_privacy_label"/>
169+
170+
<RadioButton
171+
android:id="@+id/firebase_privacy"
172+
android:layout_width="wrap_content"
173+
android:layout_height="wrap_content"
174+
android:text="@string/firebase_privacy_label"/>
175+
176+
</RadioGroup>
177+
150178
<TextView
151179
style="@style/Base.TextAppearance.AppCompat.Subhead"
152180
android:layout_width="wrap_content"
@@ -214,18 +242,18 @@
214242
android:text="@string/extra_google_scopes"/>
215243

216244
<CheckBox
217-
android:id="@+id/google_scope_games"
245+
android:id="@+id/google_scope_drive_file"
218246
android:layout_width="wrap_content"
219247
android:layout_height="wrap_content"
220248
android:checked="false"
221-
android:text="@string/games"/>
249+
android:text="@string/drive_file_scope"/>
222250

223251
<CheckBox
224-
android:id="@+id/google_scope_drive_file"
252+
android:id="@+id/google_scope_youtube_data"
225253
android:layout_width="wrap_content"
226254
android:layout_height="wrap_content"
227255
android:checked="false"
228-
android:text="@string/drive_file"/>
256+
android:text="@string/youtube_data_scope"/>
229257

230258
<TextView
231259
style="@style/Base.TextAppearance.AppCompat.Subhead"

app/src/main/res/values/strings.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
<string name="google_label_missing_config">Google - configuration missing</string>
3333
<string name="google_tos_label">Google TOS</string>
3434
<string name="firebase_tos_label">Firebase TOS</string>
35+
<string name="google_privacy_label">Google Privacy Policy</string>
36+
<string name="firebase_privacy_label">Firebase Privacy Policy</string>
3537
<string name="tos_header">Terms of Service URL:</string>
38+
<string name="privacy_policy_header">Privacy Policy URL:</string>
3639
<string name="unknown_response">Unexpected onActivityResult response code</string>
3740
<string name="unknown_sign_in_response">Unknown response from AuthUI sign-in</string>
3841
<string name="sign_in_cancelled">Sign in cancelled</string>
@@ -50,7 +53,8 @@
5053
<string name="rational_image_perm">This sample will read an image from local storage to upload to Cloud Storage.</string>
5154
<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>
5255
<string name="extra_google_scopes">Example extra Google scopes</string>
53-
<string name="games">Games</string>
56+
<string name="drive_file_scope">Drive File</string>
57+
<string name="youtube_data_scope">Youtube data</string>
5458
<string name="extra_facebook_scopes">Example extra Facebook scopes</string>
5559
<string name="friends">Friends</string>
5660
<string name="photos">Photos</string>
@@ -62,7 +66,6 @@
6266
<string name="upload">Upload</string>
6367
<string name="choose_image">Choose Image</string>
6468
<string name="accessibility_downloaded_image">Downloaded image</string>
65-
<string name="drive_file">Drive File</string>
6669
<string name="allow_new_email_acccount">Allow account creation if email does not exist.</string>
6770
<string name="reauthenticate">Reauth</string>
6871
<string name="reauthentication_reason">Reauth was requested from the test app. Please login to continue.</string>

auth/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ dependencies {
4444
compile "com.google.firebase:firebase-auth:$firebaseVersion"
4545
compile "com.google.android.gms:play-services-auth:$firebaseVersion"
4646

47-
compile 'com.facebook.android:facebook-android-sdk:4.22.1'
47+
compile 'com.facebook.android:facebook-android-sdk:4.23.0'
4848
compile("com.twitter.sdk.android:twitter:2.3.2@aar") { transitive = true }
4949

5050
// The following libraries are needed to prevent incompatibilities with the facebook

auth/src/main/java/com/firebase/ui/auth/AuthUI.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ private abstract class AuthIntentBuilder<T extends AuthIntentBuilder> {
456456
int mTheme = getDefaultTheme();
457457
List<IdpConfig> mProviders = new ArrayList<>();
458458
String mTosUrl;
459+
String mPrivacyPolicyUrl;
459460
boolean mEnableCredentials = true;
460461
boolean mEnableHints = true;
461462

@@ -491,6 +492,14 @@ public T setTosUrl(@Nullable String tosUrl) {
491492
return (T) this;
492493
}
493494

495+
/**
496+
* Specifies the privacy policy URL for the application.
497+
*/
498+
public T setPrivacyPolicyUrl(@Nullable String privacyPolicyUrl) {
499+
mPrivacyPolicyUrl = privacyPolicyUrl;
500+
return (T) this;
501+
}
502+
494503
/**
495504
* Specified the set of supported authentication providers. At least one provider must
496505
* be specified. There may only be one instance of each provider.
@@ -659,6 +668,7 @@ protected FlowParameters getFlowParams() {
659668
mTheme,
660669
mLogo,
661670
mTosUrl,
671+
mPrivacyPolicyUrl,
662672
mEnableCredentials,
663673
mEnableHints,
664674
false,
@@ -695,6 +705,7 @@ protected FlowParameters getFlowParams() {
695705
mTheme,
696706
mLogo,
697707
mTosUrl,
708+
mPrivacyPolicyUrl,
698709
mEnableCredentials,
699710
mEnableHints,
700711
mAllowNewEmailAccounts,

auth/src/main/java/com/firebase/ui/auth/ui/FlowParameters.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ public class FlowParameters implements Parcelable {
4848
@Nullable
4949
public final String termsOfServiceUrl;
5050

51+
@Nullable
52+
public final String privacyPolicyUrl;
53+
5154
public final boolean allowNewEmailAccounts;
5255

5356
@Nullable
@@ -63,6 +66,7 @@ public FlowParameters(
6366
@StyleRes int themeId,
6467
@DrawableRes int logoId,
6568
@Nullable String termsOfServiceUrl,
69+
@Nullable String privacyPolicyUrl,
6670
boolean enableCredentials,
6771
boolean enableHints,
6872
boolean allowNewEmailAccounts,
@@ -74,6 +78,7 @@ public FlowParameters(
7478
this.themeId = themeId;
7579
this.logoId = logoId;
7680
this.termsOfServiceUrl = termsOfServiceUrl;
81+
this.privacyPolicyUrl = privacyPolicyUrl;
7782
this.enableCredentials = enableCredentials;
7883
this.enableHints = enableHints;
7984
this.allowNewEmailAccounts = allowNewEmailAccounts;
@@ -88,6 +93,7 @@ public void writeToParcel(Parcel dest, int flags) {
8893
dest.writeInt(themeId);
8994
dest.writeInt(logoId);
9095
dest.writeString(termsOfServiceUrl);
96+
dest.writeString(privacyPolicyUrl);
9197
dest.writeInt(enableCredentials ? 1 : 0);
9298
dest.writeInt(enableHints ? 1 : 0);
9399
dest.writeInt(allowNewEmailAccounts ? 1 : 0);
@@ -108,6 +114,7 @@ public FlowParameters createFromParcel(Parcel in) {
108114
int themeId = in.readInt();
109115
int logoId = in.readInt();
110116
String termsOfServiceUrl = in.readString();
117+
String privacyPolicyUrl = in.readString();
111118
boolean enableCredentials = in.readInt() != 0;
112119
boolean enableHints = in.readInt() != 0;
113120
boolean allowNewEmailAccounts = in.readInt() != 0;
@@ -120,6 +127,7 @@ public FlowParameters createFromParcel(Parcel in) {
120127
themeId,
121128
logoId,
122129
termsOfServiceUrl,
130+
privacyPolicyUrl,
123131
enableCredentials,
124132
enableHints,
125133
allowNewEmailAccounts,

0 commit comments

Comments
 (0)