fix onboarding being completely reprompted when TOS updates
This commit is contained in:
parent
6e2516e547
commit
bd8dc0424c
3 changed files with 22 additions and 13 deletions
|
|
@ -7,7 +7,7 @@ use crate::Route;
|
|||
use crate::components::OnboardingNavbar;
|
||||
use crate::hooks::{
|
||||
OnboardingSelectionState, has_migration_data, onboarding_bundles_items, use_migration,
|
||||
use_onboarding_bundles, use_provide_onboarding_selection,
|
||||
use_onboarding_bundles, use_provide_onboarding_selection, use_settings_snapshot,
|
||||
};
|
||||
use crate::theme::colors;
|
||||
use crate::view::onboarding::{
|
||||
|
|
@ -46,6 +46,9 @@ impl Component for OnboardingShell {
|
|||
let route = use_route::<Route>();
|
||||
let step_index = onboarding_step_index(&route, detected_migration);
|
||||
|
||||
let onboarded = use_settings_snapshot().settings.seen_onboarding;
|
||||
let reconsent = onboarded && matches!(&route, Route::OnboardingTerms {});
|
||||
|
||||
let bundles = use_onboarding_bundles();
|
||||
|
||||
use_side_effect(move || {
|
||||
|
|
@ -85,10 +88,10 @@ impl Component for OnboardingShell {
|
|||
.height(Size::fill())
|
||||
.content(Content::Flex)
|
||||
.layer(Layer::Relative(30))
|
||||
.child(progress_bar(
|
||||
step_index,
|
||||
onboarding_total(detected_migration),
|
||||
))
|
||||
.maybe_child((!reconsent).then(|| {
|
||||
progress_bar(step_index, onboarding_total(detected_migration))
|
||||
.into_element()
|
||||
}))
|
||||
.child(OnboardingNavbar)
|
||||
.child(
|
||||
rect()
|
||||
|
|
|
|||
|
|
@ -85,8 +85,17 @@ impl Component for OnboardingTerms {
|
|||
.width(Size::fill())
|
||||
.spacing(16.)
|
||||
.child(step_heading(
|
||||
"Terms & Privacy",
|
||||
"Please read and accept these before continuing.",
|
||||
if returning {
|
||||
"Terms & Privacy updated"
|
||||
} else {
|
||||
"Terms & Privacy"
|
||||
},
|
||||
if returning {
|
||||
"We've updated these since you last accepted. Review and accept to carry on \
|
||||
where you left off."
|
||||
} else {
|
||||
"Please read and accept these before continuing."
|
||||
},
|
||||
))
|
||||
.maybe_child(tabs)
|
||||
.child(body)
|
||||
|
|
|
|||
|
|
@ -115,14 +115,11 @@ impl Component for Startup {
|
|||
Route::Home {}
|
||||
};
|
||||
|
||||
// Onboarding needs the bundle catalog before it can render its steps so gate it on the fetch
|
||||
let heading_to_onboarding = matches!(
|
||||
destination,
|
||||
Route::OnboardingWelcome { .. } | Route::OnboardingTerms { .. }
|
||||
);
|
||||
let heading_to_onboarding = matches!(destination, Route::OnboardingWelcome { .. });
|
||||
let heading_to_terms = matches!(destination, Route::OnboardingTerms { .. });
|
||||
if !heading_to_onboarding || !launcher.fetching {
|
||||
// Raise the splash curtain so the hard route swap is hidden until Home settles onboarding animates itself
|
||||
if !heading_to_onboarding {
|
||||
if !heading_to_onboarding && !heading_to_terms {
|
||||
let mut active = splash.active;
|
||||
let mut home_ready = splash.home_ready;
|
||||
home_ready.set(false);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue