diff options
| author | Alexander Tkachev | 2019-07-27 22:44:15 +0700 |
|---|---|---|
| committer | Matan Bareket | 2019-07-30 14:51:41 -0400 |
| commit | f6a17e679f4fac2fda21dc7f64565a0dc4a10ca1 (patch) | |
| tree | 115b53d284e100ae04914ac90c1a4823ef95fb4f /backends/cloud/box | |
| parent | 85431c39bf191725910703f699fe95da595f6adf (diff) | |
| download | scummvm-rg350-f6a17e679f4fac2fda21dc7f64565a0dc4a10ca1.tar.gz scummvm-rg350-f6a17e679f4fac2fda21dc7f64565a0dc4a10ca1.tar.bz2 scummvm-rg350-f6a17e679f4fac2fda21dc7f64565a0dc4a10ca1.zip | |
CLOUD: Ask user to manually enable Storage
For more security, newly connected Storage only gets username/used space
information and is disabled until user manually presses the button.
Diffstat (limited to 'backends/cloud/box')
| -rw-r--r-- | backends/cloud/box/boxstorage.cpp | 8 | ||||
| -rw-r--r-- | backends/cloud/box/boxstorage.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/backends/cloud/box/boxstorage.cpp b/backends/cloud/box/boxstorage.cpp index 13046a08e0..46af2e56be 100644 --- a/backends/cloud/box/boxstorage.cpp +++ b/backends/cloud/box/boxstorage.cpp @@ -42,8 +42,8 @@ namespace Box { #define BOX_API_FILES_CONTENT "https://api.box.com/2.0/files/%s/content" #define BOX_API_USERS_ME "https://api.box.com/2.0/users/me" -BoxStorage::BoxStorage(Common::String token, Common::String refreshToken): - IdStorage(token, refreshToken) {} +BoxStorage::BoxStorage(Common::String token, Common::String refreshToken, bool enabled): + IdStorage(token, refreshToken, enabled) {} BoxStorage::BoxStorage(Common::String code, Networking::ErrorCallback cb) { getAccessToken(code, cb); @@ -62,6 +62,7 @@ bool BoxStorage::canReuseRefreshToken() { return false; } void BoxStorage::saveConfig(Common::String keyPrefix) { ConfMan.set(keyPrefix + "access_token", _token, ConfMan.kCloudDomain); ConfMan.set(keyPrefix + "refresh_token", _refreshToken, ConfMan.kCloudDomain); + saveIsEnabledFlag(keyPrefix); } Common::String BoxStorage::name() const { @@ -224,12 +225,13 @@ BoxStorage *BoxStorage::loadFromConfig(Common::String keyPrefix) { Common::String accessToken = ConfMan.get(keyPrefix + "access_token", ConfMan.kCloudDomain); Common::String refreshToken = ConfMan.get(keyPrefix + "refresh_token", ConfMan.kCloudDomain); - return new BoxStorage(accessToken, refreshToken); + return new BoxStorage(accessToken, refreshToken, loadIsEnabledFlag(keyPrefix)); } void BoxStorage::removeFromConfig(Common::String keyPrefix) { ConfMan.removeKey(keyPrefix + "access_token", ConfMan.kCloudDomain); ConfMan.removeKey(keyPrefix + "refresh_token", ConfMan.kCloudDomain); + removeIsEnabledFlag(keyPrefix); } Common::String BoxStorage::getRootDirectoryId() { diff --git a/backends/cloud/box/boxstorage.h b/backends/cloud/box/boxstorage.h index ce77192bfa..1916c88449 100644 --- a/backends/cloud/box/boxstorage.h +++ b/backends/cloud/box/boxstorage.h @@ -31,7 +31,7 @@ namespace Box { class BoxStorage: public Id::IdStorage { /** This private constructor is called from loadFromConfig(). */ - BoxStorage(Common::String token, Common::String refreshToken); + BoxStorage(Common::String token, Common::String refreshToken, bool enabled); /** Constructs StorageInfo based on JSON response from cloud. */ void infoInnerCallback(StorageInfoCallback outerCallback, Networking::JsonResponse json); |
