Skip to content

Commit

Permalink
version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
josancamon19 committed Aug 16, 2024
1 parent 0b436d6 commit 31a360a
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
81 changes: 41 additions & 40 deletions app/lib/pages/capture/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:friend_private/pages/capture/widgets/widgets.dart';
import 'package:friend_private/pages/home/page.dart';
import 'package:friend_private/utils/audio/wav_bytes.dart';
import 'package:friend_private/utils/ble/communication.dart';
import 'package:friend_private/utils/enums.dart';
import 'package:friend_private/utils/memories/integrations.dart';
import 'package:friend_private/utils/memories/process.dart';
import 'package:friend_private/utils/other/temp.dart';
Expand All @@ -28,6 +29,7 @@ import 'package:internet_connection_checker_plus/internet_connection_checker_plu
import 'package:location/location.dart';
import 'package:uuid/uuid.dart';

import 'logic/phone_recorder_mixin.dart';
import 'logic/websocket_mixin.dart';

class CapturePage extends StatefulWidget {
Expand All @@ -47,8 +49,7 @@ class CapturePage extends StatefulWidget {
}

class CapturePageState extends State<CapturePage>
with AutomaticKeepAliveClientMixin, WidgetsBindingObserver, WebSocketMixin, OpenGlassMixin {
// PhoneRecorderMixin
with AutomaticKeepAliveClientMixin, WidgetsBindingObserver, PhoneRecorderMixin, WebSocketMixin, OpenGlassMixin {
@override
bool get wantKeepAlive => true;

Expand Down Expand Up @@ -401,7 +402,7 @@ class CapturePageState extends State<CapturePage>
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
// record.dispose();
record.dispose();

_bleBytesStream?.cancel();
_memoryCreationTimer?.cancel();
Expand Down Expand Up @@ -459,45 +460,45 @@ class CapturePageState extends State<CapturePage>
...connectionStatusWidgets(context, segments, wsConnectionState, _internetStatus),
const SizedBox(height: 16)
]),
// getPhoneMicRecordingButton(_recordingToggled, recordingState)
getPhoneMicRecordingButton(_recordingToggled, recordingState)
],
);
}

// _recordingToggled() async {
// if (recordingState == RecordingState.record) {
// if (Platform.isAndroid) {
// stopStreamRecordingOnAndroid();
// } else {
// await stopStreamRecording(wsConnectionState, websocketChannel);
// }
// setState(() => recordingState = RecordingState.stop);
// _memoryCreationTimer?.cancel();
// _createMemory();
// } else if (recordingState == RecordingState.initialising) {
// debugPrint('initialising, have to wait');
// } else {
// showDialog(
// context: context,
// builder: (c) => getDialog(
// context,
// () => Navigator.pop(context),
// () async {
// Navigator.pop(context);
// setState(() => recordingState = RecordingState.initialising);
// closeWebSocket();
// await initiateWebsocket(BleAudioCodec.pcm16, 16000);
// if (Platform.isAndroid) {
// await streamRecordingOnAndroid(wsConnectionState, websocketChannel);
// } else {
// await startStreamRecording(wsConnectionState, websocketChannel);
// }
// },
// 'Limited Capabilities',
// 'Recording with your phone microphone has a few limitations, including but not limited to: speaker profiles, background reliability.',
// okButtonText: 'Ok, I understand',
// ),
// );
// }
// }
_recordingToggled() async {
if (recordingState == RecordingState.record) {
if (Platform.isAndroid) {
stopStreamRecordingOnAndroid();
} else {
await stopStreamRecording(wsConnectionState, websocketChannel);
}
setState(() => recordingState = RecordingState.stop);
_memoryCreationTimer?.cancel();
_createMemory();
} else if (recordingState == RecordingState.initialising) {
debugPrint('initialising, have to wait');
} else {
showDialog(
context: context,
builder: (c) => getDialog(
context,
() => Navigator.pop(context),
() async {
Navigator.pop(context);
setState(() => recordingState = RecordingState.initialising);
closeWebSocket();
await initiateWebsocket(BleAudioCodec.pcm16, 16000);
if (Platform.isAndroid) {
await streamRecordingOnAndroid(wsConnectionState, websocketChannel);
} else {
await startStreamRecording(wsConnectionState, websocketChannel);
}
},
'Limited Capabilities',
'Recording with your phone microphone has a few limitations, including but not limited to: speaker profiles, background reliability.',
okButtonText: 'Ok, I understand',
),
);
}
}
}
2 changes: 1 addition & 1 deletion app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: friend_private
description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.25+80
version: 1.0.25+81

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down

0 comments on commit 31a360a

Please sign in to comment.