debug
This commit is contained in:
parent
9b67dca0e8
commit
6bddb2e0b8
|
@ -102,6 +102,9 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
photoUrls = photoUrls.sublist(0, 4);
|
photoUrls = photoUrls.sublist(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print('photoUrls: $photoUrls');
|
||||||
|
print('otherPhotos: $otherPhotos');
|
||||||
|
|
||||||
// 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.
|
||||||
|
@ -132,10 +135,10 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
mediaIds.add(resp.data['id']);
|
mediaIds.add(resp.data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
var postResponse = await dio.post('$instanceUrl/api/v1/statuses',
|
// var postResponse = await dio.post('$instanceUrl/api/v1/statuses',
|
||||||
data: {'status': postText, 'media_ids': mediaIds},
|
// data: {'status': postText, 'media_ids': mediaIds},
|
||||||
options:
|
// options:
|
||||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
// dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||||
|
|
||||||
await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete()));
|
await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete()));
|
||||||
|
|
||||||
|
@ -150,6 +153,9 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
otherPhotos = [];
|
otherPhotos = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print('photoUrls: $photoUrls');
|
||||||
|
print('otherPhotos: $otherPhotos');
|
||||||
|
|
||||||
for (final photoUrl in photoUrls) {
|
for (final photoUrl in photoUrls) {
|
||||||
final resp = await dio.post('$instanceUrl/api/v1/media',
|
final resp = await dio.post('$instanceUrl/api/v1/media',
|
||||||
data: dio_lib.FormData.fromMap(
|
data: dio_lib.FormData.fromMap(
|
||||||
|
@ -159,13 +165,13 @@ Future<void> _postOnMastodon(reqJson) async {
|
||||||
mediaIds.add(resp.data['id']);
|
mediaIds.add(resp.data['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
postResponse = await dio.post('$instanceUrl/api/v1/statuses',
|
// postResponse = await dio.post('$instanceUrl/api/v1/statuses',
|
||||||
data: {
|
// data: {
|
||||||
'in_reply_to_id': postResponse.data['id'],
|
// 'in_reply_to_id': postResponse.data['id'],
|
||||||
'media_ids': mediaIds
|
// 'media_ids': mediaIds
|
||||||
},
|
// },
|
||||||
options:
|
// options:
|
||||||
dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
// dio_lib.Options(headers: {'Authorization': 'Bearer $authToken'}));
|
||||||
|
|
||||||
await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete()));
|
await Future.wait(photoUrls.map((photoUrl) => File(photoUrl).delete()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue