executeAppleHealth method

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

Implementation

Future<void> executeAppleHealth(
  Database database,
  Preferences preferences,
  Http http,
  bool previousAccess,
) async {
  await database.init();
  final accessGranted = await preferences.getAppleHealthAccessGranted();
  if (accessGranted || previousAccess) {
    if (!accessGranted) {
      await preferences.setGoogleHealthConnectAccessGranted(true);
    }
    await _getAppleHealthData(preferences, http);
    await _syncAppleHealthData(database);
    await _deleteOldAppleHealthElements(database);
  }
}