Добавил сообщение о длительном ожидании при инициализации
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Struchkov Mark 2023-02-08 02:57:15 +03:00
parent def5eaa205
commit 56d09f7639
Signed by: upagge
GPG Key ID: D3018BE7BA428CA6

View File

@ -14,7 +14,6 @@ import dev.struchkov.godfather.main.domain.annotation.Unit;
import dev.struchkov.godfather.main.domain.content.Mail; import dev.struchkov.godfather.main.domain.content.Mail;
import dev.struchkov.godfather.simple.core.unit.AnswerText; import dev.struchkov.godfather.simple.core.unit.AnswerText;
import dev.struchkov.godfather.simple.core.unit.MainUnit; import dev.struchkov.godfather.simple.core.unit.MainUnit;
import dev.struchkov.godfather.simple.data.StorylineContext;
import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment; import dev.struchkov.godfather.telegram.domain.attachment.ButtonClickAttachment;
import dev.struchkov.godfather.telegram.main.core.util.Attachments; import dev.struchkov.godfather.telegram.main.core.util.Attachments;
import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending; import dev.struchkov.godfather.telegram.simple.context.service.TelegramSending;
@ -57,7 +56,6 @@ import static java.text.MessageFormat.format;
public class InitSettingFlow { public class InitSettingFlow {
private final TelegramSending sending; private final TelegramSending sending;
private final StorylineContext context;
private final PersonInformation personInformation; private final PersonInformation personInformation;
@ -138,7 +136,7 @@ public class InitSettingFlow {
) { ) {
return AnswerText.<Mail>builder() return AnswerText.<Mail>builder()
.triggerCheck(clickButtonRaw("NO")) .triggerCheck(clickButtonRaw("NO"))
.answer(replaceBoxAnswer("Okay, I won't scan public projects.")) .answer(replaceBoxAnswer("\uD83D\uDC4C I won't scan public projects."))
.<Integer>callBack( .<Integer>callBack(
sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 10, TimeUnit.SECONDS) sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 10, TimeUnit.SECONDS)
) )
@ -260,6 +258,7 @@ public class InitSettingFlow {
.answer(mail -> { .answer(mail -> {
final ButtonClickAttachment buttonClick = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow(); final ButtonClickAttachment buttonClick = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow();
if ("YES".equals(buttonClick.getRawCallBackData())) { if ("YES".equals(buttonClick.getRawCallBackData())) {
sending.replaceMessage(mail.getPersonId(), mail.getId(), boxAnswer("⌛I write down the available projects. This may take a long time."));
projectParser.parseAllProjectOwner(); projectParser.parseAllProjectOwner();
settingService.ownerProjectScan(true); settingService.ownerProjectScan(true);
} else { } else {
@ -378,7 +377,7 @@ public class InitSettingFlow {
) { ) {
return AnswerText.<Mail>builder() return AnswerText.<Mail>builder()
.triggerPhrase("NO") .triggerPhrase("NO")
.answer(replaceBoxAnswer("Okay, I won't scan private projects.")) .answer(replaceBoxAnswer("\uD83D\uDC4C I won't scan private projects."))
.<Integer>callBack( .<Integer>callBack(
sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 10, TimeUnit.SECONDS) sentBox -> scheduledExecutorService.schedule(() -> sending.deleteMessage(sentBox.getPersonId(), sentBox.getMessageId()), 10, TimeUnit.SECONDS)
) )
@ -394,7 +393,11 @@ public class InitSettingFlow {
.activeType(AFTER) .activeType(AFTER)
.answer( .answer(
boxAnswer( boxAnswer(
"Do you want to enable automatic notification of new private projects available to you?", """
Do you want to enable automatic notification of new private projects available to you?
-- -- -- -- --
I will be forced to scan all available private projects for this. I will not scan other entities in projects and send any notifications for these projects.
""",
inlineKeyBoard( inlineKeyBoard(
simpleLine( simpleLine(
simpleButton("Yes", "YES"), simpleButton("Yes", "YES"),
@ -416,6 +419,7 @@ public class InitSettingFlow {
.answer(mail -> { .answer(mail -> {
final ButtonClickAttachment buttonClick = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow(); final ButtonClickAttachment buttonClick = Attachments.findFirstButtonClick(mail.getAttachments()).orElseThrow();
if ("YES".equals(buttonClick.getRawCallBackData())) { if ("YES".equals(buttonClick.getRawCallBackData())) {
sending.replaceMessage(mail.getPersonId(), mail.getId(), boxAnswer("⌛I write down the available private projects. This may take a long time."));
projectParser.parseAllPrivateProject(); projectParser.parseAllPrivateProject();
settingService.privateProjectScan(true); settingService.privateProjectScan(true);
} else { } else {