-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Division of advance question from main question catalog"
- Loading branch information
1 parent
d13fd21
commit 2d4a44f
Showing
20 changed files
with
174 additions
and
221 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,25 @@ | ||
import 'dart:async'; | ||
import 'package:flutter/material.dart'; | ||
|
||
import '/utils/service_worker.dart'; | ||
import '/models/question_catalog/question_catalog.dart'; | ||
|
||
mixin QuestionCatalogHandler<M> on ServiceWorker<M> { | ||
static final _completer = Completer<QuestionCatalog>(); | ||
|
||
@mustCallSuper | ||
void updateQuestionCatalog(({QuestionCatalog questionCatalog, bool onlyLanguageChange}) questionCatalogChangeData) { | ||
if (_completer.isCompleted) { | ||
_questionCatalog = Future.value(questionCatalogChangeData.questionCatalog); | ||
} else { | ||
_completer.complete(questionCatalogChangeData.questionCatalog); | ||
} | ||
void takeQuestionCatalogAsset(QuestionCatalog questionCatalog) { | ||
_completer.complete(questionCatalog); | ||
} | ||
|
||
var _questionCatalog = _completer.future; | ||
|
||
Future<QuestionCatalog> get questionCatalog => _questionCatalog; | ||
|
||
/// Note: currently this won't update any existing questionnaires. | ||
/// Only the creation of subsequent questionnaires will be affected by this. | ||
Future<void> updateQuestionCatalogPreferences({required bool excludeProfessional}) async { | ||
final qc = await _questionCatalog; | ||
_questionCatalog = Future.value( | ||
qc.copyWith(excludeProfessional: excludeProfessional), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.