Skip to content

Commit e4e8571

Browse files
committed
Revert "Addressing Fred's comments"
This reverts commit bc6ec5c
1 parent 291635a commit e4e8571

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// Copyright 2019 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package com.google.firebase.installations;
16+
17+
import com.google.android.gms.tasks.TaskCompletionSource;
18+
import com.google.firebase.installations.local.PersistedInstallationEntry;
19+
20+
class GetIdListener implements StateListener {
21+
final TaskCompletionSource<String> taskCompletionSource;
22+
23+
public GetIdListener(TaskCompletionSource<String> taskCompletionSource) {
24+
this.taskCompletionSource = taskCompletionSource;
25+
}
26+
27+
@Override
28+
public boolean onStateReached(PersistedInstallationEntry persistedInstallationEntry) {
29+
if (persistedInstallationEntry.isUnregistered()
30+
|| persistedInstallationEntry.isRegistered()
31+
|| persistedInstallationEntry.isErrored()) {
32+
taskCompletionSource.trySetResult(persistedInstallationEntry.getFirebaseInstallationId());
33+
return true;
34+
}
35+
return false;
36+
}
37+
38+
@Override
39+
public boolean onException(
40+
PersistedInstallationEntry persistedInstallationEntry, Exception exception) {
41+
return false;
42+
}
43+
}

0 commit comments

Comments
 (0)