-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1st part of implementation to make visible indicator for watched/seen…
… replays
- Loading branch information
Showing
8 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/com/faforever/client/preferences/ReplayHistoryPrefs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.faforever.client.preferences; | ||
|
||
import javafx.beans.property.MapProperty; | ||
import javafx.beans.property.SimpleMapProperty; | ||
import javafx.collections.FXCollections; | ||
import javafx.collections.ObservableMap; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
public class ReplayHistoryPrefs { | ||
|
||
private final MapProperty<Integer, OffsetDateTime> watchedReplayMap = new SimpleMapProperty<>( | ||
FXCollections.observableHashMap()); | ||
|
||
public ObservableMap<Integer, OffsetDateTime> getWatchedReplayMap() {return watchedReplayMap.getValue();} | ||
|
||
public void setWatchedReplayMap(ObservableMap<Integer, OffsetDateTime> watchedReplayMap) { | ||
this.watchedReplayMap.setValue(watchedReplayMap); | ||
} | ||
|
||
public MapProperty<Integer, OffsetDateTime> watchedReplayMapProperty() {return watchedReplayMap;} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/faforever/client/replay/ReplayWatchingService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.faforever.client.replay; | ||
|
||
import com.faforever.client.preferences.Preferences; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.annotation.Lazy; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.time.OffsetDateTime; | ||
|
||
@Lazy | ||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class ReplayWatchingService { | ||
|
||
private final Preferences preferences; | ||
|
||
boolean wasReplayWatched(Integer replayId) { | ||
return preferences.getReplayHistory().getWatchedReplayMap().containsKey(replayId); | ||
} | ||
|
||
OffsetDateTime getReplayWatchedDateTime(Integer replayId) { | ||
if (wasReplayWatched(replayId)) { | ||
return preferences.getReplayHistory().getWatchedReplayMap().get(replayId); | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
void updateReplayWatchHistory(Integer replayId) { | ||
preferences.getReplayHistory().getWatchedReplayMap().put(replayId, OffsetDateTime.now()); | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters