-
Notifications
You must be signed in to change notification settings - Fork 275
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
Add initial classes for Remote Config API #477
Conversation
498018e
to
74c21d3
Compare
74c21d3
to
07ec304
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks mostly good. I've added a series of questions and comments on things that we can clean up.
src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java
Show resolved
Hide resolved
src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImpl.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java
Outdated
Show resolved
Hide resolved
src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java
Show resolved
Hide resolved
src/test/java/com/google/firebase/remoteconfig/FirebaseRemoteConfigClientImplTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's getting there. Just needs a bit of cleanup around error handling.
"ETag header is not available in the server response.", null, null, | ||
RemoteConfigErrorCode.INTERNAL); | ||
} | ||
checkArgument(!(etagList == null || etagList.isEmpty()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps checkState
is more appropriate here.
"ETag header is not available in the server response.", null, null, | ||
RemoteConfigErrorCode.INTERNAL); | ||
} | ||
checkArgument(!(etagList == null || etagList.isEmpty()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also checkState(etagList != null && !etagList.isEmpty())
"ETag header is not available in the server response.", null, null, | ||
RemoteConfigErrorCode.INTERNAL); | ||
} | ||
checkArgument(!Strings.isNullOrEmpty(etag), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too. I'd even recommend adding a getETag(IncomingResponse resp)
helper method, and doing all the validation there.
src/main/java/com/google/firebase/remoteconfig/internal/RemoteConfigServiceErrorResponse.java
Outdated
Show resolved
Hide resolved
src/main/java/com/google/firebase/remoteconfig/internal/RemoteConfigServiceErrorResponse.java
Outdated
Show resolved
Hide resolved
64efe89
to
426fe78
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. LGTM 👍
int separator = message.indexOf(':'); | ||
if (separator != -1) { | ||
String errorCode = message.substring(0, separator).replaceAll("\\[|\\]", ""); | ||
Matcher errorMatcher = Pattern.compile("^\\[(\\w+)\\]:.*$").matcher(message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pattern.compile()
could be expensive. Pre-compute it and store as a static constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Thanks!
643fc74
to
52319e9
Compare
FirebaseRemoteConfigClient
interface and implementationFirebaseRemoteConfigClientImpl
Note: merging to
remote-config
branch.Related issue: #446