Bug 1401749 - Remove fallback int->boolean conversion in FxAccountsDevice. r?Grisha
MozReview-Commit-ID: miGvypXH1C
--- a/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDevice.java
+++ b/mobile/android/services/src/main/java/org/mozilla/gecko/fxa/devices/FxAccountDevice.java
@@ -46,28 +46,17 @@ public class FxAccountDevice {
final String name = json.getString(JSON_KEY_NAME);
final String id = json.getString(JSON_KEY_ID);
final String type = json.getString(JSON_KEY_TYPE);
final Boolean isCurrentDevice = json.getBoolean(JSON_KEY_ISCURRENTDEVICE);
final Long lastAccessTime = json.getLong(JSON_KEY_LAST_ACCESS_TIME);
final String pushCallback = json.getString(JSON_KEY_PUSH_CALLBACK);
final String pushPublicKey = json.getString(JSON_KEY_PUSH_PUBLICKEY);
final String pushAuthKey = json.getString(JSON_KEY_PUSH_AUTHKEY);
- // The FxA server sends this boolean as a number (bug):
- // https://github.com/mozilla/fxa-auth-server/pull/2122
- // Use getBoolean directly once the fix is deployed (probably ~Oct-Nov 2017).
- final Object pushEndpointExpiredRaw = json.get(JSON_KEY_PUSH_ENDPOINT_EXPIRED);
- final Boolean pushEndpointExpired;
- if (pushEndpointExpiredRaw instanceof Number) {
- pushEndpointExpired = ((Number) pushEndpointExpiredRaw).intValue() == 1;
- } else if (pushEndpointExpiredRaw instanceof Boolean) {
- pushEndpointExpired = (Boolean) pushEndpointExpiredRaw;
- } else {
- pushEndpointExpired = false;
- }
+ final Boolean pushEndpointExpired = json.getBoolean(JSON_KEY_PUSH_ENDPOINT_EXPIRED);
return new FxAccountDevice(name, id, type, isCurrentDevice, lastAccessTime, pushCallback,
pushPublicKey, pushAuthKey, pushEndpointExpired);
}
public ExtendedJSONObject toJson() {
final ExtendedJSONObject body = new ExtendedJSONObject();
if (this.name != null) {
body.put(JSON_KEY_NAME, this.name);