mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 19:13:38 +02:00
using different paradigm for checking login dialog popup
This commit is contained in:
parent
dcacfdba7c
commit
5ece8d8707
6 changed files with 21 additions and 15 deletions
|
@ -86,11 +86,12 @@ ModalWindow {
|
|||
}
|
||||
}
|
||||
Component.onDestruction: {
|
||||
if (closeButtonVisible && clickedCloseButton) {
|
||||
if (closeButtonVisible && clickedCloseButton && Settings.getValue("loginDialogPoppedUp", false)) {
|
||||
var data = {
|
||||
"action": "opted out"
|
||||
};
|
||||
UserActivityLogger.logAction("encourageLoginDialog", data);
|
||||
}
|
||||
Settings.setValue("loginDialogPoppedUp", false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2301,23 +2301,24 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
|||
AndroidHelper::instance().notifyLoadComplete();
|
||||
#endif
|
||||
|
||||
connect(this, &Application::loginDialogPoppedUp, DependencyManager::get<DialogsManager>().data(), &DialogsManager::loginDialogPoppedUp);
|
||||
|
||||
static int CHECK_LOGIN_TIMER = 3000;
|
||||
QTimer* checkLoginTimer = new QTimer(this);
|
||||
checkLoginTimer->setInterval(CHECK_LOGIN_TIMER);
|
||||
checkLoginTimer->setSingleShot(true);
|
||||
connect(checkLoginTimer, &QTimer::timeout, this, []() {
|
||||
connect(checkLoginTimer, &QTimer::timeout, this, [this]() {
|
||||
auto accountManager = DependencyManager::get<AccountManager>();
|
||||
auto dialogsManager = DependencyManager::get<DialogsManager>();
|
||||
if (!accountManager->isLoggedIn() && !qApp->isHMDMode()) {
|
||||
emit loginDialogPoppedUp();
|
||||
Settings settings;
|
||||
settings.setValue("loginDialogPoppedUp", true);
|
||||
dialogsManager->showLoginDialog();
|
||||
QJsonObject loginData = {};
|
||||
loginData["action"] = "login dialog shown";
|
||||
UserActivityLogger::getInstance().logAction("encourageLoginDialog", loginData);
|
||||
}
|
||||
});
|
||||
Settings settings;
|
||||
settings.setValue("loginDialogPoppedUp", false);
|
||||
checkLoginTimer->start();
|
||||
}
|
||||
|
||||
|
@ -4948,6 +4949,9 @@ void Application::loadSettings() {
|
|||
}
|
||||
|
||||
void Application::saveSettings() const {
|
||||
Settings settings;
|
||||
settings.setValue("loginDialogPoppedUp", false);
|
||||
|
||||
sessionRunTime.set(_sessionRunTimer.elapsed() / MSECS_PER_SECOND);
|
||||
DependencyManager::get<AudioClient>()->saveSettings();
|
||||
DependencyManager::get<LODManager>()->saveSettings();
|
||||
|
|
|
@ -117,10 +117,6 @@ void DialogsManager::showLoginDialog() {
|
|||
LoginDialog::showWithSelection();
|
||||
}
|
||||
|
||||
void DialogsManager::loginDialogPoppedUp() {
|
||||
LoginDialog::setLoginDialogPoppedUp(true);
|
||||
}
|
||||
|
||||
void DialogsManager::showUpdateDialog() {
|
||||
UpdateDialog::show();
|
||||
}
|
||||
|
|
|
@ -48,7 +48,6 @@ public slots:
|
|||
void setDomainConnectionFailureVisibility(bool visible);
|
||||
void toggleLoginDialog();
|
||||
void showLoginDialog();
|
||||
void loginDialogPoppedUp();
|
||||
void octreeStatsDetails();
|
||||
void lodTools();
|
||||
void hmdTools(bool showTools);
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
#include <plugins/SteamClientPlugin.h>
|
||||
#include <ui/TabletScriptingInterface.h>
|
||||
|
||||
#include <UserActivityLogger.h>
|
||||
|
||||
#include "AccountManager.h"
|
||||
#include "DependencyManager.h"
|
||||
#include "Menu.h"
|
||||
|
@ -38,11 +40,18 @@ LoginDialog::LoginDialog(QQuickItem *parent) : OffscreenQmlDialog(parent) {
|
|||
connect(accountManager.data(), &AccountManager::loginFailed,
|
||||
this, &LoginDialog::handleLoginFailed);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
LoginDialog::~LoginDialog() {
|
||||
qCDebug(login_dialog) << "killing";
|
||||
Settings settings;
|
||||
Setting::Handle<bool> loginDialogPoppedUp{ "loginDialogPoppedUp", false };
|
||||
auto poppedUp = loginDialogPoppedUp.get();
|
||||
if (poppedUp) {
|
||||
QJsonObject data;
|
||||
data["action"] = "user opted out";
|
||||
UserActivityLogger::getInstance().logAction("encourageLoginDialog", data);
|
||||
}
|
||||
settings.setValue("loginDialogPoppedUp", false);
|
||||
}
|
||||
|
||||
void LoginDialog::showWithSelection()
|
||||
|
|
|
@ -23,7 +23,6 @@ class QNetworkReply;
|
|||
|
||||
class LoginDialog : public OffscreenQmlDialog {
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool poppedUp READ getLoginDialogPoppedUp)
|
||||
HIFI_QML_DECL
|
||||
|
||||
public:
|
||||
|
@ -35,8 +34,6 @@ public:
|
|||
|
||||
static void showWithSelection();
|
||||
|
||||
bool getLoginDialogPoppedUp() { return _poppedUp; }
|
||||
void setLoginDialogPoppedUp(bool poppedUp) { _poppedUp = poppedUp; }
|
||||
signals:
|
||||
void handleLoginCompleted();
|
||||
void handleLoginFailed();
|
||||
|
|
Loading…
Reference in a new issue