Add user agent into device info.

This commit is contained in:
Onuray Sahin 2022-09-26 14:39:23 +03:00
parent 90e4760ee7
commit c70b6206d0
3 changed files with 56 additions and 1 deletions

View file

@ -52,9 +52,17 @@ data class DeviceInfo(
* The last ip address.
*/
@Json(name = "last_seen_ip")
val lastSeenIp: String? = null
val lastSeenIp: String? = null,
@Json(name="org.matrix.msc3852.last_seen_user_agent")
val unstableLastSeenUserAgent: String? = null,
@Json(name="last_seen_user_agent")
val lastSeenUserAgent: String? = null,
) : DatedObject {
override val date: Long
get() = lastSeenTs ?: 0
fun getBestLastSeenUserAgent() = lastSeenUserAgent ?: unstableLastSeenUserAgent
}

View file

@ -26,4 +26,5 @@ data class DeviceFullInfo(
val roomEncryptionTrustLevel: RoomEncryptionTrustLevel,
val isInactive: Boolean,
val isCurrentDevice: Boolean,
val deviceUserAgent: DeviceUserAgent,
)

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2022 New Vector Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package im.vector.app.features.settings.devices.v2
import im.vector.app.features.settings.devices.v2.list.DeviceType
data class DeviceUserAgent(
/**
* One of MOBILE, WEB, DESKTOP or UNKNOWN
*/
val deviceType: DeviceType,
/**
* i.e. Google Pixel 6
*/
val deviceModel: String?,
/**
* i.e. Android
*/
val deviceOperatingSystem: String?,
/**
* i.e. Android 11
*/
val deviceOperatingSystemVersion: String?,
/**
* i.e. Element Nightly
*/
val clientName: String?,
/**
* i.e. 1.5.0
*/
val clientVersion: String?,
)