mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-10-02 18:17:27 +13:00
Rework licensed features to include preview check
This commit is contained in:
parent
741edbec0d
commit
eeb0de4a4e
3 changed files with 20 additions and 8 deletions
|
@ -8,6 +8,7 @@ public class Hyperlinks {
|
||||||
public static final String GITHUB = "https://github.com/xpipe-io/xpipe";
|
public static final String GITHUB = "https://github.com/xpipe-io/xpipe";
|
||||||
public static final String PRIVACY = "https://docs.xpipe.io/privacy-policy";
|
public static final String PRIVACY = "https://docs.xpipe.io/privacy-policy";
|
||||||
public static final String EULA = "https://docs.xpipe.io/end-user-license-agreement";
|
public static final String EULA = "https://docs.xpipe.io/end-user-license-agreement";
|
||||||
|
public static final String PREVIEW = "https://docs.xpipe.io/preview";
|
||||||
public static final String SECURITY = "https://docs.xpipe.io/security";
|
public static final String SECURITY = "https://docs.xpipe.io/security";
|
||||||
public static final String DISCORD = "https://discord.gg/8y89vS8cRb";
|
public static final String DISCORD = "https://discord.gg/8y89vS8cRb";
|
||||||
public static final String SLACK = "https://join.slack.com/t/XPipe/shared_invite/zt-1awjq0t5j-5i4UjNJfNe1VN4b_auu6Cg";
|
public static final String SLACK = "https://join.slack.com/t/XPipe/shared_invite/zt-1awjq0t5j-5i4UjNJfNe1VN4b_auu6Cg";
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
package io.xpipe.app.util;
|
package io.xpipe.app.util;
|
||||||
|
|
||||||
import lombok.AccessLevel;
|
import lombok.Getter;
|
||||||
import lombok.experimental.FieldDefaults;
|
|
||||||
|
|
||||||
@FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE)
|
|
||||||
public class LicenseRequiredException extends RuntimeException {
|
public class LicenseRequiredException extends RuntimeException {
|
||||||
|
|
||||||
String featureName;
|
@Getter
|
||||||
boolean plural;
|
private final LicensedFeature feature;
|
||||||
|
|
||||||
public LicenseRequiredException(String featureName, boolean plural) {
|
public LicenseRequiredException(LicensedFeature feature) {
|
||||||
|
super(feature.getDisplayName() + (feature.isPlural() ? " are" : " is") + " only supported with a professional license");
|
||||||
|
this.feature = feature;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public LicenseRequiredException(String featureName, boolean plural, LicensedFeature feature) {
|
||||||
super(featureName + (plural ? " are" : " is") + " only supported with a professional license");
|
super(featureName + (plural ? " are" : " is") + " only supported with a professional license");
|
||||||
this.featureName = featureName;
|
this.feature = feature;
|
||||||
this.plural = plural;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,5 +4,13 @@ public interface LicensedFeature {
|
||||||
|
|
||||||
String getId();
|
String getId();
|
||||||
|
|
||||||
|
String getDisplayName();
|
||||||
|
|
||||||
|
boolean isPlural();
|
||||||
|
|
||||||
boolean isSupported();
|
boolean isSupported();
|
||||||
|
|
||||||
|
boolean isPreviewSupported();
|
||||||
|
|
||||||
|
public void throwIfUnsupported() throws LicenseRequiredException;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue