Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Engineering joy: Building the celebration syste...

Engineering joy: Building the celebration system on the Home tab of the LINE app on Android

LINEのホームタブでの祝祭アニメーションの技術アーキテクチャを深く掘り下げ、Androidの核となる構成要素がいかにして日常の瞬間を大規模な魔法の祝祭に変えるかを探ります。

More Decks by LINEヤフーTech (LY Corporation Tech)

Other Decks in Technology

Transcript

  1. - Android Software Engineer - Working on LINE's Home tab

    features - Passionate about building delightful user experiences About me
  2. 1. Showcase 2. The Challenge 3. System Architecture Overview 4.

    Implementation Deep Dive 5. Building Blocks Synergy 6. Results & Impact 7. Questions & Discussion Agenda
  3. The Challenge - Precision Timing Events must trigger exactly when

    intended, surviving app restarts - Resource Management Efficient handling of celebration assets across millions of devices - Edge Cases Network failures, app terminations, multiple concurrent celebrations
  4. 3 Building Blocks Foundation - Room Database: Reliable local storage

    with reactive queries - WorkManager: Precise scheduling across app lifecycle - Kotlin Flow: Reactive UI updates and state management
  5. 4-Phase Journey Event Discovery Resource Acquisition Show Time Clean Up

    Receive event notification Download event metadata Download and validate resources Display effects at the designated time Clean up resources Schedule next occurrence Maintain readiness during idle periods
  6. Key Design Principles - 5-day preparation buffer ensures reliable delivery

    - Clear separation of concerns between phases - Independent error handling in each component - User-centric timing with grace periods
  7. Phase 1: Event Discovery Client side Server pushed scheduledTime =

    showTime - 5 days retryUntil = showTime + 1 day WorkManager {showTime} Worker {showTime}
  8. Robust Implementation // Metadata Worker: Fetch event configurations if (retryUntil

    < now) { return failure() } val event = fetchEventMetadata(eventId) // error -> retry saveEventMetadata(event) // error -> retry scheduleAssetDownload(event) // success -> next step Metadata Worker: Fetch event configurations
  9. Robust Implementation // Asset Worker: Download and validate celebration assets

    if (retryUntil < now) { return failure() } val asset = downloadAsset(event) // error -> retry validateAsset(asset, event.checksum) // error -> retry fileStorage.extractAndSave(eventId, asset) // error -> retry // success scheduleShowtime() && scheduleCleanup() Asset Worker: Download and validate celebration assets
  10. Phase 2: Resource Acquisition Metadata Fetching Asset Download retry retry

    Done Scheduling Show time Scheduling Clean up WorkManager RoomDB
  11. Elegant Simplicity // WorkManager: One simple state change eventRepository.updateEventState(eventId, READY)

    // Everything else happens automatically: // Room → Flow → UI updates seamlessly
  12. Perfect Collaboration - WorkManager: Triggers the precise moment with one

    line of code - Room: Reactive database instantly notifies all observers - Flow: Handles complex priority, timing, and UI coordination automatically
  13. Phase 4: Clean Up - 1-day grace period prevents interruption

    for late users - Comprehensive removal of assets and metadata - Recurring events automatically reschedule next occurrence Efficient Resource Management
  14. Real Impact: Complex Logic in Simple Code // All three

    building blocks working together: val displayableEventFlow = combine( homeEventEffectDao.getDisplayableEventsFlow(), // Room: reactive queries homeTabVisibilityFlow // Flow: UI state tracking ) { events, isHomeVisible -> events.takeIf { isHomeVisible } // Timing: only when visible ?.maxByOrNull { it.priority } // Priority: personal > cultural } // WorkManager updates Room → Room triggers Flow → Flow updates UI displayableEventFlow.collect { event -> showEffect(event) }
  15. What This Achieves - Complex coordination becomes declarative programming -

    Multi-phase state transitions handled automatically - Error recovery across 4 phases with single retry strategy - Reactive UI updates eliminate manual state synchronization Result: Complex celebration orchestration → Simple reactive declarations
  16. Automatic recovery from network failures and app crashes or restarts

    Technical Excellence of building blocks for complex state management Seamless integration simplifies quality assurance Independent phase testing
  17. Perfect timing creates genuine surprise moments User Experience ensures birthdays

    aren't missed by holidays Personal priority enhance emotional impact Cultural awareness enhance emotional impact Smooth animations
  18. Architecture Lessons - Strategic preparation (5-day buffer) prevents last-minute failures

    - Phase isolation enables independent error handling and testing - Building block synergy leverages Android's strengths effectively - User-centric design transforms technical constraints into delightful experiences
  19. Implementation Insights - Early resource acquisition ensures reliable celebration delivery

    - Reactive state management through Flow simplifies complex UI coordination - WorkManager scheduling coordinates precise phase transitions and retry logic - Room's reactive queries provide real-time system state awareness
  20. - Engineering joy: Building the celebration system on the Home

    tab of the LINE app on Android https://techblog.lycorp.co.jp/en/engineering-joy-building-the-celebration-system-on-the-home-tab-of-the-line- app-on-android - Kotlin Flow Documentation https://kotlinlang.org/docs/flow.html - Room Database Documentation https://developer.android.com/training/data-storage/room - WorkManager Documentation https://developer.android.com/topic/libraries/architecture/workmanager References