renamed controller

This commit is contained in:
Sebastian Stenzel
2021-08-12 12:18:36 +02:00
parent f9c2807ce1
commit ec09413575
6 changed files with 17 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ public enum FxmlFile {
HEALTH_START_FAIL("/fxml/health_start_fail.fxml"), //
HEALTH_CHECK_LIST("/fxml/health_check_list.fxml"), //
HUB_P12("/fxml/hub_p12.fxml"), //
HUB_AUTH("/fxml/hub_auth.fxml"), //
HUB_RECEIVE_KEY("/fxml/hub_receive_key.fxml"), //
LOCK_FORCED("/fxml/lock_forced.fxml"), //
LOCK_FAILED("/fxml/lock_failed.fxml"), //
MAIN_WINDOW("/fxml/main_window.fxml"), //

View File

@@ -76,10 +76,10 @@ public abstract class HubKeyLoadingModule {
}
@Provides
@FxmlScene(FxmlFile.HUB_AUTH)
@FxmlScene(FxmlFile.HUB_RECEIVE_KEY)
@KeyLoadingScoped
static Scene provideHubAuthScene(@KeyLoading FxmlLoaderFactory fxmlLoaders) {
return fxmlLoaders.createScene(FxmlFile.HUB_AUTH);
return fxmlLoaders.createScene(FxmlFile.HUB_RECEIVE_KEY);
}
@Binds
@@ -106,7 +106,7 @@ public abstract class HubKeyLoadingModule {
@Binds
@IntoMap
@FxControllerKey(AuthController.class)
abstract FxController bindAuthController(AuthController controller);
@FxControllerKey(ReceiveKeyController.class)
abstract FxController bindReceiveKeyController(ReceiveKeyController controller);
}

View File

@@ -8,7 +8,6 @@ import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.FxmlFile;
import org.cryptomator.ui.common.FxmlScene;
import org.cryptomator.ui.common.NewPasswordController;
import org.cryptomator.ui.common.UserInteractionLock;
import org.cryptomator.ui.keyloading.KeyLoading;
import org.cryptomator.ui.keyloading.KeyLoadingScoped;
import org.slf4j.Logger;
@@ -40,7 +39,7 @@ public class P12CreateController implements FxController {
private final Stage window;
private final Environment env;
private final AtomicReference<KeyPair> keyPairRef;
private final Lazy<Scene> authScene;
private final Lazy<Scene> receiveKeyScene;
private final BooleanProperty userInteractionDisabled = new SimpleBooleanProperty();
private final ObjectBinding<ContentDisplay> unlockButtonContentDisplay = Bindings.createObjectBinding(this::getUnlockButtonContentDisplay, userInteractionDisabled);
@@ -49,11 +48,11 @@ public class P12CreateController implements FxController {
public NewPasswordController newPasswordController;
@Inject
public P12CreateController(@KeyLoading Stage window, Environment env, AtomicReference<KeyPair> keyPairRef, @FxmlScene(FxmlFile.HUB_AUTH) Lazy<Scene> authScene) {
public P12CreateController(@KeyLoading Stage window, Environment env, AtomicReference<KeyPair> keyPairRef, @FxmlScene(FxmlFile.HUB_RECEIVE_KEY) Lazy<Scene> receiveKeyScene) {
this.window = window;
this.env = env;
this.keyPairRef = keyPairRef;
this.authScene = authScene;
this.receiveKeyScene = receiveKeyScene;
this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed);
}
@@ -82,7 +81,7 @@ public class P12CreateController implements FxController {
var keyPair = P12AccessHelper.createNew(p12File, pw);
setKeyPair(keyPair);
LOG.debug("Created .p12 file {}", p12File);
window.setScene(authScene.get());
window.setScene(receiveKeyScene.get());
} catch (IOException e) {
LOG.error("Failed to load .p12 file.", e);
// TODO

View File

@@ -8,7 +8,6 @@ import org.cryptomator.ui.common.Animations;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.common.FxmlFile;
import org.cryptomator.ui.common.FxmlScene;
import org.cryptomator.ui.common.UserInteractionLock;
import org.cryptomator.ui.controls.NiceSecurePasswordField;
import org.cryptomator.ui.keyloading.KeyLoading;
import org.cryptomator.ui.keyloading.KeyLoadingScoped;
@@ -42,18 +41,18 @@ public class P12LoadController implements FxController {
private final Stage window;
private final Environment env;
private final AtomicReference<KeyPair> keyPairRef;
private final Lazy<Scene> authScene;
private final Lazy<Scene> receiveKeyScene;
private final BooleanProperty userInteractionDisabled = new SimpleBooleanProperty();
private final ObjectBinding<ContentDisplay> unlockButtonContentDisplay = Bindings.createObjectBinding(this::getUnlockButtonContentDisplay, userInteractionDisabled);
public NiceSecurePasswordField passwordField;
@Inject
public P12LoadController(@KeyLoading Stage window, Environment env, AtomicReference<KeyPair> keyPairRef, @FxmlScene(FxmlFile.HUB_AUTH) Lazy<Scene> authScene) {
public P12LoadController(@KeyLoading Stage window, Environment env, AtomicReference<KeyPair> keyPairRef, @FxmlScene(FxmlFile.HUB_RECEIVE_KEY) Lazy<Scene> receiveKeyScene) {
this.window = window;
this.env = env;
this.keyPairRef = keyPairRef;
this.authScene = authScene;
this.receiveKeyScene = receiveKeyScene;
this.window.addEventHandler(WindowEvent.WINDOW_HIDING, this::windowClosed);
}
@@ -79,7 +78,7 @@ public class P12LoadController implements FxController {
var keyPair = P12AccessHelper.loadExisting(p12File, pw);
setKeyPair(keyPair);
LOG.debug("Loaded .p12 file {}", p12File);
window.setScene(authScene.get());
window.setScene(receiveKeyScene.get());
} catch (InvalidPassphraseException e) {
LOG.warn("Invalid passphrase entered for .p12 file");
Animations.createShakeWindowAnimation(window).playFromStart();

View File

@@ -28,9 +28,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicReference;
@KeyLoadingScoped
public class AuthController implements FxController {
public class ReceiveKeyController implements FxController {
private static final Logger LOG = LoggerFactory.getLogger(AuthController.class);
private static final Logger LOG = LoggerFactory.getLogger(ReceiveKeyController.class);
private final Application application;
private final ExecutorService executor;
@@ -45,7 +45,7 @@ public class AuthController implements FxController {
private final AuthReceiveTask receiveTask;
@Inject
public AuthController(Application application, ExecutorService executor, @KeyLoading Stage window, AtomicReference<KeyPair> keyPairRef, AtomicReference<EciesParams> authParamsRef, UserInteractionLock<HubKeyLoadingModule.AuthFlow> authFlowLock, AtomicReference<URI> hubUriRef, ErrorComponent.Builder errorComponent) {
public ReceiveKeyController(Application application, ExecutorService executor, @KeyLoading Stage window, AtomicReference<KeyPair> keyPairRef, AtomicReference<EciesParams> authParamsRef, UserInteractionLock<HubKeyLoadingModule.AuthFlow> authFlowLock, AtomicReference<URI> hubUriRef, ErrorComponent.Builder errorComponent) {
this.application = application;
this.executor = executor;
this.window = window;