1
0
mirror of https://github.com/etesync/android synced 2024-11-16 04:49:06 +00:00

Collection deletion: mark as deleted in cache, but don't actually delete.

This is important for protecting against potential data loss.
This commit is contained in:
Tom Hacohen 2017-03-24 18:51:37 +00:00
parent ba9f217d66
commit 3a83cf8303
2 changed files with 4 additions and 2 deletions

View File

@ -120,7 +120,9 @@ public class DeleteCollectionFragment extends DialogFragment implements LoaderMa
JournalManager journalManager = new JournalManager(HttpClient.create(getContext(), account), principal);
journalManager.deleteJournal(new JournalManager.Journal(settings.password(), collectionInfo.toJson(), collectionInfo.url));
data.delete(JournalEntity.fetch(data, collectionInfo.url));
JournalEntity journalEntity = JournalEntity.fetch(data, collectionInfo.url);
journalEntity.setDeleted(true);
data.update(journalEntity);
return null;
} catch (Exceptions.HttpException e) {

View File

@ -57,7 +57,7 @@ public class ViewCollectionActivity extends AppCompatActivity implements Refresh
int entryCount = -1;
final JournalEntity journalEntity = JournalEntity.fetch(data, info.url);
if (journalEntity == null) {
if ((journalEntity == null) || journalEntity.isDeleted()) {
finish();
return;
}