chore: FIx share stories

onboarding
Krille Fear 4 years ago
parent d87c4de5b0
commit 97066eed0f

@ -170,10 +170,21 @@ class AddStoryController extends State<AddStoryPage> {
final shareContent = Matrix.of(context).shareContent;
if (shareContent != null) {
controller.text = shareContent.tryGet<String>('body') ?? '';
final shareFile = shareContent.tryGet<MatrixFile>('file')?.detectFileType;
controller.text = shareContent.tryGet<String>('body') ?? '';
if (shareFile is MatrixImageFile) {
setState(() {
image = shareFile;
});
} else if (shareFile is MatrixVideoFile) {
setState(() {
video = shareFile;
});
}
final msgType = shareContent.tryGet<String>('msgtype');
if (msgType == MessageTypes.Image) {
Event(
content: shareContent,
type: EventTypes.Message,
@ -183,10 +194,10 @@ class AddStoryController extends State<AddStoryPage> {
originServerTs: DateTime.now(),
).downloadAndDecryptAttachment().then((file) {
setState(() {
image = shareFile;
image = file.detectFileType as MatrixImageFile;
});
});
} else if (shareFile is MatrixVideoFile) {
} else if (msgType == MessageTypes.Video) {
Event(
content: shareContent,
type: EventTypes.Message,
@ -196,7 +207,7 @@ class AddStoryController extends State<AddStoryPage> {
originServerTs: DateTime.now(),
).downloadAndDecryptAttachment().then((file) {
setState(() {
video = shareFile;
video = file.detectFileType as MatrixVideoFile;
});
});
}

Loading…
Cancel
Save