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

This is important for protecting against potential data loss.
pull/5/head
Tom Hacohen 7 years ago
parent ba9f217d66
commit 3a83cf8303

@ -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) {

@ -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;
}

Loading…
Cancel
Save