initializeIdentityDependencies function

Future<bool> initializeIdentityDependencies({
  1. required String appID,
  2. String? defaultServiceID,
})

Implementation

Future<bool> initializeIdentityDependencies({required String appID, String? defaultServiceID}) async {
  if (defaultServiceID != null) ApiService.setDefaultServiceID(defaultServiceID);
  setApplicationID(appID);
  try {
    final ca = await PlatformAssetBundle().load('assets/certs/rootCA.pem');
    SecurityContext.defaultContext.setTrustedCertificatesBytes(ca.buffer.asInt8List());
  } catch (err) {
    LOG.printError([err]);
  }
  if (!_appInfoInited) {
    await ApplicationInfo().init();
    _appInfoInited = true;
  }
  if (!_managerInited) {
    var manager = SystemStorageManager();
    manager.setPreferencias(await ApplicationPreferenceManager().load());
    manager.addprovide((preferences) => ServerSettingsSorage(preferences));
    manager.addprovide((preferences) => LoginFielsStorage(preferences));
    manager.addprovide((preferences) => SelectedSucursalStorage(preferences));
    _managerInited = true;
  }
  if (!_soundInited) {
    await SoundService().init();
    _soundInited = true;
  }
  try {
    await ManagerSDKF().init(); //es probable que falle en versiones 8.1 de android
  } catch (e) {
    LOG.printError(e.toString());
  }
  return true;
}