*/
@NonNullByDefault
public class PushoverAccountConfiguration {
+ public static final Sound SOUND_DEFAULT = new Sound("default", "Default");
public static final List<Sound> DEFAULT_SOUNDS = List.of(new Sound("alien", "Alien Alarm (long)"),
new Sound("bike", "Bike"), new Sound("bugle", "Bugle"), new Sound("cashregister", "Cash Register"),
new Sound("classical", "Classical"), new Sound("climb", "Climb (long)"), new Sound("cosmic", "Cosmic"),
new Sound("persistent", "Persistent (long)"), new Sound("pianobar", "Piano Bar"),
new Sound("pushover", "Pushover (default)"), new Sound("echo", "Pushover Echo (long)"),
new Sound("siren", "Siren"), new Sound("spacealarm", "Space Alarm"), new Sound("tugboat", "Tug Boat"),
- new Sound("updown", "Up Down (long)"), new Sound("vibrate", "Vibrate Only"));
+ new Sound("updown", "Up Down (long)"), new Sound("vibrate", "Vibrate Only"), SOUND_DEFAULT);
public @Nullable String apikey;
public @Nullable String user;
final String content = get(
buildURL(SOUNDS_URL, Map.of(PushoverMessageBuilder.MESSAGE_KEY_TOKEN, localApikey)));
final JsonObject json = JsonParser.parseString(content).getAsJsonObject();
- final JsonObject sounds = json.has(JSON_VALUE_SOUNDS) ? json.get(JSON_VALUE_SOUNDS).getAsJsonObject()
+ final JsonObject jsonSounds = json.has(JSON_VALUE_SOUNDS) ? json.get(JSON_VALUE_SOUNDS).getAsJsonObject()
: null;
- if (sounds != null) {
- return sounds.entrySet().stream()
+ if (jsonSounds != null) {
+ List<Sound> sounds = jsonSounds.entrySet().stream()
.map(entry -> new Sound(entry.getKey(), entry.getValue().getAsString()))
- .collect(Collectors.toUnmodifiableList());
+ .collect(Collectors.toList());
+ sounds.add(PushoverAccountConfiguration.SOUND_DEFAULT);
+ return sounds;
}
} catch (JsonSyntaxException e) {
// do nothing