/** * @return True if the hardware wallet has been attached and a successful connection made */ public boolean isDeviceReady() { return context.getFeatures().isPresent(); }
/** * @return True if the hardware wallet has been initialised with a seed phrase (<code>Features.isInitialised()</code>) * * @throws IllegalStateException If called when the device is not ready (see <code>isDeviceReady()</code>) */ public boolean isWalletPresent() { if (!context.getFeatures().isPresent()) { throw new IllegalStateException("Device is not ready. Check the hardware wallet events."); } return context.getFeatures().get().isInitialized(); }
@Override public Boolean call() throws Exception { Optional<HardwareWalletService> hardwareWalletServiceOptional = CoreServices.getCurrentHardwareWalletService(); if (hardwareWalletServiceOptional.isPresent()) { HardwareWalletService hardwareWalletService = hardwareWalletServiceOptional.get(); featuresOptional = hardwareWalletService.getContext().getFeatures(); log.debug("Features : {}", featuresOptional); } else { log.error("No hardware wallet service"); } return true; }
@Override protected void initialiseButtons(AbstractWizard<CredentialsWizardModel> wizard) { Optional<HardwareWalletService> hardwareWalletService = CoreServices.getCurrentHardwareWalletService(); if (hardwareWalletService.isPresent() && hardwareWalletService.get().getContext().getFeatures().isPresent()) { // The hardware wallet is connected but there may be an issue with the current wallet // so we provide a Restore button to allow the user to choose an earlier backup PanelDecorator.addExitRestoreFinish(this, wizard); } else { // There is no hardware wallet or there is a problem with connection // so we provide a Previous button to allow the user to return to either // the password screen (soft) or the device unlock (hard) to rectify it // We also require the Restore button here to force a wallet switch operation // which would not occur simply through Previous PanelDecorator.addExitRestorePreviousFinish(this, wizard); } if (getPreviousButton() != null) { getPreviousButton().addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // Clear any 'password failed' before moving back walletLoadedStatusLabel.setText(""); walletLoadedStatusLabel.setIcon(null); } }); } }
Optional<HardwareWalletService> currentHardwareWalletService = CoreServices.getCurrentHardwareWalletService(); if (currentHardwareWalletService.isPresent()) { if (currentHardwareWalletService.get().getContext().getFeatures().isPresent()) { features = currentHardwareWalletService.get().getContext().getFeatures().get(); } else { setReportMessageKey(MessageKey.HARDWARE_FAILURE_OPERATION);
Optional<Features> featuresOptional = CoreServices.getCurrentHardwareWalletService().get().getContext().getFeatures();
@Override public void afterShow() { // This requires environment popover check checkForEnvironmentEventPopover(displayEnvironmentPopoverMaV); registerDefaultButton(getFinishButton()); Optional<HardwareWalletService> currentHardwareWalletService = CoreServices.getCurrentHardwareWalletService(); // Finally check that the firmware is supported // The user may try to ignore the popover warnings final boolean enabled; enabled = currentHardwareWalletService.isPresent() && currentHardwareWalletService.get() .getContext() .getFeatures().get().isSupported(); enterPinMaV.getView().requestInitialFocus(); enterPinMaV.getView().setEnabled(enabled); }
@Override public void afterShow() { registerDefaultButton(getFinishButton()); // Finally check that the firmware is supported (we do not tolerate any absent values at this point) final boolean enabled = CoreServices.getCurrentHardwareWalletService().get().getContext().getFeatures().get().isSupported(); enterPinMaV.getView().requestInitialFocus(); enterPinMaV.getView().setEnabled(enabled); // This requires a environment popover check checkForEnvironmentEventPopover(displayEnvironmentPopoverMaV); }
Optional<Features> features = hardwareWalletContext.getFeatures(); log.debug("Features: {}", features); final String label;
@Override public void afterShow() { // This requires environment popover check checkForEnvironmentEventPopover(displayEnvironmentPopoverMaV); registerDefaultButton(getFinishButton()); // Finally check that the firmware is supported // The user may try to ignore the popover warnings final boolean enabled = CoreServices.getCurrentHardwareWalletService().get() .getContext() .getFeatures().get() .isSupported(); enterPinMaV.getView().requestInitialFocus(); enterPinMaV.getView().setEnabled(enabled); }
final Optional<Features> features = CoreServices.getCurrentHardwareWalletService().get().getContext().getFeatures();
Optional<Features> currentFeatures = currentHardwareWalletService.get().getContext().getFeatures();
@Override public void afterShow() { // This requires environment popover check checkForEnvironmentEventPopover(displayEnvironmentPopoverMaV); registerDefaultButton(getFinishButton()); Optional<HardwareWalletService> currentHardwareWalletService = CoreServices.getCurrentHardwareWalletService(); // Finally check that the firmware is supported // The user may try to ignore the popover warnings final boolean enabled = currentHardwareWalletService.get() .getContext() .getFeatures().get() .isSupported(); enterPinMaV.getView().requestInitialFocus(); enterPinMaV.getView().setEnabled(enabled); }
@Override public void afterShow() { // This requires environment popover check checkForEnvironmentEventPopover(displayEnvironmentPopoverMaV); registerDefaultButton(getFinishButton()); Optional<HardwareWalletService> currentHardwareWalletService = CoreServices.getCurrentHardwareWalletService(); // Finally check that the firmware is supported // The user may try to ignore the popover warnings final boolean enabled = currentHardwareWalletService.get() .getContext() .getFeatures().get() .isSupported(); enterPinMaV.getView().requestInitialFocus(); enterPinMaV.getView().setEnabled(enabled); }
Optional<Features> features = CoreServices.getCurrentHardwareWalletService().get().getContext().getFeatures();
Optional<Features> features = currentHardwareWalletService.get().getContext().getFeatures();