mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Fix issue with poor sent video viewing behavior.
This commit is contained in:
@@ -697,6 +697,7 @@ public class AttachmentTable extends DatabaseTable {
|
||||
contentValues.put(HEIGHT, sourceAttachment.getHeight());
|
||||
contentValues.put(CONTENT_TYPE, sourceAttachment.getContentType());
|
||||
contentValues.put(VISUAL_HASH, getVisualHashStringOrNull(sourceAttachment));
|
||||
contentValues.put(TRANSFORM_PROPERTIES, sourceAttachment.getTransformProperties().serialize());
|
||||
|
||||
database.update(TABLE_NAME, contentValues, PART_ID_WHERE, destinationId.toStrings());
|
||||
}
|
||||
@@ -1604,7 +1605,7 @@ public class AttachmentTable extends DatabaseTable {
|
||||
return new TransformProperties(true, false, 0, 0, sentMediaQuality);
|
||||
}
|
||||
|
||||
@NonNull String serialize() {
|
||||
public @NonNull String serialize() {
|
||||
return JsonUtil.toJson(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import org.thoughtcrime.securesms.database.model.databaseprotos.StoryTextPost
|
||||
import org.thoughtcrime.securesms.stories.viewer.page.StoryPost
|
||||
import org.thoughtcrime.securesms.util.Base64
|
||||
import org.thoughtcrime.securesms.util.rx.RxStore
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.microseconds
|
||||
|
||||
class StoryPostViewModel(private val repository: StoryTextPostRepository) : ViewModel() {
|
||||
@@ -40,11 +41,25 @@ class StoryPostViewModel(private val repository: StoryTextPostRepository) : View
|
||||
store.update { StoryPostState.None() }
|
||||
} else if (storyPostContent.isVideo()) {
|
||||
store.update {
|
||||
val shouldSkipTransform = storyPostContent.attachment.transformProperties.shouldSkipTransform()
|
||||
|
||||
val clipStart: Duration = if (shouldSkipTransform) {
|
||||
0L.microseconds
|
||||
} else {
|
||||
storyPostContent.attachment.transformProperties.videoTrimStartTimeUs.microseconds
|
||||
}
|
||||
|
||||
val clipEnd: Duration = if (shouldSkipTransform) {
|
||||
0L.microseconds
|
||||
} else {
|
||||
storyPostContent.attachment.transformProperties.videoTrimEndTimeUs.microseconds
|
||||
}
|
||||
|
||||
StoryPostState.VideoPost(
|
||||
videoUri = storyPostContent.uri,
|
||||
size = storyPostContent.attachment.size,
|
||||
clipStart = storyPostContent.attachment.transformProperties.videoTrimStartTimeUs.microseconds,
|
||||
clipEnd = storyPostContent.attachment.transformProperties.videoTrimEndTimeUs.microseconds,
|
||||
clipStart = clipStart,
|
||||
clipEnd = clipEnd,
|
||||
blurHash = storyPostContent.attachment.blurHash
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user