1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-26 06:45:33 +00:00

IniSettings class is now finished and also already used for GMAPS_KEY.

This commit is contained in:
Fabian Schlenz 2018-03-07 06:09:51 +01:00
parent 53fcd36e66
commit 7fa89ab1b1
2 changed files with 7 additions and 2 deletions

View File

@ -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)!!
}

View File

@ -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)
}
}