mirror of
https://github.com/overte-org/overte.git
synced 2025-04-07 23:53:54 +02:00
Add went-to user activity back in
This commit is contained in:
parent
1be30ccce9
commit
890de1bfea
3 changed files with 39 additions and 2 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "AddressManager.h"
|
||||
#include "NodeList.h"
|
||||
#include "NetworkLogging.h"
|
||||
#include "UserActivityLogger.h"
|
||||
|
||||
|
||||
const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager";
|
||||
|
@ -130,6 +131,10 @@ const JSONCallbackParameters& AddressManager::apiCallbackParameters() {
|
|||
}
|
||||
|
||||
bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
||||
static QString URL_TYPE_USER = "user";
|
||||
static QString URL_TYPE_DOMAIN_ID = "domain_id";
|
||||
static QString URL_TYPE_PLACE = "place";
|
||||
static QString URL_TYPE_NETWORK_ADDRESS = "network_address";
|
||||
if (lookupUrl.scheme() == HIFI_URL_SCHEME) {
|
||||
|
||||
qCDebug(networking) << "Trying to go to URL" << lookupUrl.toString();
|
||||
|
@ -147,6 +152,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
if (handleUsername(lookupUrl.authority())) {
|
||||
// handled a username for lookup
|
||||
|
||||
UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_USER, lookupUrl.toString());
|
||||
|
||||
// in case we're failing to connect to where we thought this user was
|
||||
// store their username as previous lookup so we can refresh their location via API
|
||||
_previousLookup = lookupUrl;
|
||||
|
@ -157,6 +164,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
if (handleNetworkAddress(lookupUrl.host()
|
||||
+ (lookupUrl.port() == -1 ? "" : ":" + QString::number(lookupUrl.port())), trigger, hostChanged)) {
|
||||
|
||||
UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_NETWORK_ADDRESS, lookupUrl.toString());
|
||||
|
||||
// a network address lookup clears the previous lookup since we don't expect to re-attempt it
|
||||
_previousLookup.clear();
|
||||
|
||||
|
@ -174,6 +183,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
// we may have a path that defines a relative viewpoint - if so we should jump to that now
|
||||
handlePath(path, trigger);
|
||||
} else if (handleDomainID(lookupUrl.host())){
|
||||
UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_DOMAIN_ID, lookupUrl.toString());
|
||||
|
||||
// store this domain ID as the previous lookup in case we're failing to connect and want to refresh API info
|
||||
_previousLookup = lookupUrl;
|
||||
|
||||
|
@ -181,6 +192,8 @@ bool AddressManager::handleUrl(const QUrl& lookupUrl, LookupTrigger trigger) {
|
|||
// try to look up the domain ID on the metaverse API
|
||||
attemptDomainIDLookup(lookupUrl.host(), lookupUrl.path(), trigger);
|
||||
} else {
|
||||
UserActivityLogger::getInstance().wentTo(trigger, URL_TYPE_PLACE, lookupUrl.toString());
|
||||
|
||||
// store this place name as the previous lookup in case we fail to connect and want to refresh API info
|
||||
_previousLookup = lookupUrl;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "UserActivityLogger.h"
|
||||
#include <DependencyManager.h>
|
||||
#include "AddressManager.h"
|
||||
|
||||
static const QString USER_ACTIVITY_URL = "/api/v1/user_activities";
|
||||
|
||||
|
@ -161,12 +162,34 @@ void UserActivityLogger::loadedScript(QString scriptName) {
|
|||
|
||||
}
|
||||
|
||||
void UserActivityLogger::wentTo(QString destinationType, QString destinationName) {
|
||||
void UserActivityLogger::wentTo(AddressManager::LookupTrigger lookupTrigger, QString destinationType, QString destinationName) {
|
||||
// Only accept these types of triggers. Other triggers are usually used internally in AddressManager.
|
||||
QString trigger;
|
||||
switch (lookupTrigger) {
|
||||
case AddressManager::UserInput:
|
||||
trigger = "UserInput";
|
||||
break;
|
||||
case AddressManager::Back:
|
||||
trigger = "Back";
|
||||
break;
|
||||
case AddressManager::Forward:
|
||||
trigger = "Forward";
|
||||
break;
|
||||
case AddressManager::StartupFromSettings:
|
||||
trigger = "StartupFromSettings";
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const QString ACTION_NAME = "went_to";
|
||||
QJsonObject actionDetails;
|
||||
const QString TRIGGER_TYPE_KEY = "trigger";
|
||||
const QString DESTINATION_TYPE_KEY = "destination_type";
|
||||
const QString DESTINATION_NAME_KEY = "detination_name";
|
||||
|
||||
actionDetails.insert(TRIGGER_TYPE_KEY, trigger);
|
||||
actionDetails.insert(DESTINATION_TYPE_KEY, destinationType);
|
||||
actionDetails.insert(DESTINATION_NAME_KEY, destinationName);
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <QNetworkReply>
|
||||
|
||||
#include <SettingHandle.h>
|
||||
#include "AddressManager.h"
|
||||
|
||||
class UserActivityLogger : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -42,7 +43,7 @@ public slots:
|
|||
void changedDomain(QString domainURL);
|
||||
void connectedDevice(QString typeOfDevice, QString deviceName);
|
||||
void loadedScript(QString scriptName);
|
||||
void wentTo(QString destinationType, QString destinationName);
|
||||
void wentTo(AddressManager::LookupTrigger trigger, QString destinationType, QString destinationName);
|
||||
|
||||
private slots:
|
||||
void requestError(QNetworkReply& errorReply);
|
||||
|
|
Loading…
Reference in a new issue