use of com.faforever.client.notification.TransientNotification in project downlords-faf-client by FAForever.
the class AbstractChatTabController method showNotificationIfNecessary.
protected void showNotificationIfNecessary(ChatMessage chatMessage) {
Stage stage = StageHolder.getStage();
if (stage.isFocused() && stage.isShowing()) {
return;
}
Player player = playerService.getPlayerForUsername(chatMessage.getUsername());
String identiconSource = player != null ? String.valueOf(player.getId()) : chatMessage.getUsername();
notificationService.addNotification(new TransientNotification(chatMessage.getUsername(), chatMessage.getMessage(), IdenticonUtil.createIdenticon(identiconSource), event -> {
eventBus.post(new NavigateEvent(NavigationItem.CHAT));
stage.toFront();
getRoot().getTabPane().getSelectionModel().select(getRoot());
}));
}
use of com.faforever.client.notification.TransientNotification in project downlords-faf-client by FAForever.
the class FriendJoinedGameNotifier method onFriendJoinedGame.
@Subscribe
public void onFriendJoinedGame(FriendJoinedGameEvent event) {
Player player = event.getPlayer();
Game game = event.getGame();
audioService.playFriendJoinsGameSound();
if (preferencesService.getPreferences().getNotification().isFriendJoinsGameToastEnabled()) {
notificationService.addNotification(new TransientNotification(i18n.get("friend.joinedGameNotification.title", player.getUsername(), game.getTitle()), i18n.get("friend.joinedGameNotification.action"), IdenticonUtil.createIdenticon(player.getId()), event1 -> joinGameHelper.join(player.getGame())));
}
}
use of com.faforever.client.notification.TransientNotification in project downlords-faf-client by FAForever.
the class FriendOnlineNotifier method onUserOnline.
@Subscribe
public void onUserOnline(UserOnlineEvent event) {
String username = event.getUsername();
Player player = playerService.getPlayerForUsername(username);
if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) {
audioService.playFriendOnlineSound();
notificationService.addNotification(new TransientNotification(i18n.get("friend.nowOnlineNotification.title", username), i18n.get("friend.nowOnlineNotification.action"), IdenticonUtil.createIdenticon(player.getId()), actionEvent -> {
eventBus.post(new NavigateEvent(NavigationItem.CHAT));
eventBus.post(new InitiatePrivateChatEvent(username));
}));
}
}
use of com.faforever.client.notification.TransientNotification in project downlords-faf-client by FAForever.
the class FriendOfflineNotifier method onUserOnline.
@Subscribe
public void onUserOnline(UserOfflineEvent event) {
String username = event.getUsername();
Player player = playerService.getPlayerForUsername(username);
if (player != null && player.getSocialStatus() == SocialStatus.FRIEND) {
audioService.playFriendOfflineSound();
notificationService.addNotification(new TransientNotification(i18n.get("friend.nowOfflineNotification.title", username), "", IdenticonUtil.createIdenticon(player.getId())));
}
}
Aggregations