steal some changes from fluffychat
This commit is contained in:
parent
165d222726
commit
fc218e6d65
|
|
@ -254,7 +254,7 @@ class PollWidgetState extends State<PollWidget> {
|
|||
final event = widget.event;
|
||||
final content =
|
||||
event.content[PollEvents.PollStart] as Map<String, dynamic?>;
|
||||
final question = content?['question']?['m.text'] as String? ?? 'Poll';
|
||||
final question = content?['question']?['m.text'] as String? ?? content?['question']?['org.matrix.msc1767.text'] as String? ?? 'Poll';
|
||||
final List<dynamic> answers = content?['answers'] ?? [];
|
||||
final maxSelections = content?['max_selections'] as int? ?? 1;
|
||||
final kind = content?['kind'] as String?;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
Timer? _recorderSubscription;
|
||||
Duration duration = Duration.zero;
|
||||
|
||||
bool error = false;
|
||||
bool isSending = false;
|
||||
|
||||
bool get isRecording => _audioRecorder != null;
|
||||
|
|
@ -88,7 +87,11 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
|
||||
final result = await audioRecorder.hasPermission();
|
||||
if (result != true) {
|
||||
setState(() => error = true);
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).oopsSomethingWentWrong,
|
||||
message: L10n.of(context).noPermission,
|
||||
);
|
||||
return;
|
||||
}
|
||||
await WakelockPlus.enable();
|
||||
|
|
@ -107,9 +110,14 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
);
|
||||
setState(() => duration = Duration.zero);
|
||||
_subscribe();
|
||||
} catch (_) {
|
||||
setState(() => error = true);
|
||||
rethrow;
|
||||
} catch (e, s) {
|
||||
Logs().w('Unable to start voice message recording', e, s);
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).oopsSomethingWentWrong,
|
||||
message: e.toString(),
|
||||
);
|
||||
setState(_reset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +147,6 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
_audioRecorder?.stop();
|
||||
_audioRecorder = null;
|
||||
isSending = false;
|
||||
error = false;
|
||||
fileName = null;
|
||||
duration = Duration.zero;
|
||||
amplitudeTimeline.clear();
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ class MatrixLocals extends MatrixLocalizations {
|
|||
|
||||
MatrixLocals(this.l10n);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
String voiceMessage(String senderName, Duration? duration) {
|
||||
return l10n.voiceMessage;
|
||||
|
|
@ -358,4 +360,17 @@ class MatrixLocals extends MatrixLocalizations {
|
|||
|
||||
@override
|
||||
String get cancelledSend => l10n.sendCanceled;
|
||||
|
||||
@override
|
||||
// TODO: implement pollHasBeenEnded
|
||||
String get pollHasBeenEnded => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
String startedAPoll(String senderName) {
|
||||
// TODO: implement startedAPoll
|
||||
throw UnimplementedError();
|
||||
}
|
||||
|
||||
// This is currently not used, just to keep up with matrix-dart-sdk upstream.
|
||||
// I will reimplement polls to match fluffychat's, I don't know when...
|
||||
}
|
||||
|
|
|
|||
20
pubspec.lock
20
pubspec.lock
|
|
@ -253,10 +253,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: cross_file
|
||||
sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
|
||||
sha256: "942a4791cd385a68ccb3b32c71c427aba508a1bb949b86dff2adbe4049f16239"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.4+2"
|
||||
version: "0.3.5"
|
||||
crypto:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -730,10 +730,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_vodozemac
|
||||
sha256: "54cd3790b6dfdc1afce928f8c46f7eeea9e4f8326f077400894935926f202057"
|
||||
sha256: "16d4b44dd338689441fe42a80d0184e5c864e9563823de9e7e6371620d2c0590"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "0.4.1"
|
||||
flutter_web_auth_2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1203,10 +1203,10 @@ packages:
|
|||
description:
|
||||
path: "."
|
||||
ref: main
|
||||
resolved-ref: f678376e3a4825a6e1a00d89585d6bae0843950c
|
||||
resolved-ref: "8272294736361eae8f3c81d220aaffcf30f38fb1"
|
||||
url: "https://git.extera.xyz/OfficialDakari/matrix-dart-sdk.git"
|
||||
source: git
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1563,10 +1563,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: qr_code_scanner_plus
|
||||
sha256: a0f1ac8e13299b3db2646635f252fe2ec67222b848b24ed34d11052faf080bfa
|
||||
sha256: b764e5004251c58d9dee0c295e6006e05bd8d249e78ac3383abdb5afe0a996cd
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.12"
|
||||
version: "2.0.14"
|
||||
qr_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -2248,10 +2248,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: vodozemac
|
||||
sha256: "95cac62ffab94db99e134c8f9aac198f8131a4eed0bed76a6cfc9c72add229b9"
|
||||
sha256: "39144e20740807731871c9248d811ed5a037b21d0aa9ffcfa630954de74139d9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "0.4.0"
|
||||
wakelock_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
|||
10
pubspec.yaml
10
pubspec.yaml
|
|
@ -16,7 +16,7 @@ dependencies:
|
|||
blurhash_dart: ^1.2.1
|
||||
chewie: ^1.11.0
|
||||
collection: ^1.18.0
|
||||
cross_file: ^0.3.4+2
|
||||
cross_file: ^0.3.5
|
||||
cupertino_icons: any
|
||||
desktop_drop: ^0.4.4
|
||||
desktop_notifications: ^0.6.3
|
||||
|
|
@ -47,7 +47,7 @@ dependencies:
|
|||
git:
|
||||
url: https://github.com/famedly/flutter_typeahead.git
|
||||
ref: main
|
||||
flutter_vodozemac: ^0.3.0
|
||||
flutter_vodozemac: ^0.4.1
|
||||
flutter_web_auth_2: ^3.1.1 # Version 4 blocked by https://github.com/MixinNetwork/flutter-plugins/issues/379
|
||||
flutter_webrtc: ^0.12.9
|
||||
geolocator: ^13.0.1
|
||||
|
|
@ -79,10 +79,10 @@ dependencies:
|
|||
pretty_qr_code: ^3.2.1
|
||||
provider: ^6.0.2
|
||||
punycode: ^1.0.0
|
||||
qr_code_scanner_plus: ^2.0.10+1
|
||||
qr_code_scanner_plus: ^2.0.14
|
||||
qr_image: ^1.0.0
|
||||
receive_sharing_intent: ^1.8.1
|
||||
record: ^6.1.1
|
||||
record: ^6.1.2
|
||||
scroll_to_index: ^3.0.1
|
||||
share_plus: ^10.0.2
|
||||
shared_preferences: ^2.2.0 # Pinned because https://github.com/flutter/flutter/issues/118401
|
||||
|
|
@ -97,7 +97,7 @@ dependencies:
|
|||
url_launcher: ^6.2.5
|
||||
video_compress: ^3.1.4
|
||||
video_player: ^2.9.2
|
||||
vodozemac: ^0.3.0
|
||||
vodozemac: ^0.4.0
|
||||
wakelock_plus: ^1.2.2
|
||||
webrtc_interface: ^1.0.13
|
||||
dio: ^5.9.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue