loadAppVersions method

Future<RequestResponse<bool?>> loadAppVersions()

Loads the apps installed in Frappé site and their versions.

Sets _appVersions on successful loading and returning true within RequestResponse.

If loading fails, a failure is returned.

Implementation

Future<RequestResponse<bool?>> loadAppVersions() async {
  final response = await config.coreInstance.call(
      <String, dynamic>{'cmd': 'renovation_core.utils.site.get_versions'});

  appVersionsLoaded = true;

  if (response.isSuccess) {
    final version = response.data!.message as Map<String, dynamic>?;
    if (version != null) {
      version.forEach((String k, dynamic v) {
        _appVersions[k] = AppVersion.fromString(k, v);
      });
    }
    return RequestResponse.success(true, rawResponse: response.rawResponse);
  }
  return RequestResponse.fail(handleError('errorId',
      response.error ?? ErrorDetail(title: 'Error getting app versions')));
}