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

chore: remove unneccesary disabled test button logic #1318

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 24 additions & 29 deletions mobile-app/lib/ui/views/learn/challenge/challenge_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ class ChallengeView extends StatelessWidget {
);

model.setEditorText = text;
model.setHasTypedInEditor = true;
model.setCompletedChallenge = false;
});

Expand Down Expand Up @@ -465,41 +464,37 @@ class ChallengeView extends StatelessWidget {
children: [
Container(
margin: const EdgeInsets.symmetric(horizontal: 8),
color: !model.hasTypedInEditor
? const Color.fromARGB(255, 9, 79, 125)
: model.completedChallenge
? const Color.fromRGBO(0x20, 0xD0, 0x32, 1)
: const Color.fromRGBO(0x1D, 0x9B, 0xF0, 1),
color: model.completedChallenge
? const Color.fromRGBO(0x20, 0xD0, 0x32, 1)
: const Color.fromRGBO(0x1D, 0x9B, 0xF0, 1),
child: IconButton(
icon: model.runningTests
? const CircularProgressIndicator()
: model.completedChallenge
? const Icon(Icons.arrow_forward_rounded, size: 30)
: const Icon(Icons.done_rounded, size: 30),
onPressed: model.hasTypedInEditor
? () async {
model.setAfterFirstTest = false;
model.setConsoleMessages = [];
model.setUserConsoleMessages = [];
if (model.showPanel &&
model.panelType == PanelType.pass) {
model.learnService.goToNextChallenge(
model.block!.challenges.length,
challengesCompleted,
challenge,
block,
);
}
onPressed: () async {
model.setAfterFirstTest = false;
model.setConsoleMessages = [];
model.setUserConsoleMessages = [];
if (model.showPanel &&
model.panelType == PanelType.pass) {
model.learnService.goToNextChallenge(
model.block!.challenges.length,
challengesCompleted,
challenge,
block,
);
}

model.setShowPanel = false;
model.setIsRunningTests = true;
await model.runner.setWebViewContent(
challenge,
controller: model.testController!,
);
FocusManager.instance.primaryFocus?.unfocus();
}
: null,
model.setShowPanel = false;
model.setIsRunningTests = true;
await model.runner.setWebViewContent(
challenge,
controller: model.testController!,
);
FocusManager.instance.primaryFocus?.unfocus();
},
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ class ChallengeViewModel extends BaseViewModel {
bool _afterFirstTest = false;
bool get afterFirstTest => _afterFirstTest;

bool _hasTypedInEditor = false;
bool get hasTypedInEditor => _hasTypedInEditor;

bool _completedChallenge = false;
bool get completedChallenge => _completedChallenge;

Expand Down Expand Up @@ -153,11 +150,6 @@ class ChallengeViewModel extends BaseViewModel {
notifyListeners();
}

set setHasTypedInEditor(bool value) {
_hasTypedInEditor = true;
notifyListeners();
}

set setEditorText(String value) {
_editorText = value;
notifyListeners();
Expand Down
Loading