diff --git a/lib/constants/storage_paths.dart b/lib/constants/storage_paths.dart new file mode 100644 index 0000000..a521ff8 --- /dev/null +++ b/lib/constants/storage_paths.dart @@ -0,0 +1,7 @@ +// 撮影データの保存先に関する共有定数. + +/// 撮影画像・メタデータの既定の保存先ディレクトリ. +/// +/// 共有ストレージの `Pictures/MiniTIAS`.`FileService` の保存先と +/// `GalleryProvider` の取得元の既定値として参照される. +const defaultCaptureBasePath = '/storage/emulated/0/Pictures/MiniTIAS'; diff --git a/lib/providers/gallery_provider.dart b/lib/providers/gallery_provider.dart index 397d1a5..65b7ba4 100644 --- a/lib/providers/gallery_provider.dart +++ b/lib/providers/gallery_provider.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; +import 'package:smtias_capture/constants/storage_paths.dart'; import 'package:smtias_capture/services/raw_capture_service.dart'; /// 画像一覧の取得・キャッシュ・削除操作を管理する. @@ -11,11 +12,9 @@ /// MediaStore 通知に使うサービスもコンストラクタで差し替え可能(省略時は既定実装). /// テストでは一時ディレクトリを渡して実メソッドを直接検証できる. GalleryProvider({String? basePath, RawCaptureService? rawCaptureService}) - : _basePath = basePath ?? _defaultBasePath, + : _basePath = basePath ?? defaultCaptureBasePath, _rawCaptureService = rawCaptureService ?? RawCaptureService(); - static const _defaultBasePath = '/storage/emulated/0/Pictures/MiniTIAS'; - final String _basePath; final RawCaptureService _rawCaptureService; diff --git a/lib/services/file_service.dart b/lib/services/file_service.dart index 911d013..53ea0fe 100644 --- a/lib/services/file_service.dart +++ b/lib/services/file_service.dart @@ -2,15 +2,15 @@ import 'dart:io'; import 'dart:typed_data'; +import 'package:smtias_capture/constants/storage_paths.dart'; + /// 撮影画像の保存・命名・削除を行うサービス. class FileService { /// 保存先ディレクトリは省略可能(省略時は本番の共有ストレージパス). /// /// テストでは一時ディレクトリを渡して実メソッドを直接検証できる. FileService({String? directoryPath}) - : _directoryPath = directoryPath ?? _defaultBasePath; - - static const _defaultBasePath = '/storage/emulated/0/Pictures/MiniTIAS'; + : _directoryPath = directoryPath ?? defaultCaptureBasePath; final String _directoryPath;