-
Notifications
You must be signed in to change notification settings - Fork 398
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Map Tags & Use Maps Server (triplea_maps.yml now unused)
__Always use Maps Server__ Stop reading 'triplea_maps.yml' Specifically instead of downloading the 'triplea_maps.yml' file and parsing it, the front end will instead contact the server and receive a JSON payload that contains the map download list. __Introduce and use map tags__ Map tags are a generic way to add additional meta data to maps dynamically. For example, instead of having a 'category' value specifically enumerated, we instead now have a tag whose key is 'category'. This allows us to have an arbitrary set of meta information without needing to update the front end. __Update server to send 'preview image url' to the frontend__ The server computes the preview image URL to make it easier and more explicit for the frontend. Having the server instead of the client compute the preview image URL also allows for it to be updated in database.
- Loading branch information
1 parent
f243a00
commit bc7c66a
Showing
42 changed files
with
568 additions
and
263 deletions.
There are no files selected for viewing
71 changes: 0 additions & 71 deletions
71
...e-core/src/main/java/games/strategy/engine/framework/map/download/DownloadFileParser.java
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
...ame-core/src/main/java/games/strategy/engine/framework/map/download/DownloadRunnable.java
This file was deleted.
Oops, something went wrong.
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
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: 0 additions & 23 deletions
23
game-app/game-core/src/test/java/games/strategy/engine/ClientContextIntegrationTest.java
This file was deleted.
Oops, something went wrong.
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
26 changes: 23 additions & 3 deletions
26
...s/lobby-client/src/main/java/org/triplea/http/client/maps/listing/MapDownloadListing.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 |
---|---|---|
@@ -1,24 +1,44 @@ | ||
package org.triplea.http.client.maps.listing; | ||
|
||
import java.util.List; | ||
import javax.annotation.Nonnull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
|
||
@Builder | ||
@AllArgsConstructor | ||
@Getter | ||
@ToString | ||
@EqualsAndHashCode | ||
public class MapDownloadListing { | ||
/** URL where the map can be downloaded. */ | ||
@Nonnull private final String downloadUrl; | ||
/** URL of the preview image of the map. */ | ||
private final String previewImageUrl; | ||
@Nonnull private final String previewImageUrl; | ||
|
||
@Nonnull private final String mapName; | ||
private final Long lastCommitDateEpochMilli; | ||
@Nonnull private final String mapCategory; | ||
@Nonnull private final Long lastCommitDateEpochMilli; | ||
/** HTML description of the map. */ | ||
@Nonnull private final String description; | ||
/** @deprecated use lastCommitDateEpochMilli and file time stamps instead. */ | ||
@Deprecated private final Integer version; | ||
|
||
/** Mapping of {tag name -> tag value} */ | ||
private final List<MapTag> mapTags; | ||
|
||
/** | ||
* Finds a tag by name and returns its corresponding value. If the tag is not found or has a null | ||
* value, an empty string is returned instead. | ||
*/ | ||
@Nonnull | ||
public String getTagValue(final String tagName) { | ||
return mapTags.stream() | ||
.filter(tag -> tag.getName().equalsIgnoreCase(tagName)) | ||
.findAny() | ||
.map(MapTag::getValue) | ||
.orElse(""); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
http-clients/lobby-client/src/main/java/org/triplea/http/client/maps/listing/MapTag.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,37 @@ | ||
package org.triplea.http.client.maps.listing; | ||
|
||
import java.util.Optional; | ||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Value; | ||
|
||
@Value | ||
@Builder | ||
@EqualsAndHashCode | ||
public class MapTag { | ||
/** The human readable name of the tag */ | ||
String name; | ||
|
||
/** The actual value of the tag */ | ||
String value; | ||
|
||
/** | ||
* Tag type determines how the value is interpreted and rendered. The value should be an element | ||
* of {@code MapTagType} | ||
*/ | ||
String type; | ||
|
||
/** | ||
* The ordering to display this map tag in relative to other map tags. Lower values should be | ||
* displayed first. displayOrder is greater than zero. | ||
*/ | ||
int displayOrder; | ||
|
||
// public MapTagType getType() { | ||
// return MapTagType.valueOf(type); | ||
// } | ||
|
||
public String getValue() { | ||
return Optional.ofNullable(value).orElse(""); | ||
} | ||
} |
Oops, something went wrong.