1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-22 22:57:29 +00:00

cover lunar new year reel exception

This commit is contained in:
Austin Huang 2021-02-11 14:47:43 -05:00 committed by GitHub
parent 28b74a6975
commit 06a6b07a53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -113,52 +113,55 @@ public class StoriesService extends BaseService {
for (int i = 0; i < feedStoriesReel.length(); ++i) { for (int i = 0; i < feedStoriesReel.length(); ++i) {
final JSONObject node = feedStoriesReel.getJSONObject(i); final JSONObject node = feedStoriesReel.getJSONObject(i);
final JSONObject userJson = node.getJSONObject(node.has("user") ? "user" : "owner"); final JSONObject userJson = node.getJSONObject(node.has("user") ? "user" : "owner");
final User user = new User(userJson.getLong("pk"), try {
userJson.getString("username"), final User user = new User(userJson.getLong("pk"),
userJson.optString("full_name"), userJson.getString("username"),
userJson.optBoolean("is_private"), userJson.optString("full_name"),
userJson.getString("profile_pic_url"), userJson.optBoolean("is_private"),
null, userJson.getString("profile_pic_url"),
new FriendshipStatus( null,
false, new FriendshipStatus(
false, false,
false, false,
false, false,
false, false,
false, false,
false, false,
false, false,
false, false,
false false,
), false
userJson.optBoolean("is_verified"), ),
false, userJson.optBoolean("is_verified"),
false, false,
false, false,
false, false,
null, false,
null, null,
0, null,
0, 0,
0, 0,
0, 0,
null, 0,
null, null,
0, null,
null, 0,
null null,
); null
final String id = node.getString("id"); );
final long timestamp = node.getLong("latest_reel_media"); final String id = node.getString("id");
final int mediaCount = node.getInt("media_count"); final long timestamp = node.getLong("latest_reel_media");
final boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp; final int mediaCount = node.getInt("media_count");
final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").optJSONObject(0) : null; final boolean fullyRead = !node.isNull("seen") && node.getLong("seen") == timestamp;
final boolean isBestie = node.optBoolean("has_besties_media", false); final JSONObject itemJson = node.has("items") ? node.getJSONArray("items").optJSONObject(0) : null;
StoryModel firstStoryModel = null; final boolean isBestie = node.optBoolean("has_besties_media", false);
if (itemJson != null) { StoryModel firstStoryModel = null;
firstStoryModel = ResponseBodyUtils.parseStoryItem(itemJson, false, false, null); if (itemJson != null) {
firstStoryModel = ResponseBodyUtils.parseStoryItem(itemJson, false, false, null);
}
feedStoryModels.add(new FeedStoryModel(id, user, fullyRead, timestamp, firstStoryModel, mediaCount, false, isBestie));
} }
feedStoryModels.add(new FeedStoryModel(id, user, fullyRead, timestamp, firstStoryModel, mediaCount, false, isBestie)); catch (Exception e) {} // to cover promotional reels with non-long user pk's
} }
final JSONArray broadcasts = new JSONObject(body).getJSONArray("broadcasts"); final JSONArray broadcasts = new JSONObject(body).getJSONArray("broadcasts");
for (int i = 0; i < broadcasts.length(); ++i) { for (int i = 0; i < broadcasts.length(); ++i) {