Remove unnecessary code

This commit is contained in:
Chumva 2018-10-23 12:36:28 +03:00
parent ec2f36760d
commit 6dc64ef13c
2 changed files with 12 additions and 18 deletions

View file

@ -4,7 +4,7 @@
<string name="not_possible_to_send_to_telegram_chats">Not possible to send to Telegram chats:</string>
<string name="waiting_for_response_from_telegram">Waiting for response from Telegram</string>
<string name="sending_location_messages">Sending location messages</string>
<string name="initializing">Initializing&#8230;</string>
<string name="initializing">Initializing</string>
<string name="searching_for_gps">Searching for GPS</string>
<string name="connecting_to_the_internet">Connecting to the internet</string>
<string name="background_work_description">Change battery optimization settings, for stable location sharing</string>

View file

@ -219,10 +219,8 @@ class TelegramSettings(private val app: TelegramApplication) {
if (statusType == SharingStatusType.INITIALIZING
&& newSharingStatus.statusType == SharingStatusType.INITIALIZING
&& !lastSharingStatus.description.contains(newSharingStatus.description)
) {
lastSharingStatus.description =
"${lastSharingStatus.description}, ${newSharingStatus.description}"
&& !lastSharingStatus.description.contains(newSharingStatus.description)) {
lastSharingStatus.description = "${lastSharingStatus.description}, ${newSharingStatus.description}"
}
}
}
@ -284,21 +282,17 @@ class TelegramSettings(private val app: TelegramApplication) {
}
}
} else {
when {
!gpsEnabled -> {
title = app.getString(R.string.initializing)
if (gpsEnabled && app.isInternetConnectionAvailable) {
title = app.getString(R.string.sending_location_messages)
description = app.getString(R.string.waiting_for_response_from_telegram)
statusType = SharingStatusType.SENDING
} else {
title = app.getString(R.string.initializing)
statusType = SharingStatusType.INITIALIZING
if (!gpsEnabled) {
description = app.getString(R.string.searching_for_gps)
statusType = SharingStatusType.INITIALIZING
}
!app.isInternetConnectionAvailable -> {
title = app.getString(R.string.initializing)
} else if (!app.isInternetConnectionAvailable) {
description = app.getString(R.string.connecting_to_the_internet)
statusType = SharingStatusType.INITIALIZING
}
else -> {
title = app.getString(R.string.sending_location_messages)
description = app.getString(R.string.waiting_for_response_from_telegram)
statusType = SharingStatusType.SENDING
}
}
}