Skip to content

Commit 7aa1f7d

Browse files
committed
Add "Exit Recovery Mode" menu item
1 parent a722623 commit 7aa1f7d

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/main/java/com/airsquared/blobsaver/Controller.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -624,13 +624,9 @@ private void useMacOSMenuBar() {
624624

625625
Menu helpMenu = menuBar.getMenus().get(1);
626626

627-
helpMenu.getItems().add(1, new SeparatorMenuItem());
628-
helpMenu.getItems().add(4, new SeparatorMenuItem());
629-
630627
MenuItem checkForValidBlobsMenuItem = new MenuItem("Check for Valid Blobs...");
631628
checkForValidBlobsMenuItem.setOnAction(event -> checkBlobs());
632-
helpMenu.getItems().set(5, checkForValidBlobsMenuItem);
633-
helpMenu.getItems().add(6, new SeparatorMenuItem());
629+
helpMenu.getItems().add(0, checkForValidBlobsMenuItem);
634630

635631
macOSMenuBar.getMenus().add(helpMenu);
636632

@@ -886,6 +882,16 @@ public void readApnonce() {
886882
}).start();
887883
}
888884

885+
public void exitRecoveryHandler() {
886+
PointerByReference irecvClient = new PointerByReference();
887+
int errorCode = Libimobiledevice.Libirecovery.irecv_open_with_ecid(irecvClient, 0);
888+
if (errorCode != 0) {
889+
newReportableError("irecovery error: code=" + errorCode + "\n\nUnable to find a device, try using another tool to exit recovery mode.");
890+
return;
891+
}
892+
Libimobiledevice.exitRecovery(irecvClient.getValue(), true);
893+
}
894+
889895
public void donate() { openURL("https://www.paypal.me/airsqrd"); }
890896

891897
@SuppressWarnings("Duplicates")

src/main/java/com/airsquared/blobsaver/Libimobiledevice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public static void throwIfNeeded(int errorCode, boolean showAlert, ErrorCodeType
253253
}
254254
} else if (errorType.equals(ErrorCodeType.irecv_error_t)) {
255255
exceptionMessage = "irecovery error: code=" + errorCode;
256-
alertMessage = exceptionMessage;
256+
alertMessage = exceptionMessage + "\n\nIf your device is still in recovery mode, use the \"Exit Recovery Mode\" option from the help menu.";
257257
reportableError = true;
258258
}
259259
if (showAlert) {

src/main/resources/com/airsquared/blobsaver/blobsaver.fxml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
<MenuItem mnemonicParsing="false" onAction="#resetAppHandler" text="Uninstall..."/>
3535
</Menu>
3636
<Menu mnemonicParsing="false" text="Help">
37+
<MenuItem mnemonicParsing="false" onAction="#exitRecoveryHandler" text="Exit Recovery Mode..."/>
38+
<SeparatorMenuItem mnemonicParsing="false"/>
3739
<MenuItem mnemonicParsing="false" onAction="#showWiki" text="blobsaver Help/Wiki"/>
3840
<MenuItem mnemonicParsing="false" onAction="#newGithubIssue" text="Send Feedback (Github Issue)"/>
3941
<MenuItem mnemonicParsing="false" onAction="#sendRedditPM" text="Send Feedback (Reddit PM)"/>

0 commit comments

Comments
 (0)