From 2610672bc3cb9e1dbbfacbc77410ae233e3edc76 Mon Sep 17 00:00:00 2001 From: artehe <112902041+artehe@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:34:23 +0000 Subject: [PATCH] Mobilegestalt deprecated (#27) * Seems mobilegestalt is deprecated in 17.4 beta so putting this in to prevent unecessary exceptions --------- Co-authored-by: artehe <112902041+artehe@users.noreply.github> --- Netimobiledevice/Backup/DeviceBackup.cs | 7 +++++++ Netimobiledevice/Diagnostics/DiagnosticsService.cs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Netimobiledevice/Backup/DeviceBackup.cs b/Netimobiledevice/Backup/DeviceBackup.cs index 01ac1c0..6edd6dc 100644 --- a/Netimobiledevice/Backup/DeviceBackup.cs +++ b/Netimobiledevice/Backup/DeviceBackup.cs @@ -451,6 +451,13 @@ private bool IsPasscodeRequiredBeforeBackup() return true; } } + else if (queryResponse.TryGetValue("Status", out PropertyNode? statusNode)) { + if (statusNode.AsStringNode().Value == "MobileGestaltDeprecated") { + // Assume that the passcode is set for now + // TODO Try and find a new way to tell if the devices passcode is set + return true; + } + } } } return false; diff --git a/Netimobiledevice/Diagnostics/DiagnosticsService.cs b/Netimobiledevice/Diagnostics/DiagnosticsService.cs index 758522d..bec5b29 100644 --- a/Netimobiledevice/Diagnostics/DiagnosticsService.cs +++ b/Netimobiledevice/Diagnostics/DiagnosticsService.cs @@ -46,7 +46,7 @@ public sealed class DiagnosticsService : BaseService "DeviceClass", "DeviceColor", "DiagData", - "DiskUsage", + "DiskUsage", "encrypted-data-partition", "EthernetMacAddress", "FirmwareVersion", @@ -200,11 +200,11 @@ public DictionaryNode MobileGestalt(List keys) } if (response.ContainsKey("Diagnostics")) { PropertyNode status = response["Diagnostics"].AsDictionaryNode()["MobileGestalt"].AsDictionaryNode()["Status"]; - if (status.AsStringNode().Value != "Success") { + if (status.AsStringNode().Value != "Success" && status.AsStringNode().Value != "MobileGestaltDeprecated") { throw new Exception("Failed to query MobileGestalt"); } } - + return response["Diagnostics"].AsDictionaryNode()["MobileGestalt"].AsDictionaryNode(); }