fetchOwnProfileFromServer method

Future<Profile> fetchOwnProfileFromServer({
  1. bool useServerCache = false,
})

Returns the user's own displayname and avatar url. In SDN it is possible that one user can have different displaynames and avatar urls in different rooms. Tries to get the profile from node first, if failed, falls back to a profile from a room where the user exists. Set useServerCache to true to get any prior value from this function

Implementation

Future<Profile> fetchOwnProfileFromServer(
    {bool useServerCache = false}) async {
  try {
    return await getProfileFromUserId(
      userID!,
      getFromRooms: false,
      cache: useServerCache,
    );
  } catch (e) {
    Logs().w(
        '[SDN] getting profile from node failed, falling back to first room with required profile');
    return await getProfileFromUserId(
      userID!,
      getFromRooms: true,
      cache: true,
    );
  }
}