From c01420a3c69ad10fbe2417c3a0692d1c2bada3d0 Mon Sep 17 00:00:00 2001 From: soraefir Date: Wed, 10 Apr 2024 21:48:57 +0200 Subject: [PATCH] Nogroup if unchecked country --- .../java/net/helcel/beans/countries/GeoLocImporter.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/helcel/beans/countries/GeoLocImporter.kt b/app/src/main/java/net/helcel/beans/countries/GeoLocImporter.kt index d00ab6a..82f0fc8 100644 --- a/app/src/main/java/net/helcel/beans/countries/GeoLocImporter.kt +++ b/app/src/main/java/net/helcel/beans/countries/GeoLocImporter.kt @@ -18,7 +18,13 @@ object GeoLocImporter { while (fs.ready()) { val line = fs.readLine().split("|") val state = State(line[0], line[2], line[3].toInt()) - Country.entries.find { it.code == line[1] }?.children?.add(state) + val country = Country.entries.find { it.code == line[1] } + country?.children?.add(state) + country?.let { + if (Data.visits.getVisited(it) == NO_GROUP) { + Data.visits.setVisited(state, NO_GROUP) + } + } } }