-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
7 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
2 changes: 1 addition & 1 deletion
2
common/src/main/java/de/tum/cit/artemis/push/common/NotificationRequest.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,4 +1,4 @@ | ||
package de.tum.cit.artemis.push.common; | ||
|
||
public record NotificationRequest(String initializationVector, String payloadCipherText, String token) { | ||
public record NotificationRequest(String initializationVector, String payloadCipherText, String token, PushNotificationApiType apiType) { | ||
} |
23 changes: 23 additions & 0 deletions
23
common/src/main/java/de/tum/cit/artemis/push/common/PushNotificationApiType.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 de.tum.cit.artemis.push.common; | ||
|
||
import java.util.Arrays; | ||
|
||
public enum PushNotificationApiType { | ||
|
||
DEFAULT((short) 0), IOS_V2((short) 1); | ||
|
||
private final short databaseKey; | ||
|
||
PushNotificationApiType(short databaseKey) { | ||
this.databaseKey = databaseKey; | ||
} | ||
|
||
public short getDatabaseKey() { | ||
return databaseKey; | ||
} | ||
|
||
public static PushNotificationApiType fromDatabaseKey(short databaseKey) { | ||
return Arrays.stream(PushNotificationApiType.values()).filter(type -> type.getDatabaseKey() == databaseKey).findFirst() | ||
.orElseThrow(() -> new IllegalArgumentException("Unknown database key: " + databaseKey)); | ||
} | ||
} |