revert some changes

This commit is contained in:
otsmr 2025-10-17 23:19:00 +02:00
parent 7063da6a2b
commit d79e7c5bc7
18 changed files with 128 additions and 138 deletions

View file

@ -24,3 +24,4 @@ linter:
public_member_api_docs: false
avoid_catches_without_on_clauses: false
document_ignores: false
discarded_futures: false

View file

@ -138,13 +138,12 @@ Future<bool> authenticateUser(
final auth = LocalAuthentication();
final didAuthenticate = await auth.authenticate(
localizedReason: localizedReason,
options: const AuthenticationOptions(useErrorDialogs: false),
);
if (didAuthenticate) {
return true;
}
} on PlatformException catch (e) {
debugPrint(e.toString());
} on LocalAuthException catch (e) {
Log.error(e.toString());
if (!force) {
return true;
}

View file

@ -118,9 +118,9 @@ class CameraPreviewControllerView extends StatelessWidget {
);
} else {
return PermissionHandlerView(
onSuccess: () async {
onSuccess: () {
// setState(() {});
await selectCamera(0, true, false);
selectCamera(0, true, false);
},
);
}
@ -175,7 +175,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
@override
void initState() {
super.initState();
unawaited(initAsync());
initAsync();
}
Future<void> initAsync() async {
@ -410,7 +410,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
try {
await cameraController?.startVideoRecording();
videoRecordingTimer =
Timer.periodic(const Duration(milliseconds: 15), (timer) async {
Timer.periodic(const Duration(milliseconds: 15), (timer) {
setState(() {
currentTime = DateTime.now();
});
@ -419,7 +419,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
maxVideoRecordingTime) {
timer.cancel();
videoRecordingTimer = null;
await stopVideoRecording();
stopVideoRecording();
}
});
setState(() {
@ -510,7 +510,7 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
});
},
onLongPressMoveUpdate: onPanUpdate,
onLongPressStart: (details) async {
onLongPressStart: (details) {
setState(() {
basePanY = details.localPosition.dy;
baseScaleFactor = widget.selectedCameraDetails.scaleFactor;
@ -524,14 +524,14 @@ class _CameraPreviewViewState extends State<CameraPreviewView> {
Rect.fromLTWH(0, 0, renderBox.size.width, renderBox.size.height);
if (containerRect.contains(localPosition)) {
await startVideoRecording();
startVideoRecording();
}
},
onLongPressEnd: (a) async {
await stopVideoRecording();
onLongPressEnd: (a) {
stopVideoRecording();
},
onPanEnd: (a) async {
await stopVideoRecording();
onPanEnd: (a) {
stopVideoRecording();
},
onPanUpdate: onPanUpdate,
child: Stack(

View file

@ -27,7 +27,6 @@ class CameraSendToViewState extends State<CameraSendToView> {
@override
void dispose() {
// ignore: discarded_futures
cameraController?.dispose();
cameraController = null;
selectedCameraDetails = SelectedCameraDetails();

View file

@ -85,18 +85,17 @@ class _TextViewState extends State<TextLayer> {
},
onTapOutside: (a) async {
widget.layerData.text = textController.text;
Future.delayed(const Duration(milliseconds: 100), () {
Future.delayed(const Duration(milliseconds: 100), () async {
if (context.mounted) {
setState(() async {
widget.layerData.isDeleted = textController.text == '';
widget.layerData.isEditing = false;
await context
.read<ImageEditorProvider>()
.updateSomeTextViewIsAlreadyEditing(false);
if (widget.onUpdate != null) {
widget.onUpdate!();
}
});
widget.layerData.isDeleted = textController.text == '';
widget.layerData.isEditing = false;
await context
.read<ImageEditorProvider>()
.updateSomeTextViewIsAlreadyEditing(false);
if (widget.onUpdate != null) {
widget.onUpdate!();
}
if (mounted) setState(() {});
}
});
@ -150,13 +149,12 @@ class _TextViewState extends State<TextLayer> {
.watch<ImageEditorProvider>()
.someTextViewIsAlreadyEditing)
? null
: () {
setState(() async {
await context
.read<ImageEditorProvider>()
.updateSomeTextViewIsAlreadyEditing(true);
widget.layerData.isEditing = true;
});
: () async {
await context
.read<ImageEditorProvider>()
.updateSomeTextViewIsAlreadyEditing(true);
widget.layerData.isEditing = true;
if (mounted) setState(() {});
},
onScaleUpdate: (detail) async {
if (detail.pointerCount == 1) {

View file

@ -88,12 +88,11 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
loadingImage = false;
});
videoController = VideoPlayerController.file(widget.videoFilePath!);
// ignore: discarded_futures
videoController?.setLooping(true);
videoController?.initialize().then((_) async {
await videoController!.play();
setState(() {});
// ignore: invalid_return_type_for_catch_error, argument_type_not_assignable_to_error_handler, discarded_futures
// ignore: invalid_return_type_for_catch_error, argument_type_not_assignable_to_error_handler
}).catchError(Log.error);
}
}
@ -125,7 +124,6 @@ class _ShareImageEditorView extends State<ShareImageEditorView> {
void dispose() {
isDisposed = true;
layers.clear();
// ignore: discarded_futures
videoController?.dispose();
super.dispose();
}

View file

@ -229,11 +229,10 @@ class _ShareImageView extends State<ShareImageView> {
);
},
),
onChanged: (a) {
setState(() async {
hideArchivedUsers = !hideArchivedUsers;
await _filterUsers(lastQuery);
});
onChanged: (a) async {
hideArchivedUsers = !hideArchivedUsers;
await _filterUsers(lastQuery);
if (mounted) setState(() {});
},
),
),

View file

@ -54,7 +54,7 @@ class _ChatListViewState extends State<ChatListView> {
@override
void initState() {
unawaited(initAsync());
initAsync();
super.initState();
}
@ -112,7 +112,7 @@ class _ChatListViewState extends State<ChatListView> {
@override
void dispose() {
tutorial?.cancel();
unawaited(_contactsSub.cancel());
_contactsSub.cancel();
super.dispose();
}
@ -148,8 +148,8 @@ class _ChatListViewState extends State<ChatListView> {
const Text('twonly '),
if (planId != 'Free')
GestureDetector(
onTap: () async {
await Navigator.push(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
@ -191,8 +191,8 @@ class _ChatListViewState extends State<ChatListView> {
child: IconButton(
key: searchForOtherUsers,
icon: const FaIcon(FontAwesomeIcons.userPlus, size: 18),
onPressed: () async {
await Navigator.push(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AddNewUserView(),
@ -234,8 +234,8 @@ class _ChatListViewState extends State<ChatListView> {
padding: const EdgeInsets.all(10),
child: OutlinedButton.icon(
icon: const Icon(Icons.person_add),
onPressed: () async {
await Navigator.push(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AddNewUserView(),
@ -302,8 +302,8 @@ class _ChatListViewState extends State<ChatListView> {
floatingActionButton: Padding(
padding: const EdgeInsets.only(bottom: 30),
child: FloatingActionButton(
onPressed: () async {
await Navigator.push(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
@ -353,8 +353,8 @@ class _UserListItem extends State<UserListItem> {
@override
void dispose() {
unawaited(messagesNotOpenedStream.cancel());
unawaited(lastMessageStream.cancel());
messagesNotOpenedStream.cancel();
lastMessageStream.cancel();
super.dispose();
}
@ -506,8 +506,8 @@ class _UserListItem extends State<UserListItem> {
trailing: (widget.user.deleted)
? null
: IconButton(
onPressed: () async {
await Navigator.push(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {

View file

@ -91,7 +91,7 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
super.initState();
user = widget.contact;
textFieldFocus = FocusNode();
unawaited(initStreams());
initStreams();
tutorial = Timer(const Duration(seconds: 1), () async {
tutorial = null;
@ -102,8 +102,8 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
@override
void dispose() {
unawaited(userSub.cancel());
unawaited(messageSub.cancel());
userSub.cancel();
messageSub.cancel();
tutorial?.cancel();
textFieldFocus.dispose();
super.dispose();
@ -283,8 +283,8 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
child: Scaffold(
appBar: AppBar(
title: GestureDetector(
onTap: () async {
await Navigator.push(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
@ -426,8 +426,8 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
currentInputText = value;
setState(() {});
},
onSubmitted: (_) async {
await _sendMessage();
onSubmitted: (_) {
_sendMessage();
},
decoration: inputTextMessageDeco(context),
),
@ -444,8 +444,8 @@ class _ChatMessagesViewState extends State<ChatMessagesView> {
IconButton(
icon: const FaIcon(FontAwesomeIcons.camera),
padding: const EdgeInsets.all(15),
onPressed: () async {
await Navigator.push(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {

View file

@ -70,7 +70,6 @@ class _InChatMediaViewerState extends State<InChatMediaViewer> {
@override
void dispose() {
super.dispose();
// ignore: discarded_futures
messageStream?.cancel();
_timer?.cancel();
// videoController?.dispose();

View file

@ -1,3 +1,5 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -23,12 +25,12 @@ class _SlidingResponseWidgetState extends State<MessageActions> {
bool gotFeedback = false;
void _onHorizontalDragUpdate(DragUpdateDetails details) {
setState(() async {
setState(() {
_offsetX += details.delta.dx;
if (_offsetX > 40) {
_offsetX = 40;
if (!gotFeedback) {
await HapticFeedback.heavyImpact();
unawaited(HapticFeedback.heavyImpact());
gotFeedback = true;
}
}

View file

@ -1,4 +1,4 @@
// ignore_for_file: inference_failure_on_collection_literal, avoid_dynamic_calls, discarded_futures
// ignore_for_file: avoid_dynamic_calls
import 'dart:async';
import 'dart:convert';
@ -78,7 +78,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
allMediaFiles = [widget.initialMessage!];
}
unawaited(asyncLoadNextMedia(true));
asyncLoadNextMedia(true);
}
@override
@ -96,7 +96,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
final messages =
twonlyDB.messagesDao.watchMediaMessageNotOpened(widget.contact.userId);
_subscription = messages.listen((messages) async {
_subscription = messages.listen((messages) {
for (final msg in messages) {
// if (!allMediaFiles.any((m) => m.messageId == msg.messageId)) {
// allMediaFiles.add(msg);
@ -116,7 +116,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
}
setState(() {});
if (firstRun) {
await loadCurrentMediaFile();
loadCurrentMediaFile();
// ignore: parameter_assignments
firstRun = false;
}
@ -239,9 +239,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
videoController = VideoPlayerController.file(File(videoPathTmp.path));
await videoController
?.setLooping(content.maxShowTime == gMediaShowInfinite);
await videoController?.initialize().then((_) async {
await videoController!.play();
videoController?.addListener(() async {
await videoController?.initialize().then((_) {
videoController!.play();
videoController?.addListener(() {
setState(() {
progress = 1 -
videoController!.value.position.inSeconds /
@ -250,7 +250,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
if (content.maxShowTime != gMediaShowInfinite) {
if (videoController?.value.position ==
videoController?.value.duration) {
await nextMediaOrExit();
nextMediaOrExit();
}
}
});
@ -290,10 +290,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
void startTimer() {
nextMediaTimer?.cancel();
progressTimer?.cancel();
nextMediaTimer =
Timer(canBeSeenUntil!.difference(DateTime.now()), () async {
nextMediaTimer = Timer(canBeSeenUntil!.difference(DateTime.now()), () {
if (context.mounted) {
await nextMediaOrExit();
nextMediaOrExit();
}
});
progressTimer = Timer.periodic(const Duration(milliseconds: 10), (timer) {
@ -481,7 +480,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
if ((imageBytes != null || videoController != null) &&
(canBeSeenUntil == null || progress >= 0))
GestureDetector(
onTap: () async {
onTap: () {
if (showSendTextMessageInput) {
setState(() {
showShortReactions = false;
@ -489,7 +488,7 @@ class _MediaViewerViewState extends State<MediaViewerView> {
});
return;
}
await nextMediaOrExit();
nextMediaOrExit();
},
child: MediaViewSizing(
bottomNavigation: bottomNavigation(),
@ -538,8 +537,8 @@ class _MediaViewerViewState extends State<MediaViewerView> {
if (isRealTwonly && imageBytes == null)
Positioned.fill(
child: GestureDetector(
onTap: () async {
await loadCurrentMediaFile(showTwonly: true);
onTap: () {
loadCurrentMediaFile(showTwonly: true);
},
child: Column(
children: [
@ -659,9 +658,9 @@ class _MediaViewerViewState extends State<MediaViewerView> {
),
IconButton(
icon: const FaIcon(FontAwesomeIcons.solidPaperPlane),
onPressed: () async {
onPressed: () {
if (textMessageController.text.isNotEmpty) {
await sendTextMessage(
sendTextMessage(
widget.contact.userId,
TextMessageContent(
text: textMessageController.text,
@ -739,7 +738,7 @@ class _ReactionButtonsState extends State<ReactionButtons> {
@override
void initState() {
super.initState();
unawaited(initAsync());
initAsync();
}
Future<void> initAsync() async {
@ -847,8 +846,8 @@ class _EmojiReactionWidgetState extends State<EmojiReactionWidget> {
duration: const Duration(milliseconds: 200),
curve: Curves.linearToEaseOut,
child: GestureDetector(
onTap: () async {
await sendTextMessage(
onTap: () {
sendTextMessage(
widget.userId,
TextMessageContent(
text: widget.emoji,
@ -865,10 +864,12 @@ class _EmojiReactionWidgetState extends State<EmojiReactionWidget> {
selectedShortReaction = 0; // Assuming index is 0 for this example
});
Future.delayed(const Duration(milliseconds: 300), () {
setState(() {
widget.hide();
selectedShortReaction = -1;
});
if (mounted) {
setState(() {
widget.hide();
selectedShortReaction = -1;
});
}
});
},
child: (selectedShortReaction ==

View file

@ -107,7 +107,6 @@ class HomeViewState extends State<HomeView> {
void dispose() {
unawaited(selectNotificationStream.close());
disableCameraTimer?.cancel();
// ignore: discarded_futures
cameraController?.dispose();
super.dispose();
}
@ -232,15 +231,14 @@ class HomeViewState extends State<HomeView> {
label: '',
),
],
onTap: (int index) {
onTap: (int index) async {
activePageIdx = index;
setState(() async {
await homeViewPageController.animateToPage(
index,
duration: const Duration(milliseconds: 100),
curve: Curves.bounceIn,
);
});
await homeViewPageController.animateToPage(
index,
duration: const Duration(milliseconds: 100),
curve: Curves.bounceIn,
);
if (mounted) setState(() {});
},
currentIndex: activePageIdx,
),

View file

@ -34,7 +34,6 @@ class MemoriesViewState extends State<MemoriesView> {
@override
void dispose() {
// ignore: discarded_futures
messageSub?.cancel();
super.dispose();
}

View file

@ -218,15 +218,14 @@ class _BackupViewState extends State<BackupView> {
label: context.lang.backupData,
),
],
onTap: (int index) {
onTap: (int index) async {
activePageIdx = index;
setState(() async {
await pageController.animateToPage(
index,
duration: const Duration(milliseconds: 100),
curve: Curves.bounceIn,
);
});
await pageController.animateToPage(
index,
duration: const Duration(milliseconds: 100),
curve: Curves.bounceIn,
);
if (mounted) setState(() {});
},
currentIndex: activePageIdx,
// ),

View file

@ -68,9 +68,7 @@ class _RetransmissionDataViewState extends State<RetransmissionDataView> {
@override
void dispose() {
// ignore: discarded_futures
subscriptionRetransmission?.cancel();
// ignore: discarded_futures
subscriptionContacts?.cancel();
super.dispose();
}

View file

@ -5,10 +5,10 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0eb33edbbe99a02e73b8bbeb6f2b65972023d902117ee8d1bf0ea1a79f83aa7b"
sha256: c209688d9f5a5f26b2fb47a188131a6fb9e876ae9e47af3737c0b4f58a93470d
url: "https://pub.dev"
source: hosted
version: "90.0.0"
version: "91.0.0"
_flutterfire_internals:
dependency: transitive
description:
@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: analyzer
sha256: "711e3a890bb529bf55f07d73b8706f4b7504ad77e90d2f205626b116c048583f"
sha256: a40a0cee526a7e1f387c6847bd8a5ccbf510a75952ef8a28338e989558072cb0
url: "https://pub.dev"
source: hosted
version: "8.3.0"
version: "8.4.0"
archive:
dependency: transitive
description:
@ -165,10 +165,10 @@ packages:
dependency: transitive
description:
name: camera_android_camerax
sha256: "2c0746d55f513bed55f52e0b5d9bda18c1533bb16bb89ea93d8033f3815e6cd8"
sha256: "92dcc36e8ff2fa1ea3acdbb609ca2976cded55dceb719b4869c124c6d011f110"
url: "https://pub.dev"
source: hosted
version: "0.6.23+1"
version: "0.6.23+2"
camera_avfoundation:
dependency: transitive
description:
@ -618,10 +618,10 @@ packages:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: "7ed76be64e8a7d01dfdf250b8434618e2a028c9dfa2a3c41dc9b531d4b3fc8a5"
sha256: "19ffb0a8bb7407875555e5e98d7343a633bb73707bae6c6a5f37c90014077875"
url: "https://pub.dev"
source: hosted
version: "19.4.2"
version: "19.5.0"
flutter_local_notifications_linux:
dependency: transitive
description:
@ -655,10 +655,10 @@ packages:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: c2fe1001710127dfa7da89977a08d591398370d099aacdaa6d44da7eb14b8476
sha256: "306f0596590e077338312f38837f595c04f28d6cdeeac392d3d74df2f0003687"
url: "https://pub.dev"
source: hosted
version: "2.0.31"
version: "2.0.32"
flutter_secure_storage:
dependency: "direct main"
description:
@ -847,10 +847,10 @@ packages:
dependency: transitive
description:
name: image_picker_android
sha256: dd7a61daaa5896cc34b7bc95f66c60225ae6bee0d167dde0e21a9d9016cac0dc
sha256: "58a85e6f09fe9c4484d53d18a0bd6271b72c53fce1d05e6f745ae36d8c18efca"
url: "https://pub.dev"
source: hosted
version: "0.8.13+4"
version: "0.8.13+5"
image_picker_for_web:
dependency: transitive
description:
@ -991,26 +991,26 @@ packages:
dependency: "direct main"
description:
name: local_auth
sha256: "434d854cf478f17f12ab29a76a02b3067f86a63a6d6c4eb8fbfdcfe4879c1b7b"
sha256: a4f1bf57f0236a4aeb5e8f0ec180e197f4b112a3456baa6c1e73b546630b0422
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "3.0.0"
local_auth_android:
dependency: transitive
description:
name: local_auth_android
sha256: b2446c74fab1db37f828d4c54adaa3f003df80a29f5cbd710bbb8883d302e991
sha256: d836715ed95b16b2de3a8c47a88ba5e607976bb1e27c9446d193152ea1429fae
url: "https://pub.dev"
source: hosted
version: "1.0.55"
version: "2.0.0"
local_auth_darwin:
dependency: transitive
description:
name: local_auth_darwin
sha256: "699873970067a40ef2f2c09b4c72eb1cfef64224ef041b3df9fdc5c4c1f91f49"
sha256: "15d9db4ad4d58a11d7269e55d46ff8d49ed5e856226c8a5a91280f0d7c37b3a6"
url: "https://pub.dev"
source: hosted
version: "1.6.1"
version: "2.0.0"
local_auth_platform_interface:
dependency: transitive
description:
@ -1023,10 +1023,10 @@ packages:
dependency: transitive
description:
name: local_auth_windows
sha256: bc4e66a29b0fdf751aafbec923b5bed7ad6ed3614875d8151afe2578520b2ab5
sha256: d95535a73eddf57ce5930d5e78a0fa4f294c31981fdeeee83325b797302be454
url: "https://pub.dev"
source: hosted
version: "1.0.11"
version: "2.0.0"
logging:
dependency: "direct main"
description:
@ -1175,10 +1175,10 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37"
sha256: e122c5ea805bb6773bb12ce667611265980940145be920cd09a4b0ec0285cb16
url: "https://pub.dev"
source: hosted
version: "2.2.19"
version: "2.2.20"
path_provider_foundation:
dependency: transitive
description:
@ -1651,10 +1651,10 @@ packages:
dependency: "direct main"
description:
name: tutorial_coach_mark
sha256: ccc4a2026d361d8a71011d0f131a2278add1a154ef43e33dfd165babbb551c17
sha256: "5a325d53bcf16ce7a969e2ab8d4dc9610f39ee3eab2b3cc57d5c98936129b891"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "1.3.3"
typed_data:
dependency: transitive
description:
@ -1795,10 +1795,10 @@ packages:
dependency: transitive
description:
name: video_player_android
sha256: a8dc4324f67705de057678372bedb66cd08572fe7c495605ac68c5f503324a39
sha256: cf768d02924b91e333e2bc1ff928528f57d686445874f383bafab12d0bdfc340
url: "https://pub.dev"
source: hosted
version: "2.8.15"
version: "2.8.17"
video_player_avfoundation:
dependency: transitive
description:

View file

@ -47,7 +47,7 @@ dependencies:
introduction_screen: ^4.0.0
json_annotation: ^4.9.0
libsignal_protocol_dart: ^0.7.4
local_auth: ^2.3.0
local_auth: ^3.0.0
logging: ^1.3.0
lottie: ^3.3.1
mutex: ^3.1.0