mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-22 16:56:16 +00:00
IniSettings class is now finished and also already used for GMAPS_KEY.
This commit is contained in:
parent
53fcd36e66
commit
7fa89ab1b1
@ -51,5 +51,10 @@ object IniSettings {
|
||||
|
||||
fun println() = println(settings)
|
||||
|
||||
fun get(key: String, default: String? = null): String? = settings.get(key)?.last() ?: default
|
||||
fun getInt(key: String, default: Int? = null): Int? = try { settings.get(key)?.last()?.toInt() } catch (e: NumberFormatException) { null } ?: default
|
||||
fun getArray(key: String): List<String> = settings.get(key) ?: listOf<String>()
|
||||
|
||||
val gmaps_key: String
|
||||
get() = get("gmaps_key", default=Config.SECRET_GMAPS)!!
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import de.fabianonline.telegram_backup.Database
|
||||
import de.fabianonline.telegram_backup.StickerConverter
|
||||
import de.fabianonline.telegram_backup.DownloadProgressInterface
|
||||
import de.fabianonline.telegram_backup.DownloadManager
|
||||
import de.fabianonline.telegram_backup.Config
|
||||
import de.fabianonline.telegram_backup.IniSettings
|
||||
|
||||
import com.github.badoualy.telegram.api.TelegramClient
|
||||
import com.github.badoualy.telegram.tl.core.TLIntVector
|
||||
@ -76,7 +76,7 @@ class GeoFileManager(msg: TLMessage, user: UserManager, client: TelegramClient)
|
||||
val url = "https://maps.googleapis.com/maps/api/staticmap?" +
|
||||
"center=" + geo.getLat() + "," + geo.getLong() + "&" +
|
||||
"zoom=14&size=300x150&scale=2&format=png&" +
|
||||
"key=" + Config.SECRET_GMAPS
|
||||
"key=" + IniSettings.gmaps_key
|
||||
return DownloadManager.downloadExternalFile(targetPathAndFilename, url)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user