chore: Update dependencies

This commit is contained in:
Christian Pauly 2022-08-14 16:59:21 +02:00
commit 7a74a8a93f
52 changed files with 163 additions and 175 deletions

View file

@ -104,10 +104,13 @@ class BackgroundPush {
}
factory BackgroundPush(
Client _client, BuildContext _context, GlobalKey<VRouterState>? router,
{final void Function(String errorMsg, {Uri? link})? onFcmError}) {
final instance = BackgroundPush.clientOnly(_client);
instance.context = _context;
Client client,
BuildContext context,
GlobalKey<VRouterState>? router, {
final void Function(String errorMsg, {Uri? link})? onFcmError,
}) {
final instance = BackgroundPush.clientOnly(client);
instance.context = context;
// ignore: prefer_initializing_formals
instance.router = router;
// ignore: prefer_initializing_formals
@ -341,9 +344,9 @@ class BackgroundPush {
}
} catch (e) {
Logs().i(
'[Push] No self-hosted unified push gateway present: ' + newEndpoint);
'[Push] No self-hosted unified push gateway present: $newEndpoint');
}
Logs().i('[Push] UnifiedPush using endpoint ' + endpoint);
Logs().i('[Push] UnifiedPush using endpoint $endpoint');
final oldTokens = <String?>{};
try {
final fcmToken = await firebase?.getToken();

View file

@ -23,10 +23,10 @@ class FluffyEmojiPickerView extends EmojiPickerBuilder {
: super(config, state);
@override
_DefaultEmojiPickerViewState createState() => _DefaultEmojiPickerViewState();
DefaultEmojiPickerViewState createState() => DefaultEmojiPickerViewState();
}
class _DefaultEmojiPickerViewState extends State<FluffyEmojiPickerView>
class DefaultEmojiPickerViewState extends State<FluffyEmojiPickerView>
with SingleTickerProviderStateMixin {
PageController? _pageController;
TabController? _tabController;
@ -267,12 +267,12 @@ class _DefaultEmojiPickerViewState extends State<FluffyEmojiPickerView>
return TextButton(
onPressed: onPressed,
onLongPress: onLongPressed,
child: child,
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
minimumSize: MaterialStateProperty.all(Size.zero),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
child: child,
);
}
return GestureDetector(

View file

@ -1,3 +1,5 @@
// ignore_for_file: depend_on_referenced_packages
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

View file

@ -33,15 +33,15 @@ Future<void> pushHelper(
Logs().wtf('Push Helper has crashed!', e, s);
// Initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
final _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
await _flutterLocalNotificationsPlugin.initialize(
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('notifications_icon'),
iOS: IOSInitializationSettings(),
),
onSelectNotification: onSelectNotification,
);
_flutterLocalNotificationsPlugin.show(
flutterLocalNotificationsPlugin.show(
0,
l10n?.newMessageInFluffyChat,
l10n?.openAppToReadMessages,
@ -83,8 +83,8 @@ Future<void> _tryPushHelper(
}
// Initialise the plugin. app_icon needs to be a added as a drawable resource to the Android head project
final _flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
await _flutterLocalNotificationsPlugin.initialize(
final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin();
await flutterLocalNotificationsPlugin.initialize(
const InitializationSettings(
android: AndroidInitializationSettings('notifications_icon'),
iOS: IOSInitializationSettings(),
@ -102,7 +102,7 @@ Future<void> _tryPushHelper(
Logs().v('Notification is a clearing indicator.');
if (notification.counts?.unread == 0) {
if (notification.counts == null || notification.counts?.unread == 0) {
await _flutterLocalNotificationsPlugin.cancelAll();
await flutterLocalNotificationsPlugin.cancelAll();
final store = await SharedPreferences.getInstance();
await store.setString(
SettingKeys.notificationCurrentIds, json.encode({}));
@ -185,7 +185,7 @@ Future<void> _tryPushHelper(
iOS: iOSPlatformChannelSpecifics,
);
await _flutterLocalNotificationsPlugin.show(
await flutterLocalNotificationsPlugin.show(
id,
event.room.displayname,
body,

View file

@ -15,7 +15,7 @@ extension ResizeImage on MatrixFile {
Future<MatrixVideoFile> resizeVideo() async {
final tmpDir = await getTemporaryDirectory();
final tmpFile = File(tmpDir.path + '/' + name);
final tmpFile = File('${tmpDir.path}/$name');
MediaInfo? mediaInfo;
await tmpFile.writeAsBytes(bytes);
try {
@ -37,7 +37,7 @@ extension ResizeImage on MatrixFile {
Future<MatrixImageFile?> getVideoThumbnail() async {
if (!PlatformInfos.isMobile) return null;
final tmpDir = await getTemporaryDirectory();
final tmpFile = File(tmpDir.path + '/' + name);
final tmpFile = File('${tmpDir.path}/$name');
if (await tmpFile.exists() == false) {
await tmpFile.writeAsBytes(bytes);
}

View file

@ -1,13 +0,0 @@
import 'dart:async';
import 'package:isolate/isolate.dart';
Future<T> runInBackground<T, U>(
FutureOr<T> Function(U arg) function, U arg) async {
final isolate = await IsolateRunner.spawn();
try {
return await isolate.run(function, arg);
} finally {
await isolate.close();
}
}

View file

@ -9,9 +9,9 @@ extension StreamExtension on Stream {
var gotMessage = false;
// as we call our inline-defined function recursively we need to make sure that the
// variable exists prior of creating the function. Silly dart.
Function? _onMessage;
Function? onMessage;
// callback to determine if we should send out an update
_onMessage = () {
onMessage = () {
// do nothing if it is already closed
if (controller.isClosed) {
return;
@ -25,7 +25,7 @@ extension StreamExtension on Stream {
// method to send out an update!
timer = null;
if (gotMessage) {
_onMessage?.call();
onMessage?.call();
}
});
} else {
@ -33,7 +33,7 @@ extension StreamExtension on Stream {
gotMessage = true;
}
};
final subscription = listen((_) => _onMessage?.call(),
final subscription = listen((_) => onMessage?.call(),
onDone: () => controller.close(),
onError: (e, s) => controller.addError(e, s));
// add proper cleanup to the subscription and the controller, to not memory leak

View file

@ -80,8 +80,8 @@ extension UiaRequestManager on MatrixState {
),
);
default:
final url = Uri.parse(client.homeserver.toString() +
'/_matrix/client/r0/auth/$stage/fallback/web?session=${uiaRequest.session}');
final url = Uri.parse(
'${client.homeserver}/_matrix/client/r0/auth/$stage/fallback/web?session=${uiaRequest.session}');
launch(
url.toString(),
forceSafariVC: true,

View file

@ -82,7 +82,7 @@ class UpdateCheckerNoStore {
final dir = await getTemporaryDirectory();
final response = await get(downloadUri(metadata));
if (response.statusCode == 200) {
final file = File(dir.path + '/fluffychat.msix');
final file = File('${dir.path}/fluffychat.msix');
await file.writeAsBytes(response.bodyBytes);
Process.start(file.path, [], runInShell: true);
} else {

View file

@ -80,7 +80,7 @@ class UrlLauncher {
final newHost = uri.host.split('.').map((hostPartEncoded) {
final hostPart = Uri.decodeComponent(hostPartEncoded);
final hostPartPunycode = punycodeEncode(hostPart);
return hostPartPunycode != hostPart + '-'
return hostPartPunycode != '$hostPart-'
? 'xn--$hostPartPunycode'
: hostPart;
}).join('.');