Skip to content

Commit d209690

Browse files
authored
Add FisError to the persisted installation entry. (#931)
1 parent ee514e8 commit d209690

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

firebase-installations/src/main/java/com/google/firebase/installations/local/PersistedInstallation.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public enum RegistrationStatus {
6363
private static final String TOKEN_CREATION_TIME_IN_SECONDS_KEY = "TokenCreationEpochInSecs";
6464
private static final String EXPIRES_IN_SECONDS_KEY = "ExpiresInSecs";
6565
private static final String PERSISTED_STATUS_KEY = "Status";
66+
private static final String FIS_ERROR_KEY = "FisError";
6667

6768
private static final List<String> FID_PREF_KEYS =
6869
Arrays.asList(
@@ -71,7 +72,8 @@ public enum RegistrationStatus {
7172
REFRESH_TOKEN_KEY,
7273
TOKEN_CREATION_TIME_IN_SECONDS_KEY,
7374
EXPIRES_IN_SECONDS_KEY,
74-
PERSISTED_STATUS_KEY);
75+
PERSISTED_STATUS_KEY,
76+
FIS_ERROR_KEY);
7577

7678
@GuardedBy("prefs")
7779
private final SharedPreferences prefs;
@@ -98,6 +100,7 @@ public PersistedInstallationEntry readPersistedInstallationEntryValue() {
98100
long tokenCreationTime =
99101
prefs.getLong(getSharedPreferencesKey(TOKEN_CREATION_TIME_IN_SECONDS_KEY), 0);
100102
long expiresIn = prefs.getLong(getSharedPreferencesKey(EXPIRES_IN_SECONDS_KEY), 0);
103+
String fisError = prefs.getString(getSharedPreferencesKey(FIS_ERROR_KEY), null);
101104

102105
if (fid == null || !(status >= 0 && status < RegistrationStatus.values().length)) {
103106
return PersistedInstallationEntry.builder().build();
@@ -109,6 +112,7 @@ public PersistedInstallationEntry readPersistedInstallationEntryValue() {
109112
.setRefreshToken(refreshToken)
110113
.setTokenCreationEpochInSecs(tokenCreationTime)
111114
.setExpiresInSecs(expiresIn)
115+
.setFisError(fisError)
112116
.build();
113117
}
114118
}
@@ -131,6 +135,7 @@ public boolean insertOrUpdatePersistedInstallationEntry(
131135
entryValue.getTokenCreationEpochInSecs());
132136
editor.putLong(
133137
getSharedPreferencesKey(EXPIRES_IN_SECONDS_KEY), entryValue.getExpiresInSecs());
138+
editor.putString(getSharedPreferencesKey(FIS_ERROR_KEY), entryValue.getFisError());
134139
return editor.commit();
135140
}
136141
}

0 commit comments

Comments
 (0)