use of com.faforever.client.notification.ImmediateNotification in project downlords-faf-client by FAForever.
the class OnlineReplayVaultController method displayReplaysFromSupplier.
private void displayReplaysFromSupplier(Supplier<CompletableFuture<List<Replay>>> mapsSupplier) {
currentPage = 1;
this.currentSupplier = mapsSupplier;
mapsSupplier.get().thenAccept(this::displaySearchResult).exceptionally(e -> {
notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("vault.replays.searchError"), Severity.ERROR, e, Collections.singletonList(new DismissAction(i18n))));
enterResultState();
return null;
});
}
use of com.faforever.client.notification.ImmediateNotification in project downlords-faf-client by FAForever.
the class GameServiceImpl method notifyCantPlayReplay.
private void notifyCantPlayReplay(@Nullable Integer replayId, Throwable throwable) {
logger.error("Could not play replay '" + replayId + "'", throwable);
notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("replayCouldNotBeStarted", replayId), ERROR, throwable, singletonList(new Action(i18n.get("report")))));
}
use of com.faforever.client.notification.ImmediateNotification in project downlords-faf-client by FAForever.
the class FafServerAccessorImpl method onUIDNotExecuted.
@VisibleForTesting
protected void onUIDNotExecuted(Exception e) {
logger.error("UID.exe not executed", e);
if (e.getMessage() == null) {
return;
}
notificationService.addNotification(new ImmediateNotification(i18n.get("UIDNotExecuted"), e.getMessage(), Severity.ERROR, Collections.singletonList(new ReportAction(i18n, reportingService, e))));
}
use of com.faforever.client.notification.ImmediateNotification in project downlords-faf-client by FAForever.
the class ReplayServiceImpl method getLocalReplays.
@Override
@SneakyThrows
public Collection<Replay> getLocalReplays() {
Collection<Replay> replayInfos = new ArrayList<>();
String replayFileGlob = clientProperties.getReplay().getReplayFileGlob();
Path replaysDirectory = preferencesService.getReplaysDirectory();
if (Files.notExists(replaysDirectory)) {
noCatch(() -> createDirectories(replaysDirectory));
}
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(replaysDirectory, replayFileGlob)) {
for (Path replayFile : directoryStream) {
try {
LocalReplayInfo replayInfo = replayFileReader.parseMetaData(replayFile);
FeaturedMod featuredMod = modService.getFeaturedMod(replayInfo.getFeaturedMod()).getNow(FeaturedMod.UNKNOWN);
mapService.findByMapFolderName(replayInfo.getMapname()).thenAccept(mapBean -> {
if (!mapBean.isPresent()) {
notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("mapNotFound", replayInfo.getMapname()), WARN));
return;
}
replayInfos.add(new Replay(replayInfo, replayFile, featuredMod, mapBean.get()));
});
} catch (Exception e) {
logger.warn("Could not read replay file '{}'", replayFile, e);
moveCorruptedReplayFile(replayFile);
}
}
}
return replayInfos;
}
use of com.faforever.client.notification.ImmediateNotification in project downlords-faf-client by FAForever.
the class ReplayServiceImpl method runLiveReplay.
@Override
public void runLiveReplay(URI uri) {
logger.debug("Running replay from URL: {}", uri);
if (!uri.getScheme().equals(FAF_LIFE_PROTOCOL)) {
throw new IllegalArgumentException("Invalid protocol: " + uri.getScheme());
}
Map<String, String> queryParams = Splitter.on('&').trimResults().withKeyValueSeparator("=").split(uri.getQuery());
String gameType = queryParams.get("mod");
String mapName = noCatch(() -> decode(queryParams.get("map"), UTF_8.name()));
Integer gameId = Integer.parseInt(uri.getPath().split("/")[1]);
try {
URI replayUri = new URI(GPGNET_SCHEME, null, uri.getHost(), uri.getPort(), uri.getPath(), null, null);
gameService.runWithLiveReplay(replayUri, gameId, gameType, mapName).exceptionally(throwable -> {
notificationService.addNotification(new ImmediateNotification(i18n.get("errorTitle"), i18n.get("liveReplayCouldNotBeStarted"), Severity.ERROR, throwable, asList(new DismissAction(i18n), new ReportAction(i18n, reportingService, throwable))));
return null;
});
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
Aggregations