mirror of https://github.com/readrops/Readrops.git
Readd date of last sync using a local value instead of using FreshRSS' one
This commit is contained in:
parent
19ca5a7398
commit
45e594d4f2
|
@ -20,6 +20,8 @@ import com.readrops.readropslibrary.services.freshrss.FreshRSSAPI;
|
|||
import com.readrops.readropslibrary.services.freshrss.FreshRSSCredentials;
|
||||
import com.readrops.readropslibrary.services.freshrss.FreshRSSSyncData;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -90,6 +92,7 @@ public class FreshRSSRepository extends ARepository<FreshRSSAPI> {
|
|||
} else
|
||||
syncType = SyncType.INITIAL_SYNC;
|
||||
|
||||
long newLastModified = DateTime.now().getMillis() / 1000L;
|
||||
TimingLogger logger = new TimingLogger(TAG, "FreshRSS sync timer");
|
||||
|
||||
return Single.<FreshRSSSyncData>create(emitter -> {
|
||||
|
@ -109,10 +112,11 @@ public class FreshRSSRepository extends ARepository<FreshRSSAPI> {
|
|||
insertItems(syncResult.getItems(), syncType == SyncType.INITIAL_SYNC);
|
||||
logger.addSplit("items insertion");
|
||||
|
||||
//account.setLastModified(syncResult.getLastUpdated());
|
||||
//database.accountDao().updateLastModified(account.getId(), syncResult.getLastUpdated());
|
||||
account.setLastModified(newLastModified);
|
||||
database.accountDao().updateLastModified(account.getId(), newLastModified);
|
||||
|
||||
//database.itemDao().resetReadChanges(account.getId());
|
||||
database.itemDao().resetReadChanges();
|
||||
logger.addSplit("reset read changes");
|
||||
logger.dumpToLog();
|
||||
|
||||
return Observable.empty();
|
||||
|
|
|
@ -97,26 +97,27 @@ public class FreshRSSAPI extends API<FreshRSSService> {
|
|||
public Single<FreshRSSSyncResult> sync(@NonNull SyncType syncType, @NonNull FreshRSSSyncData syncData, @NonNull String writeToken) {
|
||||
FreshRSSSyncResult syncResult = new FreshRSSSyncResult();
|
||||
|
||||
return getFolders()
|
||||
.flatMap(freshRSSFolders -> {
|
||||
syncResult.setFolders(freshRSSFolders);
|
||||
return setItemsReadState(syncData, writeToken)
|
||||
.andThen(getFolders()
|
||||
.flatMap(freshRSSFolders -> {
|
||||
syncResult.setFolders(freshRSSFolders);
|
||||
|
||||
return getFeeds();
|
||||
})
|
||||
.flatMap(freshRSSFeeds -> {
|
||||
syncResult.setFeeds(freshRSSFeeds);
|
||||
return getFeeds();
|
||||
})
|
||||
.flatMap(freshRSSFeeds -> {
|
||||
syncResult.setFeeds(freshRSSFeeds);
|
||||
|
||||
if (syncType == SyncType.INITIAL_SYNC) {
|
||||
return getItems(GOOGLE_READ, MAX_ITEMS, null);
|
||||
} else {
|
||||
return getItems(GOOGLE_READ, MAX_ITEMS, syncData.getLastModified());
|
||||
}
|
||||
})
|
||||
.flatMap(freshRSSItems -> {
|
||||
syncResult.setItems(freshRSSItems);
|
||||
if (syncType == SyncType.INITIAL_SYNC) {
|
||||
return getItems(GOOGLE_READ, MAX_ITEMS, null);
|
||||
} else {
|
||||
return getItems(GOOGLE_READ, MAX_ITEMS, syncData.getLastModified());
|
||||
}
|
||||
})
|
||||
.flatMap(freshRSSItems -> {
|
||||
syncResult.setItems(freshRSSItems);
|
||||
|
||||
return Single.just(syncResult);
|
||||
});
|
||||
return Single.just(syncResult);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue