fix: Remove uncompatible dependencies connectivity_plus and wakelock
This commit is contained in:
parent
bcbe82523c
commit
35367389f0
8 changed files with 8 additions and 85 deletions
|
|
@ -6,7 +6,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:record/record.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
|
@ -45,7 +45,7 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||
setState(() => error = true);
|
||||
return;
|
||||
}
|
||||
await Wakelock.enable();
|
||||
await WakelockPlus.enable();
|
||||
await _audioRecorder.start(
|
||||
path: _recordedPath,
|
||||
bitRate: bitRate,
|
||||
|
|
@ -77,7 +77,7 @@ class RecordingDialogState extends State<RecordingDialog> {
|
|||
|
||||
@override
|
||||
void dispose() {
|
||||
Wakelock.disable();
|
||||
WakelockPlus.disable();
|
||||
_recorderSubscription?.cancel();
|
||||
_audioRecorder.stop();
|
||||
super.dispose();
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import 'package:flutter_webrtc/flutter_webrtc.dart';
|
|||
import 'package:just_audio/just_audio.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:vibration/vibration.dart';
|
||||
import 'package:wakelock/wakelock.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
|
@ -223,7 +223,7 @@ class MyCallingPage extends State<Calling> {
|
|||
if (call.type == CallType.kVideo) {
|
||||
try {
|
||||
// Enable wakelock (keep screen on)
|
||||
unawaited(Wakelock.enable());
|
||||
unawaited(WakelockPlus.enable());
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
|
@ -235,7 +235,7 @@ class MyCallingPage extends State<Calling> {
|
|||
);
|
||||
if (call.type == CallType.kVideo) {
|
||||
try {
|
||||
unawaited(Wakelock.disable());
|
||||
unawaited(WakelockPlus.disable());
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import 'dart:core';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:connectivity_plus/connectivity_plus.dart';
|
||||
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
|
||||
import 'package:flutter_webrtc/flutter_webrtc.dart' as webrtc_impl;
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
|
@ -22,14 +21,6 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||
Client get client => matrix.client;
|
||||
VoipPlugin(this.matrix) {
|
||||
voip = VoIP(client, this);
|
||||
Connectivity()
|
||||
.onConnectivityChanged
|
||||
.listen(_handleNetworkChanged)
|
||||
.onError((e) => _currentConnectivity = ConnectivityResult.none);
|
||||
Connectivity()
|
||||
.checkConnectivity()
|
||||
.then((result) => _currentConnectivity = result)
|
||||
.catchError((e) => _currentConnectivity = ConnectivityResult.none);
|
||||
if (!kIsWeb) {
|
||||
final wb = WidgetsBinding.instance;
|
||||
wb.addObserver(this);
|
||||
|
|
@ -39,20 +30,9 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
|||
bool background = false;
|
||||
bool speakerOn = false;
|
||||
late VoIP voip;
|
||||
ConnectivityResult? _currentConnectivity;
|
||||
OverlayEntry? overlayEntry;
|
||||
BuildContext get context => matrix.context;
|
||||
|
||||
void _handleNetworkChanged(ConnectivityResult result) async {
|
||||
/// Got a new connectivity status!
|
||||
if (_currentConnectivity != result) {
|
||||
voip.calls.forEach((_, sess) {
|
||||
sess.restartIce();
|
||||
});
|
||||
}
|
||||
_currentConnectivity = result;
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangeAppLifecycleState(AppLifecycleState? state) {
|
||||
Logs().v('AppLifecycleState = $state');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue