mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-21 04:01:27 +00:00
Refactored decision model
See: https://github.com/cryptomator/cryptomator/pull/2985#pullrequestreview-1514141146
This commit is contained in:
@@ -75,23 +75,34 @@ public class UnlockInvalidMountPointController implements FxController {
|
||||
|
||||
private enum ExceptionType {
|
||||
|
||||
NOT_SUPPORTED("unlock.error.customPath.description.notSupported", true),
|
||||
NOT_EXISTING("unlock.error.customPath.description.notExists", false),
|
||||
IN_USE("unlock.error.customPath.description.inUse", false),
|
||||
GENERIC("unlock.error.customPath.description.generic", true);
|
||||
NOT_SUPPORTED("unlock.error.customPath.description.notSupported", ButtonAction.SHOW_PREFERENCES),
|
||||
NOT_EXISTING("unlock.error.customPath.description.notExists", ButtonAction.SHOW_VAULT_OPTIONS),
|
||||
IN_USE("unlock.error.customPath.description.inUse", ButtonAction.SHOW_VAULT_OPTIONS),
|
||||
GENERIC("unlock.error.customPath.description.generic", ButtonAction.SHOW_PREFERENCES);
|
||||
|
||||
private final String translationKey;
|
||||
private final boolean showPreferences;
|
||||
private final ButtonAction action;
|
||||
|
||||
ExceptionType(String translationKey, boolean showPreferences) {
|
||||
ExceptionType(String translationKey, ButtonAction action) {
|
||||
this.translationKey = translationKey;
|
||||
this.showPreferences = showPreferences;
|
||||
this.action = action;
|
||||
}
|
||||
}
|
||||
|
||||
private enum ButtonAction {
|
||||
|
||||
SHOW_PREFERENCES,
|
||||
SHOW_VAULT_OPTIONS;
|
||||
|
||||
}
|
||||
|
||||
/* Getter */
|
||||
|
||||
public boolean isShowPreferences() {
|
||||
return exceptionType.showPreferences;
|
||||
return exceptionType.action == ButtonAction.SHOW_PREFERENCES;
|
||||
}
|
||||
|
||||
public boolean isShowVaultOptions() {
|
||||
return exceptionType.action == ButtonAction.SHOW_VAULT_OPTIONS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user