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

Start to build join group pane

This commit is contained in:
2021-04-23 18:46:35 +02:00
parent 1fa4ed59d4
commit 0cd6ed284b
7 changed files with 123 additions and 24 deletions

View File

@ -0,0 +1,17 @@
import 'package:comunic/helpers/groups_helper.dart';
import 'package:comunic/models/api_request.dart';
import 'package:comunic/models/group.dart';
/// Forez groups helper
///
/// @author Pierre Hubert
class ForezGroupsHelper {
static Future<List<Group>> getForezGroups() async {
return (await APIRequest.withLogin("forez/get_groups").execWithThrow())
.getArray()
.cast<Map<String, dynamic>>()
.map(GroupsHelper.getGroupFromAPI)
.toList();
}
}

View File

@ -70,7 +70,7 @@ class GroupsHelper {
response
.getObject()
.forEach((k, d) => list[int.parse(k)] = _getGroupFromAPI(d));
.forEach((k, d) => list[int.parse(k)] = getGroupFromAPI(d));
return list;
}
@ -370,7 +370,7 @@ class GroupsHelper {
.execWithThrow();
/// Turn an API entry into a group object
Group _getGroupFromAPI(Map<String, dynamic> map) {
static Group getGroupFromAPI(Map<String, dynamic> map) {
return Group(
id: map["id"],
name: map["name"],