fix
This commit is contained in:
parent
12f1cb7985
commit
ea62890ba0
|
@ -82,13 +82,6 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
|
|
||||||
var photos = attachments.where((attachment) => attachment['type'] == 'photo');
|
var photos = attachments.where((attachment) => attachment['type'] == 'photo');
|
||||||
|
|
||||||
// If there are more than four photos, move other photos to another array to be posted in the thread.
|
|
||||||
var otherPhotos = [];
|
|
||||||
if (photos.length > 4) {
|
|
||||||
otherPhotos = photos.skip(4).toList();
|
|
||||||
photos = photos.take(4).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> photoUrls = [];
|
List<String> photoUrls = [];
|
||||||
|
|
||||||
for (final photo in photos) {
|
for (final photo in photos) {
|
||||||
|
@ -102,6 +95,13 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
photoUrls.add(photoPath);
|
photoUrls.add(photoPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If there are more than four photos, move other photos to another array to be posted in the thread.
|
||||||
|
List<String> otherPhotos = [];
|
||||||
|
if (photoUrls.length > 4) {
|
||||||
|
otherPhotos = photos.skip(4).toList();
|
||||||
|
photoUrls = photos.take(4).toList();
|
||||||
|
}
|
||||||
|
|
||||||
// Post the post on Mastodon.
|
// Post the post on Mastodon.
|
||||||
// First we upload all photos with dio.
|
// First we upload all photos with dio.
|
||||||
// Then we post the post with the uploaded photos and the text.
|
// Then we post the post with the uploaded photos and the text.
|
||||||
|
@ -144,9 +144,9 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
mediaIds = [];
|
mediaIds = [];
|
||||||
if (otherPhotos.length > 4) {
|
if (otherPhotos.length > 4) {
|
||||||
otherPhotos = otherPhotos.skip(4).toList();
|
otherPhotos = otherPhotos.skip(4).toList();
|
||||||
photos = otherPhotos.take(4).toList();
|
photoUrls = otherPhotos.take(4).toList();
|
||||||
} else {
|
} else {
|
||||||
photos = otherPhotos;
|
photoUrls = otherPhotos;
|
||||||
otherPhotos = [];
|
otherPhotos = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue