Send optout for real and only once.

This commit is contained in:
Adam Treat 2023-04-29 11:05:44 -04:00
parent 8fe60c29fb
commit 8aed93daa5
3 changed files with 4 additions and 12 deletions

View File

@ -178,7 +178,7 @@ void Network::sendOptOut()
QJsonDocument doc;
doc.setArray(array);
sendMixpanel(doc.toJson());
sendMixpanel(doc.toJson(), true /*isOptOut*/);
#if defined(DEBUG)
printf("%s %s\n", qPrintable("opt_out"), qPrintable(doc.toJson(QJsonDocument::Indented)));
@ -272,9 +272,9 @@ void Network::sendIpify()
connect(reply, &QNetworkReply::finished, this, &Network::handleIpifyFinished);
}
void Network::sendMixpanel(const QByteArray &json)
void Network::sendMixpanel(const QByteArray &json, bool isOptOut)
{
if (!m_usageStatsActive)
if (!m_usageStatsActive && !isOptOut)
return;
QUrl trackUrl("https://api.mixpanel.com/track");

View File

@ -47,7 +47,7 @@ private:
void sendHealth();
void sendIpify();
void sendMixpanelEvent(const QString &event);
void sendMixpanel(const QByteArray &json);
void sendMixpanel(const QByteArray &json, bool isOptOut = false);
bool packageAndSendJson(const QString &ingestId, const QString &json);
private:

View File

@ -21,14 +21,6 @@ Dialog {
id: theme
}
Connections {
target: startupDialog
function onClosed() {
if (!Network.usageStatsActive)
Network.usageStatsActive = false // opt-out triggered
}
}
Column {
id: column
spacing: 20