Skip to content

Issue #2282 Enhance LiveUpdate feature#2379

Draft
dipenpradhan wants to merge 1 commit intomainfrom
liveupdate-autopause
Draft

Issue #2282 Enhance LiveUpdate feature#2379
dipenpradhan wants to merge 1 commit intomainfrom
liveupdate-autopause

Conversation

@dipenpradhan
Copy link
Copy Markdown
Collaborator

@dipenpradhan dipenpradhan commented Mar 11, 2026

LiveUpdate enhancements for #2282:

  • Added a toggle in the Design Switcher to enable or disable LiveUpdate at runtime.
  • Displayed Live Update fetch interval and pause timeout in the Design Switcher settings view, formatted as minutes.
  • Implemented a Figma API token timeout mechanism (Live Update Pause Millis, 30 minutes by default) that clears the token after expiration for security.
  • Made the Live Update fetch interval configurable (Live Update Fetch Millis, 5000ms by default).
  • Updated ApiKeyService to allow enabling/disabling LiveUpdate, and changing the pause timeout and fetch interval via Intent.
  • Refactored DesignSettings to better manage the LiveUpdate status and respond to changes in the API key, the enabled state, the pause timeout, and the fetch interval.
  • Persistent storage for the LiveUpdate enabled state, timeout, and fetch interval using DataStore.
  • Documented new adb commands in the Live Update setup guide.
  • Added a log output to display the DesignCompose version on initialization.

@dipenpradhan dipenpradhan changed the title Issue#2282 Enhance LiveUpdate feature Issue #2282 Enhance LiveUpdate feature Mar 11, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.05%. Comparing base (56f98a1) to head (5c6562b).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2379   +/-   ##
=========================================
  Coverage     44.05%   44.05%           
  Complexity       19       19           
=========================================
  Files            39       39           
  Lines          4444     4444           
  Branches         51       51           
=========================================
  Hits           1958     1958           
  Misses         2472     2472           
  Partials         14       14           
Flag Coverage Δ
kotlin 72.17% <100.00%> (ø)
rust 41.69% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 11, 2026

Snapshot diff report vs base branch: main
Last updated: Thu Apr 2 21:33:25 PDT 2026, Sha: 5c6562b

File name Image
OptionsScreenBeforeC
heckingBox_compare.p
ng
CollapsedSwitcher_co
mpare.png
ChangeFileScreen_com
pare.png
OptionsScreenAfterCh
eckingBox_compare.pn
g
ExpandedSwitcher_com
pare.png

}

@Composable
private fun GetLiveUpdateCheckbox(state: Boolean, setState: (Boolean) -> Unit): ReplacementContent {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is fitting in with the other names in the file, but I wonder how we ended up with GetXYZ for these instead of just XYZ

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to add a new variant "Paused" to "Live/Offline" state display, and turn the display into a button instead.

// A successful call to fetchDocument (no exception) means we have a valid key.
// If this is the first success for this key, start the timer.
if (DesignSettings.firstSuccessTime == null) {
DesignSettings.firstSuccessTime = System.currentTimeMillis()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use uptimeClock or something monotonic that won't get messed up by a time sync?

@dipenpradhan dipenpradhan force-pushed the liveupdate-autopause branch from b40f77e to 74aa3b9 Compare March 11, 2026 21:34
… timeout and fetch interval

This commit introduces several improvements to the LiveUpdate feature:
- Replaced old Design Switcher Figma document with updated ID 1Ig75AsfrYc5DXdlOaCoCl containing Paused state for LiveMode.
- Displayed Live Update fetch interval and pause timeout in the Design Switcher settings view, formatted as minutes.
- Implemented a Figma API token timeout mechanism (Live Update Pause Millis, 30 minutes by default) that clears the token after expiration for security.
- Made the Live Update fetch interval configurable (Live Update Fetch Millis, 5000ms by default).
- Added click interactions on the #LiveMode node to manually toggle the Live Update pause state.
- Updated ApiKeyService to allow enabling/disabling LiveUpdate, and changing the pause timeout and fetch interval via Intent.
- Refactored DesignSettings to better manage the LiveUpdate status and respond to changes in the API key, the enabled state, the pause timeout, and the fetch interval.
- Persistent storage for the LiveUpdate enabled state, timeout, and fetch interval using DataStore.
- Documented new adb commands in the Live Update setup guide.
- Added a log output to display the DesignCompose version on initialization.

File-level changes:
- ApiKeyService.kt: Added enableLiveUpdate, setAutopauseTimeout, and setLiveUpdateFetchMillis actions and handlers.
- DesignSwitcher.kt: Updated Figma doc ID to 1Ig75AsfrYc5DXdlOaCoCl. Added 'Paused' to LiveMode enum. Integrated LiveUpdate pause toggle on #LiveMode node.
- DocServer.kt: Implemented configurable token timeout and fetch interval logic, consolidating LiveUpdate status management. Exposed pauseUpdates as MutableState.
- LiveUpdateSettingsRepository.kt: Added DataStore support for LiveUpdate enabled, pause timeout, and fetch interval preferences.
- setup.md: Added adb command examples for the new advanced Live Update configurations.
- build.gradle.kts: Enabled buildConfig and injected DESIGNCOMPOSE_VERSION.
@dipenpradhan dipenpradhan force-pushed the liveupdate-autopause branch from 74aa3b9 to 5c6562b Compare April 3, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants