mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-16 07:10:48 +00:00
bug5174: trying to consolidate invitation modes / types
This commit is contained in:
1 parent
820c421a1f
commit
c0af045f40
5 files changed
+98
-40
No files matched your search
+42
-4
@@ -1,10 +1,48 @@
|
||||
package com.sap.sailing.domain.common;
|
||||
|
||||
public enum MailInvitationType {
|
||||
LEGACY,
|
||||
SailInsight1,
|
||||
SailInsight2,
|
||||
SailInsight3;
|
||||
LEGACY(/* supportsOpenRegattas */ false,
|
||||
/* branchIOinviteURL */ BranchIOConstants.SAILINSIGHT_APP_BRANCHIO,
|
||||
/* branchIOcheckinPath */ BranchIOConstants.SAILINSIGHT_APP_BRANCHIO_PATH,
|
||||
/* branchIOopenRegattaURL */ null),
|
||||
SailInsight1(/* supportsOpenRegattas */ false,
|
||||
/* branchIOinviteURL */ BranchIOConstants.SAILINSIGHT_APP_BRANCHIO,
|
||||
/* branchIOcheckinPath */ BranchIOConstants.SAILINSIGHT_APP_BRANCHIO_PATH,
|
||||
/* branchIOopenRegattaURL */ null),
|
||||
SailInsight2(/* supportsOpenRegattas */ true,
|
||||
/* branchIOinviteURL */ BranchIOConstants.SAILINSIGHT_2_APP_BRANCHIO,
|
||||
/* branchIOcheckinPath */ BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO_PATH,
|
||||
/* branchIOopenRegattaURL */ BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO),
|
||||
SailInsight3(/* supportsOpenRegattas */ true,
|
||||
/* branchIOinviteURL */ BranchIOConstants.SAILINSIGHT_3_APP_BRANCHIO,
|
||||
/* branchIOcheckinPath */ BranchIOConstants.OPEN_REGATTA_3_APP_BRANCHIO_PATH,
|
||||
/* branchIOopenRegattaURL */ BranchIOConstants.OPEN_REGATTA_3_APP_BRANCHIO);
|
||||
|
||||
public static final String SYSTEM_PROPERTY_NAME = "com.sap.sailing.domain.tracking.MailInvitationType";
|
||||
|
||||
private MailInvitationType(boolean supportsOpenRegattas, String branchIOinviteURL, String branchIOcheckinPath,
|
||||
String branchIOopenRegattaURL) {
|
||||
this.supportsOpenRegattas = supportsOpenRegattas;
|
||||
this.branchIOinviteURL = branchIOinviteURL;
|
||||
this.branchIOcheckinPath = branchIOcheckinPath;
|
||||
this.branchIOopenRegattaURL = branchIOopenRegattaURL;
|
||||
}
|
||||
|
||||
public boolean isSupportsOpenRegattas() {
|
||||
return supportsOpenRegattas;
|
||||
}
|
||||
public String getBranchIOinviteURL() {
|
||||
return branchIOinviteURL;
|
||||
}
|
||||
public String getBranchIOcheckinPath() {
|
||||
return branchIOcheckinPath;
|
||||
}
|
||||
public String getBranchIOopenRegattaURL() {
|
||||
return branchIOopenRegattaURL;
|
||||
}
|
||||
|
||||
private final boolean supportsOpenRegattas;
|
||||
private final String branchIOinviteURL;
|
||||
private final String branchIOcheckinPath;
|
||||
private final String branchIOopenRegattaURL;
|
||||
}
|
||||
+30
-9
@@ -7,7 +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.MailInvitationType;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.DeviceMappingConstants;
|
||||
import com.sap.sailing.gwt.common.client.AbstractBasePlace;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
@@ -46,17 +46,39 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
private String targetServer;
|
||||
|
||||
public enum InvitationMode {
|
||||
COMPETITOR_2,
|
||||
COMPETITOR,
|
||||
PUBLIC_INVITE,
|
||||
BOUY_TENDER
|
||||
COMPETITOR(MailInvitationType.SailInsight1, /* isCompetitorBoatMarkMode */ true, /* isPublicInvite */ false),
|
||||
COMPETITOR_2(MailInvitationType.SailInsight2, /* isCompetitorBoatMarkMode */ true, /* isPublicInvite */ false),
|
||||
COMPETITOR_3(MailInvitationType.SailInsight3, /* isCompetitorBoatMarkMode */ true, /* isPublicInvite */ false),
|
||||
PUBLIC_INVITE(MailInvitationType.SailInsight2, /* isCompetitorBoatMarkMode */ false, /* isPublicInvite */ true),
|
||||
PUBLIC_INVITE3(MailInvitationType.SailInsight3, /* isCompetitorBoatMarkMode */ false, /* isPublicInvite */ true),
|
||||
BOUY_TENDER(null, /* isCompetitorBoatMarkMode */ false, /* isPublicInvite */ false);
|
||||
|
||||
private InvitationMode(MailInvitationType mailInvitationType, boolean isCompetitorBoatMarkMode, boolean isPublicInvite) {
|
||||
this.mailInvitationType = mailInvitationType;
|
||||
this.isCompetitorBoatMarkMode = isCompetitorBoatMarkMode;
|
||||
this.isPublicInvite = isPublicInvite;
|
||||
}
|
||||
|
||||
public MailInvitationType getMailInvitationType() {
|
||||
return mailInvitationType;
|
||||
}
|
||||
public boolean isCompetitorBoatMarkMode() {
|
||||
return isCompetitorBoatMarkMode;
|
||||
}
|
||||
public boolean isPublicInvite() {
|
||||
return isPublicInvite;
|
||||
}
|
||||
|
||||
private final MailInvitationType mailInvitationType;
|
||||
private final boolean isCompetitorBoatMarkMode;
|
||||
private final boolean isPublicInvite;
|
||||
}
|
||||
|
||||
public QRCodePlace(String token) {
|
||||
super(token);
|
||||
try {
|
||||
mode = InvitationMode.valueOf(getParameter(PARAM_MODE));
|
||||
if (mode == InvitationMode.PUBLIC_INVITE) {
|
||||
if (mode.isPublicInvite()) {
|
||||
// alternative direct link version
|
||||
targetServer = Window.Location.getParameter(PARAM_SERVER);
|
||||
publicRegattaName = Window.Location.getParameter(PARAM_REGATTA_NAME);
|
||||
@@ -165,9 +187,8 @@ public class QRCodePlace extends AbstractBasePlace {
|
||||
return pairs;
|
||||
}
|
||||
|
||||
public String getPublicInviteBranchIOUrl() {
|
||||
// TODO why is this specific to version 2 and not considering the default server setting for mailInvitationType?
|
||||
return BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO + "?" + QRCodePlace.PARAM_REGATTA_NAME + "="
|
||||
public String getPublicInviteBranchIOUrl(MailInvitationType mailInvitationType) {
|
||||
return mailInvitationType.getBranchIOopenRegattaURL() + "?" + QRCodePlace.PARAM_REGATTA_NAME + "="
|
||||
+ encodeUrl(publicRegattaName) + "&" + QRCodePlace.PARAM_REGATTA_SECRET + "="
|
||||
+ encodeUrl(regattaRegistrationLinkSecret) + "&" + QRCodePlace.PARAM_SERVER + "="
|
||||
+ encodeUrl(targetServer);
|
||||
|
||||
+9
-7
@@ -9,7 +9,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sap.sailing.domain.common.BranchIOConstants;
|
||||
import com.sap.sailing.domain.common.dto.BoatDTO;
|
||||
import com.sap.sailing.domain.common.dto.CompetitorDTO;
|
||||
import com.sap.sailing.gwt.home.desktop.places.qrcode.QRCodePlace.InvitationMode;
|
||||
import com.sap.sailing.gwt.ui.shared.MarkDTO;
|
||||
import com.sap.sailing.gwt.ui.shared.QRCodeEvent;
|
||||
import com.sap.sse.common.Util;
|
||||
@@ -123,6 +122,7 @@ public class QRCodePresenter {
|
||||
break;
|
||||
case COMPETITOR:
|
||||
case COMPETITOR_2:
|
||||
case COMPETITOR_3:
|
||||
logger.info("QR Code for competitor/boat/buoy tracking to be shown");
|
||||
if (place.getEncodedCheckInUrl() == null || place.getEncodedCheckInUrl().isEmpty()) {
|
||||
view.setError();
|
||||
@@ -142,6 +142,7 @@ public class QRCodePresenter {
|
||||
}
|
||||
break;
|
||||
case PUBLIC_INVITE:
|
||||
case PUBLIC_INVITE3:
|
||||
logger.info("QR Code for public regatta invite to be shown");
|
||||
// as the event is most likely displayed on a different server anyway, do not load additional data
|
||||
dataCollector = new DataCollector(view);
|
||||
@@ -280,13 +281,13 @@ public class QRCodePresenter {
|
||||
break;
|
||||
case COMPETITOR:
|
||||
case COMPETITOR_2:
|
||||
case COMPETITOR_3:
|
||||
if (participantIsSet && eventIsSet) {
|
||||
logger.info("About to show QR Code for competitor/boat/mark tracking");
|
||||
String sailInsightBranch = place.getMode() == InvitationMode.COMPETITOR
|
||||
? BranchIOConstants.SAILINSIGHT_APP_BRANCHIO
|
||||
: BranchIOConstants.SAILINSIGHT_2_APP_BRANCHIO;
|
||||
String sailInsightBranch = place.getMode().getMailInvitationType().getBranchIOinviteURL();
|
||||
String branchIoUrl = sailInsightBranch + "?"
|
||||
+ BranchIOConstants.SAILINSIGHT_APP_BRANCHIO_PATH + "=" + place.getEncodedCheckInUrl();
|
||||
+ place.getMode().getMailInvitationType().getBranchIOcheckinPath() + "="
|
||||
+ place.getEncodedCheckInUrl();
|
||||
view.showCompetitor(event, competitor, boat, mark, place.getLeaderboardName(), branchIoUrl);
|
||||
} else {
|
||||
if (!participantIsSet) {
|
||||
@@ -298,11 +299,12 @@ public class QRCodePresenter {
|
||||
}
|
||||
break;
|
||||
case PUBLIC_INVITE:
|
||||
case PUBLIC_INVITE3:
|
||||
logger.info("About to show QR Code for public regatta invite");
|
||||
view.showPublic(place.getPublicRegattaName(), place.getPublicInviteBranchIOUrl());
|
||||
view.showPublic(place.getPublicRegattaName(),
|
||||
place.getPublicInviteBranchIOUrl(place.getMode().getMailInvitationType()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
-1
@@ -216,7 +216,6 @@ public class RegattaLogAddDeviceMappingDialog extends DataEntryDialogWithDateTim
|
||||
if (events.getValue() == null) {
|
||||
throw new QRCodeURLCreationException(stringMessages.noEventSelected());
|
||||
}
|
||||
|
||||
final String eventIdAsString = events.getValue().id.toString();
|
||||
String url = DeviceMappingConstants.getDeviceMappingForRegattaLogUrl(baseUrlWithoutTrailingSlash,
|
||||
eventIdAsString, leaderboardName, mappedItemType, mappedItemId, regattaRegisterSecret,
|
||||
|
||||
+17
-19
@@ -19,7 +19,6 @@ import com.google.gwt.user.client.ui.TextBox;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sap.sailing.domain.common.BranchIO;
|
||||
import com.sap.sailing.domain.common.BranchIOConstants;
|
||||
import com.sap.sailing.domain.common.MailInvitationType;
|
||||
import com.sap.sailing.gwt.ui.client.SailingServiceAsync;
|
||||
import com.sap.sailing.gwt.ui.client.StringMessages;
|
||||
@@ -157,27 +156,26 @@ public class RegistrationLinkWithQRCodeDialog extends DataEntryDialog<Registrati
|
||||
parameters.put("secret", secret);
|
||||
parameters.put("server", baseUrl);
|
||||
parameters.put("event_id", eventIdAsString);
|
||||
// TODO decide OPEN_REGATTA link variant based on invitationType
|
||||
String deeplinkUrl = BranchIO.generateLink(BranchIOConstants.OPEN_REGATTA_2_APP_BRANCHIO, parameters,
|
||||
URL::encodeQueryString);
|
||||
urlTextBox.setText(deeplinkUrl);
|
||||
if (invitationType != MailInvitationType.SailInsight2 &&
|
||||
invitationType != MailInvitationType.SailInsight3) { // TODO it would be better to make it a property of an enum literal whether open regatta invitation is possible
|
||||
if (invitationType.isSupportsOpenRegattas()) {
|
||||
String deeplinkUrl = BranchIO.generateLink(invitationType.getBranchIOopenRegattaURL(), parameters,
|
||||
URL::encodeQueryString);
|
||||
urlTextBox.setText(deeplinkUrl);
|
||||
sailingService.openRegattaRegistrationQrCode(deeplinkUrl, new AsyncCallback<String>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
GWT.log("Qrcode generation failed: ", caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
GWT.log("Qrcode generated for url: " + deeplinkUrl);
|
||||
qrCodeImage.setUrl("data:image/png;base64, " + result);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
getStatusLabel().setText(stringMessages.warningSailInsightVersion());
|
||||
getStatusLabel().setStyleName("errorLabel");
|
||||
}
|
||||
sailingService.openRegattaRegistrationQrCode(deeplinkUrl, new AsyncCallback<String>() {
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
GWT.log("Qrcode generation failed: ", caught);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
GWT.log("Qrcode generated for url: " + deeplinkUrl);
|
||||
qrCodeImage.setUrl("data:image/png;base64, " + result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static native boolean copyToClipboard() /*-{
|
||||
|
||||
Reference in new issue
Block a user