Fixing ReplyKeyboard flicker on TaggedButtonGrid
- fixing ReplyKeyboard flicker - updating message handling on existing messages
This commit is contained in:
parent
fd7d72b986
commit
2158f53cde
@ -506,21 +506,15 @@ namespace TelegramBotBase.Controls.Hybrid
|
|||||||
//Reply Keyboard could only be updated with a new keyboard.
|
//Reply Keyboard could only be updated with a new keyboard.
|
||||||
case eKeyboardType.ReplyKeyboard:
|
case eKeyboardType.ReplyKeyboard:
|
||||||
|
|
||||||
if (this.MessageId != null)
|
if (form.Count == 0)
|
||||||
{
|
{
|
||||||
if (form.Count == 0)
|
if (this.MessageId != null)
|
||||||
{
|
{
|
||||||
await this.Device.HideReplyKeyboard();
|
await this.Device.HideReplyKeyboard();
|
||||||
this.MessageId = null;
|
this.MessageId = null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.DeletePreviousMessage)
|
|
||||||
await this.Device.DeleteMessage(this.MessageId.Value);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (form.Count == 0)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
var rkm = (ReplyKeyboardMarkup)form;
|
var rkm = (ReplyKeyboardMarkup)form;
|
||||||
@ -528,6 +522,10 @@ namespace TelegramBotBase.Controls.Hybrid
|
|||||||
rkm.OneTimeKeyboard = this.OneTimeKeyboard;
|
rkm.OneTimeKeyboard = this.OneTimeKeyboard;
|
||||||
m = await this.Device.Send(this.Title, rkm, disableNotification: true, parseMode: MessageParseMode, MarkdownV2AutoEscape: false);
|
m = await this.Device.Send(this.Title, rkm, disableNotification: true, parseMode: MessageParseMode, MarkdownV2AutoEscape: false);
|
||||||
|
|
||||||
|
//Prevent flicker of keyboard
|
||||||
|
if (this.DeletePreviousMessage && this.MessageId != null)
|
||||||
|
await this.Device.DeleteMessage(this.MessageId.Value);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eKeyboardType.InlineKeyBoard:
|
case eKeyboardType.InlineKeyBoard:
|
||||||
@ -636,21 +634,18 @@ namespace TelegramBotBase.Controls.Hybrid
|
|||||||
//Reply Keyboard could only be updated with a new keyboard.
|
//Reply Keyboard could only be updated with a new keyboard.
|
||||||
case eKeyboardType.ReplyKeyboard:
|
case eKeyboardType.ReplyKeyboard:
|
||||||
|
|
||||||
if (this.MessageId != null)
|
if (bf.Count == 0)
|
||||||
{
|
{
|
||||||
if (bf.Count == 0)
|
if (this.MessageId != null)
|
||||||
{
|
{
|
||||||
await this.Device.HideReplyKeyboard();
|
await this.Device.HideReplyKeyboard();
|
||||||
this.MessageId = null;
|
this.MessageId = null;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
if (this.DeletePreviousMessage)
|
|
||||||
await this.Device.DeleteMessage(this.MessageId.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bf.Count == 0)
|
//if (bf.Count == 0)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
|
|
||||||
var rkm = (ReplyKeyboardMarkup)bf;
|
var rkm = (ReplyKeyboardMarkup)bf;
|
||||||
@ -658,6 +653,10 @@ namespace TelegramBotBase.Controls.Hybrid
|
|||||||
rkm.OneTimeKeyboard = this.OneTimeKeyboard;
|
rkm.OneTimeKeyboard = this.OneTimeKeyboard;
|
||||||
m = await this.Device.Send("Choose category", rkm, disableNotification: true, parseMode: MessageParseMode, MarkdownV2AutoEscape: false);
|
m = await this.Device.Send("Choose category", rkm, disableNotification: true, parseMode: MessageParseMode, MarkdownV2AutoEscape: false);
|
||||||
|
|
||||||
|
//Prevent flicker of keyboard
|
||||||
|
if (this.DeletePreviousMessage && this.MessageId != null)
|
||||||
|
await this.Device.DeleteMessage(this.MessageId.Value);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case eKeyboardType.InlineKeyBoard:
|
case eKeyboardType.InlineKeyBoard:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user