mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-24 14:38:45 +00:00
Merge remote-tracking branch 'origin/master' into bug5261
This commit is contained in:
+8
@@ -11,6 +11,14 @@ public class BranchIOConstants {
|
||||
public static final String OPEN_REGATTA_2_APP_BRANCHIO_PATH = "checkinUrl";
|
||||
public static final String OPEN_REGATTA_3_APP_BRANCHIO = "https://sailinsight30-app.sapsailing.com/publicInvite";
|
||||
public static final String OPEN_REGATTA_3_APP_BRANCHIO_PATH = "checkinUrl";
|
||||
public static final String RACEMANAGER_APP_BRANCH_QUICK_LINK = "https://racemanager-app.sapsailing.com/invite";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_SERVER_URL = "server_url";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_DEVICE_CONFIG_IDENTIFIER = "device_config_identifier";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_DEVICE_CONFIG_UUID = "device_config_uuid";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_TOKEN = "token";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_EVENT_ID = "event_id";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_COURSE_AREA_UUID = "course_area_uuid";
|
||||
public static final String RACEMANAGER_APP_BRANCH_PARAM_PRIORITY = "priority";
|
||||
|
||||
private BranchIOConstants() {
|
||||
}
|
||||
|
||||
+36
-14
@@ -7,42 +7,64 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* This class is used by our backend, in GWT-client code and by the Android app. Therefore we cannot use classes like
|
||||
* {@link URLEncoder} to help us with the encoding.
|
||||
* {@link URLEncoder} to help us with the encoding.<p>
|
||||
*
|
||||
* Example URL:<pre>
|
||||
* https://racemanager-app.sapsailing.com/invite?server_url=https://dev.sapsailing.com/&device_config_identifier=D-Labs+Test&device_config_uuid=6fb0e2e3-23e6-4d2e-b66a-77d98feb7fdd&token=KY5G48LdOiTysCCiRfvFIVO87Ljbfzo3a4%2Bal63H%2Fvw%3D&event_id=8c3bdd16-a3d1-4a38-bf82-29d98ce18bec&course_area_uuid=fe96623a-d570-4dc5-8cc4-7fe8c5e7e2c0&priority=2
|
||||
* </pre>
|
||||
*/
|
||||
public class DeviceConfigurationQRCodeUtils {
|
||||
public static final String deviceIdentifierKey = "identifier";
|
||||
private static final String BASE_INVITATION_URL = "https://racemanager-app.sapsailing.com/invite";
|
||||
public static final String serverUrl = "server_url";
|
||||
public static final String eventId = "event_id";
|
||||
public static final String courseAreaId = "course_area_uuid";
|
||||
public static final String priority = "priority";
|
||||
public static final String deviceIdentifierKey = "device_config_identifier";
|
||||
public static final String deviceUuidKey = "device_config_uuid";
|
||||
public static final String accessTokenKey = "token";
|
||||
public static final String deviceUuidKey = "uuid";
|
||||
|
||||
|
||||
public static class DeviceConfigurationDetails {
|
||||
private final String apkUrl;
|
||||
private final String url;
|
||||
private final String deviceIdentifier;
|
||||
private final UUID uuid;
|
||||
private final String accessToken;
|
||||
public DeviceConfigurationDetails(String apkUrl, UUID uuid, String deviceConfigurationName, String accessToken) {
|
||||
|
||||
public DeviceConfigurationDetails(String url, UUID uuid, String deviceConfigurationName, String accessToken) {
|
||||
super();
|
||||
this.apkUrl = apkUrl;
|
||||
this.url = url;
|
||||
this.uuid = uuid;
|
||||
this.deviceIdentifier = deviceConfigurationName;
|
||||
this.accessToken = accessToken;
|
||||
}
|
||||
public String getApkUrl() {
|
||||
return apkUrl;
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public UUID getUuid() { return uuid; }
|
||||
|
||||
public String getDeviceIdentifier() { return deviceIdentifier; }
|
||||
|
||||
public String getAccessToken() {
|
||||
return accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static interface URLDecoder {
|
||||
String decode(String encodedURL);
|
||||
}
|
||||
|
||||
public static String composeQRContent(String urlEncodedDeviceConfigName, String apkUrl, String accessToken, String urlEncodedDeviceIdAsString) {
|
||||
return apkUrl + "#" + deviceIdentifierKey + "=" + urlEncodedDeviceConfigName + "&" + deviceUuidKey + "="
|
||||
+ urlEncodedDeviceIdAsString + "&" + accessTokenKey + "=" + accessToken;
|
||||
public static String composeQRContent(String serverUrlWithoutFinalSlash, String urlEncodedDeviceConfigName,
|
||||
String urlEncodedDeviceIdAsString, UUID eventId, UUID courseAreaId, Integer priority,
|
||||
String accessToken) {
|
||||
return BASE_INVITATION_URL
|
||||
+ "?"+serverUrl+"="+serverUrlWithoutFinalSlash
|
||||
+ "&" + deviceIdentifierKey + "=" + urlEncodedDeviceConfigName
|
||||
+ "&" + deviceUuidKey + "=" + urlEncodedDeviceIdAsString
|
||||
+ (eventId != null ? ("&" + DeviceConfigurationQRCodeUtils.eventId + "=" + eventId) : "")
|
||||
+ (courseAreaId != null ? ("&" + DeviceConfigurationQRCodeUtils.courseAreaId + "=" + courseAreaId) : "")
|
||||
+ (priority != null ? ("&" + DeviceConfigurationQRCodeUtils.priority + "=" + priority) : "")
|
||||
+ (accessToken != null ? ("&" + accessTokenKey + "=" + accessToken) : "");
|
||||
}
|
||||
|
||||
public static DeviceConfigurationDetails splitQRContent(String qrCodeContent, URLDecoder urlDecoder) {
|
||||
@@ -50,7 +72,7 @@ public class DeviceConfigurationQRCodeUtils {
|
||||
if (fragmentIndex == -1 || fragmentIndex == 0 || qrCodeContent.length() == fragmentIndex + 1) {
|
||||
throw new IllegalArgumentException("There is no server or identifier.");
|
||||
}
|
||||
String fragment = qrCodeContent.substring(fragmentIndex + 1, qrCodeContent.length());
|
||||
String fragment = qrCodeContent.substring(fragmentIndex + 1);
|
||||
final String[] params = fragment.split("&");
|
||||
final Map<String, String> paramMap = new HashMap<>();
|
||||
for (String param : params) {
|
||||
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
package com.sap.sailing.domain.common.racelog;
|
||||
|
||||
/**
|
||||
* Generally, any {@code AbstractLogEvent} has an author of type {@code AbstractLogEventAuthor} which has a numerical
|
||||
* non-negative priority. Lesser numerical values represent higher priority/precedence. This enumeration captures
|
||||
* the default priorities the Race Manager App is expected to handle.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public enum AuthorPriority {
|
||||
ADMIN(0),
|
||||
OFFICER_ON_VESSEL(1),
|
||||
SHORE_CONTROL(2),
|
||||
DEMO_MODE(3);
|
||||
|
||||
private final int priority;
|
||||
|
||||
private AuthorPriority(int priority) {
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return priority;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user