1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Can upload a new logo for the group

This commit is contained in:
2020-05-02 08:51:34 +02:00
parent f450a46e99
commit 1a53a26f39
3 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,5 @@
import 'dart:typed_data';
import 'package:comunic/lists/groups_list.dart';
import 'package:comunic/models/advanced_group_info.dart';
import 'package:comunic/models/api_request.dart';
@ -226,6 +228,15 @@ class GroupsHelper {
.execWithThrow();
}
/// Upload a new logo
///
/// Throws in case of failure
static Future<void> uploadNewLogo(int groupID, Uint8List bytes) async =>
await APIRequest(uri: "groups/upload_logo", needLogin: true)
.addInt("id", groupID)
.addBytesFile("logo", BytesFile("logo.png", bytes))
.execWithFilesAndThrow();
/// Turn an API entry into a group object
Group _getGroupFromAPI(Map<String, dynamic> map) {
return Group(