chore: don't interupt message audio with button click sound

This commit is contained in:
ggurdin 2025-06-27 10:40:39 -04:00
parent fe9eaf539d
commit e6d2a68348
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
3 changed files with 29 additions and 20 deletions

View file

@ -209,28 +209,37 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
// #Pangea
// if (!kIsWeb) {
if (!kIsWeb && matrixFile != null) {
// Pangea#
final tempDir = await getTemporaryDirectory();
final fileName = Uri.encodeComponent(
// #Pangea
// widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
widget.event!.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
if (!kIsWeb) {
if (matrixFile != null) {
// Pangea#
);
file = File('${tempDir.path}/${fileName}_${matrixFile.name}');
final tempDir = await getTemporaryDirectory();
final fileName = Uri.encodeComponent(
// #Pangea
// widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
widget.event!.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
// Pangea#
);
file = File('${tempDir.path}/${fileName}_${matrixFile.name}');
await file.writeAsBytes(matrixFile.bytes);
await file.writeAsBytes(matrixFile.bytes);
if (Platform.isIOS &&
matrixFile.mimeType.toLowerCase() == 'audio/ogg') {
Logs().v('Convert ogg audio file for iOS...');
final convertedFile = File('${file.path}.caf');
if (await convertedFile.exists() == false) {
OpusCaf().convertOpusToCaf(file.path, convertedFile.path);
if (Platform.isIOS &&
matrixFile.mimeType.toLowerCase() == 'audio/ogg') {
Logs().v('Convert ogg audio file for iOS...');
final convertedFile = File('${file.path}.caf');
if (await convertedFile.exists() == false) {
OpusCaf().convertOpusToCaf(file.path, convertedFile.path);
}
file = convertedFile;
}
file = convertedFile;
// #Pangea
} else if (widget.matrixFile != null) {
final tempDir = await getTemporaryDirectory();
file = File('${tempDir.path}/${widget.matrixFile!.name}');
await file.writeAsBytes(widget.matrixFile!.bytes);
}
// Pangea#
}
setState(() {

View file

@ -206,8 +206,8 @@ class OverlayMessage extends StatelessWidget {
text: overlayController
.transcription!.transcript.text,
textLanguage: PLanguageStore.byLangCode(
pangeaMessageEvent!
.messageDisplayLangCode,
overlayController
.transcription!.langCode,
) ??
LanguageModel.unknown,
style: AppConfig.messageTextStyle(

View file

@ -492,7 +492,7 @@ class SelectModeButtonsState extends State<SelectModeButtons> {
borderRadius: BorderRadius.circular(20),
color: Theme.of(context).colorScheme.primaryContainer,
onPressed: () => _updateMode(mode),
playSound: true,
playSound: mode != SelectMode.audio,
colorFactor: Theme.of(context).brightness == Brightness.light
? 0.55
: 0.3,