File tree Expand file tree Collapse file tree 4 files changed +12
-14
lines changed
lib/src/main/kotlin/com/wire/integrations/jvm Expand file tree Collapse file tree 4 files changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ import io.ktor.client.plugins.websocket.DefaultClientWebSocketSession
33
33
import java.util.UUID
34
34
35
35
interface BackendClient {
36
- fun getCurrentSyncMarker (): UUID ?
36
+ fun getNotificationSyncMarker (): UUID ?
37
37
38
38
suspend fun connectWebSocket (handleFrames : suspend (DefaultClientWebSocketSession ) -> Unit )
39
39
Original file line number Diff line number Diff line change @@ -81,24 +81,22 @@ internal class BackendClientDemo(
81
81
private var cachedFeatures: FeaturesResponse ? = null
82
82
private var cachedAccessToken: String? = null
83
83
private var cachedDeviceId: String? = null
84
- private var currentSyncMarker : UUID ? = null
84
+ private var notificationSyncMarker : UUID ? = null
85
85
86
- override fun getCurrentSyncMarker (): UUID ? = currentSyncMarker
86
+ override fun getNotificationSyncMarker (): UUID ? = notificationSyncMarker
87
87
88
88
override suspend fun connectWebSocket (
89
89
handleFrames : suspend (DefaultClientWebSocketSession ) -> Unit
90
90
) {
91
91
logger.info(" Connecting to the webSocket, waiting for events" )
92
92
93
- currentSyncMarker = UUID .randomUUID()
93
+ notificationSyncMarker = UUID .randomUUID()
94
94
val token = loginUser()
95
95
96
- val url = StringBuilder ().apply {
97
- append(" /$API_VERSION /events" )
98
- append(" ?client=$cachedDeviceId " )
99
- append(" &access_token=$token " )
100
- append(" &sync_marker=$currentSyncMarker " )
101
- }.toString()
96
+ val url = " /$API_VERSION /events" +
97
+ " ?client=$cachedDeviceId " +
98
+ " &access_token=$token " +
99
+ " &sync_marker=$notificationSyncMarker "
102
100
103
101
httpClient.wss(
104
102
host = IsolatedKoinContext .getApiHost()?.replace(" https://" , " " )
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ import org.slf4j.LoggerFactory
48
48
internal class BackendClientImpl (private val httpClient : HttpClient ) : BackendClient {
49
49
private val logger = LoggerFactory .getLogger(this ::class .java)
50
50
51
- override fun getCurrentSyncMarker (): UUID ? = null
51
+ override fun getNotificationSyncMarker (): UUID ? = TODO ( " Not yet implemented " )
52
52
53
53
override suspend fun connectWebSocket (
54
54
handleFrames : suspend (DefaultClientWebSocketSession ) -> Unit
Original file line number Diff line number Diff line change @@ -100,11 +100,11 @@ internal class WireTeamEventsListener internal constructor(
100
100
val ackRequest = EventAcknowledgeRequest .basicAck(deliveryTag)
101
101
ackEvent(ackRequest, session)
102
102
}
103
- val currentSyncMarker = backendClient.getCurrentSyncMarker ()
104
- if (notification.data.markerId == currentSyncMarker .toString()) {
103
+ val notificationSyncMarker = backendClient.getNotificationSyncMarker ()
104
+ if (notification.data.markerId == notificationSyncMarker .toString()) {
105
105
logger.info(" Notifications are up to date since last sync marker." )
106
106
} else {
107
- logger.debug (
107
+ logger.info (
108
108
" Skipping sync marker [${notification.data.markerId} ], " +
109
109
" as it is not valid for this session."
110
110
)
You can’t perform that action at this time.
0 commit comments