chore: Update SDK

This commit is contained in:
Christian Pauly 2022-06-20 15:35:22 +02:00
commit 24ee341670
12 changed files with 94 additions and 46 deletions

View file

@ -399,6 +399,19 @@ class ChatController extends State<Chat> {
}
void voiceMessageAction() async {
if (PlatformInfos.isAndroid) {
final info = await DeviceInfoPlugin().androidInfo;
if ((info.version.sdkInt ?? 16) < 19) {
showOkAlertDialog(
context: context,
title: L10n.of(context)!.unsupportedAndroidVersion,
message: L10n.of(context)!.unsupportedAndroidVersionLong,
okLabel: L10n.of(context)!.close,
);
return;
}
}
if (await Record().hasPermission() == false) return;
final result = await showDialog<RecordingResult>(
context: context,

View file

@ -246,7 +246,8 @@ class ChatInputRow extends StatelessWidget {
),
),
),
if (PlatformInfos.isMobile && controller.inputText.isEmpty)
if (PlatformInfos.platformCanRecord &&
controller.inputText.isEmpty)
Container(
height: 56,
alignment: Alignment.center,

View file

@ -33,7 +33,7 @@ class _RecordingDialogState extends State<RecordingDialog> {
final List<double> amplitudeTimeline = [];
static const int bitRate = 64000;
static const double samplingRate = 22050.0;
static const int samplingRate = 22050;
Future<void> startRecording() async {
try {
@ -49,7 +49,6 @@ class _RecordingDialogState extends State<RecordingDialog> {
await Wakelock.enable();
await _audioRecorder.start(
path: _recordedPath,
encoder: AudioEncoder.AAC,
bitRate: bitRate,
samplingRate: samplingRate,
);

View file

@ -193,8 +193,8 @@ class _MyCallingPage extends State<Calling> {
final call = this.call;
if (call == null) return;
call.onCallStateChanged.listen(_handleCallState);
call.onCallEventChanged.listen((event) {
call.onCallStateChanged.stream.listen(_handleCallState);
call.onCallEventChanged.stream.listen((event) {
if (event == CallEvent.kFeedsChanged) {
setState(() {
call.tryRemoveStopedStreams();

View file

@ -30,6 +30,8 @@ abstract class PlatformInfos {
static bool get usesTouchscreen => !isMobile;
static bool get platformCanRecord => (isMobile || isMacOS);
static String get clientName =>
'${AppConfig.applicationName} ${isWeb ? 'web' : Platform.operatingSystem}${kReleaseMode ? '' : 'Debug'}';

View file

@ -11,7 +11,7 @@ import 'package:fluffychat/utils/voip_plugin.dart';
class CallKeeper {
CallKeeper(this.callKeepManager, this.uuid, this.number, this.call) {
call?.onCallStateChanged.listen(_handleCallState);
call?.onCallStateChanged.stream.listen(_handleCallState);
}
CallKeepManager callKeepManager;
@ -119,12 +119,12 @@ class CallKeepManager {
await displayIncomingCall(call);
call.onCallStateChanged.listen((state) {
call.onCallStateChanged.stream.listen((state) {
if (state == CallState.kEnded) {
_callKeep.endAllCalls();
}
});
call.onCallEventChanged.listen((event) {
call.onCallEventChanged.stream.listen((event) {
if (event == CallEvent.kLocalHoldUnhold) {
Logs().i(
'Call hold event: local ${call.localHold}, remote ${call.remoteOnHold}');

View file

@ -154,4 +154,14 @@ class VoipPlugin extends WidgetsBindingObserver implements WebRTCDelegate {
overlayEntry = null;
}
}
@override
void handleGroupCallEnded(GroupCall groupCall) {
// TODO: implement handleGroupCallEnded
}
@override
void handleNewGroupCall(GroupCall groupCall) {
// TODO: implement handleNewGroupCall
}
}