Skip to content

Commit b037e2a

Browse files
committed
Improve wildfire alerts
1 parent c9f4a24 commit b037e2a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/com/kylecorry/bell/infrastructure/alerts/fire/InciwebWildfireAlertSource.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import java.time.ZoneId
2222
class InciwebWildfireAlertSource(context: Context) : AlertSource {
2323

2424
private val lastUpdatedDateRegex = Regex("Last updated: (\\d{4}-\\d{2}-\\d{2})")
25-
private val stateRegex = Regex("State: (\\w+)")
25+
private val stateRegex = Regex("State: ([\\w\\s]+)")
2626
private val fireNameRegex = Regex("[A-Z0-9]+\\s(.+)\\sFire")
2727

2828
private val loader = AlertLoader(context)
@@ -69,7 +69,7 @@ class InciwebWildfireAlertSource(context: Context) : AlertSource {
6969
?.let { DateTimeParser.parseInstant(it, ZoneId.of("America/New_York")) }
7070
?: originalSent
7171

72-
var state = stateRegex.find(description)?.groupValues?.get(1)
72+
var state = stateRegex.find(description)?.groupValues?.get(1)?.trim()
7373
if (state.isNullOrBlank()) {
7474
val words = SimpleWordTokenizer().tokenize(description).toSet()
7575
state = words.firstOrNull { word -> StateUtils.isState(word, false) }

0 commit comments

Comments
 (0)