From c73c5ce4c8540947c4fe2002816a9fa95201280a Mon Sep 17 00:00:00 2001 From: JFronny Date: Sun, 12 May 2024 14:53:51 +0200 Subject: [PATCH] fix: restore current contest and problem --- src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt b/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt index f9d394f..8eee410 100644 --- a/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt +++ b/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt @@ -138,9 +138,19 @@ object SDom { val result = client.get("${SDCredentials.url}contests/${currentContest!!.id}/problems") if (result.status.isSuccess()) { problems = result.body>() + + if (!problems.contains(currentProblem)) { + currentProblem = null + } } } val loggedIn: Boolean get() = SDCredentials.credentials.first != null && SDCredentials.credentials.second != null + + init { + if (loggedIn) { + loginListeners.forEach { ApplicationManager.getApplication().invokeLater(it) } + } + } } \ No newline at end of file