Search in sources :

Example 1 with WARN

use of com.faforever.client.notification.Severity.WARN in project downlords-faf-client by FAForever.

the class ReplayServiceImpl method moveCorruptedReplayFile.

private void moveCorruptedReplayFile(Path replayFile) {
    Path corruptedReplaysDirectory = preferencesService.getCorruptedReplaysDirectory();
    noCatch(() -> createDirectories(corruptedReplaysDirectory));
    Path target = corruptedReplaysDirectory.resolve(replayFile.getFileName());
    logger.debug("Moving corrupted replay file from {} to {}", replayFile, target);
    noCatch(() -> move(replayFile, target));
    notificationService.addNotification(new PersistentNotification(i18n.get("corruptedReplayFiles.notification"), WARN, singletonList(new Action(i18n.get("corruptedReplayFiles.show"), event -> platformService.reveal(replayFile)))));
}
Also used : Path(java.nio.file.Path) GameService(com.faforever.client.game.GameService) SneakyThrows(lombok.SneakyThrows) URL(java.net.URL) URISyntaxException(java.net.URISyntaxException) LoggerFactory(org.slf4j.LoggerFactory) ReportingService(com.faforever.client.reporting.ReportingService) Collections.singletonList(java.util.Collections.singletonList) DirectoryStream(java.nio.file.DirectoryStream) ByteArrayInputStream(java.io.ByteArrayInputStream) Arrays.asList(java.util.Arrays.asList) Map(java.util.Map) URI(java.net.URI) Splitter(com.google.common.base.Splitter) Path(java.nio.file.Path) ClientProperties(com.faforever.client.config.ClientProperties) URIBuilder(org.apache.http.client.utils.URIBuilder) UrlEscapers(com.google.common.net.UrlEscapers) MethodHandles(java.lang.invoke.MethodHandles) Collection(java.util.Collection) Set(java.util.Set) Files.createDirectories(java.nio.file.Files.createDirectories) DismissAction(com.faforever.client.notification.DismissAction) Collectors(java.util.stream.Collectors) Bytes(com.google.common.primitives.Bytes) FeaturedMod(com.faforever.client.mod.FeaturedMod) List(java.util.List) Optional(java.util.Optional) ModService(com.faforever.client.mod.ModService) Lazy(org.springframework.context.annotation.Lazy) TaskService(com.faforever.client.task.TaskService) PreferencesService(com.faforever.client.preferences.PreferencesService) Files.move(java.nio.file.Files.move) GameOption(com.faforever.client.replay.Replay.GameOption) CompletableFuture(java.util.concurrent.CompletableFuture) ChatMessage(com.faforever.client.replay.Replay.ChatMessage) StandardCopyOption(java.nio.file.StandardCopyOption) ArrayList(java.util.ArrayList) PlatformService(com.faforever.client.fx.PlatformService) Inject(javax.inject.Inject) NotificationService(com.faforever.client.notification.NotificationService) KnownFeaturedMod(com.faforever.client.game.KnownFeaturedMod) Service(org.springframework.stereotype.Service) WARN(com.faforever.client.notification.Severity.WARN) ReplayData(com.faforever.commons.replay.ReplayData) SortConfig(com.faforever.client.vault.search.SearchController.SortConfig) ReportAction(com.faforever.client.notification.ReportAction) Collections.emptyMap(java.util.Collections.emptyMap) Logger(org.slf4j.Logger) Collections.emptySet(java.util.Collections.emptySet) Files(java.nio.file.Files) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Action(com.faforever.client.notification.Action) IOException(java.io.IOException) ApplicationContext(org.springframework.context.ApplicationContext) PersistentNotification(com.faforever.client.notification.PersistentNotification) URLDecoder.decode(java.net.URLDecoder.decode) FafService(com.faforever.client.remote.FafService) US_ASCII(java.nio.charset.StandardCharsets.US_ASCII) Severity(com.faforever.client.notification.Severity) ImmediateNotification(com.faforever.client.notification.ImmediateNotification) VisibleForTesting(com.google.common.annotations.VisibleForTesting) I18n(com.faforever.client.i18n.I18n) MapService(com.faforever.client.map.MapService) NoCatch.noCatch(com.github.nocatch.NoCatch.noCatch) Game(com.faforever.client.game.Game) DismissAction(com.faforever.client.notification.DismissAction) ReportAction(com.faforever.client.notification.ReportAction) Action(com.faforever.client.notification.Action) PersistentNotification(com.faforever.client.notification.PersistentNotification)

