forked from GitHub-Mirror/riotX-android
Fix code quality issues
This commit is contained in:
parent
d3827b8673
commit
501474b720
@ -65,13 +65,29 @@ internal class RoomFactory @Inject constructor(private val context: Context,
|
|||||||
private val leaveRoomTask: LeaveRoomTask) {
|
private val leaveRoomTask: LeaveRoomTask) {
|
||||||
|
|
||||||
fun create(roomId: String): Room {
|
fun create(roomId: String): Room {
|
||||||
val timelineService = DefaultTimelineService(roomId, monarchy, taskExecutor, contextOfEventTask, cryptoService, paginationTask, timelineEventMapper, readReceiptsSummaryMapper)
|
val timelineService = DefaultTimelineService(roomId,
|
||||||
|
monarchy,
|
||||||
|
taskExecutor,
|
||||||
|
contextOfEventTask,
|
||||||
|
cryptoService,
|
||||||
|
paginationTask,
|
||||||
|
timelineEventMapper,
|
||||||
|
readReceiptsSummaryMapper
|
||||||
|
)
|
||||||
val sendService = DefaultSendService(context, credentials, roomId, eventFactory, cryptoService, monarchy)
|
val sendService = DefaultSendService(context, credentials, roomId, eventFactory, cryptoService, monarchy)
|
||||||
val stateService = DefaultStateService(roomId, monarchy.realmConfiguration, taskExecutor, sendStateTask)
|
val stateService = DefaultStateService(roomId, monarchy.realmConfiguration, taskExecutor, sendStateTask)
|
||||||
val roomMembersService = DefaultMembershipService(roomId, monarchy, taskExecutor, loadRoomMembersTask, inviteTask, joinRoomTask, leaveRoomTask)
|
val roomMembersService = DefaultMembershipService(roomId, monarchy, taskExecutor, loadRoomMembersTask, inviteTask, joinRoomTask, leaveRoomTask)
|
||||||
val readService = DefaultReadService(roomId, monarchy, taskExecutor, setReadMarkersTask, readReceiptsSummaryMapper, credentials)
|
val readService = DefaultReadService(roomId, monarchy, taskExecutor, setReadMarkersTask, readReceiptsSummaryMapper, credentials)
|
||||||
val relationService = DefaultRelationService(context,
|
val relationService = DefaultRelationService(context,
|
||||||
credentials, roomId, eventFactory, cryptoService, findReactionEventForUndoTask, fetchEditHistoryTask, monarchy, taskExecutor)
|
credentials,
|
||||||
|
roomId,
|
||||||
|
eventFactory,
|
||||||
|
cryptoService,
|
||||||
|
findReactionEventForUndoTask,
|
||||||
|
fetchEditHistoryTask,
|
||||||
|
monarchy,
|
||||||
|
taskExecutor
|
||||||
|
)
|
||||||
|
|
||||||
return DefaultRoom(
|
return DefaultRoom(
|
||||||
roomId,
|
roomId,
|
||||||
|
@ -52,7 +52,10 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
|
|||||||
// Deletion here means we don't have any readReceipts for the given hidden events
|
// Deletion here means we don't have any readReceipts for the given hidden events
|
||||||
changeSet.deletions.forEach {
|
changeSet.deletions.forEach {
|
||||||
val eventId = correctedReadReceiptsEventByIndex[it]
|
val eventId = correctedReadReceiptsEventByIndex[it]
|
||||||
val timelineEvent = liveEvents.where().equalTo(TimelineEventEntityFields.EVENT_ID, eventId).findFirst()
|
val timelineEvent = liveEvents.where()
|
||||||
|
.equalTo(TimelineEventEntityFields.EVENT_ID, eventId)
|
||||||
|
.findFirst()
|
||||||
|
|
||||||
// We are rebuilding the corresponding event with only his own RR
|
// We are rebuilding the corresponding event with only his own RR
|
||||||
val readReceipts = readReceiptsSummaryMapper.map(timelineEvent?.readReceipts)
|
val readReceipts = readReceiptsSummaryMapper.map(timelineEvent?.readReceipts)
|
||||||
hasChange = delegate.rebuildEvent(eventId, readReceipts) || hasChange
|
hasChange = delegate.rebuildEvent(eventId, readReceipts) || hasChange
|
||||||
@ -71,11 +74,11 @@ internal class TimelineHiddenReadReceipts constructor(private val readReceiptsSu
|
|||||||
// If we find one, we should
|
// If we find one, we should
|
||||||
if (firstDisplayedEvent != null) {
|
if (firstDisplayedEvent != null) {
|
||||||
correctedReadReceiptsEventByIndex.put(index, firstDisplayedEvent.eventId)
|
correctedReadReceiptsEventByIndex.put(index, firstDisplayedEvent.eventId)
|
||||||
correctedReadReceiptsByEvent.getOrPut(firstDisplayedEvent.eventId, {
|
correctedReadReceiptsByEvent
|
||||||
readReceiptsSummaryMapper.map(firstDisplayedEvent.readReceipts).toMutableList()
|
.getOrPut(firstDisplayedEvent.eventId, {
|
||||||
}).addAll(
|
ArrayList(readReceiptsSummaryMapper.map(firstDisplayedEvent.readReceipts))
|
||||||
readReceiptsSummaryMapper.map(summary)
|
})
|
||||||
)
|
.addAll(readReceiptsSummaryMapper.map(summary))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,12 @@ class VectorDateFormatter @Inject constructor(private val context: Context,
|
|||||||
if (time == null) {
|
if (time == null) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
return DateUtils.getRelativeDateTimeString(context, time, DateUtils.DAY_IN_MILLIS, 2 * DateUtils.DAY_IN_MILLIS, DateUtils.FORMAT_SHOW_WEEKDAY).toString()
|
return DateUtils.getRelativeDateTimeString(context,
|
||||||
|
time,
|
||||||
|
DateUtils.DAY_IN_MILLIS,
|
||||||
|
2 * DateUtils.DAY_IN_MILLIS,
|
||||||
|
DateUtils.FORMAT_SHOW_WEEKDAY
|
||||||
|
).toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user