fluffychat merge
This commit is contained in:
commit
f63a07eefb
4 changed files with 42 additions and 43 deletions
|
|
@ -13,6 +13,7 @@ import 'package:wakelock_plus/wakelock_plus.dart';
|
|||
|
||||
import 'package:fluffychat/config/setting_keys.dart';
|
||||
import 'package:fluffychat/l10n/l10n.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||
import 'events/audio_player.dart';
|
||||
|
|
@ -39,11 +40,6 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
Timer? _recorderSubscription;
|
||||
Duration duration = Duration.zero;
|
||||
|
||||
// #Pangea
|
||||
// bool error = false;
|
||||
Object? error;
|
||||
bool loading = true;
|
||||
// Pangea#
|
||||
bool isSending = false;
|
||||
|
||||
bool get isRecording => _audioRecorder != null;
|
||||
|
|
@ -96,11 +92,12 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
|
||||
final result = await audioRecorder.hasPermission();
|
||||
if (result != true) {
|
||||
// #Pangea
|
||||
throw PermissionException();
|
||||
// setState(() => error = true);
|
||||
// return;
|
||||
// Pangea#
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).oopsSomethingWentWrong,
|
||||
message: L10n.of(context).noPermission,
|
||||
);
|
||||
return;
|
||||
}
|
||||
await WakelockPlus.enable();
|
||||
|
||||
|
|
@ -116,21 +113,16 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
),
|
||||
path: path ?? '',
|
||||
);
|
||||
// #Pangea
|
||||
// setState(() => duration = Duration.zero);
|
||||
setState(() {
|
||||
duration = Duration.zero;
|
||||
loading = false;
|
||||
});
|
||||
// Pangea#
|
||||
setState(() => duration = Duration.zero);
|
||||
_subscribe();
|
||||
// #Pangea
|
||||
// } catch (_) {
|
||||
// setState(() => error = true);
|
||||
} catch (e) {
|
||||
setState(() => error = e);
|
||||
// Pangea#
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +152,6 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
_audioRecorder?.stop();
|
||||
_audioRecorder = null;
|
||||
isSending = false;
|
||||
error = false;
|
||||
fileName = null;
|
||||
duration = Duration.zero;
|
||||
amplitudeTimeline.clear();
|
||||
|
|
@ -213,7 +204,11 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
// #Pangea
|
||||
if (amplitudeTimeline.isEmpty || amplitudeTimeline.every((e) => e <= 1)) {
|
||||
if (mounted) {
|
||||
setState(() => error = EmptyAudioException());
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).oopsSomethingWentWrong,
|
||||
message: EmptyAudioException().toLocalizedString(context),
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,14 +58,18 @@ extension LocalNotificationsExtension on MatrixState {
|
|||
const size = 128;
|
||||
const thumbnailMethod = ThumbnailMethod.crop;
|
||||
// Pre-cache so that we can later just set the thumbnail uri as icon:
|
||||
await client.downloadMxcCached(
|
||||
avatarUrl,
|
||||
width: size,
|
||||
height: size,
|
||||
thumbnailMethod: thumbnailMethod,
|
||||
isThumbnail: true,
|
||||
rounded: true,
|
||||
);
|
||||
try {
|
||||
await client.downloadMxcCached(
|
||||
avatarUrl,
|
||||
width: size,
|
||||
height: size,
|
||||
thumbnailMethod: thumbnailMethod,
|
||||
isThumbnail: true,
|
||||
rounded: true,
|
||||
);
|
||||
} catch (e, s) {
|
||||
Logs().d('Unable to pre-download avatar for web notification', e, s);
|
||||
}
|
||||
|
||||
thumbnailUri =
|
||||
await event.senderFromMemoryOrFallback.avatarUrl?.getThumbnailUri(
|
||||
|
|
|
|||
16
pubspec.lock
16
pubspec.lock
|
|
@ -1953,26 +1953,26 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: record
|
||||
sha256: "9dbc6ff3e784612f90a9b001373c45ff76b7a08abd2bd9fdf72c242320c8911c"
|
||||
sha256: "6bad72fb3ea6708d724cf8b6c97c4e236cf9f43a52259b654efeb6fd9b737f1f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.1"
|
||||
version: "6.1.2"
|
||||
record_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: record_android
|
||||
sha256: "8361a791c9a3fa5c065f0b8b5adb10f12531f8538c86b19474cf7b56ea80d426"
|
||||
sha256: fb54ee4e28f6829b8c580252a9ef49d9c549cfd263b0660ad7eeac0908658e9f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.4.1"
|
||||
version: "1.4.4"
|
||||
record_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: record_ios
|
||||
sha256: "13e241ed9cbc220534a40ae6b66222e21288db364d96dd66fb762ebd3cb77c71"
|
||||
sha256: "765b42ac1be019b1674ddd809b811fc721fe5a93f7bb1da7803f0d16772fd6d7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.2"
|
||||
version: "1.1.4"
|
||||
record_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1985,10 +1985,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: record_macos
|
||||
sha256: "2849068bb59072f300ad63ed146e543d66afaef8263edba4de4834fc7c8d4d35"
|
||||
sha256: "842ea4b7e95f4dd237aacffc686d1b0ff4277e3e5357865f8d28cd28bc18ed95"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "1.1.2"
|
||||
record_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ dependencies:
|
|||
qr_code_scanner_plus: ^2.0.13
|
||||
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: ^12.0.1
|
||||
shared_preferences: ^2.2.0 # Pinned because https://github.com/flutter/flutter/issues/118401
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue