mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-17 04:20:00 +03:00
Cleanup injected constructors
This commit is contained in:
parent
b4a13f9504
commit
0ffb5e627e
17 changed files with 32 additions and 34 deletions
|
@ -20,7 +20,7 @@ import im.vector.matrix.android.api.auth.data.Credentials
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class ObjectSigner @Inject constructor(private val credentials: Credentials,
|
internal class ObjectSigner @Inject constructor(private val credentials: Credentials,
|
||||||
private val olmDevice: MXOlmDevice) {
|
private val olmDevice: MXOlmDevice) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sign Object
|
* Sign Object
|
||||||
|
|
|
@ -27,14 +27,14 @@ import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class EnsureOlmSessionsForUsersAction @Inject constructor(private val olmDevice: MXOlmDevice,
|
internal class EnsureOlmSessionsForUsersAction @Inject constructor(private val olmDevice: MXOlmDevice,
|
||||||
private val cryptoStore: IMXCryptoStore,
|
private val cryptoStore: IMXCryptoStore,
|
||||||
private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction) {
|
private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to make sure we have established olm sessions for the given users.
|
* Try to make sure we have established olm sessions for the given users.
|
||||||
* @param users a list of user ids.
|
* @param users a list of user ids.
|
||||||
*/
|
*/
|
||||||
suspend fun handle(users: List<String>) : MXUsersDevicesMap<MXOlmSessionResult> {
|
suspend fun handle(users: List<String>): MXUsersDevicesMap<MXOlmSessionResult> {
|
||||||
Timber.v("## ensureOlmSessionsForUsers() : ensureOlmSessionsForUsers $users")
|
Timber.v("## ensureOlmSessionsForUsers() : ensureOlmSessionsForUsers $users")
|
||||||
val devicesByUser = HashMap<String /* userId */, MutableList<MXDeviceInfo>>()
|
val devicesByUser = HashMap<String /* userId */, MutableList<MXDeviceInfo>>()
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class SetDeviceVerificationAction @Inject constructor(private val cryptoStore: IMXCryptoStore,
|
internal class SetDeviceVerificationAction @Inject constructor(private val cryptoStore: IMXCryptoStore,
|
||||||
private val credentials: Credentials,
|
private val credentials: Credentials,
|
||||||
private val keysBackup: KeysBackup) {
|
private val keysBackup: KeysBackup) {
|
||||||
|
|
||||||
fun handle(verificationStatus: Int, deviceId: String, userId: String) {
|
fun handle(verificationStatus: Int, deviceId: String, userId: String) {
|
||||||
val device = cryptoStore.getUserDevice(deviceId, userId)
|
val device = cryptoStore.getUserDevice(deviceId, userId)
|
||||||
|
|
|
@ -28,14 +28,14 @@ import im.vector.matrix.android.internal.util.MatrixCoroutineDispatchers
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class MXMegolmDecryptionFactory @Inject constructor(private val credentials: Credentials,
|
internal class MXMegolmDecryptionFactory @Inject constructor(private val credentials: Credentials,
|
||||||
private val olmDevice: MXOlmDevice,
|
private val olmDevice: MXOlmDevice,
|
||||||
private val deviceListManager: DeviceListManager,
|
private val deviceListManager: DeviceListManager,
|
||||||
private val outgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager,
|
private val outgoingRoomKeyRequestManager: OutgoingRoomKeyRequestManager,
|
||||||
private val messageEncrypter: MessageEncrypter,
|
private val messageEncrypter: MessageEncrypter,
|
||||||
private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction,
|
private val ensureOlmSessionsForDevicesAction: EnsureOlmSessionsForDevicesAction,
|
||||||
private val cryptoStore: IMXCryptoStore,
|
private val cryptoStore: IMXCryptoStore,
|
||||||
private val sendToDeviceTask: SendToDeviceTask,
|
private val sendToDeviceTask: SendToDeviceTask,
|
||||||
private val coroutineDispatchers: MatrixCoroutineDispatchers) {
|
private val coroutineDispatchers: MatrixCoroutineDispatchers) {
|
||||||
|
|
||||||
fun create(): MXMegolmDecryption {
|
fun create(): MXMegolmDecryption {
|
||||||
return MXMegolmDecryption(
|
return MXMegolmDecryption(
|
||||||
|
|
|
@ -26,8 +26,8 @@ import java.util.UUID
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
internal class RoomSummaryMapper @Inject constructor(
|
internal class RoomSummaryMapper @Inject constructor(
|
||||||
val cryptoService: CryptoService,
|
private val cryptoService: CryptoService,
|
||||||
val timelineEventMapper: TimelineEventMapper
|
private val timelineEventMapper: TimelineEventMapper
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun map(roomSummaryEntity: RoomSummaryEntity): RoomSummary {
|
fun map(roomSummaryEntity: RoomSummaryEntity): RoomSummary {
|
||||||
|
|
|
@ -24,7 +24,7 @@ import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
@MatrixScope
|
@MatrixScope
|
||||||
internal class UserAgentHolder @Inject constructor(val context: Context) {
|
internal class UserAgentHolder @Inject constructor(private val context: Context) {
|
||||||
|
|
||||||
var userAgent: String = ""
|
var userAgent: String = ""
|
||||||
private set
|
private set
|
||||||
|
|
|
@ -32,8 +32,8 @@ internal interface GetContextOfEventTask : Task<GetContextOfEventTask.Params, To
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class DefaultGetContextOfEventTask @Inject constructor(private val roomAPI: RoomAPI,
|
internal class DefaultGetContextOfEventTask @Inject constructor(private val roomAPI: RoomAPI,
|
||||||
private val filterRepository: FilterRepository,
|
private val filterRepository: FilterRepository,
|
||||||
private val tokenChunkEventPersistor: TokenChunkEventPersistor
|
private val tokenChunkEventPersistor: TokenChunkEventPersistor
|
||||||
) : GetContextOfEventTask {
|
) : GetContextOfEventTask {
|
||||||
|
|
||||||
override suspend fun execute(params: GetContextOfEventTask.Params): TokenChunkEventPersistor.Result {
|
override suspend fun execute(params: GetContextOfEventTask.Params): TokenChunkEventPersistor.Result {
|
||||||
|
|
|
@ -23,7 +23,7 @@ import im.vector.riotx.core.resources.StringProvider
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class ErrorFormatter @Inject constructor(val stringProvider: StringProvider) {
|
class ErrorFormatter @Inject constructor(private val stringProvider: StringProvider) {
|
||||||
|
|
||||||
|
|
||||||
fun toHumanReadable(failure: Failure): String {
|
fun toHumanReadable(failure: Failure): String {
|
||||||
|
|
|
@ -34,8 +34,8 @@ import im.vector.riotx.core.ui.list.genericItem
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class KeysBackupSettingsRecyclerViewController @Inject constructor(val stringProvider: StringProvider,
|
class KeysBackupSettingsRecyclerViewController @Inject constructor(private val stringProvider: StringProvider,
|
||||||
val session: Session) : TypedEpoxyController<KeysBackupSettingViewState>() {
|
private val session: Session) : TypedEpoxyController<KeysBackupSettingViewState>() {
|
||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ import kotlin.collections.HashMap
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class KeyRequestHandler @Inject constructor(val context: Context)
|
class KeyRequestHandler @Inject constructor(private val context: Context)
|
||||||
: RoomKeysRequestListener,
|
: RoomKeysRequestListener,
|
||||||
SasVerificationService.SasVerificationListener {
|
SasVerificationService.SasVerificationListener {
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ import javax.inject.Singleton
|
||||||
* Listens to the VerificationManager and add a new notification when an incoming request is detected.
|
* Listens to the VerificationManager and add a new notification when an incoming request is detected.
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
class IncomingVerificationRequestHandler @Inject constructor(val context: Context) : SasVerificationService.SasVerificationListener {
|
class IncomingVerificationRequestHandler @Inject constructor(private val context: Context) : SasVerificationService.SasVerificationListener {
|
||||||
|
|
||||||
private var session: Session? = null
|
private var session: Session? = null
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@
|
||||||
|
|
||||||
package im.vector.riotx.features.home.room.list
|
package im.vector.riotx.features.home.room.list
|
||||||
|
|
||||||
import im.vector.matrix.android.api.session.Session
|
|
||||||
import im.vector.matrix.android.api.session.events.model.EventType
|
import im.vector.matrix.android.api.session.events.model.EventType
|
||||||
import im.vector.matrix.android.api.session.events.model.toModel
|
import im.vector.matrix.android.api.session.events.model.toModel
|
||||||
import im.vector.matrix.android.api.session.room.model.Membership
|
import im.vector.matrix.android.api.session.room.model.Membership
|
||||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||||
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
import im.vector.matrix.android.api.session.room.model.message.MessageContent
|
||||||
import im.vector.riotx.R
|
import im.vector.riotx.R
|
||||||
|
import im.vector.riotx.core.date.VectorDateFormatter
|
||||||
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
import im.vector.riotx.core.epoxy.VectorEpoxyModel
|
||||||
import im.vector.riotx.core.extensions.localDateTime
|
import im.vector.riotx.core.extensions.localDateTime
|
||||||
import im.vector.riotx.core.resources.ColorProvider
|
import im.vector.riotx.core.resources.ColorProvider
|
||||||
|
@ -30,7 +30,6 @@ import im.vector.riotx.core.resources.DateProvider
|
||||||
import im.vector.riotx.core.resources.StringProvider
|
import im.vector.riotx.core.resources.StringProvider
|
||||||
import im.vector.riotx.features.home.AvatarRenderer
|
import im.vector.riotx.features.home.AvatarRenderer
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.format.NoticeEventFormatter
|
import im.vector.riotx.features.home.room.detail.timeline.format.NoticeEventFormatter
|
||||||
import im.vector.riotx.core.date.VectorDateFormatter
|
|
||||||
import im.vector.riotx.features.home.room.detail.timeline.helper.senderName
|
import im.vector.riotx.features.home.room.detail.timeline.helper.senderName
|
||||||
import me.gujun.android.span.span
|
import me.gujun.android.span.span
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
@ -39,8 +38,7 @@ class RoomSummaryItemFactory @Inject constructor(private val noticeEventFormatte
|
||||||
private val dateFormatter: VectorDateFormatter,
|
private val dateFormatter: VectorDateFormatter,
|
||||||
private val colorProvider: ColorProvider,
|
private val colorProvider: ColorProvider,
|
||||||
private val stringProvider: StringProvider,
|
private val stringProvider: StringProvider,
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer) {
|
||||||
private val session: Session) {
|
|
||||||
|
|
||||||
fun create(roomSummary: RoomSummary,
|
fun create(roomSummary: RoomSummary,
|
||||||
joiningRoomsIds: Set<String>,
|
joiningRoomsIds: Set<String>,
|
||||||
|
@ -96,7 +94,7 @@ class RoomSummaryItemFactory @Inject constructor(private val noticeEventFormatte
|
||||||
val currentDate = DateProvider.currentLocalDateTime()
|
val currentDate = DateProvider.currentLocalDateTime()
|
||||||
val isSameDay = date.toLocalDate() == currentDate.toLocalDate()
|
val isSameDay = date.toLocalDate() == currentDate.toLocalDate()
|
||||||
latestFormattedEvent = if (latestEvent.root.isEncrypted()
|
latestFormattedEvent = if (latestEvent.root.isEncrypted()
|
||||||
&& latestEvent.root.mxDecryptionResult == null) {
|
&& latestEvent.root.mxDecryptionResult == null) {
|
||||||
stringProvider.getString(R.string.encrypted_message)
|
stringProvider.getString(R.string.encrypted_message)
|
||||||
} else if (latestEvent.root.getClearType() == EventType.MESSAGE) {
|
} else if (latestEvent.root.getClearType() == EventType.MESSAGE) {
|
||||||
val senderName = latestEvent.senderName() ?: latestEvent.root.senderId
|
val senderName = latestEvent.senderName() ?: latestEvent.root.senderId
|
||||||
|
|
|
@ -40,7 +40,7 @@ import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class EventHtmlRenderer @Inject constructor(context: Context,
|
class EventHtmlRenderer @Inject constructor(context: Context,
|
||||||
val avatarRenderer: AvatarRenderer,
|
avatarRenderer: AvatarRenderer,
|
||||||
sessionHolder: ActiveSessionHolder) {
|
sessionHolder: ActiveSessionHolder) {
|
||||||
private val markwon = Markwon.builder(context)
|
private val markwon = Markwon.builder(context)
|
||||||
.usePlugin(MatrixPlugin.create(GlideApp.with(context), context, avatarRenderer, sessionHolder))
|
.usePlugin(MatrixPlugin.create(GlideApp.with(context), context, avatarRenderer, sessionHolder))
|
||||||
|
|
|
@ -26,7 +26,7 @@ import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class BitmapLoader @Inject constructor(val context: Context) {
|
class BitmapLoader @Inject constructor(private val context: Context) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Avatar Url -> Bitmap
|
* Avatar Url -> Bitmap
|
||||||
|
|
|
@ -28,7 +28,7 @@ import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class IconLoader @Inject constructor(val context: Context) {
|
class IconLoader @Inject constructor(private val context: Context) {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Avatar Url -> IconCompat
|
* Avatar Url -> IconCompat
|
||||||
|
|
|
@ -33,7 +33,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class PublicRoomsController @Inject constructor(private val stringProvider: StringProvider,
|
class PublicRoomsController @Inject constructor(private val stringProvider: StringProvider,
|
||||||
private val avatarRenderer: AvatarRenderer,
|
private val avatarRenderer: AvatarRenderer,
|
||||||
private val errorFormatter: ErrorFormatter) : TypedEpoxyController<PublicRoomsViewState>() {
|
private val errorFormatter: ErrorFormatter) : TypedEpoxyController<PublicRoomsViewState>() {
|
||||||
|
|
||||||
var callback: Callback? = null
|
var callback: Callback? = null
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import im.vector.riotx.features.form.formSwitchItem
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class CreateRoomController @Inject constructor(private val stringProvider: StringProvider,
|
class CreateRoomController @Inject constructor(private val stringProvider: StringProvider,
|
||||||
private val errorFormatter: ErrorFormatter
|
private val errorFormatter: ErrorFormatter
|
||||||
) : TypedEpoxyController<CreateRoomViewState>() {
|
) : TypedEpoxyController<CreateRoomViewState>() {
|
||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
Loading…
Add table
Reference in a new issue