fix: Remove uncompatible dependencies connectivity_plus and wakelock

pull/611/head
Krille 1 year ago
parent bcbe82523c
commit 35367389f0
No known key found for this signature in database

@ -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');

@ -6,7 +6,6 @@ import FlutterMacOS
import Foundation
import audio_session
import connectivity_plus
import desktop_drop
import desktop_lifecycle
import device_info_plus
@ -31,13 +30,11 @@ import shared_preferences_foundation
import sqflite
import url_launcher_macos
import video_compress
import wakelock_macos
import wakelock_plus
import window_to_front
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin"))
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin"))
DesktopLifecyclePlugin.register(with: registry.registrar(forPlugin: "DesktopLifecyclePlugin"))
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
@ -62,7 +59,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
VideoCompressPlugin.register(with: registry.registrar(forPlugin: "VideoCompressPlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
WindowToFrontPlugin.register(with: registry.registrar(forPlugin: "WindowToFrontPlugin"))
}

@ -177,22 +177,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.2"
connectivity_plus:
dependency: "direct main"
description:
name: connectivity_plus
sha256: "77a180d6938f78ca7d2382d2240eb626c0f6a735d0bfdce227d8ffb80f95c48b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
connectivity_plus_platform_interface:
dependency: transitive
description:
name: connectivity_plus_platform_interface
sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a
url: "https://pub.dev"
source: hosted
version: "1.2.4"
console:
dependency: transitive
description:
@ -1189,14 +1173,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
nm:
dependency: transitive
description:
name: nm
sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254"
url: "https://pub.dev"
source: hosted
version: "0.5.0"
olm:
dependency: transitive
description:
@ -2058,22 +2034,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "11.7.1"
wakelock:
dependency: "direct main"
description:
name: wakelock
sha256: "769ecf42eb2d07128407b50cb93d7c10bd2ee48f0276ef0119db1d25cc2f87db"
url: "https://pub.dev"
source: hosted
version: "0.6.2"
wakelock_macos:
dependency: transitive
description:
name: wakelock_macos
sha256: "047c6be2f88cb6b76d02553bca5a3a3b95323b15d30867eca53a19a0a319d4cd"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
wakelock_platform_interface:
dependency: transitive
description:
@ -2083,7 +2043,7 @@ packages:
source: hosted
version: "0.3.0"
wakelock_plus:
dependency: transitive
dependency: "direct main"
description:
name: wakelock_plus
sha256: aac3f3258f01781ec9212df94eecef1eb9ba9350e106728def405baa096ba413
@ -2098,14 +2058,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
wakelock_web:
dependency: transitive
description:
name: wakelock_web
sha256: "1b256b811ee3f0834888efddfe03da8d18d0819317f20f6193e2922b41a501b5"
url: "https://pub.dev"
source: hosted
version: "0.4.0"
wakelock_windows:
dependency: "direct overridden"
description:

@ -16,7 +16,6 @@ dependencies:
callkeep: ^0.3.2
chewie: ^1.3.6
collection: ^1.16.0
connectivity_plus: ^4.0.1
cupertino_icons: any
desktop_drop: ^0.4.0
desktop_lifecycle: ^0.1.0
@ -88,7 +87,7 @@ dependencies:
vibration: ^1.7.4-nullsafety.0
video_compress: ^3.1.1
video_player: ^2.2.18
wakelock: ^0.6.2
wakelock_plus: ^1.1.1
webrtc_interface: ^1.0.13
dev_dependencies:

@ -6,7 +6,6 @@
#include "generated_plugin_registrant.h"
#include <connectivity_plus/connectivity_plus_windows_plugin.h>
#include <desktop_drop/desktop_drop_plugin.h>
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
#include <dynamic_color/dynamic_color_plugin_c_api.h>
@ -22,8 +21,6 @@
#include <window_to_front/window_to_front_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
ConnectivityPlusWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
DesktopDropPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
DesktopLifecyclePluginRegisterWithRegistrar(

@ -3,7 +3,6 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
connectivity_plus
desktop_drop
desktop_lifecycle
dynamic_color

Loading…
Cancel
Save