Showing the changes to interface/src/DiscoverabilityManager.cpp (1 of 4 files). Show all
Unified · Split
| @@ -80,7 +80,8 @@ void DiscoverabilityManager::updateLocation() { · 79 unmodified lines | |||
| 80 | locationObject.insert(FRIENDS_ONLY_KEY_IN_LOCATION, (_mode.get() == Discoverability::Friends)); | 80 | locationObject.insert(FRIENDS_ONLY_KEY_IN_LOCATION, (_mode.get() == Discoverability::Friends)); |
| 81 | 81 | ||
| 82 | // if we have a session ID add it now, otherwise add a null value | 82 | // if we have a session ID add it now, otherwise add a null value |
| 83 | rootObject[SESSION_ID_KEY] = _sessionID.isEmpty() ? QJsonValue() : _sessionID; | 83 | auto sessionID = accountManager->getSessionID(); |
| 84 | rootObject[SESSION_ID_KEY] = sessionID.isNull() ? QJsonValue() : sessionID.toString(); | ||
| 84 | 85 | ||
| 85 | JSONCallbackParameters callbackParameters; | 86 | JSONCallbackParameters callbackParameters; |
| 86 | callbackParameters.jsonCallbackReceiver = this; | 87 | callbackParameters.jsonCallbackReceiver = this; |
| @@ -110,11 +111,8 @@ void DiscoverabilityManager::updateLocation() { · 23 unmodified lines | |||
| 110 | callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse"; | 111 | callbackParameters.jsonCallbackMethod = "handleHeartbeatResponse"; |
| 111 | 112 | ||
| 112 | QJsonObject heartbeatObject; | 113 | QJsonObject heartbeatObject; |
| 113 | if (!_sessionID.isEmpty()) { | 114 | auto sessionID = accountManager->getSessionID(); |
| 114 | heartbeatObject[SESSION_ID_KEY] = _sessionID; | 115 | heartbeatObject[SESSION_ID_KEY] = sessionID.isNull() ? QJsonValue() : sessionID.toString(); |
| 115 | } else { | ||
| 116 | heartbeatObject[SESSION_ID_KEY] = QJsonValue(); | ||
| 117 | } | ||
| 118 | 116 | ||
| 119 | accountManager->sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Optional, | 117 | accountManager->sendRequest(API_USER_HEARTBEAT_PATH, AccountManagerAuth::Optional, |
| 120 | QNetworkAccessManager::PutOperation, callbackParameters, | 118 | QNetworkAccessManager::PutOperation, callbackParameters, |
| @@ -126,11 +124,11 @@ void DiscoverabilityManager::handleHeartbeatResponse(QNetworkReply& requestReply · 5 unmodified lines | |||
| 126 | auto dataObject = AccountManager::dataObjectFromResponse(requestReply); | 124 | auto dataObject = AccountManager::dataObjectFromResponse(requestReply); |
| 127 | 125 | ||
| 128 | if (!dataObject.isEmpty()) { | 126 | if (!dataObject.isEmpty()) { |
| 129 | _sessionID = dataObject[SESSION_ID_KEY].toString(); | 127 | auto sessionID = dataObject[SESSION_ID_KEY].toString(); |
| 130 | 128 | ||
| 131 | // give that session ID to the account manager | 129 | // give that session ID to the account manager |
| 132 | auto accountManager = DependencyManager::get<AccountManager>(); | 130 | auto accountManager = DependencyManager::get<AccountManager>(); |
| 133 | accountManager->setSessionID(_sessionID); | 131 | accountManager->setSessionID(sessionID); |
| 134 | } | 132 | } |
| 135 | } | 133 | } |
| 136 | 134 | ||