executeGoogleHealthConnect method

Future<void> executeGoogleHealthConnect(
  1. Database database,
  2. Preferences preferences,
  3. Http http,
  4. bool previousAccess,
)

Implementation

Future<void> executeGoogleHealthConnect(
  Database database,
  Preferences preferences,
  Http http,
  bool previousAccess,
) async {
  await database.init();
  final accessGranted =
      await preferences.getGoogleHealthConnectAccessGranted();
  if (accessGranted || previousAccess) {
    if (!accessGranted) {
      await preferences.setGoogleHealthConnectAccessGranted(true);
    }
    await _getGoogleHealthConnectData(preferences, http);
    await _syncGoogleHealthConnectData(database);
    await _deleteOldGoogleHealthConnectElements(database);
  }
}