This commit is contained in:
Alex Sytnyk 2018-06-20 15:00:04 +03:00
parent 29acba902e
commit 24afcc2c52
2 changed files with 6 additions and 6 deletions

View file

@ -162,7 +162,7 @@ class TelegramHelper private constructor() {
fun onTelegramChatChanged(chat: TdApi.Chat) fun onTelegramChatChanged(chat: TdApi.Chat)
fun onTelegramUserChanged(user: TdApi.User) fun onTelegramUserChanged(user: TdApi.User)
fun onTelegramError(code: Int, message: String) fun onTelegramError(code: Int, message: String)
fun onSendLiveLicationError(code: Int, message: String) fun onSendLiveLocationError(code: Int, message: String)
} }
interface TelegramIncomingMessagesListener { interface TelegramIncomingMessagesListener {
@ -404,7 +404,7 @@ class TelegramHelper private constructor() {
val error = obj as TdApi.Error val error = obj as TdApi.Error
if (error.code != IGNORED_ERROR_CODE) { if (error.code != IGNORED_ERROR_CODE) {
needRefreshActiveLiveLocationMessages = true needRefreshActiveLiveLocationMessages = true
listener?.onSendLiveLicationError(error.code, error.message) listener?.onSendLiveLocationError(error.code, error.message)
} }
} }
TdApi.Messages.CONSTRUCTOR -> { TdApi.Messages.CONSTRUCTOR -> {
@ -418,7 +418,7 @@ class TelegramHelper private constructor() {
} }
onComplete?.invoke() onComplete?.invoke()
} }
else -> listener?.onSendLiveLicationError(-1, "Receive wrong response from TDLib: $obj") else -> listener?.onSendLiveLocationError(-1, "Receive wrong response from TDLib: $obj")
} }
requestingActiveLiveLocationMessages = false requestingActiveLiveLocationMessages = false
} }
@ -503,7 +503,7 @@ class TelegramHelper private constructor() {
val error = obj as TdApi.Error val error = obj as TdApi.Error
if (error.code != IGNORED_ERROR_CODE) { if (error.code != IGNORED_ERROR_CODE) {
needRefreshActiveLiveLocationMessages = true needRefreshActiveLiveLocationMessages = true
listener?.onSendLiveLicationError(error.code, error.message) listener?.onSendLiveLocationError(error.code, error.message)
} }
} }
else -> { else -> {
@ -511,7 +511,7 @@ class TelegramHelper private constructor() {
when (obj.sendingState?.constructor) { when (obj.sendingState?.constructor) {
TdApi.MessageSendingStateFailed.CONSTRUCTOR -> { TdApi.MessageSendingStateFailed.CONSTRUCTOR -> {
needRefreshActiveLiveLocationMessages = true needRefreshActiveLiveLocationMessages = true
listener?.onSendLiveLicationError(-1, "Live location message ${obj.id} failed to send") listener?.onSendLiveLocationError(-1, "Live location message ${obj.id} failed to send")
} }
} }
} }

View file

@ -188,7 +188,7 @@ class MainActivity : AppCompatActivity(), TelegramListener {
} }
} }
override fun onSendLiveLicationError(code: Int, message: String) { override fun onSendLiveLocationError(code: Int, message: String) {
log.error("Send live location error: $code - $message") log.error("Send live location error: $code - $message")
app.isInternetConnectionAvailable(true) app.isInternetConnectionAvailable(true)
} }