Merge pull request #194 from pangeachat/speech-to-text-fixes
updated record package version for iOS fix
This commit is contained in:
commit
d29d5ce379
6 changed files with 72 additions and 12 deletions
|
|
@ -3944,5 +3944,6 @@
|
|||
"score": "Score",
|
||||
"accuracy": "Accuracy",
|
||||
"points": "Points",
|
||||
"noPaymentInfo": "No payment info necessary!"
|
||||
"noPaymentInfo": "No payment info necessary!",
|
||||
"updatePhoneOS": "You may need to update your device's OS version."
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/utils/update_version_dialog.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
|
@ -27,7 +28,10 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||
|
||||
bool error = false;
|
||||
String? _recordedPath;
|
||||
final _audioRecorder = Record();
|
||||
// #Pangea
|
||||
// final _audioRecorder = Record();
|
||||
final _audioRecorder = AudioRecorder();
|
||||
// Pangea#
|
||||
final List<double> amplitudeTimeline = [];
|
||||
|
||||
static const int bitRate = 64000;
|
||||
|
|
@ -45,13 +49,28 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||
return;
|
||||
}
|
||||
await WakelockPlus.enable();
|
||||
await _audioRecorder.start(
|
||||
path: _recordedPath,
|
||||
bitRate: bitRate,
|
||||
samplingRate: samplingRate,
|
||||
encoder: AudioEncoder.wav,
|
||||
numChannels: 1,
|
||||
// #Pangea
|
||||
final bool isNotError = await showUpdateVersionDialog(
|
||||
future: () =>
|
||||
// Pangea#
|
||||
_audioRecorder.start(
|
||||
path: _recordedPath!,
|
||||
const RecordConfig(
|
||||
bitRate: bitRate,
|
||||
sampleRate: samplingRate,
|
||||
encoder: AudioEncoder.wav,
|
||||
numChannels: 1,
|
||||
),
|
||||
),
|
||||
// #Pangea
|
||||
context: context,
|
||||
);
|
||||
|
||||
if (!isNotError) {
|
||||
Navigator.of(context).pop();
|
||||
return;
|
||||
}
|
||||
// Pangea#
|
||||
setState(() => _duration = Duration.zero);
|
||||
_recorderSubscription?.cancel();
|
||||
_recorderSubscription =
|
||||
|
|
|
|||
|
|
@ -107,10 +107,10 @@ class STTToken {
|
|||
return STTToken(
|
||||
token: PangeaToken.fromJson(json['token']),
|
||||
startTime: json['start_time'] != null
|
||||
? Duration(milliseconds: json['start_time'] * 1000.toInt())
|
||||
? Duration(milliseconds: (json['start_time'] * 1000).round())
|
||||
: null,
|
||||
endTime: json['end_time'] != null
|
||||
? Duration(milliseconds: json['end_time'] * 1000.toInt())
|
||||
? Duration(milliseconds: (json['end_time'] * 1000).round())
|
||||
: null,
|
||||
confidence: json['confidence'],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
|
|
@ -39,7 +40,17 @@ class PangeaAnyState {
|
|||
|
||||
void closeOverlay() {
|
||||
if (overlay != null) {
|
||||
overlay?.remove();
|
||||
try {
|
||||
overlay?.remove();
|
||||
} catch (err, s) {
|
||||
ErrorHandler.logError(
|
||||
e: err,
|
||||
s: s,
|
||||
data: {
|
||||
"overlay": overlay,
|
||||
},
|
||||
);
|
||||
}
|
||||
overlay = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
26
lib/pangea/utils/update_version_dialog.dart
Normal file
26
lib/pangea/utils/update_version_dialog.dart
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
Future<bool> showUpdateVersionDialog({
|
||||
required Future Function() future,
|
||||
required BuildContext context,
|
||||
}) async {
|
||||
try {
|
||||
await future();
|
||||
return true;
|
||||
} catch (err, s) {
|
||||
ErrorHandler.logError(
|
||||
e: err,
|
||||
s: s,
|
||||
);
|
||||
await showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context)!.oopsSomethingWentWrong,
|
||||
message: L10n.of(context)!.updatePhoneOS,
|
||||
okLabel: L10n.of(context)!.close,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -83,7 +83,10 @@ dependencies:
|
|||
punycode: ^1.0.0
|
||||
qr_code_scanner: ^1.0.1
|
||||
receive_sharing_intent: 1.4.5 # Update needs more work
|
||||
record: 4.4.4 # Upgrade to 5 currently breaks playing on iOS
|
||||
# #Pangea
|
||||
# record: 4.4.4 # Upgrade to 5 currently breaks playing on iOS
|
||||
record: ^5.0.5
|
||||
# Pangea#
|
||||
scroll_to_index: ^3.0.1
|
||||
share_plus: ^8.0.2
|
||||
shared_preferences: ^2.2.0 # Pinned because https://github.com/flutter/flutter/issues/118401
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue