Fix: All statuses failed to load when status JSON was checked for boolean values, but received null and would throw a JSONException.
A change in the Mastodon server implementation seemed to be the cause. In the future, either default booleans to false or check for null first before getting them.
This commit is contained in:
parent
e0ab25334b
commit
c937d30713
|
@ -86,8 +86,6 @@ public class MainActivity extends AppCompatActivity {
|
||||||
notificationServiceEnabled = preferences.getBoolean("pullNotifications", true);
|
notificationServiceEnabled = preferences.getBoolean("pullNotifications", true);
|
||||||
String minutesString = preferences.getString("pullNotificationCheckInterval", "15");
|
String minutesString = preferences.getString("pullNotificationCheckInterval", "15");
|
||||||
long notificationCheckInterval = 60 * 1000 * Integer.valueOf(minutesString);
|
long notificationCheckInterval = 60 * 1000 * Integer.valueOf(minutesString);
|
||||||
Log.d(TAG, String.format("pull notifications: %b %dm", notificationServiceEnabled,
|
|
||||||
Integer.valueOf(minutesString)));
|
|
||||||
// Start up the PullNotificationsService.
|
// Start up the PullNotificationsService.
|
||||||
alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
Intent intent = new Intent(this, PullNotificationService.class);
|
Intent intent = new Intent(this, PullNotificationService.class);
|
||||||
|
|
|
@ -194,8 +194,8 @@ public class Status {
|
||||||
String id = object.getString("id");
|
String id = object.getString("id");
|
||||||
String content = object.getString("content");
|
String content = object.getString("content");
|
||||||
Date createdAt = parseDate(object.getString("created_at"));
|
Date createdAt = parseDate(object.getString("created_at"));
|
||||||
boolean reblogged = object.getBoolean("reblogged");
|
boolean reblogged = object.optBoolean("reblogged");
|
||||||
boolean favourited = object.getBoolean("favourited");
|
boolean favourited = object.optBoolean("favourited");
|
||||||
String spoilerText = object.getString("spoiler_text");
|
String spoilerText = object.getString("spoiler_text");
|
||||||
boolean sensitive = object.optBoolean("sensitive");
|
boolean sensitive = object.optBoolean("sensitive");
|
||||||
String visibility = object.getString("visibility");
|
String visibility = object.getString("visibility");
|
||||||
|
|
|
@ -24,6 +24,7 @@ import android.support.v4.widget.SwipeRefreshLayout;
|
||||||
import android.support.v7.widget.DividerItemDecoration;
|
import android.support.v7.widget.DividerItemDecoration;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -42,6 +43,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public class TimelineFragment extends SFragment implements
|
public class TimelineFragment extends SFragment implements
|
||||||
SwipeRefreshLayout.OnRefreshListener, StatusActionListener, FooterActionListener {
|
SwipeRefreshLayout.OnRefreshListener, StatusActionListener, FooterActionListener {
|
||||||
|
private static final String TAG = "Timeline"; // logging tag
|
||||||
|
|
||||||
public enum Kind {
|
public enum Kind {
|
||||||
HOME,
|
HOME,
|
||||||
|
@ -176,12 +178,10 @@ public class TimelineFragment extends SFragment implements
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TAG: {
|
case TAG: {
|
||||||
assert(hashtagOrId != null);
|
|
||||||
endpoint = String.format(getString(R.string.endpoint_timelines_tag), hashtagOrId);
|
endpoint = String.format(getString(R.string.endpoint_timelines_tag), hashtagOrId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case USER: {
|
case USER: {
|
||||||
assert(hashtagOrId != null);
|
|
||||||
endpoint = String.format(getString(R.string.endpoint_statuses), hashtagOrId);
|
endpoint = String.format(getString(R.string.endpoint_statuses), hashtagOrId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,7 @@ public class TimelineFragment extends SFragment implements
|
||||||
public void onFetchTimelineFailure(Exception exception) {
|
public void onFetchTimelineFailure(Exception exception) {
|
||||||
showFetchTimelineRetry(true);
|
showFetchTimelineRetry(true);
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
|
Log.e(TAG, exception.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFetchTimelineRetry(boolean show) {
|
private void showFetchTimelineRetry(boolean show) {
|
||||||
|
|
Loading…
Reference in New Issue