Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: original image path was used images when sharing from share extension #2604

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/src/main/kotlin/com/wire/android/model/ImageAsset.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

package com.wire.android.model

import android.net.Uri
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Stable
import com.wire.android.util.ui.WireSessionImageLoader
import com.wire.kalium.logic.data.id.ConversationId
import com.wire.kalium.logic.data.id.QualifiedIdMapper
import com.wire.kalium.logic.data.user.UserAssetId
import okio.Path

@Stable
sealed class ImageAsset(private val imageLoader: WireSessionImageLoader) {
Expand All @@ -50,7 +50,7 @@ sealed class ImageAsset(private val imageLoader: WireSessionImageLoader) {
@Stable
data class LocalImageAsset(
private val imageLoader: WireSessionImageLoader,
val dataUri: Uri,
val dataPath: Path,
val idKey: String
) : ImageAsset(imageLoader) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ class ImportMediaAuthenticatedViewModel @Inject constructor(
size = fileMetadata.sizeInBytes,
mimeType = mimeType,
dataPath = tempAssetPath,
dataUri = uri,
key = assetKey,
width = imgWidth,
height = imgHeight,
Expand All @@ -460,7 +459,6 @@ class ImportMediaAuthenticatedViewModel @Inject constructor(
size = fileMetadata.sizeInBytes,
mimeType = mimeType,
dataPath = tempAssetPath,
dataUri = uri,
key = assetKey
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package com.wire.android.ui.sharing

import android.net.Uri
import androidx.compose.runtime.Composable
import com.wire.android.model.Clickable
import com.wire.android.model.ImageAsset
Expand Down Expand Up @@ -70,17 +69,15 @@ sealed class ImportedMediaAsset(
open val size: Long,
open val mimeType: String,
open val dataPath: Path,
open val dataUri: Uri,
open val key: String
) {
class GenericAsset(
override val name: String,
override val size: Long,
override val mimeType: String,
override val dataPath: Path,
override val dataUri: Uri,
override val key: String
) : ImportedMediaAsset(name, size, mimeType, dataPath, dataUri, key)
) : ImportedMediaAsset(name, size, mimeType, dataPath, key)

class Image(
val width: Int,
Expand All @@ -89,10 +86,9 @@ sealed class ImportedMediaAsset(
override val size: Long,
override val mimeType: String,
override val dataPath: Path,
override val dataUri: Uri,
override val key: String,
val wireSessionImageLoader: WireSessionImageLoader
) : ImportedMediaAsset(name, size, mimeType, dataPath, dataUri, key) {
val localImageAsset = ImageAsset.LocalImageAsset(wireSessionImageLoader, dataUri, key)
) : ImportedMediaAsset(name, size, mimeType, dataPath, key) {
val localImageAsset = ImageAsset.LocalImageAsset(wireSessionImageLoader, dataPath, key)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import com.wire.kalium.logic.feature.asset.MessageAssetResult
import com.wire.kalium.logic.feature.asset.PublicAssetResult

internal class AssetImageFetcher(
private val context: Context,
private val assetFetcherParameters: AssetFetcherParameters,
private val getPublicAsset: GetAvatarAssetUseCase,
private val getPrivateAsset: GetMessageAssetUseCase,
Expand Down Expand Up @@ -79,15 +78,7 @@ internal class AssetImageFetcher(
}
}

is ImageAsset.LocalImageAsset -> {
data.dataUri.toDrawable(context)?.let {
DrawableResult(
drawable = it,
isSampled = true,
dataSource = DataSource.DISK
)
}
}
is ImageAsset.LocalImageAsset -> drawableResultWrapper.toFetchResult(data.dataPath)
}
}
}
Expand All @@ -103,7 +94,6 @@ internal class AssetImageFetcher(
private val getPrivateAssetUseCase: GetMessageAssetUseCase,
private val deleteAssetUseCase: DeleteAssetUseCase,
private val drawableResultWrapper: DrawableResultWrapper,
private val context: Context
) : Fetcher.Factory<ImageAsset> {
override fun create(
data: ImageAsset,
Expand All @@ -115,7 +105,6 @@ internal class AssetImageFetcher(
getPrivateAsset = getPrivateAssetUseCase,
deleteAsset = deleteAssetUseCase,
drawableResultWrapper = drawableResultWrapper,
context = context
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class WireSessionImageLoader(
getPrivateAssetUseCase = getPrivateAsset,
deleteAssetUseCase = deleteAsset,
drawableResultWrapper = DrawableResultWrapper(resources),
context = context
)
)
if (SDK_INT >= 28) {
Expand Down
Loading