refactor: Avoid redundant async
This commit is contained in:
parent
9d007815df
commit
d08364688e
15 changed files with 153 additions and 166 deletions
|
|
@ -90,7 +90,7 @@ class BootstrapDialogState extends State<BootstrapDialog> {
|
|||
context.canPop() ? context.pop(success) : context.go('/rooms');
|
||||
}
|
||||
|
||||
void _decryptLastEvents() async {
|
||||
void _decryptLastEvents() {
|
||||
for (final room in client.rooms) {
|
||||
final event = room.lastEvent;
|
||||
if (event != null &&
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ class ChatController extends State<ChatPageWithRoom>
|
|||
}
|
||||
}
|
||||
|
||||
void _loadDraft() async {
|
||||
void _loadDraft() {
|
||||
final prefs = Matrix.of(context).store;
|
||||
final draft = prefs.getString('draft_$roomId');
|
||||
if (draft != null && draft.isNotEmpty) {
|
||||
|
|
|
|||
|
|
@ -27,11 +27,7 @@ class PollWidget extends StatelessWidget {
|
|||
void _endPoll(BuildContext context) =>
|
||||
showFutureLoadingDialog(context: context, future: () => event.endPoll());
|
||||
|
||||
void _toggleVote(
|
||||
BuildContext context,
|
||||
String answerId,
|
||||
int maxSelection,
|
||||
) async {
|
||||
void _toggleVote(BuildContext context, String answerId, int maxSelection) {
|
||||
final userId = event.room.client.userID!;
|
||||
final answerIds = event.getPollResponses(timeline)[userId] ?? {};
|
||||
if (!answerIds.remove(answerId)) {
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ class ChatListController extends State<ChatList>
|
|||
scrollController.addListener(_onScroll);
|
||||
_waitForFirstSync();
|
||||
_hackyWebRTCFixForWeb();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
searchServer = Matrix.of(
|
||||
context,
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ class MyCallingPage extends State<Calling> {
|
|||
_playCallSound();
|
||||
}
|
||||
|
||||
void initialize() async {
|
||||
void initialize() {
|
||||
final call = this.call;
|
||||
call.onCallStateChanged.stream.listen(_handleCallState);
|
||||
call.onCallEventChanged.stream.listen((event) {
|
||||
|
|
@ -282,7 +282,7 @@ class MyCallingPage extends State<Calling> {
|
|||
});
|
||||
}
|
||||
|
||||
void _screenSharing() async {
|
||||
void _screenSharing() {
|
||||
if (PlatformInfos.isAndroid) {
|
||||
if (!call.screensharingEnabled) {
|
||||
FlutterForegroundTask.init(
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
|||
}
|
||||
}
|
||||
|
||||
void searchUserWithCoolDown(String text) async {
|
||||
void searchUserWithCoolDown(String text) {
|
||||
coolDown?.cancel();
|
||||
coolDown = Timer(
|
||||
const Duration(milliseconds: 500),
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class LoginController extends State<Login> {
|
|||
|
||||
Timer? _coolDown;
|
||||
|
||||
void checkWellKnownWithCoolDown(String userId) async {
|
||||
void checkWellKnownWithCoolDown(String userId) {
|
||||
_coolDown?.cancel();
|
||||
_coolDown = Timer(
|
||||
const Duration(seconds: 1),
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class SettingsStyle extends StatefulWidget {
|
|||
}
|
||||
|
||||
class SettingsStyleController extends State<SettingsStyle> {
|
||||
void setChatColor(Color? color) async {
|
||||
void setChatColor(Color? color) {
|
||||
AppSettings.colorSchemeSeedInt.setItem(
|
||||
color?.toARGB32() ?? AppSettings.colorSchemeSeedInt.defaultValue,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
Future<void> applyWorkaroundToOpenSqlCipherOnOldAndroidVersions() async {}
|
||||
Future<void> applyWorkaroundToOpenSqlCipherOnOldAndroidVersions() =>
|
||||
Future.value();
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class QrCodeViewer extends StatelessWidget {
|
|||
void _save(BuildContext context) async {
|
||||
final imageResult = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
future: () {
|
||||
final inviteLink = 'https://matrix.to/#/$content';
|
||||
final image = QRImage(inviteLink, size: 256, radius: 1).generate();
|
||||
return compute(encodePng, image);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue