Be more precise regarding the online state of the model
This commit is contained in:
parent
b447c76dac
commit
2d3a4c87be
|
@ -55,8 +55,18 @@ public class BongaCamsUpdateService extends PaginatedScheduledService {
|
||||||
String name = m.getString("username");
|
String name = m.getString("username");
|
||||||
BongaCamsModel model = (BongaCamsModel) bongaCams.createModel(name);
|
BongaCamsModel model = (BongaCamsModel) bongaCams.createModel(name);
|
||||||
model.setUserId(m.getInt("user_id"));
|
model.setUserId(m.getInt("user_id"));
|
||||||
|
boolean away = m.optBoolean("is_away");
|
||||||
|
boolean online = m.optBoolean("online") && !away;
|
||||||
|
model.setOnline(online);
|
||||||
|
if(online) {
|
||||||
|
if(away) {
|
||||||
|
model.setOnlineState("away");
|
||||||
|
} else {
|
||||||
model.setOnlineState(m.getString("room"));
|
model.setOnlineState(m.getString("room"));
|
||||||
model.setOnline(m.optBoolean("online") && !m.optBoolean("is_away"));
|
}
|
||||||
|
} else {
|
||||||
|
model.setOnlineState("offline");
|
||||||
|
}
|
||||||
model.setPreview("https:" + m.getString("thumb_image"));
|
model.setPreview("https:" + m.getString("thumb_image"));
|
||||||
models.add(model);
|
models.add(model);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue