mobile/save-changes: untangle the handling of alreadySaving

I'm suspicious that an issue that some people have seen around changes
not being saved is caused by our handling of alreadySaving.
When starting with Subsurface-mobile in no-autosync mode, we were able
to end in a scenario where alreadySaving was true, even though there
were no unsaved changes. And in that case no changes made during such a
session were saved unless the user forced a manual sync with the server.

This commit radically changes our approach to handling the flag. It
moves it right next to the actual calls into code that could modify git
storage, and ensures that the flag can never stay set.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-28 10:33:10 -07:00
parent 73bbe1f02b
commit 98966fdd8a
2 changed files with 34 additions and 33 deletions

View file

@ -260,6 +260,7 @@ private:
bool checkLocation(DiveSiteChange &change, const DiveObjectHelper &myDive, struct dive *d, QString location, QString gps);
bool checkDuration(const DiveObjectHelper &myDive, struct dive *d, QString duration);
bool checkDepth(const DiveObjectHelper &myDive, struct dive *d, QString depth);
int openAndMaybeSync(const char *filename);
bool currentGitLocalOnly;
Q_INVOKABLE DCDeviceData *m_device_data;
QString m_progressMessage;