CLOUD: Update syncSaves() to return SavesSyncRequest *

So other classes could use that information without casting.
This commit is contained in:
Alexander Tkachev 2016-06-05 15:22:26 +06:00
parent 8d09e1a6b3
commit 8de2862eaa
4 changed files with 8 additions and 7 deletions

View File

@ -116,9 +116,10 @@ void CloudManager::printBool(Storage::BoolResponse response) const {
debug("bool = %s", (response.value ? "true" : "false"));
}
void CloudManager::syncSaves(Storage::BoolCallback callback, Networking::ErrorCallback errorCallback) {
SavesSyncRequest *CloudManager::syncSaves(Storage::BoolCallback callback, Networking::ErrorCallback errorCallback) {
Storage *storage = getCurrentStorage();
if (storage) storage->syncSaves(callback, errorCallback);
if (storage) return storage->syncSaves(callback, errorCallback);
return nullptr;
}
void CloudManager::testFeature() {

View File

@ -71,7 +71,7 @@ public:
/**
* Starts saves syncing process in currently active storage if there is any.
*/
void syncSaves(Cloud::Storage::BoolCallback callback = nullptr, Networking::ErrorCallback errorCallback = nullptr);
SavesSyncRequest *syncSaves(Cloud::Storage::BoolCallback callback = nullptr, Networking::ErrorCallback errorCallback = nullptr);
/**
* Starts feature testing (the one I'm working on currently). (Temporary)

View File

@ -97,7 +97,7 @@ Networking::Request *Storage::downloadFolder(Common::String remotePath, Common::
return addRequest(new FolderDownloadRequest(this, callback, errorCallback, remotePath, localPath, recursive));
}
Networking::Request *Storage::syncSaves(BoolCallback callback, Networking::ErrorCallback errorCallback) {
SavesSyncRequest *Storage::syncSaves(BoolCallback callback, Networking::ErrorCallback errorCallback) {
_runningRequestsMutex.lock();
if (_savesSyncRequest) {
warning("Storage::syncSaves: there is a sync in progress already");
@ -106,8 +106,8 @@ Networking::Request *Storage::syncSaves(BoolCallback callback, Networking::Error
}
if (!errorCallback) errorCallback = getErrorPrintingCallback();
_savesSyncRequest = new SavesSyncRequest(this, callback, errorCallback);
_runningRequestsMutex.unlock();
return addRequest(_savesSyncRequest);
_runningRequestsMutex.unlock();
return (SavesSyncRequest *)addRequest(_savesSyncRequest); //who knows what that ConnMan could return in the future
}
bool Storage::isWorking() {

View File

@ -124,7 +124,7 @@ public:
virtual Networking::Request *remove(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) = 0;
/** Calls the callback when finished. */
virtual Networking::Request *syncSaves(BoolCallback callback, Networking::ErrorCallback errorCallback);
virtual SavesSyncRequest *syncSaves(BoolCallback callback, Networking::ErrorCallback errorCallback);
/** Calls the callback when finished. */
virtual Networking::Request *createDirectory(Common::String path, BoolCallback callback, Networking::ErrorCallback errorCallback) = 0;