Avoid duplicate toots from cache.
This commit is contained in:
parent
ec7b074574
commit
00ca2c4061
|
@ -988,12 +988,19 @@ public class API {
|
|||
*/
|
||||
public APIResponse getHomeTimelineCache(String max_id) {
|
||||
|
||||
HashMap<String, String> params = new HashMap<>();
|
||||
if (max_id != null)
|
||||
params.put("max_id", max_id);
|
||||
params.put("limit","40");
|
||||
SQLiteDatabase db = Sqlite.getInstance(context, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
statuses = new TimelineCacheDAO(context, db).get(max_id);
|
||||
Iterator<Status> i = statuses.iterator();
|
||||
List<String> ids = new ArrayList<>();
|
||||
while (i.hasNext()) {
|
||||
Status s = i.next();
|
||||
if( ids.contains(s.getId())) {
|
||||
i.remove();
|
||||
new TimelineCacheDAO(context, db).remove(s.getId());
|
||||
}else{
|
||||
ids.add(s.getId());
|
||||
}
|
||||
}
|
||||
if( statuses == null){
|
||||
return getHomeTimeline(max_id);
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue