Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GT-2288 Update circuit to v0.19.1 #3367

Merged
merged 4 commits into from
Feb 13, 2024
Merged

GT-2288 Update circuit to v0.19.1 #3367

merged 4 commits into from
Feb 13, 2024

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 9, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
com.slack.circuit:circuit-test 0.18.2 -> 0.19.1 age adoption passing confidence
com.slack.circuit:circuit-foundation 0.18.2 -> 0.19.1 age adoption passing confidence
com.slack.circuit:circuit-codegen-annotations 0.18.2 -> 0.19.1 age adoption passing confidence
com.slack.circuit:circuit-codegen 0.18.2 -> 0.19.1 age adoption passing confidence

Warning

Some dependencies could not be looked up. Check the Dependency Dashboard for more information.


Release Notes

slackhq/circuit (com.slack.circuit:circuit-test)

v0.19.1

Compare Source

2024-02-12

This is a small bug fix release focused SaveableBackStack consistency and FakeNavigator API improvements.

  • Fix FakeNavigator.awaitNextScreen() not suspending.
  • Fix FakeNavigator.resetRoot() not returning the actual popped screens.
  • Make Navigator.peekBackStack() and Navigator.resetRoot() return ImmutableList.
  • Make BackStack.popUntil() return the ImmutableList of the popped records.
  • Support FakeNavigator.peekBackStack() return the ImmutableList of the popped records.
  • Strongly pop events and resetRoot events in FakeNavigator. This should offer much more information about the events.
  • Use a real BackStack instance in FakeNavigator + allow for specifying a user-provided instance.
  • Require an initial root screen to construct FakeNavigator unless using a custom BackStack.
    • Note this slightly changes semantics, as now the root screen will not be recorded as the first goTo event.
  • Require an initial root screen (or list of screens) for rememberSaveableBackStack().
  • Expose a top-level non-composable Navigator() factory function.

v0.19.0

Compare Source

2024-02-09

Navigation with results

This release introduces support for inter-screen navigation results. This is useful for scenarios where you want to pass data back to the previous screen after a navigation event, such as when a user selects an item from a list and you want to pass the selected item back to the previous screen.

var photoUrl by remember { mutableStateOf<String?>(null) }
val takePhotoNavigator = rememberAnsweringNavigator<TakePhotoScreen.Result>(navigator) { result ->
  photoUrl = result.url
}

// Elsewhere
takePhotoNavigator.goTo(TakePhotoScreen)

// In TakePhotoScreen.kt
data object TakePhotoScreen : Screen {
  @&#8203;Parcelize
  data class Result(val url: String) : PopResult
}

class TakePhotoPresenter {
  @&#8203;Composable fun present(): State {
    // ...
    navigator.pop(result = TakePhotoScreen.Result(newFilters))
  }
}

See the new section in the navigation docs for more details, as well as updates to the Overlays docs that help explain when to use an Overlay vs navigating to a Screen with a result.

Support for multiple back stacks

This release introduces support for saving/restoring navigation state on root resets (aka multi back stack). This is useful for scenarios where you want to reset the back stack to a new root but still want to retain the previous back stack's state, such as an app UI that has a persistent bottom navigation bar with different back stacks for each tab.

This works by adding two new optional saveState and restoreState parameters to Navigator.resetRoot().

navigator.resetRoot(HomeNavTab1, saveState = true, restoreState = true)
// User navigates to a details screen
navigator.push(EntityDetails(id = foo))
// Later, user clicks on a bottom navigation item
navigator.resetRoot(HomeNavTab2, saveState = true, restoreState = true)
// Later, user switches back to the first navigation item
navigator.resetRoot(HomeNavTab1, saveState = true, restoreState = true)
// The existing back stack is restored, and EntityDetails(id = foo) will be top of
// the back stack

There are times when saving and restoring the back stack may not be appropriate, so use this feature only when it makes sense. A common example where it probably does not make sense is launching screens which define a UX flow which has a defined completion, such as onboarding.

New Tutorial!

On top of Circuit's existing docs, we've added a new tutorial to help you get started with Circuit. It's a step-by-step guide that walks you through building a simple inbox app using Circuit, intended to serve as a sort of small code lab that one could do in 1-2 hours. Check it out here.

Overlay Improvements
  • New: Promote AlertDialogOverlay, BasicAlertDialogOverlay, and BasicDialogOverlay to circuitx-overlay.
  • New: Add OverlayEffect to circuit-overlay. This offers a simple composable effect to show an overlay and await a result.
    OverlayEffect(state) { host ->
      val result = host.show(AlertDialogOverlay(...))
      // Do something with the result
    }
  • Add OverlayState and LocalOverlayState to circuit-overlay. This allows you to check the current overlay state (UNAVAILABLE, HIDDEN, or SHOWING).
  • Mark OverlayHost as @ReadOnlyOverlayApi to indicate that it's not intended for direct implementation by consumers.
  • Mark Overlay as @Stable.
Misc
  • Make NavEvent.screen public.
  • Change Navigator.popUntil to be exclusive.
  • Add Navigator.peek() to peek the top screen of the back stack.
  • Add Navigator.peekBackStack() to peek the top screen of the back stack.
  • Align spelling of back stack parameters across all APIs to backStack.
  • Refreshed iOS Counter sample using SPM and SKIE.
  • Convert STAR sample to KMP. Starting with Android and Desktop.
  • Fix baseline profiles packaging. Due to a bug in the baseline profile plugin, we were not packaging the baseline profiles in the artifacts. This is now fixed.
  • Mark BackStack.Record as @Stable.
  • Fix an infinite loop in the onRootPop of the Android rememberCircuitNavigator.
  • Update the default decoration to better match the android 34 transitions.
  • Update androidx.lifecycle to 2.7.0.
  • Update to compose multiplatform to 1.5.12.
  • Update to compose to 1.6.1.
  • Update to compose-bom to 2024.02.00.
  • Update compose-compiler to 1.5.9.
  • Update AtomicFu to 0.23.2.
  • Update Anvil to 2.4.9.
  • Update KotlinPoet to 1.16.0.
  • Compile against KSP 1.9.22-1.0.17.

Special thanks to @​milis92, @​ChrisBanes, and @​vulpeszerda for contributing to this release!


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot added the dependencies Pull requests that update a dependency file label Feb 9, 2024
@renovate renovate bot force-pushed the renovate/circuit branch from 4e2bb8c to 76c026d Compare February 12, 2024 21:50
@renovate renovate bot changed the title Update circuit to v0.19.0 Update circuit to v0.19.1 Feb 12, 2024
@frett frett changed the title Update circuit to v0.19.1 GT-2288 Update circuit to v0.19.1 Feb 13, 2024
@frett frett enabled auto-merge February 13, 2024 18:26
Copy link

codecov bot commented Feb 13, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (642fae7) 35.07% compared to head (80a8f14) 35.06%.

Files Patch % Lines
...n/org/cru/godtools/ui/dashboard/DashboardLayout.kt 50.00% 3 Missing ⚠️
...odtools/ui/account/delete/DeleteAccountActivity.kt 0.00% 1 Missing ⚠️
...u/godtools/ui/languages/app/AppLanguageActivity.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3367      +/-   ##
===========================================
- Coverage    35.07%   35.06%   -0.01%     
===========================================
  Files          442      442              
  Lines        10707    10705       -2     
  Branches      2423     2424       +1     
===========================================
- Hits          3755     3754       -1     
  Misses        6325     6325              
+ Partials       627      626       -1     

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

@frett frett merged commit 15518d1 into develop Feb 13, 2024
12 checks passed
@frett frett deleted the renovate/circuit branch February 13, 2024 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant