mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 04:04:18 +00:00 
			
		
		
		
	Start to display user groups
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import 'package:comunic/lists/groups_list.dart';
 | 
			
		||||
import 'package:comunic/models/api_request.dart';
 | 
			
		||||
import 'package:comunic/models/group.dart';
 | 
			
		||||
import 'package:comunic/utils/api_utils.dart';
 | 
			
		||||
 | 
			
		||||
/// Groups helper
 | 
			
		||||
///
 | 
			
		||||
@@ -91,11 +92,20 @@ class GroupsHelper {
 | 
			
		||||
    return list;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Get the list of groups of a user
 | 
			
		||||
  Future<Set<int>> getListUser() async =>
 | 
			
		||||
      (await APIRequest(uri: "groups/get_my_list", needLogin: true).exec())
 | 
			
		||||
          .assertOk()
 | 
			
		||||
          .getArray()
 | 
			
		||||
          .map((f) => cast<int>(f))
 | 
			
		||||
          .toSet();
 | 
			
		||||
 | 
			
		||||
  /// Turn an API entry into a group object
 | 
			
		||||
  Group _getGroupFromAPI(Map<String, dynamic> map) {
 | 
			
		||||
    return Group(
 | 
			
		||||
        id: map["id"],
 | 
			
		||||
        name: map["name"],
 | 
			
		||||
        iconURL: map["icon_url"],
 | 
			
		||||
        numberMembers: map["number_members"],
 | 
			
		||||
        membershipLevel: _APIGroupsMembershipLevelsMap[map["membership"]],
 | 
			
		||||
        visibilityLevel: _APIGroupsVisibilityLevelsMap[map["visibility"]],
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user