← Writing

When it rains, the app tells you.

Rain slows delivery. How riders report it, how one rain state drives both the delivery fee and the app's rain look, and the animation details.

Sakshyam Baral··4 min readdesignproductiosandroid

Rain changes delivery in Jhapa. Roads flood, riders slow down or wait it out, and orders take longer. Laayo adds a rain surcharge to delivery fees while it rains, and the customer app now shows the rain too: a short note when you open it, and a patch of clouds and falling rain behind your address.

The hard part was not the animation. It was deciding when it is raining.

Who knows it is raining

Each zone's rain surcharge has a mode: on, off, auto, or rider.

Auto asks a weather service. For a town this size, weather APIs were not reliable.

On and off are manual, and nobody is watching an admin panel in the middle of a storm.

Rider mode puts the decision with the people standing in the rain. Any rider in the zone can flip a shared switch from the rider app. The server records who flipped it and when, and sends a silent push so every rider app shows the new state.

The design is deliberately simple, with trade-offs I chose on purpose:

  • Last writer wins. There is no vote. Any rider can turn it on or off.
  • It never expires by itself. If riders forget to turn it off when the rain stops, the surcharge stays until someone does. That is the price of keeping it simple, and I accepted it.
  • Changing the zone's mode clears the switch, so an old "on" from days ago can't come back to life when someone selects rider mode again.
  • Flipping it to the state it already has returns success without sending a push. Two riders tapping at the same moment should not mean two broadcasts.
  • The rider confirms first, on a sheet that says this applies to every customer in the zone.
func rainApplies(s Surcharge, raining bool) bool {
	switch s.WeatherOverride {
	case "on":
		return true
	case "auto":
		return raining
	case "rider":
		return s.RiderReportedActive
	default:
		return false
	}
}
func rainApplies(s Surcharge, raining bool) bool {
	switch s.WeatherOverride {
	case "on":
		return true
	case "auto":
		return raining
	case "rider":
		return s.RiderReportedActive
	default:
		return false
	}
}

Adding that fourth mode showed me where state hides. The customer app read rain state from two places: the delivery fee quote at checkout, and a separate config endpoint behind the rain banner on store pages. I updated the first, and the banner stayed hidden because the second didn't return the new field. On the app side, the cached config needed the new case in both the parser and the serializer, and a new cache key version. Without the version bump, phones holding an old cached config would have kept the banner hidden.

One fact, one switch

When I added the rain look to the app, I first gave it its own setting in the operations console: auto (follow the surcharge), on now, or off. That was a mistake. A rain look set to "on now" for one zone ignored the surcharge everywhere else, so the app could show rain where it was dry and stay dry where riders were reporting rain.

Now they are one fact. The rain look follows the surcharge in every zone. "On now" forces rain only in the zones it lists. "Off" is a kill switch. The server sends the app one rain object: whether it is raining, the strength, the texts and a spell id. A spell ends after forty-five minutes without rain, and the app uses the spell id to show the note once per rainy spell, not every time it opens.

The animation

I went through eight versions of the mockup before building it, mostly about timing.

  • The note ("It's raining! Delivery partners may take longer to reach you") drops in about half a second after the app opens, holds for a few seconds, then folds away. While it is visible it pushes the header down instead of covering it, so the address stays readable right below.
  • Nothing rains before the note. After it folds, the location pin turns into a small cloud, and only then does the band of clouds and rain fade in, slowly.
  • The rain lives only behind the address row, in a band with feathered edges: an alpha mask that fades in at the start and out at the end, so there are no hard lines. The text sits above it.
  • My first rain was far too fast and looked like a storm in a video game. Drops now fall at a bit over a third of the original speed, and there are fewer of them.
  • On a home screen with a hero banner, the rain plays only over the top of the banner, with a dark scrim behind the address so it stays legible. The banner itself is untouched.
  • With Reduce Motion on, the app shows the clouds and the note, and no falling rain.

On the tracking screen, rain is a quieter line: "It's raining near the restaurant. The delivery partner may drive slower to keep safe."

The rain view is native on both platforms, written once per platform as a shared core component in Swift and in Kotlin, and the server decides everything about when it shows.

Get new posts by email

One email when something new goes up. No tracking pixels, unsubscribe in one click.