mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-24 04:59:26 +01:00
chore: FIx share stories
This commit is contained in:
parent
79a2db9e63
commit
f9617b1b57
@ -170,23 +170,21 @@ class AddStoryController extends State<AddStoryPage> {
|
|||||||
|
|
||||||
final shareContent = Matrix.of(context).shareContent;
|
final shareContent = Matrix.of(context).shareContent;
|
||||||
if (shareContent != null) {
|
if (shareContent != null) {
|
||||||
|
controller.text = shareContent.tryGet<String>('body') ?? '';
|
||||||
final shareFile = shareContent.tryGet<MatrixFile>('file')?.detectFileType;
|
final shareFile = shareContent.tryGet<MatrixFile>('file')?.detectFileType;
|
||||||
|
|
||||||
controller.text = shareContent.tryGet<String>('body') ?? '';
|
|
||||||
if (shareFile is MatrixImageFile) {
|
if (shareFile is MatrixImageFile) {
|
||||||
Event(
|
setState(() {
|
||||||
content: shareContent,
|
image = shareFile;
|
||||||
type: EventTypes.Message,
|
|
||||||
room: Room(id: '!tmproom', client: Matrix.of(context).client),
|
|
||||||
eventId: 'tmpevent',
|
|
||||||
senderId: '@tmpsender:example',
|
|
||||||
originServerTs: DateTime.now(),
|
|
||||||
).downloadAndDecryptAttachment().then((file) {
|
|
||||||
setState(() {
|
|
||||||
image = shareFile;
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else if (shareFile is MatrixVideoFile) {
|
} else if (shareFile is MatrixVideoFile) {
|
||||||
|
setState(() {
|
||||||
|
video = shareFile;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
final msgType = shareContent.tryGet<String>('msgtype');
|
||||||
|
if (msgType == MessageTypes.Image) {
|
||||||
Event(
|
Event(
|
||||||
content: shareContent,
|
content: shareContent,
|
||||||
type: EventTypes.Message,
|
type: EventTypes.Message,
|
||||||
@ -196,7 +194,20 @@ class AddStoryController extends State<AddStoryPage> {
|
|||||||
originServerTs: DateTime.now(),
|
originServerTs: DateTime.now(),
|
||||||
).downloadAndDecryptAttachment().then((file) {
|
).downloadAndDecryptAttachment().then((file) {
|
||||||
setState(() {
|
setState(() {
|
||||||
video = shareFile;
|
image = file.detectFileType as MatrixImageFile;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else if (msgType == MessageTypes.Video) {
|
||||||
|
Event(
|
||||||
|
content: shareContent,
|
||||||
|
type: EventTypes.Message,
|
||||||
|
room: Room(id: '!tmproom', client: Matrix.of(context).client),
|
||||||
|
eventId: 'tmpevent',
|
||||||
|
senderId: '@tmpsender:example',
|
||||||
|
originServerTs: DateTime.now(),
|
||||||
|
).downloadAndDecryptAttachment().then((file) {
|
||||||
|
setState(() {
|
||||||
|
video = file.detectFileType as MatrixVideoFile;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user