Revert "refactor: Avoid unnecessary bool comparison"
This reverts commit 1cd3a91037.
This commit is contained in:
parent
84993dec59
commit
a9a8b39465
14 changed files with 24 additions and 22 deletions
|
|
@ -37,7 +37,6 @@ dart_code_linter:
|
||||||
- avoid-unnecessary-type-assertions
|
- avoid-unnecessary-type-assertions
|
||||||
- avoid-unnecessary-type-casts
|
- avoid-unnecessary-type-casts
|
||||||
- avoid-unrelated-type-assertions
|
- avoid-unrelated-type-assertions
|
||||||
- no-boolean-literal-compare
|
|
||||||
- no-equal-then-else
|
- no-equal-then-else
|
||||||
- prefer-first
|
- prefer-first
|
||||||
- prefer-last
|
- prefer-last
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,8 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
Widget body = const Center(child: CircularProgressIndicator.adaptive());
|
Widget body = const Center(child: CircularProgressIndicator.adaptive());
|
||||||
titleText = L10n.of(context).loadingPleaseWait;
|
titleText = L10n.of(context).loadingPleaseWait;
|
||||||
|
|
||||||
if (bootstrap.newSsssKey?.recoveryKey != null && _recoveryKeyStored) {
|
if (bootstrap.newSsssKey?.recoveryKey != null &&
|
||||||
|
_recoveryKeyStored == false) {
|
||||||
final key = bootstrap.newSsssKey!.recoveryKey;
|
final key = bootstrap.newSsssKey!.recoveryKey;
|
||||||
titleText = L10n.of(context).recoveryKey;
|
titleText = L10n.of(context).recoveryKey;
|
||||||
return LoginScaffold(
|
return LoginScaffold(
|
||||||
|
|
|
||||||
|
|
@ -249,9 +249,9 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
if (!scrollController.hasClients) return;
|
if (!scrollController.hasClients) return;
|
||||||
if (timeline?.allowNewEvent == false ||
|
if (timeline?.allowNewEvent == false ||
|
||||||
scrollController.position.pixels > 0 && _scrolledUp) {
|
scrollController.position.pixels > 0 && _scrolledUp == false) {
|
||||||
setState(() => _scrolledUp = true);
|
setState(() => _scrolledUp = true);
|
||||||
} else if (scrollController.position.pixels <= 0 && _scrolledUp) {
|
} else if (scrollController.position.pixels <= 0 && _scrolledUp == true) {
|
||||||
setState(() => _scrolledUp = false);
|
setState(() => _scrolledUp = false);
|
||||||
setReadMarker();
|
setReadMarker();
|
||||||
}
|
}
|
||||||
|
|
@ -919,7 +919,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
final clients = Matrix.of(context).currentBundle;
|
final clients = Matrix.of(context).currentBundle;
|
||||||
for (final event in selectedEvents) {
|
for (final event in selectedEvents) {
|
||||||
if (!event.status.isSent) return false;
|
if (!event.status.isSent) return false;
|
||||||
if (event.canRedact &&
|
if (event.canRedact == false &&
|
||||||
!(clients!.any((cl) => event.senderId == cl!.userID))) {
|
!(clients!.any((cl) => event.senderId == cl!.userID))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -317,7 +317,7 @@ class ChatInputRow extends StatelessWidget {
|
||||||
autofocus: !PlatformInfos.isMobile,
|
autofocus: !PlatformInfos.isMobile,
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
textInputAction:
|
textInputAction:
|
||||||
AppSettings.sendOnEnter.value &&
|
AppSettings.sendOnEnter.value == true &&
|
||||||
PlatformInfos.isMobile
|
PlatformInfos.isMobile
|
||||||
? TextInputAction.send
|
? TextInputAction.send
|
||||||
: null,
|
: null,
|
||||||
|
|
|
||||||
|
|
@ -364,7 +364,7 @@ class ChatView extends StatelessWidget {
|
||||||
? theme.colorScheme.tertiaryContainer
|
? theme.colorScheme.tertiaryContainer
|
||||||
: theme.colorScheme.surfaceContainerHigh,
|
: theme.colorScheme.surfaceContainerHigh,
|
||||||
borderRadius: BorderRadius.circular(32),
|
borderRadius: BorderRadius.circular(32),
|
||||||
child: controller.room.isAbandonedDMRoom
|
child: controller.room.isAbandonedDMRoom == true
|
||||||
? Row(
|
? Row(
|
||||||
mainAxisAlignment: .spaceEvenly,
|
mainAxisAlignment: .spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
matrixFile.mimeType.toLowerCase() == 'audio/ogg') {
|
matrixFile.mimeType.toLowerCase() == 'audio/ogg') {
|
||||||
Logs().v('Convert ogg audio file for iOS...');
|
Logs().v('Convert ogg audio file for iOS...');
|
||||||
final convertedFile = File('${file.path}.caf');
|
final convertedFile = File('${file.path}.caf');
|
||||||
if (await convertedFile.exists()) {
|
if (await convertedFile.exists() == false) {
|
||||||
OpusCaf().convertOpusToCaf(file.path, convertedFile.path);
|
OpusCaf().convertOpusToCaf(file.path, convertedFile.path);
|
||||||
}
|
}
|
||||||
file = convertedFile;
|
file = convertedFile;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (await AudioRecorder().hasPermission()) return;
|
if (await AudioRecorder().hasPermission() == false) return;
|
||||||
|
|
||||||
final audioRecorder = _audioRecorder ??= AudioRecorder();
|
final audioRecorder = _audioRecorder ??= AudioRecorder();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
@ -76,7 +76,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
final result = await audioRecorder.hasPermission();
|
final result = await audioRecorder.hasPermission();
|
||||||
if (!result) {
|
if (result != true) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).oopsSomethingWentWrong,
|
title: L10n.of(context).oopsSomethingWentWrong,
|
||||||
|
|
|
||||||
|
|
@ -320,7 +320,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
try {
|
try {
|
||||||
await room.client.setRoomVisibilityOnDirectory(
|
await room.client.setRoomVisibilityOnDirectory(
|
||||||
room.id,
|
room.id,
|
||||||
visibility: visibility ? Visibility.public : Visibility.private,
|
visibility: visibility == true ? Visibility.public : Visibility.private,
|
||||||
);
|
);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
|
|
|
||||||
|
|
@ -168,8 +168,9 @@ class ChatListController extends State<ChatList>
|
||||||
initialText: searchServer,
|
initialText: searchServer,
|
||||||
keyboardType: TextInputType.url,
|
keyboardType: TextInputType.url,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
validator: (server) =>
|
validator: (server) => server.contains('.') == true
|
||||||
server.contains('.') ? null : L10n.of(context).invalidServerName,
|
? null
|
||||||
|
: L10n.of(context).invalidServerName,
|
||||||
);
|
);
|
||||||
if (newServer == null) return;
|
if (newServer == null) return;
|
||||||
Matrix.of(context).store.setString(_serverStoreNamespace, newServer);
|
Matrix.of(context).store.setString(_serverStoreNamespace, newServer);
|
||||||
|
|
@ -202,9 +203,10 @@ class ChatListController extends State<ChatList>
|
||||||
|
|
||||||
if (searchQuery.isValidMatrixId &&
|
if (searchQuery.isValidMatrixId &&
|
||||||
searchQuery.sigil == '#' &&
|
searchQuery.sigil == '#' &&
|
||||||
!roomSearchResult.chunk.any(
|
roomSearchResult.chunk.any(
|
||||||
(room) => room.canonicalAlias == searchQuery,
|
(room) => room.canonicalAlias == searchQuery,
|
||||||
)) {
|
) ==
|
||||||
|
false) {
|
||||||
final response = await client.getRoomIdByAlias(searchQuery);
|
final response = await client.getRoomIdByAlias(searchQuery);
|
||||||
final roomId = response.roomId;
|
final roomId = response.roomId;
|
||||||
if (roomId != null) {
|
if (roomId != null) {
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ extension on CachedPresence {
|
||||||
? DateTime.now()
|
? DateTime.now()
|
||||||
: DateTime.fromMillisecondsSinceEpoch(0));
|
: DateTime.fromMillisecondsSinceEpoch(0));
|
||||||
|
|
||||||
LinearGradient get gradient => presence.isOnline
|
LinearGradient get gradient => presence.isOnline == true
|
||||||
? LinearGradient(
|
? LinearGradient(
|
||||||
colors: [Colors.green, Colors.green.shade200, Colors.green.shade900],
|
colors: [Colors.green, Colors.green.shade200, Colors.green.shade900],
|
||||||
begin: Alignment.topLeft,
|
begin: Alignment.topLeft,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class ImageViewerController extends State<ImageViewer> {
|
||||||
|
|
||||||
/// Go back if user swiped it away
|
/// Go back if user swiped it away
|
||||||
void onInteractionEnds(ScaleEndDetails endDetails) {
|
void onInteractionEnds(ScaleEndDetails endDetails) {
|
||||||
if (!PlatformInfos.usesTouchscreen) {
|
if (PlatformInfos.usesTouchscreen == false) {
|
||||||
if (endDetails.velocity.pixelsPerSecond.dy >
|
if (endDetails.velocity.pixelsPerSecond.dy >
|
||||||
MediaQuery.sizeOf(context).height * maxScaleFactor) {
|
MediaQuery.sizeOf(context).height * maxScaleFactor) {
|
||||||
Navigator.of(context, rootNavigator: false).pop();
|
Navigator.of(context, rootNavigator: false).pop();
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
|
widget.event.attachmentOrThumbnailMxcUrl()!.pathSegments.last,
|
||||||
);
|
);
|
||||||
final file = File('${tempDir.path}/${fileName}_${videoFile.name}');
|
final file = File('${tempDir.path}/${fileName}_${videoFile.name}');
|
||||||
if (!await file.exists()) {
|
if (await file.exists() == false) {
|
||||||
await file.writeAsBytes(videoFile.bytes);
|
await file.writeAsBytes(videoFile.bytes);
|
||||||
}
|
}
|
||||||
videoPlayerController = VideoPlayerController.file(file);
|
videoPlayerController = VideoPlayerController.file(file);
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ Future<String?> getDatabaseCipher() async {
|
||||||
void _sendNoEncryptionWarning(Object exception) async {
|
void _sendNoEncryptionWarning(Object exception) async {
|
||||||
final isStored = AppSettings.noEncryptionWarningShown.value;
|
final isStored = AppSettings.noEncryptionWarningShown.value;
|
||||||
|
|
||||||
if (isStored) return;
|
if (isStored == true) return;
|
||||||
|
|
||||||
final l10n = await lookupL10n(PlatformDispatcher.instance.locale);
|
final l10n = await lookupL10n(PlatformDispatcher.instance.locale);
|
||||||
ClientManager.sendInitNotification(
|
ClientManager.sendInitNotification(
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ class VoipPlugin with WidgetsBindingObserver implements WebRTCDelegate {
|
||||||
|
|
||||||
await matrix.store.setString(
|
await matrix.store.setString(
|
||||||
'wasForeground',
|
'wasForeground',
|
||||||
wasForeground ? 'true' : 'false',
|
wasForeground == true ? 'true' : 'false',
|
||||||
);
|
);
|
||||||
FlutterForegroundTask.setOnLockScreenVisibility(true);
|
FlutterForegroundTask.setOnLockScreenVisibility(true);
|
||||||
FlutterForegroundTask.wakeUpScreen();
|
FlutterForegroundTask.wakeUpScreen();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue