refactor: Enable more strict lints
This commit is contained in:
parent
f797bce8d0
commit
28af7bb0c7
65 changed files with 170 additions and 146 deletions
|
|
@ -11,6 +11,7 @@ linter:
|
||||||
- omit_local_variable_types
|
- omit_local_variable_types
|
||||||
- cancel_subscriptions
|
- cancel_subscriptions
|
||||||
- always_declare_return_types
|
- always_declare_return_types
|
||||||
|
- avoid_void_async
|
||||||
- no_adjacent_strings_in_list
|
- no_adjacent_strings_in_list
|
||||||
- test_types_in_equals
|
- test_types_in_equals
|
||||||
- throw_in_finally
|
- throw_in_finally
|
||||||
|
|
@ -19,6 +20,15 @@ linter:
|
||||||
- prefer_single_quotes
|
- prefer_single_quotes
|
||||||
- prefer_const_declarations
|
- prefer_const_declarations
|
||||||
- unnecessary_lambdas
|
- unnecessary_lambdas
|
||||||
|
- combinators_ordering
|
||||||
|
- noop_primitive_operations
|
||||||
|
- unnecessary_null_checks
|
||||||
|
- unnecessary_null_in_if_null_operators
|
||||||
|
- unnecessary_to_list_in_spreads
|
||||||
|
- use_is_even_rather_than_modulo
|
||||||
|
- use_super_parameters
|
||||||
|
# Flutter specific:
|
||||||
|
- use_colored_box
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
plugins:
|
plugins:
|
||||||
|
|
@ -61,7 +71,6 @@ dart_code_linter:
|
||||||
- prefer-correct-edge-insets-constructor
|
- prefer-correct-edge-insets-constructor
|
||||||
- avoid-returning-widgets
|
- avoid-returning-widgets
|
||||||
# TODO:
|
# TODO:
|
||||||
# - avoid-returning-widgets
|
|
||||||
# - prefer-single-widget-per-file:
|
# - prefer-single-widget-per-file:
|
||||||
# ignore-private-widgets: true
|
# ignore-private-widgets: true
|
||||||
# - prefer-extracting-callbacks
|
# - prefer-extracting-callbacks
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class ArchiveController extends State<Archive> {
|
||||||
return archive = await Matrix.of(context).client.loadArchive();
|
return archive = await Matrix.of(context).client.loadArchive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void forgetRoomAction(int i) async {
|
Future<void> forgetRoomAction(int i) async {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () async {
|
future: () async {
|
||||||
|
|
@ -35,7 +35,7 @@ class ArchiveController extends State<Archive> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void forgetAllAction() async {
|
Future<void> forgetAllAction() async {
|
||||||
final archive = this.archive;
|
final archive = this.archive;
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
if (archive.isEmpty) return;
|
if (archive.isEmpty) return;
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
_createBootstrap(widget.wipe);
|
_createBootstrap(widget.wipe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _cancelAction() async {
|
Future<void> _cancelAction() async {
|
||||||
final consent = await showOkCancelAlertDialog(
|
final consent = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).skipChatBackup,
|
title: L10n.of(context).skipChatBackup,
|
||||||
|
|
@ -110,7 +110,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _createBootstrap(bool wipe) async {
|
Future<void> _createBootstrap(bool wipe) async {
|
||||||
await client.roomsLoading;
|
await client.roomsLoading;
|
||||||
await client.accountDataLoading;
|
await client.accountDataLoading;
|
||||||
await client.userDeviceKeysLoading;
|
await client.userDeviceKeysLoading;
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
|
|
||||||
void onDragExited(_) => setState(() => dragging = false);
|
void onDragExited(_) => setState(() => dragging = false);
|
||||||
|
|
||||||
void onDragDone(DropDoneDetails details) async {
|
Future<void> onDragDone(DropDoneDetails details) async {
|
||||||
setState(() => dragging = false);
|
setState(() => dragging = false);
|
||||||
if (details.files.isEmpty) return;
|
if (details.files.isEmpty) return;
|
||||||
|
|
||||||
|
|
@ -190,7 +190,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
selectedEvents.clear();
|
selectedEvents.clear();
|
||||||
});
|
});
|
||||||
|
|
||||||
void recreateChat() async {
|
Future<void> recreateChat() async {
|
||||||
final room = this.room;
|
final room = this.room;
|
||||||
final userId = room.directChatMatrixID;
|
final userId = room.directChatMatrixID;
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
|
|
@ -204,7 +204,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void leaveChat() async {
|
Future<void> leaveChat() async {
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: room.leave,
|
future: room.leave,
|
||||||
|
|
@ -213,12 +213,12 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
context.go('/rooms');
|
context.go('/rooms');
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestHistory([_]) async {
|
Future<void> requestHistory([_]) async {
|
||||||
Logs().v('Requesting history...');
|
Logs().v('Requesting history...');
|
||||||
await timeline?.requestHistory(historyCount: _loadHistoryCount);
|
await timeline?.requestHistory(historyCount: _loadHistoryCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestFuture() async {
|
Future<void> requestFuture() async {
|
||||||
final timeline = this.timeline;
|
final timeline = this.timeline;
|
||||||
if (timeline == null) return;
|
if (timeline == null) return;
|
||||||
Logs().v('Requesting future...');
|
Logs().v('Requesting future...');
|
||||||
|
|
@ -392,7 +392,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _tryLoadTimeline() async {
|
Future<void> _tryLoadTimeline() async {
|
||||||
final initialEventId = widget.eventId;
|
final initialEventId = widget.eventId;
|
||||||
loadTimelineFuture = _getTimeline();
|
loadTimelineFuture = _getTimeline();
|
||||||
try {
|
try {
|
||||||
|
|
@ -625,7 +625,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendFileAction({FileType type = FileType.any}) async {
|
Future<void> sendFileAction({FileType type = FileType.any}) async {
|
||||||
final files = await selectFiles(context, allowMultiple: true, type: type);
|
final files = await selectFiles(context, allowMultiple: true, type: type);
|
||||||
if (files.isEmpty) return;
|
if (files.isEmpty) return;
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
|
|
@ -640,7 +640,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendImageFromClipBoard(Uint8List? image) async {
|
Future<void> sendImageFromClipBoard(Uint8List? image) async {
|
||||||
if (image == null) return;
|
if (image == null) return;
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -654,7 +654,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openCameraAction() async {
|
Future<void> openCameraAction() async {
|
||||||
// Make sure the textfield is unfocused before opening the camera
|
// Make sure the textfield is unfocused before opening the camera
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
final file = await ImagePicker().pickImage(source: ImageSource.camera);
|
final file = await ImagePicker().pickImage(source: ImageSource.camera);
|
||||||
|
|
@ -672,7 +672,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openVideoCameraAction() async {
|
Future<void> openVideoCameraAction() async {
|
||||||
// Make sure the textfield is unfocused before opening the camera
|
// Make sure the textfield is unfocused before opening the camera
|
||||||
FocusScope.of(context).requestFocus(FocusNode());
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
final file = await ImagePicker().pickVideo(
|
final file = await ImagePicker().pickVideo(
|
||||||
|
|
@ -759,7 +759,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendLocationAction() async {
|
Future<void> sendLocationAction() async {
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (c) => SendLocationDialog(room: room),
|
builder: (c) => SendLocationDialog(room: room),
|
||||||
|
|
@ -793,7 +793,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportEventAction() async {
|
Future<void> reportEventAction() async {
|
||||||
final event = selectedEvents.single;
|
final event = selectedEvents.single;
|
||||||
final score = await showModalActionPopup<int>(
|
final score = await showModalActionPopup<int>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -837,7 +837,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteErrorEventsAction() async {
|
Future<void> deleteErrorEventsAction() async {
|
||||||
try {
|
try {
|
||||||
if (selectedEvents.any((event) => event.status != EventStatus.error)) {
|
if (selectedEvents.any((event) => event.status != EventStatus.error)) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
|
|
@ -856,7 +856,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void redactEventsAction() async {
|
Future<void> redactEventsAction() async {
|
||||||
final reasonInput = selectedEvents.any((event) => event.status.isSent)
|
final reasonInput = selectedEvents.any((event) => event.status.isSent)
|
||||||
? await showTextInputDialog(
|
? await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -949,7 +949,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void forwardEventsAction() async {
|
Future<void> forwardEventsAction() async {
|
||||||
if (selectedEvents.isEmpty) return;
|
if (selectedEvents.isEmpty) return;
|
||||||
final timeline = this.timeline;
|
final timeline = this.timeline;
|
||||||
if (timeline == null) return;
|
if (timeline == null) return;
|
||||||
|
|
@ -992,7 +992,10 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
inputFocus.requestFocus();
|
inputFocus.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollToEventId(String eventId, {bool highlightEvent = true}) async {
|
Future<void> scrollToEventId(
|
||||||
|
String eventId, {
|
||||||
|
bool highlightEvent = true,
|
||||||
|
}) async {
|
||||||
final foundEvent = timeline!.events.firstWhereOrNull(
|
final foundEvent = timeline!.events.firstWhereOrNull(
|
||||||
(event) => event.eventId == eventId,
|
(event) => event.eventId == eventId,
|
||||||
);
|
);
|
||||||
|
|
@ -1036,7 +1039,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
_updateScrollController();
|
_updateScrollController();
|
||||||
}
|
}
|
||||||
|
|
||||||
void scrollDown() async {
|
Future<void> scrollDown() async {
|
||||||
if (!timeline!.allowNewEvent) {
|
if (!timeline!.allowNewEvent) {
|
||||||
setState(() {
|
setState(() {
|
||||||
timeline = null;
|
timeline = null;
|
||||||
|
|
@ -1117,7 +1120,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
inputFocus.requestFocus();
|
inputFocus.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void goToNewRoomAction() async {
|
Future<void> goToNewRoomAction() async {
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () async {
|
future: () async {
|
||||||
|
|
@ -1216,7 +1219,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void unpinEvent(String eventId) async {
|
Future<void> unpinEvent(String eventId) async {
|
||||||
final response = await showOkCancelAlertDialog(
|
final response = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).unpin,
|
title: L10n.of(context).unpin,
|
||||||
|
|
@ -1309,7 +1312,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
void showEventInfo([Event? event]) =>
|
void showEventInfo([Event? event]) =>
|
||||||
(event ?? selectedEvents.single).showInfoDialog(context);
|
(event ?? selectedEvents.single).showInfoDialog(context);
|
||||||
|
|
||||||
void onPhoneButtonTap() async {
|
Future<void> onPhoneButtonTap() async {
|
||||||
// VoIP required Android SDK 21
|
// VoIP required Android SDK 21
|
||||||
if (PlatformInfos.isAndroid) {
|
if (PlatformInfos.isAndroid) {
|
||||||
DeviceInfoPlugin().androidInfo.then((value) {
|
DeviceInfoPlugin().androidInfo.then((value) {
|
||||||
|
|
@ -1365,7 +1368,7 @@ class ChatController extends State<ChatPageWithRoom>
|
||||||
|
|
||||||
late final ValueNotifier<bool> _displayChatDetailsColumn;
|
late final ValueNotifier<bool> _displayChatDetailsColumn;
|
||||||
|
|
||||||
void toggleDisplayChatDetailsColumn() async {
|
Future<void> toggleDisplayChatDetailsColumn() async {
|
||||||
await AppSettings.displayChatDetailsColumn.setItem(
|
await AppSettings.displayChatDetailsColumn.setItem(
|
||||||
!_displayChatDetailsColumn.value,
|
!_displayChatDetailsColumn.value,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onButtonTap() async {
|
Future<void> _onButtonTap() async {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
ScaffoldMessenger.of(matrix.context).clearMaterialBanners();
|
ScaffoldMessenger.of(matrix.context).clearMaterialBanners();
|
||||||
});
|
});
|
||||||
|
|
@ -216,7 +216,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _toggleSpeed() async {
|
Future<void> _toggleSpeed() async {
|
||||||
final audioPlayer = matrix.audioPlayer;
|
final audioPlayer = matrix.audioPlayer;
|
||||||
if (audioPlayer == null) return;
|
if (audioPlayer == null) return;
|
||||||
switch (audioPlayer.speed) {
|
switch (audioPlayer.speed) {
|
||||||
|
|
@ -459,7 +459,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
height: 20,
|
height: 20,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'${audioPlayer?.speed.toString()}x',
|
'${audioPlayer?.speed}x',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.color,
|
color: widget.color,
|
||||||
fontSize: 9,
|
fontSize: 9,
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class MessageContent extends StatelessWidget {
|
||||||
required this.selected,
|
required this.selected,
|
||||||
});
|
});
|
||||||
|
|
||||||
void _verifyOrRequestKey(BuildContext context) async {
|
Future<void> _verifyOrRequestKey(BuildContext context) async {
|
||||||
final l10n = L10n.of(context);
|
final l10n = L10n.of(context);
|
||||||
if (event.content['can_request_session'] != true) {
|
if (event.content['can_request_session'] != true) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
|
|
||||||
|
|
@ -411,7 +411,7 @@ class InputBar extends StatelessWidget {
|
||||||
),
|
),
|
||||||
minLines: minLines,
|
minLines: minLines,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
keyboardType: keyboardType!,
|
keyboardType: keyboardType,
|
||||||
textInputAction: textInputAction,
|
textInputAction: textInputAction,
|
||||||
autofocus: autofocus!,
|
autofocus: autofocus!,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ class RecordingViewModelState extends State<RecordingViewModel> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void stopAndSend(
|
Future<void> stopAndSend(
|
||||||
Future<void> Function(
|
Future<void> Function(
|
||||||
String path,
|
String path,
|
||||||
int duration,
|
int duration,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class ReplyDisplay extends StatelessWidget {
|
||||||
child: controller.replyEvent != null
|
child: controller.replyEvent != null
|
||||||
? ReplyContent(
|
? ReplyContent(
|
||||||
controller.replyEvent!,
|
controller.replyEvent!,
|
||||||
timeline: controller.timeline!,
|
timeline: controller.timeline,
|
||||||
)
|
)
|
||||||
: _EditContent(
|
: _EditContent(
|
||||||
controller.editEvent?.getDisplayEvent(controller.timeline!),
|
controller.editEvent?.getDisplayEvent(controller.timeline!),
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ class SendLocationDialogState extends State<SendLocationDialog> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendAction() async {
|
Future<void> sendAction() async {
|
||||||
setState(() => isSending = true);
|
setState(() => isSending = true);
|
||||||
final body =
|
final body =
|
||||||
'https://www.openstreetmap.org/?mlat=${position!.latitude}&mlon=${position!.longitude}#map=16/${position!.latitude}/${position!.longitude}';
|
'https://www.openstreetmap.org/?mlat=${position!.latitude}&mlon=${position!.longitude}#map=16/${position!.latitude}/${position!.longitude}';
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class _StartPollBottomSheetState extends State<StartPollBottomSheet> {
|
||||||
|
|
||||||
String? _txid;
|
String? _txid;
|
||||||
|
|
||||||
void _createPoll() async {
|
Future<void> _createPoll() async {
|
||||||
try {
|
try {
|
||||||
var id = 0;
|
var id = 0;
|
||||||
_txid ??= widget.room.client.generateUniqueTransactionId();
|
_txid ??= widget.room.client.generateUniqueTransactionId();
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
return joinRules.toList();
|
return joinRules.toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setJoinRule(JoinRules? newJoinRules) async {
|
Future<void> setJoinRule(JoinRules? newJoinRules) async {
|
||||||
if (newJoinRules == null) return;
|
if (newJoinRules == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
joinRulesLoading = true;
|
joinRulesLoading = true;
|
||||||
|
|
@ -111,7 +111,9 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setHistoryVisibility(HistoryVisibility? historyVisibility) async {
|
Future<void> setHistoryVisibility(
|
||||||
|
HistoryVisibility? historyVisibility,
|
||||||
|
) async {
|
||||||
if (historyVisibility == null) return;
|
if (historyVisibility == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
historyVisibilityLoading = true;
|
historyVisibilityLoading = true;
|
||||||
|
|
@ -135,7 +137,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGuestAccess(GuestAccess? guestAccess) async {
|
Future<void> setGuestAccess(GuestAccess? guestAccess) async {
|
||||||
if (guestAccess == null) return;
|
if (guestAccess == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
guestAccessLoading = true;
|
guestAccessLoading = true;
|
||||||
|
|
@ -159,7 +161,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateRoomAction() async {
|
Future<void> updateRoomAction() async {
|
||||||
final roomVersion = room
|
final roomVersion = room
|
||||||
.getState(EventTypes.RoomCreate)!
|
.getState(EventTypes.RoomCreate)!
|
||||||
.content
|
.content
|
||||||
|
|
@ -303,7 +305,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteAlias(String alias) async {
|
Future<void> deleteAlias(String alias) async {
|
||||||
await showFutureLoadingDialog(
|
await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () => room.client.deleteRoomAlias(alias),
|
future: () => room.client.deleteRoomAlias(alias),
|
||||||
|
|
@ -311,7 +313,7 @@ class ChatAccessSettingsController extends State<ChatAccessSettings> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setChatVisibilityOnDirectory(bool? visibility) async {
|
Future<void> setChatVisibilityOnDirectory(bool? visibility) async {
|
||||||
if (visibility == null) return;
|
if (visibility == null) return;
|
||||||
setState(() {
|
setState(() {
|
||||||
visibilityLoading = true;
|
visibilityLoading = true;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
|
|
||||||
String? get roomId => widget.roomId;
|
String? get roomId => widget.roomId;
|
||||||
|
|
||||||
void setDisplaynameAction() async {
|
Future<void> setDisplaynameAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -59,7 +59,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTopicAction() async {
|
Future<void> setTopicAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -83,7 +83,7 @@ class ChatDetailsController extends State<ChatDetails> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAvatarAction() async {
|
Future<void> setAvatarAction() async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!);
|
final room = Matrix.of(context).client.getRoomById(roomId!);
|
||||||
final actions = [
|
final actions = [
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void enableEncryption(_) async {
|
Future<void> enableEncryption(_) async {
|
||||||
if (room.encrypted) {
|
if (room.encrypted) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -69,7 +69,7 @@ class ChatEncryptionSettingsController extends State<ChatEncryptionSettings> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void startVerification() async {
|
Future<void> startVerification() async {
|
||||||
final consent = await showOkCancelAlertDialog(
|
final consent = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).verifyOtherUser,
|
title: L10n.of(context).verifyOtherUser,
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class ChatListController extends State<ChatList>
|
||||||
String? _activeSpaceId;
|
String? _activeSpaceId;
|
||||||
String? get activeSpaceId => _activeSpaceId;
|
String? get activeSpaceId => _activeSpaceId;
|
||||||
|
|
||||||
void setActiveSpace(String spaceId) async {
|
Future<void> setActiveSpace(String spaceId) async {
|
||||||
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
|
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -90,7 +90,7 @@ class ChatListController extends State<ChatList>
|
||||||
_activeSpaceId = null;
|
_activeSpaceId = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
void onChatTap(Room room) async {
|
Future<void> onChatTap(Room room) async {
|
||||||
if (room.membership == Membership.invite) {
|
if (room.membership == Membership.invite) {
|
||||||
final joinResult = await showFutureLoadingDialog(
|
final joinResult = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -156,7 +156,7 @@ class ChatListController extends State<ChatList>
|
||||||
bool isSearching = false;
|
bool isSearching = false;
|
||||||
static const String _serverStoreNamespace = 'im.fluffychat.search.server';
|
static const String _serverStoreNamespace = 'im.fluffychat.search.server';
|
||||||
|
|
||||||
void setServer() async {
|
Future<void> setServer() async {
|
||||||
final newServer = await showTextInputDialog(
|
final newServer = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
title: L10n.of(context).changeTheHomeserver,
|
title: L10n.of(context).changeTheHomeserver,
|
||||||
|
|
@ -184,7 +184,7 @@ class ChatListController extends State<ChatList>
|
||||||
final TextEditingController searchController = TextEditingController();
|
final TextEditingController searchController = TextEditingController();
|
||||||
final FocusNode searchFocusNode = FocusNode();
|
final FocusNode searchFocusNode = FocusNode();
|
||||||
|
|
||||||
void _search() async {
|
Future<void> _search() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
if (!isSearching) {
|
if (!isSearching) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -292,7 +292,7 @@ class ChatListController extends State<ChatList>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void editSpace(BuildContext context, String spaceId) async {
|
Future<void> editSpace(BuildContext context, String spaceId) async {
|
||||||
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
|
await Matrix.of(context).client.getRoomById(spaceId)!.postLoad();
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
context.push('/rooms/$spaceId/details');
|
context.push('/rooms/$spaceId/details');
|
||||||
|
|
@ -326,7 +326,7 @@ class ChatListController extends State<ChatList>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _processIncomingUris(Uri? uri) async {
|
Future<void> _processIncomingUris(Uri? uri) async {
|
||||||
if (uri == null) return;
|
if (uri == null) return;
|
||||||
context.go('/rooms');
|
context.go('/rooms');
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
|
|
@ -399,7 +399,7 @@ class ChatListController extends State<ChatList>
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void chatContextAction(
|
Future<void> chatContextAction(
|
||||||
Room room,
|
Room room,
|
||||||
BuildContext posContext, [
|
BuildContext posContext, [
|
||||||
Room? space,
|
Room? space,
|
||||||
|
|
@ -671,7 +671,7 @@ class ChatListController extends State<ChatList>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dismissStatusList() async {
|
Future<void> dismissStatusList() async {
|
||||||
final result = await showOkCancelAlertDialog(
|
final result = await showOkCancelAlertDialog(
|
||||||
title: L10n.of(context).hidePresences,
|
title: L10n.of(context).hidePresences,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -682,7 +682,7 @@ class ChatListController extends State<ChatList>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setStatus() async {
|
Future<void> setStatus() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
final currentPresence = await client.fetchCurrentPresence(client.userID!);
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
|
|
@ -793,7 +793,10 @@ class ChatListController extends State<ChatList>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void editBundlesForAccount(String? userId, String? activeBundle) async {
|
Future<void> editBundlesForAccount(
|
||||||
|
String? userId,
|
||||||
|
String? activeBundle,
|
||||||
|
) async {
|
||||||
final l10n = L10n.of(context);
|
final l10n = L10n.of(context);
|
||||||
final client = Matrix.of(
|
final client = Matrix.of(
|
||||||
context,
|
context,
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ class ClientChooserButton extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _clientSelected(Object object, BuildContext context) async {
|
Future<void> _clientSelected(Object object, BuildContext context) async {
|
||||||
if (object is Client) {
|
if (object is Client) {
|
||||||
controller.setActiveClient(object);
|
controller.setActiveClient(object);
|
||||||
} else if (object is String) {
|
} else if (object is String) {
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class SearchTitle extends StatelessWidget {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.centerRight,
|
alignment: Alignment.centerRight,
|
||||||
child: trailing!,
|
child: trailing,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadHierarchy() async {
|
Future<void> _loadHierarchy() async {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
final room = matrix.client.getRoomById(widget.spaceId);
|
final room = matrix.client.getRoomById(widget.spaceId);
|
||||||
if (room == null) return;
|
if (room == null) return;
|
||||||
|
|
@ -127,7 +127,7 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _joinChildRoom(SpaceRoomsChunk$2 item) async {
|
Future<void> _joinChildRoom(SpaceRoomsChunk$2 item) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final space = client.getRoomById(widget.spaceId);
|
final space = client.getRoomById(widget.spaceId);
|
||||||
final via = space?.spaceChildren
|
final via = space?.spaceChildren
|
||||||
|
|
@ -146,7 +146,7 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
if (room != null) widget.onChatTab(room);
|
if (room != null) widget.onChatTab(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSpaceAction(SpaceActions action) async {
|
Future<void> _onSpaceAction(SpaceActions action) async {
|
||||||
final space = Matrix.of(context).client.getRoomById(widget.spaceId);
|
final space = Matrix.of(context).client.getRoomById(widget.spaceId);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
|
@ -184,7 +184,7 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _addChatOrSubspace(AddRoomType roomType) async {
|
Future<void> _addChatOrSubspace(AddRoomType roomType) async {
|
||||||
final names = await showTextInputDialog(
|
final names = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: roomType == AddRoomType.subspace
|
title: roomType == AddRoomType.subspace
|
||||||
|
|
@ -261,7 +261,10 @@ class _SpaceViewState extends State<SpaceView> {
|
||||||
_loadHierarchy();
|
_loadHierarchy();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showSpaceChildEditMenu(BuildContext posContext, String roomId) async {
|
Future<void> _showSpaceChildEditMenu(
|
||||||
|
BuildContext posContext,
|
||||||
|
String roomId,
|
||||||
|
) async {
|
||||||
final overlay =
|
final overlay =
|
||||||
Overlay.of(posContext).context.findRenderObject() as RenderBox;
|
Overlay.of(posContext).context.findRenderObject() as RenderBox;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ class ChatMembersController extends State<ChatMembersPage> {
|
||||||
setFilter();
|
setFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFilter([_]) async {
|
Future<void> setFilter([_]) async {
|
||||||
final filter = filterController.text.toLowerCase().trim();
|
final filter = filterController.text.toLowerCase().trim();
|
||||||
|
|
||||||
final members = this.members
|
final members = this.members
|
||||||
|
|
@ -56,7 +56,7 @@ class ChatMembersController extends State<ChatMembersPage> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshMembers([_]) async {
|
Future<void> refreshMembers([_]) async {
|
||||||
Logs().d('Load room members from', widget.roomId);
|
Logs().d('Load room members from', widget.roomId);
|
||||||
try {
|
try {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class ChatPermissionsSettings extends StatefulWidget {
|
||||||
|
|
||||||
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
class ChatPermissionsSettingsController extends State<ChatPermissionsSettings> {
|
||||||
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
String? get roomId => GoRouterState.of(context).pathParameters['roomid'];
|
||||||
void editPowerLevel(
|
Future<void> editPowerLevel(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
String key,
|
String key,
|
||||||
int currentLevel, {
|
int currentLevel, {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ class ChatSearchController extends State<ChatSearchPage>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void startSearch() async {
|
Future<void> startSearch() async {
|
||||||
switch (tabController.index) {
|
switch (tabController.index) {
|
||||||
case 0:
|
case 0:
|
||||||
final searchQuery = searchController.text.trim();
|
final searchQuery = searchController.text.trim();
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkChatBackup() async {
|
Future<void> _checkChatBackup() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final state = await client.getCryptoIdentityState();
|
final state = await client.getCryptoIdentityState();
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
@ -46,7 +46,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeDevicesAction(List<Device> devices) async {
|
Future<void> removeDevicesAction(List<Device> devices) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
|
|
||||||
final wellKnown = await client.getWellknown();
|
final wellKnown = await client.getWellknown();
|
||||||
|
|
@ -84,7 +84,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
void renameDeviceAction(Device device) async {
|
Future<void> renameDeviceAction(Device device) async {
|
||||||
final displayName = await showTextInputDialog(
|
final displayName = await showTextInputDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).changeDeviceName,
|
title: L10n.of(context).changeDeviceName,
|
||||||
|
|
@ -104,7 +104,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyDeviceAction(Device device) async {
|
Future<void> verifyDeviceAction(Device device) async {
|
||||||
final consent = await showOkCancelAlertDialog(
|
final consent = await showOkCancelAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).verifyOtherDevice,
|
title: L10n.of(context).verifyOtherDevice,
|
||||||
|
|
@ -129,7 +129,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
await KeyVerificationDialog(request: req).show(context);
|
await KeyVerificationDialog(request: req).show(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blockDeviceAction(Device device) async {
|
Future<void> blockDeviceAction(Device device) async {
|
||||||
final key = Matrix.of(context)
|
final key = Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
.userDeviceKeys[Matrix.of(context).client.userID!]!
|
.userDeviceKeys[Matrix.of(context).client.userID!]!
|
||||||
|
|
@ -141,7 +141,7 @@ class DevicesSettingsController extends State<DevicesSettings> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void unblockDeviceAction(Device device) async {
|
Future<void> unblockDeviceAction(Device device) async {
|
||||||
final key = Matrix.of(context)
|
final key = Matrix.of(context)
|
||||||
.client
|
.client
|
||||||
.userDeviceKeys[Matrix.of(context).client.userID!]!
|
.userDeviceKeys[Matrix.of(context).client.userID!]!
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ class MyCallingPage extends State<Calling> {
|
||||||
EdgeInsetsGeometry? _localVideoMargin;
|
EdgeInsetsGeometry? _localVideoMargin;
|
||||||
CallState? _state;
|
CallState? _state;
|
||||||
|
|
||||||
void _playCallSound() async {
|
Future<void> _playCallSound() async {
|
||||||
const path = 'assets/sounds/call.ogg';
|
const path = 'assets/sounds/call.ogg';
|
||||||
if (kIsWeb || PlatformInfos.isMobile || PlatformInfos.isMacOS) {
|
if (kIsWeb || PlatformInfos.isMobile || PlatformInfos.isMacOS) {
|
||||||
final player = AudioPlayer();
|
final player = AudioPlayer();
|
||||||
|
|
@ -245,7 +245,7 @@ class MyCallingPage extends State<Calling> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _handleCallState(CallState state) {
|
void _handleCallState(CallState state) {
|
||||||
Logs().v('CallingPage::handleCallState: ${state.toString()}');
|
Logs().v('CallingPage::handleCallState: $state');
|
||||||
if ({CallState.kConnected, CallState.kEnded}.contains(state)) {
|
if ({CallState.kConnected, CallState.kEnded}.contains(state)) {
|
||||||
HapticFeedback.heavyImpact();
|
HapticFeedback.heavyImpact();
|
||||||
}
|
}
|
||||||
|
|
@ -322,7 +322,7 @@ class MyCallingPage extends State<Calling> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _switchCamera() async {
|
Future<void> _switchCamera() async {
|
||||||
if (call.localUserMediaStream != null) {
|
if (call.localUserMediaStream != null) {
|
||||||
await Helper.switchCamera(
|
await Helper.switchCamera(
|
||||||
call.localUserMediaStream!.stream!.getVideoTracks().first,
|
call.localUserMediaStream!.stream!.getVideoTracks().first,
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class ImageViewerController extends State<ImageViewer> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void prevImage() async {
|
Future<void> prevImage() async {
|
||||||
await pageController.previousPage(
|
await pageController.previousPage(
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
curve: FluffyThemes.animationCurve,
|
curve: FluffyThemes.animationCurve,
|
||||||
|
|
@ -76,7 +76,7 @@ class ImageViewerController extends State<ImageViewer> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void nextImage() async {
|
Future<void> nextImage() async {
|
||||||
await pageController.nextPage(
|
await pageController.nextPage(
|
||||||
duration: FluffyThemes.animationDuration,
|
duration: FluffyThemes.animationDuration,
|
||||||
curve: FluffyThemes.animationCurve,
|
curve: FluffyThemes.animationCurve,
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
final _supportsVideoPlayer =
|
final _supportsVideoPlayer =
|
||||||
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
|
!PlatformInfos.isWindows && !PlatformInfos.isLinux;
|
||||||
|
|
||||||
void _downloadAction() async {
|
Future<void> _downloadAction() async {
|
||||||
if (!_supportsVideoPlayer) {
|
if (!_supportsVideoPlayer) {
|
||||||
widget.event.saveFile(context);
|
widget.event.saveFile(context);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class _IntroPagePresenterState extends State<IntroPagePresenter> {
|
||||||
if (kIsWeb) _finishOidcLogin();
|
if (kIsWeb) _finishOidcLogin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _finishOidcLogin() async {
|
Future<void> _finishOidcLogin() async {
|
||||||
final store = await SharedPreferences.getInstance();
|
final store = await SharedPreferences.getInstance();
|
||||||
final storedHomeserverString = store.getString(
|
final storedHomeserverString = store.getString(
|
||||||
OidcSessionJsonExtension.homeserverStoreKey,
|
OidcSessionJsonExtension.homeserverStoreKey,
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,11 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
return contacts;
|
return contacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
void inviteAction(BuildContext context, String id, String displayname) async {
|
Future<void> inviteAction(
|
||||||
|
BuildContext context,
|
||||||
|
String id,
|
||||||
|
String displayname,
|
||||||
|
) async {
|
||||||
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
final room = Matrix.of(context).client.getRoomById(roomId!)!;
|
||||||
|
|
||||||
final success = await showFutureLoadingDialog(
|
final success = await showFutureLoadingDialog(
|
||||||
|
|
@ -74,7 +78,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void searchUser(BuildContext context, String text) async {
|
Future<void> searchUser(BuildContext context, String text) async {
|
||||||
coolDown?.cancel();
|
coolDown?.cancel();
|
||||||
if (text.isEmpty) {
|
if (text.isEmpty) {
|
||||||
setState(() => foundProfiles = []);
|
setState(() => foundProfiles = []);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class LoginController extends State<Login> {
|
||||||
void toggleShowPassword() =>
|
void toggleShowPassword() =>
|
||||||
setState(() => showPassword = !loading && !showPassword);
|
setState(() => showPassword = !loading && !showPassword);
|
||||||
|
|
||||||
void login() async {
|
Future<void> login() async {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
if (usernameController.text.isEmpty) {
|
if (usernameController.text.isEmpty) {
|
||||||
setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
|
setState(() => usernameError = L10n.of(context).pleaseEnterYourUsername);
|
||||||
|
|
@ -102,7 +102,7 @@ class LoginController extends State<Login> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkWellKnown(String userId) async {
|
Future<void> _checkWellKnown(String userId) async {
|
||||||
if (mounted) setState(() => usernameError = null);
|
if (mounted) setState(() => usernameError = null);
|
||||||
if (!userId.isValidMatrixId) return;
|
if (!userId.isValidMatrixId) return;
|
||||||
final oldHomeserver = widget.client.homeserver;
|
final oldHomeserver = widget.client.homeserver;
|
||||||
|
|
@ -158,7 +158,7 @@ class LoginController extends State<Login> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void passwordForgotten() async {
|
Future<void> passwordForgotten() async {
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class NewGroupController extends State<NewGroup> {
|
||||||
|
|
||||||
void setGroupCanBeFound(bool b) => setState(() => groupCanBeFound = b);
|
void setGroupCanBeFound(bool b) => setState(() => groupCanBeFound = b);
|
||||||
|
|
||||||
void selectPhoto() async {
|
Future<void> selectPhoto() async {
|
||||||
final photo = await selectFiles(
|
final photo = await selectFiles(
|
||||||
context,
|
context,
|
||||||
type: FileType.image,
|
type: FileType.image,
|
||||||
|
|
@ -108,7 +108,7 @@ class NewGroupController extends State<NewGroup> {
|
||||||
context.pop<String>(spaceId);
|
context.pop<String>(spaceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void submitAction([_]) async {
|
Future<void> submitAction([_]) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
|
||||||
|
|
||||||
static const Duration _coolDown = Duration(milliseconds: 500);
|
static const Duration _coolDown = Duration(milliseconds: 500);
|
||||||
|
|
||||||
void searchUsers([String? input]) async {
|
Future<void> searchUsers([String? input]) async {
|
||||||
final searchTerm = input ?? controller.text;
|
final searchTerm = input ?? controller.text;
|
||||||
if (searchTerm.isEmpty) {
|
if (searchTerm.isEmpty) {
|
||||||
_searchCoolDown?.cancel();
|
_searchCoolDown?.cancel();
|
||||||
|
|
@ -68,7 +68,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
|
||||||
|
|
||||||
void inviteAction() => FluffyShare.shareInviteLink(context);
|
void inviteAction() => FluffyShare.shareInviteLink(context);
|
||||||
|
|
||||||
void openScannerAction() async {
|
Future<void> openScannerAction() async {
|
||||||
if (PlatformInfos.isAndroid) {
|
if (PlatformInfos.isAndroid) {
|
||||||
final info = await DeviceInfoPlugin().androidInfo;
|
final info = await DeviceInfoPlugin().androidInfo;
|
||||||
if (info.version.sdkInt < 21) {
|
if (info.version.sdkInt < 21) {
|
||||||
|
|
@ -88,7 +88,7 @@ class NewPrivateChatController extends State<NewPrivateChat> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copyUserId() async {
|
Future<void> copyUserId() async {
|
||||||
await Clipboard.setData(
|
await Clipboard.setData(
|
||||||
ClipboardData(text: Matrix.of(context).client.userID!),
|
ClipboardData(text: Matrix.of(context).client.userID!),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ class SettingsController extends State<Settings> {
|
||||||
profileFuture = null;
|
profileFuture = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
void setDisplaynameAction() async {
|
Future<void> setDisplaynameAction() async {
|
||||||
final profile = await profileFuture;
|
final profile = await profileFuture;
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
|
|
@ -61,7 +61,7 @@ class SettingsController extends State<Settings> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void logoutAction() async {
|
Future<void> logoutAction() async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -81,7 +81,7 @@ class SettingsController extends State<Settings> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setAvatarAction() async {
|
Future<void> setAvatarAction() async {
|
||||||
final profile = await profileFuture;
|
final profile = await profileFuture;
|
||||||
final actions = [
|
final actions = [
|
||||||
if (PlatformInfos.isMobile)
|
if (PlatformInfos.isMobile)
|
||||||
|
|
@ -159,7 +159,7 @@ class SettingsController extends State<Settings> {
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkBootstrap() async {
|
Future<void> checkBootstrap() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
if (!client.encryptionEnabled) return;
|
if (!client.encryptionEnabled) return;
|
||||||
await client.accountDataLoading;
|
await client.accountDataLoading;
|
||||||
|
|
@ -176,7 +176,7 @@ class SettingsController extends State<Settings> {
|
||||||
|
|
||||||
bool? cryptoIdentityConnected;
|
bool? cryptoIdentityConnected;
|
||||||
|
|
||||||
void firstRunBootstrapAction([_]) async {
|
Future<void> firstRunBootstrapAction([_]) async {
|
||||||
if (cryptoIdentityConnected == true) {
|
if (cryptoIdentityConnected == true) {
|
||||||
showOkAlertDialog(
|
showOkAlertDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class Settings3Pid extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class Settings3PidController extends State<Settings3Pid> {
|
class Settings3PidController extends State<Settings3Pid> {
|
||||||
void add3PidAction() async {
|
Future<void> add3PidAction() async {
|
||||||
final input = await showTextInputDialog(
|
final input = await showTextInputDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -63,7 +63,7 @@ class Settings3PidController extends State<Settings3Pid> {
|
||||||
|
|
||||||
Future<List<ThirdPartyIdentifier>?>? request;
|
Future<List<ThirdPartyIdentifier>?>? request;
|
||||||
|
|
||||||
void delete3Pid(ThirdPartyIdentifier identifier) async {
|
Future<void> delete3Pid(ThirdPartyIdentifier identifier) async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void createImagePack() async {
|
Future<void> createImagePack() async {
|
||||||
final room = this.room;
|
final room = this.room;
|
||||||
if (room == null) throw Exception('Cannot create image pack without room');
|
if (room == null) throw Exception('Cannot create image pack without room');
|
||||||
|
|
||||||
|
|
@ -287,14 +287,14 @@ class EmotesSettingsController extends State<EmotesSettings> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveAction() async {
|
Future<void> saveAction() async {
|
||||||
await save(context);
|
await save(context);
|
||||||
setState(() {
|
setState(() {
|
||||||
showSave = false;
|
showSave = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void createStickers() async {
|
Future<void> createStickers() async {
|
||||||
final pickedFiles = await selectFiles(
|
final pickedFiles = await selectFiles(
|
||||||
context,
|
context,
|
||||||
type: FileType.image,
|
type: FileType.image,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class SettingsNotifications extends StatefulWidget {
|
||||||
class SettingsNotificationsController extends State<SettingsNotifications> {
|
class SettingsNotificationsController extends State<SettingsNotifications> {
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
|
||||||
void onPusherTap(Pusher pusher) async {
|
Future<void> onPusherTap(Pusher pusher) async {
|
||||||
final delete = await showModalActionPopup<bool>(
|
final delete = await showModalActionPopup<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
title: pusher.deviceDisplayName,
|
title: pusher.deviceDisplayName,
|
||||||
|
|
@ -58,7 +58,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
||||||
|
|
||||||
Future<List<Pusher>?>? pusherFuture;
|
Future<List<Pusher>?>? pusherFuture;
|
||||||
|
|
||||||
void togglePushRule(PushRuleKind kind, PushRule pushRule) async {
|
Future<void> togglePushRule(PushRuleKind kind, PushRule pushRule) async {
|
||||||
setState(() {
|
setState(() {
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
});
|
});
|
||||||
|
|
@ -91,7 +91,7 @@ class SettingsNotificationsController extends State<SettingsNotifications> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void editPushRule(PushRule rule, PushRuleKind kind) async {
|
Future<void> editPushRule(PushRule rule, PushRuleKind kind) async {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final action = await showAdaptiveDialog<PushRuleDialogAction>(
|
final action = await showAdaptiveDialog<PushRuleDialogAction>(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ class SettingsPasswordController extends State<SettingsPassword> {
|
||||||
|
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|
||||||
void changePassword() async {
|
Future<void> changePassword() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
oldPasswordError = newPassword1Error = newPassword2Error = null;
|
oldPasswordError = newPassword1Error = newPassword2Error = null;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ class SettingsSecurity extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class SettingsSecurityController extends State<SettingsSecurity> {
|
class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
void setAppLockAction() async {
|
Future<void> setAppLockAction() async {
|
||||||
if (AppLock.of(context).isActive) {
|
if (AppLock.of(context).isActive) {
|
||||||
AppLock.of(context).showLockScreen();
|
AppLock.of(context).showLockScreen();
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteAccountAction() async {
|
Future<void> deleteAccountAction() async {
|
||||||
if (await showOkCancelAlertDialog(
|
if (await showOkCancelAlertDialog(
|
||||||
useRootNavigator: false,
|
useRootNavigator: false,
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -93,7 +93,7 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
|
|
||||||
Future<void> dehydrateAction() => Matrix.of(context).dehydrateAction(context);
|
Future<void> dehydrateAction() => Matrix.of(context).dehydrateAction(context);
|
||||||
|
|
||||||
void changeShareKeysWith(ShareKeysWith? shareKeysWith) async {
|
Future<void> changeShareKeysWith(ShareKeysWith? shareKeysWith) async {
|
||||||
if (shareKeysWith == null) return;
|
if (shareKeysWith == null) return;
|
||||||
AppSettings.shareKeysWith.setItem(shareKeysWith.name);
|
AppSettings.shareKeysWith.setItem(shareKeysWith.name);
|
||||||
Matrix.of(context).client.shareKeysWith = shareKeysWith;
|
Matrix.of(context).client.shareKeysWith = shareKeysWith;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class SettingsStyleController extends State<SettingsStyle> {
|
||||||
ThemeController.of(context).setPrimaryColor(color);
|
ThemeController.of(context).setPrimaryColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWallpaper() async {
|
Future<void> setWallpaper() async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final picked = await selectFiles(context, type: FileType.image);
|
final picked = await selectFiles(context, type: FileType.image);
|
||||||
final pickedFile = picked.firstOrNull;
|
final pickedFile = picked.firstOrNull;
|
||||||
|
|
@ -53,7 +53,7 @@ class SettingsStyleController extends State<SettingsStyle> {
|
||||||
|
|
||||||
double? _wallpaperOpacity;
|
double? _wallpaperOpacity;
|
||||||
|
|
||||||
void saveWallpaperOpacity(double opacity) async {
|
Future<void> saveWallpaperOpacity(double opacity) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -80,7 +80,7 @@ class SettingsStyleController extends State<SettingsStyle> {
|
||||||
0.5;
|
0.5;
|
||||||
double? _wallpaperBlur;
|
double? _wallpaperBlur;
|
||||||
|
|
||||||
void saveWallpaperBlur(double blur) async {
|
Future<void> saveWallpaperBlur(double blur) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final result = await showFutureLoadingDialog(
|
final result = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
@ -153,7 +153,7 @@ class SettingsStyleController extends State<SettingsStyle> {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void changeFontSizeFactor(double d) async {
|
Future<void> changeFontSizeFactor(double d) async {
|
||||||
await AppSettings.fontSizeFactor.setItem(d);
|
await AppSettings.fontSizeFactor.setItem(d);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ class SettingsStyleView extends StatelessWidget {
|
||||||
type: EventTypes.RoomMember,
|
type: EventTypes.RoomMember,
|
||||||
senderId: client.userID!,
|
senderId: client.userID!,
|
||||||
originServerTs: DateTime.now(),
|
originServerTs: DateTime.now(),
|
||||||
stateKey: client.userID!,
|
stateKey: client.userID,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class SignInViewModel extends ValueNotifier<SignInState> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void refreshPublicHomeservers() async {
|
Future<void> refreshPublicHomeservers() async {
|
||||||
value = value.copyWith(publicHomeservers: AsyncSnapshot.waiting());
|
value = value.copyWith(publicHomeservers: AsyncSnapshot.waiting());
|
||||||
final defaultHomeserverData = PublicHomeserverData(
|
final defaultHomeserverData = PublicHomeserverData(
|
||||||
name: AppSettings.defaultHomeserver.value,
|
name: AppSettings.defaultHomeserver.value,
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ class BackgroundPush {
|
||||||
|
|
||||||
bool upAction = false;
|
bool upAction = false;
|
||||||
|
|
||||||
void _init() async {
|
Future<void> _init() async {
|
||||||
//<GOOGLE_SERVICES>firebaseEnabled = true;
|
//<GOOGLE_SERVICES>firebaseEnabled = true;
|
||||||
try {
|
try {
|
||||||
mainIsolateReceivePort?.listen((message) async {
|
mainIsolateReceivePort?.listen((message) async {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ extension ClientDownloadContentExtension on Client {
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
animated: animated,
|
animated: animated,
|
||||||
method: thumbnailMethod!,
|
method: thumbnailMethod,
|
||||||
)
|
)
|
||||||
: mxc;
|
: mxc;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ abstract class ClientManager {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sendInitNotification(String title, String body) async {
|
static Future<void> sendInitNotification(String title, String body) async {
|
||||||
if (kIsWeb) {
|
if (kIsWeb) {
|
||||||
html.Notification(title, body: body);
|
html.Notification(title, body: body);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -22,14 +22,14 @@ class ErrorReporter {
|
||||||
'HandshakeException',
|
'HandshakeException',
|
||||||
};
|
};
|
||||||
|
|
||||||
void onErrorCallback(Object error, [StackTrace? stackTrace]) {
|
Future<void> onErrorCallback(Object error, [StackTrace? stackTrace]) async {
|
||||||
if (ingoredTypes.contains(error.runtimeType.toString())) return;
|
if (ingoredTypes.contains(error.runtimeType.toString())) return;
|
||||||
Logs().e(message ?? 'Error caught', error, stackTrace);
|
Logs().e(message ?? 'Error caught', error, stackTrace);
|
||||||
final text = '$error\n${stackTrace ?? ''}';
|
final text = '$error\n${stackTrace ?? ''}';
|
||||||
return _onErrorCallback(text);
|
return _onErrorCallback(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onErrorCallback(String text) async {
|
Future<void> _onErrorCallback(String text) async {
|
||||||
await showAdaptiveDialog(
|
await showAdaptiveDialog(
|
||||||
context: context!,
|
context: context!,
|
||||||
builder: (context) => AlertDialog.adaptive(
|
builder: (context) => AlertDialog.adaptive(
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class MarkdownContextBuilder extends StatelessWidget {
|
||||||
controller.text = controller.text.replaceRange(
|
controller.text = controller.text.replaceRange(
|
||||||
selection.start,
|
selection.start,
|
||||||
selection.end,
|
selection.end,
|
||||||
'[$selectedText](${url.toString()})',
|
'[$selectedText]($url)',
|
||||||
);
|
);
|
||||||
ContextMenuController.removeAny();
|
ContextMenuController.removeAny();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -26,13 +26,13 @@ extension LocalizedBody on Event {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
void saveFile(BuildContext context) async {
|
Future<void> saveFile(BuildContext context) async {
|
||||||
final matrixFile = await _getFile(context);
|
final matrixFile = await _getFile(context);
|
||||||
|
|
||||||
matrixFile.result?.save(context);
|
matrixFile.result?.save(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareFile(BuildContext context) async {
|
Future<void> shareFile(BuildContext context) async {
|
||||||
final matrixFile = await _getFile(context);
|
final matrixFile = await _getFile(context);
|
||||||
inspect(matrixFile);
|
inspect(matrixFile);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ Future<String?> getDatabaseCipher() async {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _sendNoEncryptionWarning(Object exception) async {
|
Future<void> _sendNoEncryptionWarning(Object exception) async {
|
||||||
final isStored = AppSettings.noEncryptionWarningShown.value;
|
final isStored = AppSettings.noEncryptionWarningShown.value;
|
||||||
|
|
||||||
if (isStored == true) return;
|
if (isStored == true) return;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import 'package:fluffychat/l10n/l10n.dart';
|
||||||
import 'package:fluffychat/utils/size_string.dart';
|
import 'package:fluffychat/utils/size_string.dart';
|
||||||
|
|
||||||
extension MatrixFileExtension on MatrixFile {
|
extension MatrixFileExtension on MatrixFile {
|
||||||
void save(BuildContext context) async {
|
Future<void> save(BuildContext context) async {
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
final l10n = L10n.of(context);
|
final l10n = L10n.of(context);
|
||||||
final downloadPath = await FilePicker.platform.saveFile(
|
final downloadPath = await FilePicker.platform.saveFile(
|
||||||
|
|
@ -31,7 +31,7 @@ extension MatrixFileExtension on MatrixFile {
|
||||||
return FileType.any;
|
return FileType.any;
|
||||||
}
|
}
|
||||||
|
|
||||||
void share(BuildContext context) async {
|
Future<void> share(BuildContext context) async {
|
||||||
// Workaround for iPad from
|
// Workaround for iPad from
|
||||||
// https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus/share_plus#ipad
|
// https://github.com/fluttercommunity/plus_plugins/tree/main/packages/share_plus/share_plus#ipad
|
||||||
final box = context.findRenderObject() as RenderBox?;
|
final box = context.findRenderObject() as RenderBox?;
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ Future<void> waitForPushIsolateDone() async {
|
||||||
}
|
}
|
||||||
|
|
||||||
@pragma('vm:entry-point')
|
@pragma('vm:entry-point')
|
||||||
void notificationTapBackground(
|
Future<void> notificationTapBackground(
|
||||||
NotificationResponse notificationResponse,
|
NotificationResponse notificationResponse,
|
||||||
) async {
|
) async {
|
||||||
final sendPort = IsolateNameServer.lookupPortByName(
|
final sendPort = IsolateNameServer.lookupPortByName(
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ abstract class PlatformInfos {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void showDialog(BuildContext context) async {
|
static Future<void> showDialog(BuildContext context) async {
|
||||||
final version = await PlatformInfos.getVersion();
|
final version = await PlatformInfos.getVersion();
|
||||||
showAboutDialog(
|
showAboutDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import 'package:fluffychat/utils/platform_infos.dart';
|
||||||
abstract class UpdateNotifier {
|
abstract class UpdateNotifier {
|
||||||
static const String versionStoreKey = 'last_known_version';
|
static const String versionStoreKey = 'last_known_version';
|
||||||
|
|
||||||
static void showUpdateSnackBar(BuildContext context) async {
|
static Future<void> showUpdateSnackBar(BuildContext context) async {
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
final currentVersion = await PlatformInfos.getVersion();
|
final currentVersion = await PlatformInfos.getVersion();
|
||||||
final store = await SharedPreferences.getInstance();
|
final store = await SharedPreferences.getInstance();
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import 'package:fluffychat/utils/sign_in_flows/sso_login.dart';
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import 'package:fluffychat/widgets/matrix.dart';
|
import 'package:fluffychat/widgets/matrix.dart';
|
||||||
|
|
||||||
void connectToHomeserverFlow(
|
Future<void> connectToHomeserverFlow(
|
||||||
PublicHomeserverData homeserverData,
|
PublicHomeserverData homeserverData,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
void Function(AsyncSnapshot<bool>) setState,
|
void Function(AsyncSnapshot<bool>) setState,
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,15 @@ extension SizeString on num {
|
||||||
if (size < 1000 * 1000) {
|
if (size < 1000 * 1000) {
|
||||||
size = size / 1000;
|
size = size / 1000;
|
||||||
size = (size * 10).round() / 10;
|
size = (size * 10).round() / 10;
|
||||||
return '${size.toString()} KB';
|
return '$size KB';
|
||||||
}
|
}
|
||||||
if (size < 1000 * 1000 * 1000) {
|
if (size < 1000 * 1000 * 1000) {
|
||||||
size = size / 1000000;
|
size = size / 1000000;
|
||||||
size = (size * 10).round() / 10;
|
size = (size * 10).round() / 10;
|
||||||
return '${size.toString()} MB';
|
return '$size MB';
|
||||||
}
|
}
|
||||||
size = size / 1000 * 1000 * 1000 * 1000;
|
size = size / 1000 * 1000 * 1000 * 1000;
|
||||||
size = (size * 10).round() / 10;
|
size = (size * 10).round() / 10;
|
||||||
return '${size.toString()} GB';
|
return '$size GB';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ class UrlLauncher {
|
||||||
|
|
||||||
const UrlLauncher(this.context, this.url, [this.name]);
|
const UrlLauncher(this.context, this.url, [this.name]);
|
||||||
|
|
||||||
void launchUrl() async {
|
Future<void> launchUrl() async {
|
||||||
if (url!.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
|
if (url!.toLowerCase().startsWith(AppConfig.deepLinkPrefix) ||
|
||||||
url!.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
|
url!.toLowerCase().startsWith(AppConfig.inviteLinkPrefix) ||
|
||||||
{'#', '@', '!', '+', '\$'}.contains(url![0]) ||
|
{'#', '@', '!', '+', '\$'}.contains(url![0]) ||
|
||||||
|
|
@ -117,7 +117,7 @@ class UrlLauncher {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void openMatrixToUrl() async {
|
Future<void> openMatrixToUrl() async {
|
||||||
final matrix = Matrix.of(context);
|
final matrix = Matrix.of(context);
|
||||||
final url = this.url!.replaceFirst(
|
final url = this.url!.replaceFirst(
|
||||||
AppConfig.deepLinkPrefix,
|
AppConfig.deepLinkPrefix,
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class PublicRoomDialog extends StatelessWidget {
|
||||||
|
|
||||||
const PublicRoomDialog({super.key, this.roomAlias, this.chunk, this.via});
|
const PublicRoomDialog({super.key, this.roomAlias, this.chunk, this.via});
|
||||||
|
|
||||||
void _joinRoom(BuildContext context) async {
|
Future<void> _joinRoom(BuildContext context) async {
|
||||||
final client = Matrix.of(context).client;
|
final client = Matrix.of(context).client;
|
||||||
final chunk = this.chunk;
|
final chunk = this.chunk;
|
||||||
final knock = chunk?.joinRule == 'knock';
|
final knock = chunk?.joinRule == 'knock';
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class AppLock extends State<AppLockWidget> with WidgetsBindingObserver {
|
||||||
WidgetsBinding.instance.addPostFrameCallback(_checkLoggedIn);
|
WidgetsBinding.instance.addPostFrameCallback(_checkLoggedIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _checkLoggedIn(_) async {
|
Future<void> _checkLoggedIn(_) async {
|
||||||
if (widget.clients.any((client) => client.isLogged())) return;
|
if (widget.clients.any((client) => client.isLogged())) return;
|
||||||
|
|
||||||
await changePincode(null);
|
await changePincode(null);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class ConfigViewer extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ConfigViewerState extends State<ConfigViewer> {
|
class _ConfigViewerState extends State<ConfigViewer> {
|
||||||
void _changeSetting(
|
Future<void> _changeSetting(
|
||||||
AppSettings appSetting,
|
AppSettings appSetting,
|
||||||
SharedPreferences store,
|
SharedPreferences store,
|
||||||
String initialValue,
|
String initialValue,
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ extension LocalNotificationsExtension on MatrixState {
|
||||||
..src = 'assets/assets/sounds/notification.ogg'
|
..src = 'assets/assets/sounds/notification.ogg'
|
||||||
..load();
|
..load();
|
||||||
|
|
||||||
void showLocalNotification(Event event) async {
|
Future<void> showLocalNotification(Event event) async {
|
||||||
final roomId = event.room.id;
|
final roomId = event.room.id;
|
||||||
if (activeRoomId == roomId) {
|
if (activeRoomId == roomId) {
|
||||||
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ class _LockScreenState extends State<LockScreen> {
|
||||||
bool _inputBlocked = false;
|
bool _inputBlocked = false;
|
||||||
final TextEditingController _textEditingController = TextEditingController();
|
final TextEditingController _textEditingController = TextEditingController();
|
||||||
|
|
||||||
void tryUnlock(String text) async {
|
Future<void> tryUnlock(String text) async {
|
||||||
text = text.trim();
|
text = text.trim();
|
||||||
setState(() {
|
setState(() {
|
||||||
_errorText = null;
|
_errorText = null;
|
||||||
|
|
|
||||||
|
|
@ -81,10 +81,10 @@ extension on LogEvent {
|
||||||
String toDisplayString() {
|
String toDisplayString() {
|
||||||
var str = '# [${level.toString().split('.').last.toUpperCase()}] $title';
|
var str = '# [${level.toString().split('.').last.toUpperCase()}] $title';
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
str += ' - ${exception.toString()}';
|
str += ' - $exception';
|
||||||
}
|
}
|
||||||
if (stackTrace != null) {
|
if (stackTrace != null) {
|
||||||
str += '\n${stackTrace.toString()}';
|
str += '\n$stackTrace';
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -342,7 +342,7 @@ class MatrixState extends State<Matrix> with WidgetsBindingObserver {
|
||||||
createVoipPlugin();
|
createVoipPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
void createVoipPlugin() async {
|
Future<void> createVoipPlugin() async {
|
||||||
if (AppSettings.experimentalVoip.value) {
|
if (AppSettings.experimentalVoip.value) {
|
||||||
voipPlugin = null;
|
voipPlugin = null;
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import 'adaptive_dialogs/user_dialog.dart';
|
||||||
import 'avatar.dart';
|
import 'avatar.dart';
|
||||||
import 'future_loading_dialog.dart';
|
import 'future_loading_dialog.dart';
|
||||||
|
|
||||||
void showMemberActionsPopupMenu({
|
Future<void> showMemberActionsPopupMenu({
|
||||||
required BuildContext context,
|
required BuildContext context,
|
||||||
required User user,
|
required User user,
|
||||||
void Function()? onMention,
|
void Function()? onMention,
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ class _MxcImageState extends State<MxcImage> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _tryLoad() async {
|
Future<void> _tryLoad() async {
|
||||||
if (_imageData != null) {
|
if (_imageData != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class QrCodeViewer extends StatelessWidget {
|
||||||
|
|
||||||
const QrCodeViewer({required this.content, super.key});
|
const QrCodeViewer({required this.content, super.key});
|
||||||
|
|
||||||
void _save(BuildContext context) async {
|
Future<void> _save(BuildContext context) async {
|
||||||
final imageResult = await showFutureLoadingDialog(
|
final imageResult = await showFutureLoadingDialog(
|
||||||
context: context,
|
context: context,
|
||||||
future: () {
|
future: () {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class _ShareScaffoldDialogState extends State<ShareScaffoldDialog> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void _forwardAction() async {
|
Future<void> _forwardAction() async {
|
||||||
final roomId = selectedRoomId;
|
final roomId = selectedRoomId;
|
||||||
if (roomId == null) {
|
if (roomId == null) {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ class ThemeController extends State<ThemeBuilder> {
|
||||||
static ThemeController of(BuildContext context) =>
|
static ThemeController of(BuildContext context) =>
|
||||||
Provider.of<ThemeController>(context, listen: false);
|
Provider.of<ThemeController>(context, listen: false);
|
||||||
|
|
||||||
void _loadData(_) async {
|
Future<void> _loadData(_) async {
|
||||||
final preferences = _sharedPreferences ??=
|
final preferences = _sharedPreferences ??=
|
||||||
await SharedPreferences.getInstance();
|
await SharedPreferences.getInstance();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue