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; QJsonDocument doc;
doc.setArray(array); doc.setArray(array);
sendMixpanel(doc.toJson()); sendMixpanel(doc.toJson(), true /*isOptOut*/);
#if defined(DEBUG) #if defined(DEBUG)
printf("%s %s\n", qPrintable("opt_out"), qPrintable(doc.toJson(QJsonDocument::Indented))); 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); 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; return;
QUrl trackUrl("https://api.mixpanel.com/track"); QUrl trackUrl("https://api.mixpanel.com/track");

View File

@ -47,7 +47,7 @@ private:
void sendHealth(); void sendHealth();
void sendIpify(); void sendIpify();
void sendMixpanelEvent(const QString &event); 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); bool packageAndSendJson(const QString &ingestId, const QString &json);
private: private:

View File

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