mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-14 22:43:57 +00:00
bug4941 fixed missing encoding for branchio parameters
This commit is contained in:
1 parent
abf48a8c8f
commit
bfcedef8c2
2 files changed
+27
-27
No files matched your search
+17
-11
@@ -7,6 +7,7 @@ import java.util.UUID;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.place.shared.PlaceTokenizer;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.sap.sailing.domain.common.BranchIOConstants;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.DeviceMappingConstants;
|
||||
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
@@ -23,7 +24,7 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
private UUID boatId;
|
||||
private UUID markId;
|
||||
private String leaderboardName;
|
||||
private String regattaName;
|
||||
private String publicRegattaName;
|
||||
private String regattaRegistrationLinkSecret;
|
||||
private InvitationMode mode;
|
||||
private String rawCheckInUrl;
|
||||
@@ -43,9 +44,9 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
if (mode == InvitationMode.PUBLIC_INVITE) {
|
||||
// alternative direct link version
|
||||
targetServer = Window.Location.getParameter(PARAM_SERVER);
|
||||
regattaName = Window.Location.getParameter(PARAM_REGATTA_NAME);
|
||||
publicRegattaName = Window.Location.getParameter(PARAM_REGATTA_NAME);
|
||||
regattaRegistrationLinkSecret = Window.Location.getParameter(PARAM_REGATTA_SECRET);
|
||||
if (regattaName == null || regattaRegistrationLinkSecret == null || targetServer == null) {
|
||||
if (publicRegattaName == null || regattaRegistrationLinkSecret == null || targetServer == null) {
|
||||
GWT.log("Missing parameter for regatta, secret or server");
|
||||
}
|
||||
} else {
|
||||
@@ -97,34 +98,32 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
try {
|
||||
eventId = UUID.fromString(parameter.getB());
|
||||
} catch (IllegalArgumentException e) {
|
||||
GWT.log("Invalid event_id");
|
||||
GWT.log("Invalid " + DeviceMappingConstants.URL_EVENT_ID);
|
||||
eventId = null;
|
||||
}
|
||||
} else if (DeviceMappingConstants.URL_COMPETITOR_ID_AS_STRING.equals(parameter.getA())) {
|
||||
try {
|
||||
competitorId = UUID.fromString(parameter.getB());
|
||||
} catch (IllegalArgumentException e) {
|
||||
GWT.log("Invalid competitor_id");
|
||||
GWT.log("Invalid " + DeviceMappingConstants.URL_COMPETITOR_ID_AS_STRING);
|
||||
competitorId = null;
|
||||
}
|
||||
} else if (DeviceMappingConstants.URL_BOAT_ID_AS_STRING.equals(parameter.getA())) {
|
||||
try {
|
||||
boatId = UUID.fromString(parameter.getB());
|
||||
} catch (IllegalArgumentException e) {
|
||||
GWT.log("Invalid boatId");
|
||||
GWT.log("Invalid " + DeviceMappingConstants.URL_BOAT_ID_AS_STRING);
|
||||
boatId = null;
|
||||
}
|
||||
} else if (DeviceMappingConstants.URL_MARK_ID_AS_STRING.equals(parameter.getA())) {
|
||||
try {
|
||||
markId = UUID.fromString(parameter.getB());
|
||||
} catch (IllegalArgumentException e) {
|
||||
GWT.log("Invalid markId");
|
||||
GWT.log("Invalid " + DeviceMappingConstants.URL_MARK_ID_AS_STRING);
|
||||
boatId = null;
|
||||
}
|
||||
} else if (DeviceMappingConstants.URL_LEADERBOARD_NAME.equals(parameter.getA())) {
|
||||
leaderboardName = parameter.getB();
|
||||
} else if (PARAM_REGATTA_NAME.equals(parameter.getA())) {
|
||||
regattaName = parameter.getB();
|
||||
} else if (PARAM_REGATTA_SECRET.equals(parameter.getA())) {
|
||||
regattaRegistrationLinkSecret = parameter.getB();
|
||||
}
|
||||
@@ -151,6 +150,13 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
return pairs;
|
||||
}
|
||||
|
||||
public String getPublicInviteBranchIOUrl() {
|
||||
return BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO + "?" + QRCodePlace.PARAM_REGATTA_NAME + "="
|
||||
+ encodeUrl(publicRegattaName) + "&" + QRCodePlace.PARAM_REGATTA_SECRET + "="
|
||||
+ encodeUrl(regattaRegistrationLinkSecret) + "&" + QRCodePlace.PARAM_SERVER + "="
|
||||
+ encodeUrl(targetServer);
|
||||
}
|
||||
|
||||
public InvitationMode getMode() {
|
||||
return mode;
|
||||
}
|
||||
@@ -175,8 +181,8 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
return leaderboardName;
|
||||
}
|
||||
|
||||
public String getRegattaName() {
|
||||
return regattaName;
|
||||
public String getPublicRegattaName() {
|
||||
return publicRegattaName;
|
||||
}
|
||||
|
||||
public UUID getMarkId() {
|
||||
|
||||
+10
-16
@@ -225,20 +225,12 @@ public class QRCodePresenter {
|
||||
|
||||
private void proceedIfFinished() {
|
||||
InvitationMode invitationMode = place.getMode();
|
||||
String regattaName = place.getRegattaName();
|
||||
String regattaRegistrationLinkSecret = place.getRegattaRegistrationLinkSecret();
|
||||
String serverForPublic = place.getTargetServer();
|
||||
String checkInUrl = place.getEncodedCheckInUrl();
|
||||
String leaderBoardName = place.getLeaderboardName();
|
||||
UUID eventId = place.getEventId();
|
||||
UUID competitorId = place.getCompetitorId();
|
||||
if (invitationMode == InvitationMode.PUBLIC_INVITE) {
|
||||
String branchIoUrl = BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO + "?"
|
||||
+ QRCodePlace.PARAM_REGATTA_NAME + "=" + regattaName + "&" + QRCodePlace.PARAM_REGATTA_SECRET
|
||||
+ "=" + regattaRegistrationLinkSecret + "&" + QRCodePlace.PARAM_SERVER + "=" + serverForPublic;
|
||||
view.setData(null, null, null, null, regattaName, branchIoUrl, invitationMode);
|
||||
view.setData(null, null, null, null, place.getPublicRegattaName(), place.getPublicInviteBranchIOUrl(),
|
||||
invitationMode);
|
||||
} else {
|
||||
if (participantIsSet && eventIsSet) {
|
||||
String checkInUrl = place.getEncodedCheckInUrl();
|
||||
if (checkInUrl != null) {
|
||||
String branchIoUrl = null;
|
||||
switch (invitationMode) {
|
||||
@@ -257,14 +249,16 @@ public class QRCodePresenter {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
view.setData(event, competitor, boat, mark, leaderBoardName, branchIoUrl, invitationMode);
|
||||
view.setData(event, competitor, boat, mark, place.getLeaderboardName(), branchIoUrl,
|
||||
invitationMode);
|
||||
} else {
|
||||
view.setError();
|
||||
GWT.log("checkInUrl " + checkInUrl);
|
||||
GWT.log("competitorId " + competitorId);
|
||||
GWT.log("boatId " + boat);
|
||||
GWT.log("invitationMode " + invitationMode);
|
||||
GWT.log("eventId " + eventId);
|
||||
GWT.log("checkInUrl " + place.getEncodedCheckInUrl());
|
||||
GWT.log("competitorId " + place.getCompetitorId());
|
||||
GWT.log("boatId " + place.getBoatId());
|
||||
GWT.log("markId " + place.getMarkId());
|
||||
GWT.log("eventId " + place.getEventId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user