@@ -28,7 +28,6 @@ import com.zhuinden.monarchy.Monarchy
28
28
import dagger.Lazy
29
29
import im.vector.matrix.android.api.MatrixCallback
30
30
import im.vector.matrix.android.api.NoOpMatrixCallback
31
- import im.vector.matrix.android.api.auth.data.Credentials
32
31
import im.vector.matrix.android.api.crypto.MXCryptoConfig
33
32
import im.vector.matrix.android.api.failure.Failure
34
33
import im.vector.matrix.android.api.listeners.ProgressListener
@@ -79,7 +78,9 @@ import im.vector.matrix.android.internal.crypto.verification.DefaultVerification
79
78
import im.vector.matrix.android.internal.database.model.EventEntity
80
79
import im.vector.matrix.android.internal.database.model.EventEntityFields
81
80
import im.vector.matrix.android.internal.database.query.whereType
81
+ import im.vector.matrix.android.internal.di.DeviceId
82
82
import im.vector.matrix.android.internal.di.MoshiProvider
83
+ import im.vector.matrix.android.internal.di.UserId
83
84
import im.vector.matrix.android.internal.extensions.foldToCallback
84
85
import im.vector.matrix.android.internal.session.SessionScope
85
86
import im.vector.matrix.android.internal.session.room.membership.LoadRoomMembersTask
@@ -117,8 +118,10 @@ import kotlin.math.max
117
118
internal class DefaultCryptoService @Inject constructor(
118
119
// Olm Manager
119
120
private val olmManager : OlmManager ,
120
- // The credentials,
121
- private val credentials : Credentials ,
121
+ @UserId
122
+ private val userId : String ,
123
+ @DeviceId
124
+ private val deviceId : String? ,
122
125
private val myDeviceInfoHolder : Lazy <MyDeviceInfoHolder >,
123
126
// the crypto store
124
127
private val cryptoStore : IMXCryptoStore ,
@@ -199,7 +202,7 @@ internal class DefaultCryptoService @Inject constructor(
199
202
this .callback = object : MatrixCallback <Unit > {
200
203
override fun onSuccess (data : Unit ) {
201
204
// bg refresh of crypto device
202
- downloadKeys(listOf (credentials. userId), true , NoOpMatrixCallback ())
205
+ downloadKeys(listOf (userId), true , NoOpMatrixCallback ())
203
206
callback.onSuccess(data)
204
207
}
205
208
@@ -398,7 +401,7 @@ internal class DefaultCryptoService @Inject constructor(
398
401
}
399
402
400
403
/* *
401
- * Provides the device information for a device id and a user Id
404
+ * Provides the device information for a user id and a device Id
402
405
*
403
406
* @param userId the user id
404
407
* @param deviceId the device id
@@ -746,7 +749,7 @@ internal class DefaultCryptoService @Inject constructor(
746
749
}
747
750
748
751
// Was that sent by us?
749
- if (event.senderId != credentials. userId) {
752
+ if (event.senderId != userId) {
750
753
Timber .e(" ## GOSSIP onSecretSend() : Ignore secret from other user ${event.senderId} " )
751
754
return
752
755
}
@@ -1164,7 +1167,7 @@ internal class DefaultCryptoService @Inject constructor(
1164
1167
* ========================================================================================== */
1165
1168
1166
1169
override fun toString (): String {
1167
- return " DefaultCryptoService of " + credentials. userId + " ( " + credentials. deviceId + " )"
1170
+ return " DefaultCryptoService of $ userId ( $ deviceId )"
1168
1171
}
1169
1172
1170
1173
override fun getOutgoingRoomKeyRequest (): List <OutgoingRoomKeyRequest > {
0 commit comments