aboutsummaryrefslogtreecommitdiff
path: root/backends/cloud/dropbox
diff options
context:
space:
mode:
authorPeter Bozsó2016-06-12 23:02:32 +0200
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit219e565c32d81e375677b62f6e82e48fae75f26f (patch)
treefa3d95179c7a6b0e3291194f2022eebcc1981309 /backends/cloud/dropbox
parentbfc5cab9e88a2f70ac4a60c441c91a8b141ce113 (diff)
downloadscummvm-rg350-219e565c32d81e375677b62f6e82e48fae75f26f.tar.gz
scummvm-rg350-219e565c32d81e375677b62f6e82e48fae75f26f.tar.bz2
scummvm-rg350-219e565c32d81e375677b62f6e82e48fae75f26f.zip
CLOUD: Introduce CloudConfigHelper
Diffstat (limited to 'backends/cloud/dropbox')
-rw-r--r--backends/cloud/dropbox/dropboxstorage.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/backends/cloud/dropbox/dropboxstorage.cpp b/backends/cloud/dropbox/dropboxstorage.cpp
index bcafcf5264..b677b56ff9 100644
--- a/backends/cloud/dropbox/dropboxstorage.cpp
+++ b/backends/cloud/dropbox/dropboxstorage.cpp
@@ -28,24 +28,24 @@
#include "backends/cloud/cloudmanager.h"
#include "backends/networking/curl/connectionmanager.h"
#include "backends/networking/curl/curljsonrequest.h"
-#include "common/config-manager.h"
#include "common/debug.h"
#include "common/json.h"
#include <curl/curl.h>
+#include "backends/cloud/cloudconfighelper.h"
namespace Cloud {
namespace Dropbox {
-char *DropboxStorage::KEY = nullptr; //can't use ConfMan there yet, loading it on instance creation/auth
+char *DropboxStorage::KEY = nullptr; //can't use CloudConfig there yet, loading it on instance creation/auth
char *DropboxStorage::SECRET = nullptr; //TODO: hide these secrets somehow
void DropboxStorage::loadKeyAndSecret() {
- Common::String k = ConfMan.get("DROPBOX_KEY", "cloud");
+ Common::String k = CloudConfig.get("DROPBOX_KEY");
KEY = new char[k.size() + 1];
memcpy(KEY, k.c_str(), k.size());
KEY[k.size()] = 0;
- k = ConfMan.get("DROPBOX_SECRET", "cloud");
+ k = CloudConfig.get("DROPBOX_SECRET");
SECRET = new char[k.size() + 1];
memcpy(SECRET, k.c_str(), k.size());
SECRET[k.size()] = 0;
@@ -80,9 +80,9 @@ void DropboxStorage::codeFlowComplete(Networking::JsonResponse response) {
} else {
_token = result.getVal("access_token")->asString();
_uid = result.getVal("uid")->asString();
- ConfMan.removeKey("dropbox_code", "cloud");
+ CloudConfig.removeKey("dropbox_code");
CloudMan.replaceStorage(this, kStorageDropboxId);
- ConfMan.flushToDisk();
+ CloudConfig.flushToDisk();
debug("Done! You can use Dropbox now! Look:");
CloudMan.testFeature();
}
@@ -94,8 +94,8 @@ void DropboxStorage::codeFlowComplete(Networking::JsonResponse response) {
}
void DropboxStorage::saveConfig(Common::String keyPrefix) {
- ConfMan.set(keyPrefix + "access_token", _token, "cloud");
- ConfMan.set(keyPrefix + "user_id", _uid, "cloud");
+ CloudConfig.set(keyPrefix + "access_token", _token);
+ CloudConfig.set(keyPrefix + "user_id", _uid);
}
Common::String DropboxStorage::name() const {
@@ -199,18 +199,18 @@ void DropboxStorage::infoMethodCallback(StorageInfoResponse response) {
DropboxStorage *DropboxStorage::loadFromConfig(Common::String keyPrefix) {
loadKeyAndSecret();
- if (!ConfMan.hasKey(keyPrefix + "access_token", "cloud")) {
+ if (!CloudConfig.hasKey(keyPrefix + "access_token")) {
warning("No access_token found");
return 0;
}
- if (!ConfMan.hasKey(keyPrefix + "user_id", "cloud")) {
+ if (!CloudConfig.hasKey(keyPrefix + "user_id")) {
warning("No user_id found");
return 0;
}
- Common::String accessToken = ConfMan.get(keyPrefix + "access_token", "cloud");
- Common::String userId = ConfMan.get(keyPrefix + "user_id", "cloud");
+ Common::String accessToken = CloudConfig.get(keyPrefix + "access_token");
+ Common::String userId = CloudConfig.get(keyPrefix + "user_id");
return new DropboxStorage(accessToken, userId);
}