mirror of
https://github.com/wiz0u/WTelegramClient.git
synced 2025-12-06 06:52:01 +01:00
fetch Updates_GetState on session resuming to subscribe to new updates
This commit is contained in:
parent
184a133dce
commit
a403a462db
|
|
@ -743,11 +743,19 @@ namespace WTelegram
|
||||||
{
|
{
|
||||||
var prevUser = Schema.Deserialize<User>(_session.User);
|
var prevUser = Schema.Deserialize<User>(_session.User);
|
||||||
var userId = _config("user_id"); // if config prefers to validate current user by its id, use it
|
var userId = _config("user_id"); // if config prefers to validate current user by its id, use it
|
||||||
if (userId != null && int.TryParse(userId, out int id) && (id == -1 || prevUser.id == id))
|
if (userId == null || !int.TryParse(userId, out int id) || id != -1 && prevUser.id != id)
|
||||||
return prevUser;
|
{
|
||||||
phone_number = Config("phone_number"); // otherwise, validation is done by the phone number
|
phone_number = Config("phone_number"); // otherwise, validation is done by the phone number
|
||||||
if (prevUser?.phone == string.Concat(phone_number.Where(char.IsDigit)))
|
if (prevUser?.phone != string.Concat(phone_number.Where(char.IsDigit)))
|
||||||
|
prevUser = null;
|
||||||
|
}
|
||||||
|
if (prevUser != null)
|
||||||
|
{
|
||||||
|
// TODO: implement a more complete Updates gaps handling system? https://core.telegram.org/api/updates
|
||||||
|
var udpatesState = await Updates_GetState();
|
||||||
|
OnUpdate(udpatesState);
|
||||||
return prevUser;
|
return prevUser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue