Skip to content
Merged
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
19 changes: 19 additions & 0 deletions open_wearable/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
PODS:
- audioplayers_darwin (0.0.1):
- Flutter
- FlutterMacOS
- DKImagePickerController/Core (4.3.9):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
Expand Down Expand Up @@ -48,6 +51,8 @@ PODS:
- SwiftProtobuf
- open_file_ios (1.0.3):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- permission_handler_apple (9.3.0):
- Flutter
- SDWebImage (5.21.5):
Expand All @@ -66,20 +71,25 @@ PODS:
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
- Flutter
- ZIPFoundation (0.9.19)

DEPENDENCIES:
- audioplayers_darwin (from `.symlinks/plugins/audioplayers_darwin/darwin`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- file_selector_ios (from `.symlinks/plugins/file_selector_ios/ios`)
- Flutter (from `Flutter`)
- flutter_archive (from `.symlinks/plugins/flutter_archive/ios`)
- mcumgr_flutter (from `.symlinks/plugins/mcumgr_flutter/ios`)
- open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- universal_ble (from `.symlinks/plugins/universal_ble/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

SPEC REPOS:
trunk:
Expand All @@ -93,6 +103,8 @@ SPEC REPOS:
- ZIPFoundation

EXTERNAL SOURCES:
audioplayers_darwin:
:path: ".symlinks/plugins/audioplayers_darwin/darwin"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
file_selector_ios:
Expand All @@ -105,6 +117,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/mcumgr_flutter/ios"
open_file_ios:
:path: ".symlinks/plugins/open_file_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
share_plus:
Expand All @@ -115,8 +129,11 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/universal_ble/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
audioplayers_darwin: 835ced6edd4c9fc8ebb0a7cc9e294a91d99917d5
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
Expand All @@ -126,6 +143,7 @@ SPEC CHECKSUMS:
iOSMcuManagerLibrary: e9555825af11a61744fe369c12e1e66621061b58
mcumgr_flutter: 969e99cc15e9fe658242669ce1075bf4612aef8a
open_file_ios: 46184d802ee7959203f6392abcfa0dd49fdb5be0
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
SDWebImage: e9c98383c7572d713c1a0d7dd2783b10599b9838
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
Expand All @@ -135,6 +153,7 @@ SPEC CHECKSUMS:
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
universal_ble: ff19787898040d721109c6324472e5dd4bc86adc
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
ZIPFoundation: b8c29ea7ae353b309bc810586181fd073cb3312c

PODFILE CHECKSUM: 251cb053df7158f337c0712f2ab29f4e0fa474ce
Expand Down
52 changes: 35 additions & 17 deletions open_wearable/lib/view_models/sensor_recorder_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,32 +34,35 @@ class SensorRecorderProvider with ChangeNotifier {
String? get currentDirectory => _currentDirectory;
DateTime? get recordingStart => _recordingStart;

void startRecording(String dirname) async {
_isRecording = true;
Future<void> startRecording(String dirname) async {
if (_isRecording) {
return;
}

_currentDirectory = dirname;
_recordingStart = DateTime.now();

for (Wearable wearable in _recorders.keys) {
await _startRecorderForWearable(wearable, dirname);
try {
for (Wearable wearable in _recorders.keys) {
await _startRecorderForWearable(wearable, dirname);
}
_isRecording = true;
notifyListeners();
} catch (e, st) {
logger.e('Failed to start recording: $e\n$st');
_stopAllRecorderStreams();
_currentDirectory = null;
_recordingStart = null;
_isRecording = false;
notifyListeners();
rethrow;
}

notifyListeners();
}

void stopRecording() {
_isRecording = false;
_recordingStart = null;
for (Wearable wearable in _recorders.keys) {
for (Sensor sensor in _recorders[wearable]!.keys) {
Recorder? recorder = _recorders[wearable]?[sensor];
if (recorder != null) {
recorder.stop();
logger.i(
'Stopped recording for ${wearable.name} - ${sensor.sensorName}',
);
}
}
}
_stopAllRecorderStreams();
notifyListeners();
}

Expand Down Expand Up @@ -172,6 +175,21 @@ class SensorRecorderProvider with ChangeNotifier {
}
}

void _stopAllRecorderStreams() {
for (Wearable wearable in _recorders.keys) {
for (Sensor sensor in _recorders[wearable]!.keys) {
final recorder = _recorders[wearable]?[sensor];
if (recorder == null) {
continue;
}
recorder.stop();
logger.i(
'Stopped recording for ${wearable.name} - ${sensor.sensorName}',
);
}
}
}

@override
void dispose() {
for (final wearable in _recorders.keys.toList()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,13 @@ class _LocalRecorderViewState extends State<LocalRecorderView> {
if (!proceed) return;
}

recorder.startRecording(dir);
await _listRecordings();
try {
await recorder.startRecording(dir);
await _listRecordings();
} catch (e) {
_logger.e('Error starting recording: $e');
await _showErrorDialog('Failed to start recording: $e');
}
}

Future<void> _openRecordingFile(File file) async {
Expand Down
2 changes: 0 additions & 2 deletions open_wearable/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import file_selector_macos
import flutter_archive
import open_file_mac
import package_info_plus
import path_provider_foundation
import share_plus
import shared_preferences_foundation
import universal_ble
Expand All @@ -25,7 +24,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterArchivePlugin.register(with: registry.registrar(forPlugin: "FlutterArchivePlugin"))
OpenFilePlugin.register(with: registry.registrar(forPlugin: "OpenFilePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UniversalBlePlugin.register(with: registry.registrar(forPlugin: "UniversalBlePlugin"))
Expand Down
7 changes: 0 additions & 7 deletions open_wearable/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ PODS:
- FlutterMacOS
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- share_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
Expand All @@ -39,7 +36,6 @@ DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- open_file_mac (from `Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- universal_ble (from `Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin`)
Expand All @@ -65,8 +61,6 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/open_file_mac/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
shared_preferences_foundation:
Expand All @@ -86,7 +80,6 @@ SPEC CHECKSUMS:
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
open_file_mac: 76f06c8597551249bdb5e8fd8827a98eae0f4585
package_info_plus: f0052d280d17aa382b932f399edf32507174e870
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
share_plus: 510bf0af1a42cd602274b4629920c9649c52f4cc
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
universal_ble: ff19787898040d721109c6324472e5dd4bc86adc
Expand Down
Loading
Loading