Skip to content

Commit

Permalink
When questions are answered, check if new ones are available (#4586)
Browse files Browse the repository at this point in the history
  • Loading branch information
g123k authored Aug 23, 2023
1 parent d584f8d commit b84cd3c
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,30 @@ class _ProductQuestionsWidgetState extends State<ProductQuestionsWidget>
};
}

void _openQuestions() {
Future<void> _openQuestions() async {
_trackEvent(AnalyticsEvent.questionClicked);

openQuestionPage(
await openQuestionPage(
context,
product: widget.product,
questions: (_state as _ProductQuestionsWithQuestions).questions.toList(
growable: false,
),
updateProductUponAnswers: _updateProductUponAnswers,
);

if (context.mounted) {
return _reloadQuestions(silentCheck: true);
}
}

Future<void> _reloadQuestions() async {
setState(() => _state = const _ProductQuestionsLoading());
Future<void> _reloadQuestions({
bool silentCheck = false,
}) async {
if (!silentCheck) {
setState(() => _state = const _ProductQuestionsLoading());
}

final List<RobotoffQuestion>? list = await _loadProductQuestions();

if (!mounted) {
Expand Down

0 comments on commit b84cd3c

Please sign in to comment.