Skip to content

Commit

Permalink
Remove toc
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherHX committed Mar 24, 2020
1 parent e3396a0 commit 25bd4f7
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 121 deletions.
36 changes: 1 addition & 35 deletions googleplayapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ void GooglePlayApi::loadApiInfo() {
QSettings settings;
settings.beginGroup("playapi");
api->device_config_token = settings.value("device_config_token").toString().toStdString();
api->toc_cookie = settings.value("toc_cookie").toString().toStdString();
api->experiments.set_targets(settings.value("experiments").toString().toStdString());
settings.endGroup();
}
Expand All @@ -61,7 +60,6 @@ void GooglePlayApi::saveApiInfo() {
QSettings settings;
settings.beginGroup("playapi");
settings.setValue("device_config_token", QString::fromStdString(api->device_config_token));
settings.setValue("toc_cookie", QString::fromStdString(api->toc_cookie));
settings.setValue("experiments", QString::fromStdString(api->experiments.get_comma_separated_target_list()));
settings.endGroup();
}
Expand All @@ -82,39 +80,7 @@ void GooglePlayApi::handleCheckinAndTos() {
api->set_auth(loginHelper->getLoginApi())->call();

loadApiInfo();
api->info_mutex.lock();
bool needsAcceptTos = api->toc_cookie.empty() || api->device_config_token.empty();
api->info_mutex.unlock();
if (needsAcceptTos) {
api->fetch_user_settings()->call();
auto toc = api->fetch_toc()->call();
if (toc.payload().tocresponse().has_cookie())
api->set_toc_cookie(toc.payload().tocresponse().cookie());

if (api->fetch_toc()->call().payload().tocresponse().requiresuploaddeviceconfig()) {
auto resp = api->upload_device_config()->call();
api->set_device_config_token(resp.payload().uploaddeviceconfigresponse().uploaddeviceconfigtoken());

toc = api->fetch_toc()->call();
if (toc.payload().tocresponse().requiresuploaddeviceconfig() || !toc.payload().tocresponse().has_cookie())
throw std::runtime_error("Invalid state");
api->set_toc_cookie(toc.payload().tocresponse().cookie());
if (toc.payload().tocresponse().has_toscontent() && toc.payload().tocresponse().has_tostoken()) {
tosApprovalPromise = std::promise<std::pair<bool, bool>>();
auto future = tosApprovalPromise.get_future();
emit tosApprovalRequired(QString::fromStdString(toc.payload().tocresponse().toscontent()),
QString::fromStdString(toc.payload().tocresponse().toscheckboxtextmarketingemails()));
auto state = future.get();
if (!state.first)
throw std::runtime_error("Rejected TOS");
auto tos = api->accept_tos(toc.payload().tocresponse().tostoken(), state.second)->call();
if (!tos.payload().has_accepttosresponse())
throw std::runtime_error("Invalid state");
saveApiInfo();
}
}
}

saveApiInfo();
emit ready();
} catch (const std::exception& ex) {
emit initError(ex.what());
Expand Down
1 change: 0 additions & 1 deletion qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<file>qml/LauncherLogin.qml</file>
<file>qml/CenteredRectangle.qml</file>
<file>qml/ProfileComboBox.qml</file>
<file>qml/GoogleTosApprovalWindow.qml</file>
<file>qml/EditProfileWindow.qml</file>
<file>qml/LauncherSettingsWindow.qml</file>
<file>qml/GameLogWindow.qml</file>
Expand Down
79 changes: 0 additions & 79 deletions qml/GoogleTosApprovalWindow.qml

This file was deleted.

6 changes: 0 additions & 6 deletions qml/LauncherMain.qml
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,6 @@ ColumnLayout {
}
}

GoogleTosApprovalWindow {
id: googleTosApprovalWindow

onDone: playApi.setTosApproved(approved, marketing)
}

EditProfileWindow {
id: profileEditWindow
versionManager: versionManagerInstance
Expand Down

0 comments on commit 25bd4f7

Please sign in to comment.