Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions openhealth/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ PODS:
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_blue_plus_darwin (from `.symlinks/plugins/flutter_blue_plus_darwin/darwin`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)

EXTERNAL SOURCES:
Flutter:
Expand All @@ -19,11 +23,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_blue_plus_darwin/darwin"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"

SPEC CHECKSUMS:
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_blue_plus_darwin: 20a08bfeaa0f7804d524858d3d8744bcc1b6dbc3
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0

PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e

Expand Down
25 changes: 25 additions & 0 deletions openhealth/lib/src/persistence/health_store.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:cgm_core/cgm_core.dart';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';

import 'sqflite_health_repository.dart';

export 'sqflite_health_repository.dart';

/// Default on-disk filename for the local health database.
const String kHealthDbFileName = 'openhealth_health.db';

/// Opens the app's local-first [HealthRepository], backed by sqflite in the
/// platform application-documents directory.
///
/// This is the production entry point the journaling / AI / HealthKit-import
/// features should use. Tests construct [SqfliteHealthRepository] directly with
/// an in-memory FFI factory instead, so they need no device or file system.
Future<HealthRepository> openHealthRepository({
String fileName = kHealthDbFileName,
}) async {
final dir = await getApplicationDocumentsDirectory();
final repo = SqfliteHealthRepository(path: p.join(dir.path, fileName));
await repo.init();
return repo;
}
Loading