mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Provide user credentials when signing in
This commit is contained in:
		@@ -20,7 +20,9 @@ class UsersHelper {
 | 
				
			|||||||
  Future<UsersList> _downloadInfo(List<int> users) async {
 | 
					  Future<UsersList> _downloadInfo(List<int> users) async {
 | 
				
			||||||
    // Execute the request
 | 
					    // Execute the request
 | 
				
			||||||
    final response = await APIRequest(
 | 
					    final response = await APIRequest(
 | 
				
			||||||
        uri: "user/getInfoMultiple", args: {"usersID": users.join(",")}).exec();
 | 
					        uri: "user/getInfoMultiple",
 | 
				
			||||||
 | 
					        needLogin: true,
 | 
				
			||||||
 | 
					        args: {"usersID": users.join(",")}).exec();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check if the request did not execute correctly
 | 
					    // Check if the request did not execute correctly
 | 
				
			||||||
    if (response.code != 200) return null;
 | 
					    if (response.code != 200) return null;
 | 
				
			||||||
@@ -63,24 +65,22 @@ class UsersHelper {
 | 
				
			|||||||
  /// the server, otherwise cached data will be used if available
 | 
					  /// the server, otherwise cached data will be used if available
 | 
				
			||||||
  Future<UsersList> getUsersInfo(List<int> users,
 | 
					  Future<UsersList> getUsersInfo(List<int> users,
 | 
				
			||||||
      {bool forceDownload = false}) async {
 | 
					      {bool forceDownload = false}) async {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    List<int> toDownload = List();
 | 
					    List<int> toDownload = List();
 | 
				
			||||||
    UsersList list = UsersList();
 | 
					    UsersList list = UsersList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Check cache
 | 
					    // Check cache
 | 
				
			||||||
    for(int userID in users){
 | 
					    for (int userID in users) {
 | 
				
			||||||
      if(!forceDownload && await _usersDatabaseHelper.has(userID))
 | 
					      if (!forceDownload && await _usersDatabaseHelper.has(userID))
 | 
				
			||||||
        list.add(await _usersDatabaseHelper.get(userID));
 | 
					        list.add(await _usersDatabaseHelper.get(userID));
 | 
				
			||||||
      else
 | 
					      else
 | 
				
			||||||
        toDownload.add(userID);
 | 
					        toDownload.add(userID);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Process download if required
 | 
					    // Process download if required
 | 
				
			||||||
    if(toDownload.length > 0) {
 | 
					    if (toDownload.length > 0) {
 | 
				
			||||||
      final downloadedList = await _downloadInfo(toDownload);
 | 
					      final downloadedList = await _downloadInfo(toDownload);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      if(downloadedList == null)
 | 
					      if (downloadedList == null) return null;
 | 
				
			||||||
        return null;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
      list.addAll(downloadedList);
 | 
					      list.addAll(downloadedList);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user