Revert "IJPL-165257 Show windows defender notification after project opening"

This reverts commit a0d2bb2f8fa84a377b324ee6e1095445866dff57.

GitOrigin-RevId: a08f6730f0828250ccf388b74a66eb6705874296
This commit is contained in:
Vera Petrenkova
2024-11-26 11:28:33 +00:00
committed by intellij-monorepo-bot
parent fe20eb4070
commit 1399406244
2 changed files with 12 additions and 23 deletions
@@ -34,7 +34,6 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -90,17 +89,13 @@ public class WindowsDefenderChecker {
@ApiStatus.Internal
@RequiresBackgroundThread
final boolean isAlreadyProcessed(@NotNull Project project, Consumer<Boolean> notifyAction) {
final boolean isAlreadyProcessed(@NotNull Project project) {
var projectPath = getProjectPath(project);
if (projectPath != null && myProjectPaths.containsKey(projectPath)) {
while (!project.isDisposed() && myProjectPaths.get(projectPath) == null) TimeoutUtil.sleep(100);
Boolean success = myProjectPaths.remove(projectPath);
if (success == Boolean.TRUE) {
if (myProjectPaths.remove(projectPath) == Boolean.TRUE) {
PropertiesComponent.getInstance(project).setValue(IGNORE_STATUS_CHECK, true);
}
if (success != null) {
notifyAction.accept(success);
}
return true;
}
@@ -44,20 +44,15 @@ internal class WindowsDefenderCheckerActivity : ProjectActivity {
WindowsDefenderStatisticsCollector.configured(project, success)
if (project == null) return@launch //notification will be sent after project opening
notify(project, success)
}
}
private fun notify(project: Project, success: Boolean) {
if (success) {
Notification("WindowsDefender", DiagnosticBundle.message("defender.config.success"), NotificationType.INFORMATION)
.notify(project)
}
else {
Notification("WindowsDefender", DiagnosticBundle.message("defender.config.failed"), NotificationType.ERROR)
.addAction(ShowLogAction.notificationAction())
.notify(project)
if (success) {
Notification("WindowsDefender", DiagnosticBundle.message("defender.config.success"), NotificationType.INFORMATION)
.notify(project)
}
else {
Notification("WindowsDefender", DiagnosticBundle.message("defender.config.failed"), NotificationType.ERROR)
.addAction(ShowLogAction.notificationAction())
.notify(project)
}
}
}
}
@@ -71,8 +66,7 @@ internal class WindowsDefenderCheckerActivity : ProjectActivity {
override suspend fun execute(project: Project) {
val checker = serviceAsync<WindowsDefenderChecker>()
val alreadyProcessed = checker.isAlreadyProcessed(project) { success: Boolean -> notify(project, success) }
if (checker.isStatusCheckIgnored(project) || alreadyProcessed) {
if (checker.isStatusCheckIgnored(project) || checker.isAlreadyProcessed(project)) {
LOG.info("status check is disabled")
WindowsDefenderStatisticsCollector.protectionCheckSkipped(project)
return