mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 21:43:13 +02:00
Merge pull request #3169 from murillodigital/master
Adding place/user go to logging
This commit is contained in:
commit
529fa50025
3 changed files with 25 additions and 4 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "LocationManager.h"
|
#include "LocationManager.h"
|
||||||
|
#include <UserActivityLogger.h>
|
||||||
|
|
||||||
const QString GET_USER_ADDRESS = "/api/v1/users/%1/address";
|
const QString GET_USER_ADDRESS = "/api/v1/users/%1/address";
|
||||||
const QString GET_PLACE_ADDRESS = "/api/v1/places/%1";
|
const QString GET_PLACE_ADDRESS = "/api/v1/places/%1";
|
||||||
|
@ -60,23 +61,30 @@ void LocationManager::createNamedLocation(NamedLocation* namedLocation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LocationManager::goTo(QString destination) {
|
void LocationManager::goTo(QString destination) {
|
||||||
|
const QString USER_DESTINATION_TYPE = "user";
|
||||||
|
const QString PLACE_DESTINATION_TYPE = "place";
|
||||||
|
const QString OTHER_DESTINATION_TYPE = "coordinate_or_username";
|
||||||
|
|
||||||
if (destination.startsWith("@")) {
|
if (destination.startsWith("@")) {
|
||||||
// remove '@' and go to user
|
// remove '@' and go to user
|
||||||
goToUser(destination.remove(0, 1));
|
QString destinationUser = destination.remove(0, 1);
|
||||||
|
UserActivityLogger::getInstance().wentTo(USER_DESTINATION_TYPE, destinationUser);
|
||||||
|
goToUser(destinationUser);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destination.startsWith("#")) {
|
if (destination.startsWith("#")) {
|
||||||
// remove '#' and go to named place
|
// remove '#' and go to named place
|
||||||
goToPlace(destination.remove(0, 1));
|
QString destinationPlace = destination.remove(0, 1);
|
||||||
|
UserActivityLogger::getInstance().wentTo(PLACE_DESTINATION_TYPE, destinationPlace);
|
||||||
|
goToPlace(destinationPlace);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// go to coordinate destination or to Username
|
// go to coordinate destination or to Username
|
||||||
if (!goToDestination(destination)) {
|
if (!goToDestination(destination)) {
|
||||||
destination = QString(QUrl::toPercentEncoding(destination));
|
destination = QString(QUrl::toPercentEncoding(destination));
|
||||||
|
UserActivityLogger::getInstance().wentTo(OTHER_DESTINATION_TYPE, destination);
|
||||||
JSONCallbackParameters callbackParams;
|
JSONCallbackParameters callbackParams;
|
||||||
callbackParams.jsonCallbackReceiver = this;
|
callbackParams.jsonCallbackReceiver = this;
|
||||||
callbackParams.jsonCallbackMethod = "goToAddressFromResponse";
|
callbackParams.jsonCallbackMethod = "goToAddressFromResponse";
|
||||||
|
|
|
@ -146,3 +146,15 @@ void UserActivityLogger::loadedScript(QString scriptName) {
|
||||||
logAction(ACTION_NAME, actionDetails);
|
logAction(ACTION_NAME, actionDetails);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserActivityLogger::wentTo(QString destinationType, QString destinationName) {
|
||||||
|
const QString ACTION_NAME = "went_to";
|
||||||
|
QJsonObject actionDetails;
|
||||||
|
const QString DESTINATION_TYPE_KEY = "destination_type";
|
||||||
|
const QString DESTINATION_NAME_KEY = "detination_name";
|
||||||
|
|
||||||
|
actionDetails.insert(DESTINATION_TYPE_KEY, destinationType);
|
||||||
|
actionDetails.insert(DESTINATION_NAME_KEY, destinationName);
|
||||||
|
|
||||||
|
logAction(ACTION_NAME, actionDetails);
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ public slots:
|
||||||
void changedDomain(QString domainURL);
|
void changedDomain(QString domainURL);
|
||||||
void connectedDevice(QString typeOfDevice, QString deviceName);
|
void connectedDevice(QString typeOfDevice, QString deviceName);
|
||||||
void loadedScript(QString scriptName);
|
void loadedScript(QString scriptName);
|
||||||
|
void wentTo(QString destinationType, QString destinationName);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void requestFinished(const QJsonObject& object);
|
void requestFinished(const QJsonObject& object);
|
||||||
|
|
Loading…
Reference in a new issue