Example 2 with WARN

use of com.faforever.client.notification.Severity.WARN in project downlords-faf-client by FAForever.

the class ClientUpdateServiceImpl method downloadAndInstallInBackground.

private void downloadAndInstallInBackground(UpdateInfo updateInfo) {
    DownloadUpdateTask task = applicationContext.getBean(DownloadUpdateTask.class);
    task.setUpdateInfo(updateInfo);
    taskService.submitTask(task).getFuture().thenAccept(this::install).exceptionally(throwable -> {
        logger.warn("Error while downloading client update", throwable);
        notificationService.addNotification(new PersistentNotification(i18n.get("clientUpdateDownloadFailed.notification"), WARN, singletonList(new Action(i18n.get("clientUpdateDownloadFailed.retry"), event -> downloadAndInstallInBackground(updateInfo)))));
        return null;
    });
}
Also used : LoggerFactory(org.slf4j.LoggerFactory) Collections.singletonList(java.util.Collections.singletonList) PlatformService(com.faforever.client.fx.PlatformService) Inject(javax.inject.Inject) NotificationService(com.faforever.client.notification.NotificationService) Service(org.springframework.stereotype.Service) WARN(com.faforever.client.notification.Severity.WARN) Arrays.asList(java.util.Arrays.asList) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) Path(java.nio.file.Path) FafClientApplication(com.faforever.client.FafClientApplication) Logger(org.slf4j.Logger) MethodHandles(java.lang.invoke.MethodHandles) INFO(com.faforever.client.notification.Severity.INFO) Action(com.faforever.client.notification.Action) IOException(java.io.IOException) ApplicationContext(org.springframework.context.ApplicationContext) Profile(org.springframework.context.annotation.Profile) PersistentNotification(com.faforever.client.notification.PersistentNotification) Bytes.formatSize(com.faforever.commons.io.Bytes.formatSize) StringUtils.defaultString(org.apache.commons.lang3.StringUtils.defaultString) Lazy(org.springframework.context.annotation.Lazy) VisibleForTesting(com.google.common.annotations.VisibleForTesting) I18n(com.faforever.client.i18n.I18n) TaskService(com.faforever.client.task.TaskService) Action(com.faforever.client.notification.Action) PersistentNotification(com.faforever.client.notification.PersistentNotification)

Aggregations

PlatformService (com.faforever.client.fx.PlatformService)2 I18n (com.faforever.client.i18n.I18n)2 Action (com.faforever.client.notification.Action)2 NotificationService (com.faforever.client.notification.NotificationService)2 PersistentNotification (com.faforever.client.notification.PersistentNotification)2 WARN (com.faforever.client.notification.Severity.WARN)2 TaskService (com.faforever.client.task.TaskService)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)2 IOException (java.io.IOException)2 MethodHandles (java.lang.invoke.MethodHandles)2 FafClientApplication (com.faforever.client.FafClientApplication)1 ClientProperties (com.faforever.client.config.ClientProperties)1 Game (com.faforever.client.game.Game)1 GameService (com.faforever.client.game.GameService)1 KnownFeaturedMod (com.faforever.client.game.KnownFeaturedMod)1 MapService (com.faforever.client.map.MapService)1 FeaturedMod (com.faforever.client.mod.FeaturedMod)1 ModService (com.faforever.client.mod.ModService)1 DismissAction (com.faforever.client.notification.DismissAction)1 ImmediateNotification (com.faforever.client.notification.ImmediateNotification)1