-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: asset media files (WPB-5378) (#2322)
* feat: add new query to get assets without images * feat: add new usecase for assets only without images * feat: add missing implementation of dao * feat: add property NOT IN in sql query and rename mapping function * feat: add nullable to AssetMessageEntity width and height of asset * feat: add nullable to AssetMessageEntity width and height of asset * chore: revert changes to nullable parameters * feat: get assets from message details view instead of assets due to need of user data * feat: adjust return type of usecase and repository * feat: add count query for asset messages without images * chore: remove get asset messages by conversation id without images * feat: add usecase and repository extension for paginated asset messages without images * chore: remove unused usecase from message scope * chore: remove unused usecase from message scope * chore: remove receiving mimetype to paginated usecase * chore: move unique asset scope to message scope * chore: add logs * chore: remove logs * chore: fix detekt * test: fix existing tests * fix: media image assets [WPB-5848] (#2332) * fix: load only downloaded image media assets --------- Co-authored-by: Jakub Żerko <[email protected]>
- Loading branch information
1 parent
7c64581
commit 10e2eec
Showing
16 changed files
with
331 additions
and
31 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.../wire/kalium/logic/feature/asset/GetPaginatedFlowOfAssetMessageByConversationIdUseCase.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.kalium.logic.feature.asset | ||
|
||
import androidx.paging.PagingConfig | ||
import androidx.paging.PagingData | ||
import com.wire.kalium.logic.data.id.ConversationId | ||
import com.wire.kalium.logic.data.message.Message | ||
import com.wire.kalium.logic.data.message.MessageRepository | ||
import com.wire.kalium.util.KaliumDispatcher | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOn | ||
|
||
/** | ||
* This use case will observe and return a flow of paginated asset messages for a given conversation. | ||
* @see PagingData | ||
* @see Message | ||
*/ | ||
class GetPaginatedFlowOfAssetMessageByConversationIdUseCase internal constructor( | ||
private val dispatcher: KaliumDispatcher, | ||
private val messageRepository: MessageRepository | ||
) { | ||
suspend operator fun invoke( | ||
conversationId: ConversationId, | ||
startingOffset: Long, | ||
pagingConfig: PagingConfig | ||
): Flow<PagingData<Message.Standalone>> = messageRepository.extensions.getPaginatedMessageAssetsWithoutImageByConversationId( | ||
conversationId = conversationId, | ||
pagingConfig = pagingConfig, | ||
startingOffset = startingOffset | ||
).flowOn(dispatcher.io) | ||
} |
47 changes: 47 additions & 0 deletions
47
...roidMain/kotlin/com/wire/kalium/logic/feature/asset/ObservePaginatedAssetImageMessages.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Wire | ||
* Copyright (C) 2023 Wire Swiss GmbH | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
package com.wire.kalium.logic.feature.asset | ||
|
||
import androidx.paging.PagingConfig | ||
import androidx.paging.PagingData | ||
import com.wire.kalium.logic.data.asset.AssetMessage | ||
import com.wire.kalium.logic.data.id.ConversationId | ||
import com.wire.kalium.logic.data.message.MessageRepository | ||
import com.wire.kalium.util.KaliumDispatcher | ||
import kotlinx.coroutines.flow.Flow | ||
import kotlinx.coroutines.flow.flowOn | ||
|
||
/** | ||
* This use case will observe and return a flow of paginated image asset messages for a given conversation. | ||
* @see PagingData | ||
* @see AssetMessage | ||
*/ | ||
class ObservePaginatedAssetImageMessages internal constructor( | ||
private val dispatcher: KaliumDispatcher, | ||
private val messageRepository: MessageRepository | ||
) { | ||
suspend operator fun invoke( | ||
conversationId: ConversationId, | ||
startingOffset: Long, | ||
pagingConfig: PagingConfig | ||
): Flow<PagingData<AssetMessage>> = messageRepository.extensions.observePaginatedMessageAssetImageByConversationId( | ||
conversationId = conversationId, | ||
pagingConfig = pagingConfig, | ||
startingOffset = startingOffset | ||
).flowOn(dispatcher.io) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.