mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 11:18:41 +00:00
fix tutorial gets open to often
This commit is contained in:
parent
7997bc2fa0
commit
33ab69b1b7
2 changed files with 90 additions and 85 deletions
|
|
@ -1,15 +1,10 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mutex/mutex.dart';
|
||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/utils/storage.dart';
|
||||
|
||||
final lockDisplayTutorial = Mutex();
|
||||
|
||||
Future showTutorial(BuildContext context, List<TargetFocus> targets) async {
|
||||
await lockDisplayTutorial.protect(() async {
|
||||
Completer completer = Completer();
|
||||
TutorialCoachMark(
|
||||
targets: targets,
|
||||
|
|
@ -42,7 +37,6 @@ Future showTutorial(BuildContext context, List<TargetFocus> targets) async {
|
|||
).show(context: context);
|
||||
|
||||
await completer.future;
|
||||
});
|
||||
}
|
||||
|
||||
Future<bool> checkIfTutorialAlreadyShown(String tutorialId) async {
|
||||
|
|
|
|||
|
|
@ -1,12 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:mutex/mutex.dart';
|
||||
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
import 'package:twonly/src/views/tutorial/show_tutorial.dart';
|
||||
|
||||
final lockDisplayTutorial = Mutex();
|
||||
|
||||
Future showChatListTutorialSearchOtherUsers(
|
||||
BuildContext context,
|
||||
GlobalKey searchForOtherUsers,
|
||||
) async {
|
||||
await lockDisplayTutorial.protect(() async {
|
||||
if (await checkIfTutorialAlreadyShown("chat_list:search_users")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -19,12 +23,14 @@ Future showChatListTutorialSearchOtherUsers(
|
|||
context.lang.tutorialChatListSearchUsersDesc,
|
||||
));
|
||||
await showTutorial(context, targets);
|
||||
});
|
||||
}
|
||||
|
||||
Future showChatListTutorialContextMenu(
|
||||
BuildContext context,
|
||||
GlobalKey firstUserListItemKey,
|
||||
) async {
|
||||
await lockDisplayTutorial.protect(() async {
|
||||
if (await checkIfTutorialAlreadyShown("chat_list:context_menu")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -37,12 +43,14 @@ Future showChatListTutorialContextMenu(
|
|||
context.lang.tutorialChatListContextMenuDesc,
|
||||
));
|
||||
await showTutorial(context, targets);
|
||||
});
|
||||
}
|
||||
|
||||
Future showVerifyShieldTutorial(
|
||||
BuildContext context,
|
||||
GlobalKey firstUserListItemKey,
|
||||
) async {
|
||||
await lockDisplayTutorial.protect(() async {
|
||||
if (await checkIfTutorialAlreadyShown("chat_messages:verify_shield")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -55,12 +63,14 @@ Future showVerifyShieldTutorial(
|
|||
context.lang.tutorialChatMessagesVerifyShieldDesc,
|
||||
));
|
||||
await showTutorial(context, targets);
|
||||
});
|
||||
}
|
||||
|
||||
Future showReopenMediaFilesTutorial(
|
||||
BuildContext context,
|
||||
GlobalKey firstUserListItemKey,
|
||||
) async {
|
||||
await lockDisplayTutorial.protect(() async {
|
||||
if (await checkIfTutorialAlreadyShown("chat_messages:reopen_message")) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -73,4 +83,5 @@ Future showReopenMediaFilesTutorial(
|
|||
context.lang.tutorialChatMessagesReopenMessageDesc,
|
||||
));
|
||||
await showTutorial(context, targets);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue