mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
bug fixes & replace idevice_get_device_version with get_device_version
This commit is contained in:
@@ -29,7 +29,7 @@ private:
|
||||
QString m_bundleId;
|
||||
QLabel *m_statusLabel;
|
||||
QFutureWatcher<int> *m_installWatcher;
|
||||
QTemporaryDir *m_tempDir;
|
||||
QTemporaryDir *m_tempDir = nullptr;
|
||||
void updateDeviceList();
|
||||
void performInstallation(const QString &ipaPath, const QString &deviceUdid);
|
||||
};
|
||||
|
||||
@@ -102,7 +102,7 @@ mobile_image_mounter_error_t mount_dev_image(const char *udid,
|
||||
goto leave;
|
||||
}
|
||||
|
||||
device_version = idevice_get_device_version(device);
|
||||
device_version = get_device_version(device);
|
||||
if (LOCKDOWN_E_SUCCESS != (ldret = lockdownd_client_new_with_handshake(
|
||||
device, &lckd, TOOL_NAME))) {
|
||||
qDebug() << "ERROR: Could not connect to lockdownd service!";
|
||||
|
||||
@@ -71,7 +71,7 @@ bool set_location(idevice_t device, char *lat, char *lon)
|
||||
lerr = lockdownd_start_service(lockdown, DT_SIMULATELOCATION_SERVICE,
|
||||
&svc);
|
||||
if (lerr != LOCKDOWN_E_SUCCESS) {
|
||||
unsigned int device_version = idevice_get_device_version(device);
|
||||
unsigned int device_version = get_device_version(device);
|
||||
lockdownd_client_free(lockdown);
|
||||
idevice_free(device);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void DevDiskImageHelper::onMountButtonClicked()
|
||||
m_isMounting = true;
|
||||
|
||||
// Check if we need to download first
|
||||
unsigned int device_version = idevice_get_device_version(m_device->device);
|
||||
unsigned int device_version = get_device_version(m_device->device);
|
||||
unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF;
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ void DevDiskImagesWidget::displayImages()
|
||||
// todo wtf is this
|
||||
if (m_currentDevice && m_currentDevice->device) {
|
||||
unsigned int device_version =
|
||||
idevice_get_device_version(m_currentDevice->device);
|
||||
get_device_version(m_currentDevice->device);
|
||||
deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
deviceMinorVersion = (device_version >> 8) & 0xFF;
|
||||
hasConnectedDevice = true;
|
||||
|
||||
@@ -294,7 +294,7 @@ bool DevDiskManager::isImageDownloaded(const QString &version,
|
||||
bool DevDiskManager::downloadCompatibleImageInternal(iDescriptorDevice *device)
|
||||
{
|
||||
|
||||
unsigned int device_version = idevice_get_device_version(device->device);
|
||||
unsigned int device_version = get_device_version(device->device);
|
||||
unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF;
|
||||
qDebug() << "Device version:" << deviceMajorVersion << "."
|
||||
@@ -381,7 +381,7 @@ bool DevDiskManager::downloadCompatibleImage(iDescriptorDevice *device)
|
||||
|
||||
bool DevDiskManager::mountCompatibleImageInternal(iDescriptorDevice *device)
|
||||
{
|
||||
unsigned int device_version = idevice_get_device_version(device->device);
|
||||
unsigned int device_version = get_device_version(device->device);
|
||||
unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
unsigned int deviceMinorVersion = (device_version >> 8) & 0xFF;
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ QString DeviceImageWidget::getMockupNameFromDisplayName(
|
||||
|
||||
int DeviceImageWidget::getIosVersionFromDevice() const
|
||||
{
|
||||
unsigned int version = idevice_get_device_version(m_device->device);
|
||||
unsigned int version = get_device_version(m_device->device);
|
||||
|
||||
if (version > 0) {
|
||||
int majorVersion = (version >> 16) & 0xFF;
|
||||
|
||||
+24
-1
@@ -402,4 +402,27 @@ QByteArray read_afc_file_to_byte_array(afc_client_t afcClient,
|
||||
bool isDarkMode();
|
||||
|
||||
instproxy_error_t install_IPA(idevice_t device, afc_client_t afc,
|
||||
const char *filePath);
|
||||
const char *filePath);
|
||||
|
||||
typedef struct _idevice_private {
|
||||
char *udid;
|
||||
uint32_t mux_id;
|
||||
enum idevice_connection_type conn_type;
|
||||
void *conn_data;
|
||||
int version;
|
||||
int device_class;
|
||||
};
|
||||
|
||||
/*
|
||||
we need this because idevice_get_device_version
|
||||
is not always available in libimobiledevice
|
||||
which could cause issues when installed from package managers
|
||||
*/
|
||||
inline unsigned int get_device_version(idevice_t _device)
|
||||
{
|
||||
_idevice_private *idevice = reinterpret_cast<_idevice_private *>(_device);
|
||||
if (!idevice) {
|
||||
return 0;
|
||||
}
|
||||
return static_cast<unsigned int>(idevice->version);
|
||||
}
|
||||
+9
-5
@@ -109,6 +109,9 @@ void iFuseWidget::setupUI()
|
||||
|
||||
void iFuseWidget::updateDeviceComboBox()
|
||||
{
|
||||
QList<iDescriptorDevice *> devices =
|
||||
AppContext::sharedInstance()->getAllDevices();
|
||||
|
||||
m_deviceComboBox->clear();
|
||||
m_deviceComboBox->setEnabled(true);
|
||||
m_mountButton->setEnabled(true);
|
||||
@@ -330,21 +333,22 @@ void iFuseWidget::onProcessFinished(int exitCode,
|
||||
auto *b = new iFuseDiskUnmountButton(m_currentMountPath);
|
||||
MainWindow::sharedInstance()->statusBar()->addPermanentWidget(b);
|
||||
QProcess *processToKill = m_ifuseProcess;
|
||||
QString currentMountPath = m_currentMountPath;
|
||||
connect(b, &iFuseDiskUnmountButton::clicked, this,
|
||||
[b, processToKill]() {
|
||||
qDebug() << "Unmounting" << m_currentMountPath;
|
||||
bool ok = iFuseManager::linuxUnmount(m_currentMountPath);
|
||||
[b, processToKill, currentMountPath]() {
|
||||
qDebug() << "Unmounting" << currentMountPath;
|
||||
bool ok = iFuseManager::linuxUnmount(currentMountPath);
|
||||
if (!ok) {
|
||||
QMessageBox::warning(nullptr, "Unmount Failed",
|
||||
"Failed to unmount iFuse at " +
|
||||
m_currentMountPath +
|
||||
currentMountPath +
|
||||
". Please try again.");
|
||||
return;
|
||||
}
|
||||
MainWindow::sharedInstance()->statusBar()->removeWidget(b);
|
||||
b->deleteLater();
|
||||
});
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m_currentMountPath));
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(currentMountPath));
|
||||
} else {
|
||||
QString errorOutput = m_ifuseProcess->readAllStandardError();
|
||||
setStatusMessage("Mount failed: " + errorOutput, true);
|
||||
|
||||
@@ -20,7 +20,7 @@ RealtimeScreenWidget::RealtimeScreenWidget(iDescriptorDevice *device,
|
||||
{
|
||||
setWindowTitle("Real-time Screen - iDescriptor");
|
||||
|
||||
unsigned int device_version = idevice_get_device_version(m_device->device);
|
||||
unsigned int device_version = get_device_version(m_device->device);
|
||||
unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
|
||||
if (deviceMajorVersion > 16) {
|
||||
|
||||
@@ -45,7 +45,15 @@ QString SettingsManager::devdiskimgpath() const
|
||||
// Settings implementation
|
||||
QString SettingsManager::downloadPath() const
|
||||
{
|
||||
return m_settings->value("downloadPath", DEFAULT_DEVDISKIMGPATH).toString();
|
||||
return m_settings
|
||||
->value("downloadPath", SettingsManager::docsPath() + "/devdiskimages")
|
||||
.toString();
|
||||
}
|
||||
|
||||
QString SettingsManager::docsPath()
|
||||
{
|
||||
return QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) +
|
||||
"/.idescriptor";
|
||||
}
|
||||
|
||||
void SettingsManager::setDownloadPath(const QString &path)
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
Theme,
|
||||
ConnectionTimeout
|
||||
};
|
||||
|
||||
static QString docsPath();
|
||||
// Existing methods
|
||||
QString devdiskimgpath() const;
|
||||
void clearKeys(const QString &keyPrefix);
|
||||
|
||||
@@ -124,14 +124,13 @@ VirtualLocation::VirtualLocation(iDescriptorDevice *device, QWidget *parent)
|
||||
});
|
||||
|
||||
DevDiskManager::sharedInstance()->downloadCompatibleImage(m_device);
|
||||
|
||||
unsigned int device_version = idevice_get_device_version(m_device->device);
|
||||
unsigned int device_version = get_device_version(m_device->device);
|
||||
unsigned int deviceMajorVersion = (device_version >> 16) & 0xFF;
|
||||
|
||||
if (deviceMajorVersion > 16) {
|
||||
QMessageBox::warning(
|
||||
this, "Unsupported iOS Version",
|
||||
"Real-time Screen feature requires iOS 16 or earlier.\n"
|
||||
"Virtual Location feature requires iOS 16 or earlier.\n"
|
||||
"Your device is running iOS " +
|
||||
QString::number(deviceMajorVersion) +
|
||||
", which is not yet supported.");
|
||||
|
||||
Reference in New Issue
Block a user