mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
refine user track logics
This commit is contained in:
parent
14617a4172
commit
3c05e9b27b
@ -1734,3 +1734,19 @@ void VConfigManager::setWindowsOpenGL(int p_openGL)
|
||||
QString fullKey("global/windows_opengl");
|
||||
userSet->setValue(fullKey, p_openGL);
|
||||
}
|
||||
|
||||
QDate VConfigManager::getLastUserTrackDate() const
|
||||
{
|
||||
|
||||
auto dateStr = getConfigFromSessionSettings("global",
|
||||
"last_user_track_date").toString();
|
||||
return QDate::fromString(dateStr, Qt::ISODate);
|
||||
}
|
||||
|
||||
void VConfigManager::updateLastUserTrackDate()
|
||||
{
|
||||
auto date = QDate::currentDate();
|
||||
setConfigToSessionSettings("global",
|
||||
"last_user_track_date",
|
||||
date.toString(Qt::ISODate));
|
||||
}
|
||||
|
@ -637,6 +637,9 @@ public:
|
||||
bool getSyncNoteListToTab() const;
|
||||
void setSyncNoteListToTab(bool p_enabled);
|
||||
|
||||
QDate getLastUserTrackDate() const;
|
||||
void updateLastUserTrackDate();
|
||||
|
||||
private:
|
||||
void initEditorConfigs();
|
||||
|
||||
|
@ -3477,7 +3477,7 @@ void VMainWindow::kickOffStartUpTimer(const QStringList &p_files)
|
||||
}
|
||||
|
||||
if (g_config->getAllowUserTrack()) {
|
||||
QTimer::singleShot(60000, this, SLOT(collectUserStat()));
|
||||
QTimer::singleShot(30 * 1000, this, SLOT(collectUserStat()));
|
||||
}
|
||||
|
||||
m_syncNoteListToCurrentTab = true;
|
||||
@ -3585,6 +3585,13 @@ void VMainWindow::setupFileListSplitOut(bool p_enabled)
|
||||
|
||||
void VMainWindow::collectUserStat() const
|
||||
{
|
||||
// One request per day.
|
||||
auto lastCheckDate = g_config->getLastUserTrackDate();
|
||||
if (lastCheckDate != QDate::currentDate()) {
|
||||
g_config->updateLastUserTrackDate();
|
||||
|
||||
qDebug() << "send user track" << QDate::currentDate();
|
||||
|
||||
QWebEnginePage *page = new QWebEnginePage;
|
||||
page->load(QUrl("https://tamlok.github.io/user_track/vnote.html"));
|
||||
connect(page, &QWebEnginePage::loadFinished,
|
||||
@ -3592,6 +3599,9 @@ void VMainWindow::collectUserStat() const
|
||||
VUtils::sleepWait(2000);
|
||||
page->deleteLater();
|
||||
});
|
||||
}
|
||||
|
||||
QTimer::singleShot(30 * 60 * 1000, this, SLOT(collectUserStat()));
|
||||
}
|
||||
|
||||
void VMainWindow::promptForVNoteRestart()
|
||||
|
Loading…
x
Reference in New Issue
Block a user