@@ -107,8 +107,38 @@ fun <T> rememberPolled(key: Any?, everyMs: Long, fetch: suspend () -> T): State<
107107 }
108108}
109109
110- /* * Kia ora, in the right words for the time of day. */
110+ /* * Matariki public holidays (a Friday that moves with the maramataka). */
111+ private val MATARIKI = setOf (" 2026-07-10" , " 2027-06-25" , " 2028-07-14" , " 2029-07-06" , " 2030-06-21" )
112+
113+ /* * A day worth a different hello: (greeting in te reo, in English, the line under it). */
114+ private fun special (): Triple <String , String , String >? {
115+ val d = Nz .now().toLocalDate()
116+ return when {
117+ d.toString() in MATARIKI -> Triple (" Mānawatia a Matariki" , " Happy Matariki" , " Happy Māori New Year ✨" )
118+ d.monthValue == 1 && d.dayOfMonth == 1 -> Triple (" Ngā mihi o te Tau Hou" , " Happy New Year" , " New year, same bus stop 🎆" )
119+ d.monthValue == 2 && d.dayOfMonth == 6 -> Triple (" " , " " , " Happy Waitangi Day" )
120+ d.monthValue == 4 && d.dayOfMonth == 1 -> Triple (" " , " " , " Every bus is on time today. (April Fools 🤡)" )
121+ d.monthValue == 10 && d.dayOfMonth == 31 -> Triple (" " , " " , " Watch out for ghost buses 👻" )
122+ d.monthValue == 12 && d.dayOfMonth == 25 -> Triple (" Meri Kirihimete" , " Merry Christmas" , " It's a public holiday: check the times 🎄" )
123+ d.monthValue == 12 && d.dayOfMonth == 31 -> Triple (" " , " " , " Last buses of the year 🎉" )
124+ else -> null
125+ }
126+ }
127+
128+ /* * What the te reo greetings mean, for a tap on them. */
129+ val GREETING_MEANS = mapOf (
130+ " Mōrena" to " Mōrena: good morning" ,
131+ " Kia ora" to " Kia ora: hello (and thanks, and cheers)" ,
132+ " Ahiahi mārie" to " Ahiahi mārie: good evening" ,
133+ " Pō mārie" to " Pō mārie: good night" ,
134+ " Mānawatia a Matariki" to " Mānawatia a Matariki: celebrate Matariki, the Māori New Year" ,
135+ " Ngā mihi o te Tau Hou" to " Ngā mihi o te Tau Hou: happy New Year" ,
136+ " Meri Kirihimete" to " Meri Kirihimete: merry Christmas" ,
137+ )
138+
139+ /* * Kia ora, in the right words for the time of day (or the day). */
111140fun greeting (kiwi : Boolean ): String {
141+ special()?.let { (reo, en, _) -> if (reo.isNotEmpty()) return if (kiwi) reo else en }
112142 val h = Nz .now().hour
113143 return if (kiwi) when (h) {
114144 in 5 .. 11 -> " Mōrena"
@@ -134,6 +164,7 @@ fun vibe(boards: List<StopBoard>, w: Weather?, s: Settings, now: Long): String {
134164 next == null -> if (k) " Quiet out there. No buses for a bit" else " No buses coming soon"
135165 next.cancelled -> if (k) " Your ${next.route} got cancelled. Gutted." else " Your next ${next.route} is cancelled"
136166 late >= 5 -> if (k) " The ${next.route} 's running $late min late, eh" else " The ${next.route} is $late min late"
167+ special() != null -> special()!! .third
137168 w != null && w.rain >= 2 -> if (k) " Bit wet out there. Grab a brolly ☔" else " It's raining"
138169 model?.doubleDeck == true -> " Double-decker incoming: front seat upstairs? 🚌"
139170 model?.electric == true -> " Your next ${next.route} is electric ⚡"
@@ -179,7 +210,7 @@ fun HomeScreen(vm: AppViewModel) {
179210 }
180211 item { NextUp (boards, s, now) }
181212 itemsIndexed(boards, key = { _, b -> " board-" + b.code }) { i, b ->
182- BusCard (b, now, frameT, i, weather,
213+ BusCard (b, now, frameT, i, weather, meow = s.meow,
183214 onTrack = { d -> notify { vm.track(b, d) } },
184215 onOpen = { nav.go(" stop/${android.net.Uri .encode(b.code)} " ) })
185216 }
@@ -208,7 +239,12 @@ private fun HomeHeader(vm: AppViewModel, s: Settings, boards: List<StopBoard>, w
208239 Row (Modifier .fillMaxWidth().windowInsetsPadding(WindowInsets .statusBars).padding(top = 14 .dp, start = 4 .dp),
209240 verticalAlignment = Alignment .Top ) {
210241 Column (Modifier .weight(1f )) {
211- Text (" ${greeting(s.kiwi)} ," , style = MaterialTheme .typography.titleMedium, color = MaterialTheme .colorScheme.primary)
242+ val hello = greeting(s.kiwi)
243+ // tap the te reo for what it means
244+ Text (" $hello${if (s.meow) " 🐾" else " " } ," , style = MaterialTheme .typography.titleMedium, color = MaterialTheme .colorScheme.primary,
245+ modifier = Modifier .clickable(interactionSource = null , indication = null ) {
246+ GREETING_MEANS [hello]?.let { vm.toast.tryEmit(it) }
247+ })
212248 Text (s.place, style = MaterialTheme .typography.headlineLarge, maxLines = 1 , overflow = TextOverflow .Ellipsis )
213249 Text (vibe(boards, w, s, now), style = MaterialTheme .typography.bodyMedium,
214250 color = MaterialTheme .colorScheme.onSurfaceVariant, modifier = Modifier .padding(top = 2 .dp))
0 commit comments