Send proof hint flags for media messages
This commit is contained in:
parent
f1b9de48d1
commit
a667f28984
3 changed files with 16 additions and 4 deletions
|
|
@ -627,7 +627,8 @@ export const createUploadBatch = (manager: AttachmentManager | null, room: Room
|
|||
},
|
||||
eventId,
|
||||
attachment.dimensions,
|
||||
attachment.thumbnail
|
||||
attachment.thumbnail,
|
||||
attachment.proofHintFlags
|
||||
)
|
||||
.then((mediaEventId: string) => {
|
||||
// Look at last item rotation, flipping the sign on this, so looks more like a true stack
|
||||
|
|
|
|||
|
|
@ -67,6 +67,8 @@ export type ProofHintFlags = {
|
|||
export const extractProofHintFlags = (proof?: Proof): (ProofHintFlags | undefined) => {
|
||||
if (!proof) return undefined;
|
||||
|
||||
let foundCreated = false;
|
||||
|
||||
let screenshot = false;
|
||||
let camera = false;
|
||||
let aiGenerated = false;
|
||||
|
|
@ -104,10 +106,14 @@ export const extractProofHintFlags = (proof?: Proof): (ProofHintFlags | undefine
|
|||
) {
|
||||
aiGenerated = true;
|
||||
}
|
||||
return;
|
||||
foundCreated = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (foundCreated) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (valid) {
|
||||
const flags: ProofHintFlags = {
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export const ROOM_TYPE_FILE_MODE = "im.keanu.room_type_file";
|
|||
export const ROOM_TYPE_CHANNEL = "im.keanu.room_type_channel";
|
||||
|
||||
export const STATE_EVENT_ROOM_TYPE = "im.keanu.room_type";
|
||||
export const CLIENT_EVENT_PROOF_HINT = "im.keanu.proof_hint";
|
||||
|
||||
export const THUMBNAIL_MAX_WIDTH = 640;
|
||||
export const THUMBNAIL_MAX_HEIGHT = 640;
|
||||
|
|
@ -410,7 +411,7 @@ class Util {
|
|||
return [encryptedBytes, encryptedFile];
|
||||
}
|
||||
|
||||
sendFile(matrixClient, roomId, file, onUploadProgress, threadRoot, dimensions, thumbnail) {
|
||||
sendFile(matrixClient, roomId, file, onUploadProgress, threadRoot, dimensions, thumbnail, proofHintFlags) {
|
||||
const uploadPromise = new UploadPromise(undefined);
|
||||
uploadPromise.wrappedPromise = new Promise((resolve, reject) => {
|
||||
var reader = new FileReader();
|
||||
|
|
@ -485,12 +486,16 @@ class Util {
|
|||
msgtype = "m.video";
|
||||
}
|
||||
|
||||
var messageContent = {
|
||||
let messageContent = {
|
||||
body: description,
|
||||
info: info,
|
||||
msgtype: msgtype,
|
||||
};
|
||||
|
||||
if (proofHintFlags) {
|
||||
messageContent[CLIENT_EVENT_PROOF_HINT] = JSON.stringify(proofHintFlags);
|
||||
}
|
||||
|
||||
// If thread root (an eventId) is set, add that here
|
||||
if (threadRoot) {
|
||||
messageContent["m.relates_to"] = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue