Fix TelegramSettings formatting
This commit is contained in:
parent
2e346b79a6
commit
ee13ff7763
1 changed files with 15 additions and 16 deletions
|
@ -33,21 +33,13 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
read()
|
read()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasAnyChatToShareLocation(): Boolean {
|
fun hasAnyChatToShareLocation() = shareLocationChats.isNotEmpty()
|
||||||
return shareLocationChats.isNotEmpty()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isSharingLocationToChat(chatTitle: String): Boolean {
|
fun isSharingLocationToChat(chatTitle: String) = shareLocationChats.contains(chatTitle)
|
||||||
return shareLocationChats.contains(chatTitle)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun hasAnyChatToShowOnMap(): Boolean {
|
fun hasAnyChatToShowOnMap() = showOnMapChats.isNotEmpty()
|
||||||
return showOnMapChats.isNotEmpty()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun isShowingChatOnMap(chatTitle: String): Boolean {
|
fun isShowingChatOnMap(chatTitle: String) = showOnMapChats.contains(chatTitle)
|
||||||
return showOnMapChats.contains(chatTitle)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun removeNonexistingChats(presentChatTitles: List<String>) {
|
fun removeNonexistingChats(presentChatTitles: List<String>) {
|
||||||
val shareLocationChats = shareLocationChats.toMutableList()
|
val shareLocationChats = shareLocationChats.toMutableList()
|
||||||
|
@ -84,6 +76,7 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getShareLocationChats() = ArrayList(shareLocationChats)
|
fun getShareLocationChats() = ArrayList(shareLocationChats)
|
||||||
|
|
||||||
fun getShowOnMapChats() = ArrayList(showOnMapChats)
|
fun getShowOnMapChats() = ArrayList(showOnMapChats)
|
||||||
|
|
||||||
fun getShowOnMapChatsCount() = showOnMapChats.size
|
fun getShowOnMapChatsCount() = showOnMapChats.size
|
||||||
|
@ -131,10 +124,16 @@ class TelegramSettings(private val app: TelegramApplication) {
|
||||||
}
|
}
|
||||||
this.showOnMapChats = showOnMapChats
|
this.showOnMapChats = showOnMapChats
|
||||||
|
|
||||||
metricsConstants = MetricsConstants.valueOf(prefs.getString(METRICS_CONSTANTS_KEY, MetricsConstants.KILOMETERS_AND_METERS.name))
|
metricsConstants = MetricsConstants.valueOf(
|
||||||
speedConstants = SpeedConstants.valueOf(prefs.getString(SPEED_CONSTANTS_KEY, SpeedConstants.KILOMETERS_PER_HOUR.name))
|
prefs.getString(METRICS_CONSTANTS_KEY, MetricsConstants.KILOMETERS_AND_METERS.name)
|
||||||
|
)
|
||||||
|
speedConstants = SpeedConstants.valueOf(
|
||||||
|
prefs.getString(SPEED_CONSTANTS_KEY, SpeedConstants.KILOMETERS_PER_HOUR.name)
|
||||||
|
)
|
||||||
|
|
||||||
sendMyLocationInterval = prefs.getLong(SEND_MY_LOCATION_INTERVAL_KEY, SEND_MY_LOCATION_INTERVAL_DEFAULT)
|
sendMyLocationInterval =
|
||||||
userLocationExpireTime = prefs.getLong(USER_LOCATION_EXPIRE_TIME_KEY, USER_LOCATION_EXPIRE_TIME_DEFAULT)
|
prefs.getLong(SEND_MY_LOCATION_INTERVAL_KEY, SEND_MY_LOCATION_INTERVAL_DEFAULT)
|
||||||
|
userLocationExpireTime =
|
||||||
|
prefs.getLong(USER_LOCATION_EXPIRE_TIME_KEY, USER_LOCATION_EXPIRE_TIME_DEFAULT)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue