Skip to content

Commit 8461adf

Browse files
committed
fix issue #165: leaked GoogleApiClient (#177)
* fix issue #165: leaked GoogleApiClient * Review feedback
1 parent 69fd014 commit 8461adf

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

auth/src/main/java/com/firebase/ui/auth/provider/GoogleProvider.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ public void setAuthenticationCallback(IDPCallback callback) {
8787
mIDPCallback = callback;
8888
}
8989

90+
public void disconnect() {
91+
if (mGoogleApiClient != null) {
92+
mGoogleApiClient.disconnect();
93+
mGoogleApiClient = null;
94+
}
95+
}
96+
9097
private IDPResponse createIDPResponse(GoogleSignInAccount account) {
9198
Bundle response = new Bundle();
9299
response.putString(TOKEN_KEY, account.getIdToken());

auth/src/main/java/com/firebase/ui/auth/ui/idp/AuthMethodPickerActivity.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,18 @@ public void onClick(View view) {
180180
}
181181
}
182182

183+
@Override
184+
protected void onDestroy() {
185+
super.onDestroy();
186+
if (mIdpProviders != null) {
187+
for (final IDPProvider provider : mIdpProviders) {
188+
if (provider instanceof GoogleProvider) {
189+
((GoogleProvider) provider).disconnect();
190+
}
191+
}
192+
}
193+
}
194+
183195
public static Intent createIntent(
184196
Context context,
185197
FlowParameters flowParams) {

0 commit comments

Comments
 (0)