refactor: Avoid unnecessary bool comparison
This commit is contained in:
parent
d08364688e
commit
1cd3a91037
15 changed files with 26 additions and 25 deletions
|
|
@ -249,9 +249,9 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
}
|
||||
if (!scrollController.hasClients) return;
|
||||
if (timeline?.allowNewEvent == false ||
|
||||
scrollController.position.pixels > 0 && _scrolledUp == false) {
|
||||
scrollController.position.pixels > 0 && _scrolledUp) {
|
||||
setState(() => _scrolledUp = true);
|
||||
} else if (scrollController.position.pixels <= 0 && _scrolledUp == true) {
|
||||
} else if (scrollController.position.pixels <= 0 && _scrolledUp) {
|
||||
setState(() => _scrolledUp = false);
|
||||
setReadMarker();
|
||||
}
|
||||
|
|
@ -919,7 +919,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
final clients = Matrix.of(context).currentBundle;
|
||||
for (final event in selectedEvents) {
|
||||
if (!event.status.isSent) return false;
|
||||
if (event.canRedact == false &&
|
||||
if (event.canRedact &&
|
||||
!(clients!.any((cl) => event.senderId == cl!.userID))) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ class ChatInputRow extends StatelessWidget {
|
|||
autofocus: !PlatformInfos.isMobile,
|
||||
keyboardType: TextInputType.multiline,
|
||||
textInputAction:
|
||||
AppSettings.sendOnEnter.value == true &&
|
||||
AppSettings.sendOnEnter.value &&
|
||||
PlatformInfos.isMobile
|
||||
? TextInputAction.send
|
||||
: null,
|
||||
|
|
|
|||
|
|
@ -364,7 +364,7 @@ class ChatView extends StatelessWidget {
|
|||
? theme.colorScheme.tertiaryContainer
|
||||
: theme.colorScheme.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(32),
|
||||
child: controller.room.isAbandonedDMRoom == true
|
||||
child: controller.room.isAbandonedDMRoom
|
||||
? Row(
|
||||
mainAxisAlignment: .spaceEvenly,
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
|||
matrixFile.mimeType.toLowerCase() == 'audio/ogg') {
|
||||
Logs().v('Convert ogg audio file for iOS...');
|
||||
final convertedFile = File('${file.path}.caf');
|
||||
if (await convertedFile.exists() == false) {
|
||||
if (await convertedFile.exists()) {
|
||||
OpusCaf().convertOpusToCaf(file.path, convertedFile.path);
|
||||
}
|
||||
file = convertedFile;
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
return;
|
||||
}
|
||||
}
|
||||
if (await AudioRecorder().hasPermission() == false) return;
|
||||
if (await AudioRecorder().hasPermission()) return;
|
||||
|
||||
final audioRecorder = _audioRecorder ??= AudioRecorder();
|
||||
setState(() {});
|
||||
|
|
@ -76,7 +76,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
|||
}
|
||||
|
||||
final result = await audioRecorder.hasPermission();
|
||||
if (result != true) {
|
||||
if (!result) {
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
title: L10n.of(context).oopsSomethingWentWrong,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue