From 30d36c9010f1fed81884bfb1615e1510196b318c Mon Sep 17 00:00:00 2001 From: BlackYps Date: Wed, 11 Nov 2020 16:35:09 +0100 Subject: [PATCH] Remove notification for match available --- .../faforever/client/game/GameService.java | 4 - .../faforever/client/main/MainController.java | 55 -------------- .../preferences/NotificationsPrefs.java | 14 ---- .../preferences/ui/SettingsController.java | 3 - .../client/remote/MockFafServerAccessor.java | 9 --- src/main/resources/i18n/messages.properties | 2 - .../resources/theme/settings/settings.fxml | 6 +- .../client/main/MainControllerTest.java | 73 ------------------- 8 files changed, 2 insertions(+), 164 deletions(-) diff --git a/src/main/java/com/faforever/client/game/GameService.java b/src/main/java/com/faforever/client/game/GameService.java index 4a1018ba11..8f2bc5f8ff 100644 --- a/src/main/java/com/faforever/client/game/GameService.java +++ b/src/main/java/com/faforever/client/game/GameService.java @@ -496,10 +496,6 @@ public Game getByUid(int uid) { return game; } - public void addOnMatchmakerQueueNotificationListener(Consumer listener) { - fafService.addOnMessageListener(MatchmakerInfoMessage.class, listener); - } - public CompletableFuture startSearchMatchmaker() { inMatchmakerQueue.set(true); diff --git a/src/main/java/com/faforever/client/main/MainController.java b/src/main/java/com/faforever/client/main/MainController.java index baa7790426..309c87af5e 100644 --- a/src/main/java/com/faforever/client/main/MainController.java +++ b/src/main/java/com/faforever/client/main/MainController.java @@ -219,7 +219,6 @@ public void initialize() { notificationService.addPersistentNotificationListener(change -> runLater(() -> updateNotificationsButton(change.getSet()))); notificationService.addImmediateNotificationListener(notification -> runLater(() -> displayImmediateNotification(notification))); notificationService.addTransientNotificationListener(notification -> runLater(() -> transientNotificationsController.addNotification(notification))); - gameService.addOnMatchmakerQueueNotificationListener(this::onMatchmakerMessage); // Always load chat immediately so messages or joined channels don't need to be cached until we display them. getView(NavigationItem.CHAT); @@ -321,60 +320,6 @@ private void updateNotificationsButton(Collection> ratingRangesSupplier; - if (leaderboardRatingDeviation <= deviationFor80PercentQuality) { - ratingRangesSupplier = MatchmakerInfoMessage.MatchmakerQueue::getBoundary80s; - } else if (leaderboardRatingDeviation <= deviationFor75PercentQuality) { - ratingRangesSupplier = MatchmakerInfoMessage.MatchmakerQueue::getBoundary75s; - } else { - return; - } - - float leaderboardRatingMean = currentPlayer.getLeaderboardRatingMean(); - boolean showNotification = false; - for (MatchmakerInfoMessage.MatchmakerQueue matchmakerQueue : message.getQueues()) { - if (!Objects.equals("ladder1v1", matchmakerQueue.getQueueName())) { - continue; - } - List ratingRanges = ratingRangesSupplier.apply(matchmakerQueue); - - for (RatingRange ratingRange : ratingRanges) { - if (ratingRange.getMin() <= leaderboardRatingMean && leaderboardRatingMean <= ratingRange.getMax()) { - showNotification = true; - break; - } - } - } - - if (!showNotification) { - return; - } - - notificationService.addNotification(new TransientNotification( - i18n.get("ranked1v1.notification.title"), - i18n.get("ranked1v1.notification.message"), - uiService.getThemeImage(UiService.LADDER_1V1_IMAGE), - event -> eventBus.post(new OpenTeamMatchmakingEvent()) - )); - } - public void display() { eventBus.post(UpdateApplicationBadgeEvent.ofNewValue(0)); diff --git a/src/main/java/com/faforever/client/preferences/NotificationsPrefs.java b/src/main/java/com/faforever/client/preferences/NotificationsPrefs.java index 534925f42e..a40ecd3f44 100644 --- a/src/main/java/com/faforever/client/preferences/NotificationsPrefs.java +++ b/src/main/java/com/faforever/client/preferences/NotificationsPrefs.java @@ -17,7 +17,6 @@ public class NotificationsPrefs { private final BooleanProperty errorSoundEnabled; private final BooleanProperty friendOnlineToastEnabled; private final BooleanProperty friendOfflineToastEnabled; - private final BooleanProperty ladder1v1ToastEnabled; private final BooleanProperty friendOnlineSoundEnabled; private final BooleanProperty friendOfflineSoundEnabled; private final BooleanProperty friendJoinsGameSoundEnabled; @@ -42,7 +41,6 @@ public NotificationsPrefs() { toastPosition = new SimpleObjectProperty<>(ToastPosition.BOTTOM_RIGHT); friendOnlineToastEnabled = new SimpleBooleanProperty(true); friendOfflineToastEnabled = new SimpleBooleanProperty(true); - ladder1v1ToastEnabled = new SimpleBooleanProperty(true); friendOnlineSoundEnabled = new SimpleBooleanProperty(true); friendOfflineSoundEnabled = new SimpleBooleanProperty(true); friendJoinsGameSoundEnabled = new SimpleBooleanProperty(true); @@ -153,18 +151,6 @@ public BooleanProperty friendOfflineToastEnabledProperty() { return friendOfflineToastEnabled; } - public boolean getLadder1v1ToastEnabled() { - return ladder1v1ToastEnabled.get(); - } - - public void setLadder1v1ToastEnabled(boolean ladder1v1ToastEnabled) { - this.ladder1v1ToastEnabled.set(ladder1v1ToastEnabled); - } - - public BooleanProperty ladder1v1ToastEnabledProperty() { - return ladder1v1ToastEnabled; - } - public boolean isFriendOnlineSoundEnabled() { return friendOnlineSoundEnabled.get(); } diff --git a/src/main/java/com/faforever/client/preferences/ui/SettingsController.java b/src/main/java/com/faforever/client/preferences/ui/SettingsController.java index 9e25b227c7..49c78b8688 100644 --- a/src/main/java/com/faforever/client/preferences/ui/SettingsController.java +++ b/src/main/java/com/faforever/client/preferences/ui/SettingsController.java @@ -5,7 +5,6 @@ import com.faforever.client.config.ClientProperties; import com.faforever.client.fx.Controller; import com.faforever.client.fx.JavaFxUtil; -import com.faforever.client.fx.NodeListCell; import com.faforever.client.fx.PlatformService; import com.faforever.client.fx.StringListCell; import com.faforever.client.i18n.I18n; @@ -112,7 +111,6 @@ public class SettingsController implements Controller { public CheckBox playFriendJoinsGameSoundCheckBox; public CheckBox playFriendPlaysGameSoundCheckBox; public CheckBox displayPmReceivedToastCheckBox; - public CheckBox displayLadder1v1ToastCheckBox; public CheckBox playPmReceivedSoundCheckBox; public CheckBox afterGameReviewCheckBox; public Region settingsRoot; @@ -284,7 +282,6 @@ public void initialize() { displayFriendJoinsGameToastCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().friendJoinsGameToastEnabledProperty()); displayFriendPlaysGameToastCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().friendPlaysGameToastEnabledProperty()); displayPmReceivedToastCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().privateMessageToastEnabledProperty()); - displayLadder1v1ToastCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().ladder1v1ToastEnabledProperty()); playFriendOnlineSoundCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().friendOnlineSoundEnabledProperty()); playFriendOfflineSoundCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().friendOfflineSoundEnabledProperty()); playFriendJoinsGameSoundCheckBox.selectedProperty().bindBidirectional(preferences.getNotification().friendJoinsGameSoundEnabledProperty()); diff --git a/src/main/java/com/faforever/client/remote/MockFafServerAccessor.java b/src/main/java/com/faforever/client/remote/MockFafServerAccessor.java index 2d30268f4b..26c199a561 100644 --- a/src/main/java/com/faforever/client/remote/MockFafServerAccessor.java +++ b/src/main/java/com/faforever/client/remote/MockFafServerAccessor.java @@ -134,15 +134,6 @@ public void run() { } }, 7000); - timer.schedule(new TimerTask() { - @Override - public void run() { - MatchmakerInfoMessage matchmakerServerMessage = new MatchmakerInfoMessage(); - matchmakerServerMessage.setQueues(singletonList(new MatchmakerQueue("ladder1v1", null, 1, 1, singletonList(new RatingRange(100, 200)), singletonList(new RatingRange(100, 200))))); - messageListeners.getOrDefault(matchmakerServerMessage.getClass(), Collections.emptyList()).forEach(consumer -> consumer.accept(matchmakerServerMessage)); - } - }, 7000); - List gameInfoMessages = Arrays.asList( createGameInfo(1, "Mock game 500 - 800", PUBLIC, "faf", "scmp_010", 1, 6, "Mock user"), createGameInfo(2, "Mock game 500+", PUBLIC, "faf", "scmp_011", 2, 6, "Mock user"), diff --git a/src/main/resources/i18n/messages.properties b/src/main/resources/i18n/messages.properties index fb60fcff3d..20e1c4f794 100644 --- a/src/main/resources/i18n/messages.properties +++ b/src/main/resources/i18n/messages.properties @@ -67,8 +67,6 @@ coop.leaderboard.couldNotLoad=Co-Op leaderboard could not be loaded. coop.couldNotLoad=Co-Op missions could not be loaded: {0} coop.watchReplay=Watch ranked1v1.gamesPlayed=Games played -ranked1v1.notification.title=1v1 ranked match available -ranked1v1.notification.message=Click here to open the 1v1 tab teammatchmaking.leaveParty=Leave party teammatchmaking.invitePlayer=Invite players teammatchmaking.invite=Invite diff --git a/src/main/resources/theme/settings/settings.fxml b/src/main/resources/theme/settings/settings.fxml index 21d6952108..fbff174cd7 100644 --- a/src/main/resources/theme/settings/settings.fxml +++ b/src/main/resources/theme/settings/settings.fxml @@ -457,10 +457,8 @@