Add compatibility for libimobiledevice API >= 1.1.0
diff --git a/configure.ac b/configure.ac
index ab3945b..4dc3d76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,10 @@
if test x"$libimobiledevice_1_0" = xyes; then
AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_0], 1, [Define if libimobiledevice is using 1.0.0 API])
fi
+PKG_CHECK_MODULES(libimobiledevice11, libimobiledevice-1.0 >= 1.1.0, libimobiledevice_1_1=yes, libimobiledevice_1_1=no)
+if test x"$libimobiledevice_1_1" = xyes; then
+ AC_DEFINE([HAVE_LIBIMOBILEDEVICE_1_1], 1, [Define if libimobiledevice is using 1.1.0 API])
+fi
PKG_CHECK_MODULES(libplist, libplist >= 0.15)
PKG_CHECK_MODULES(libzip, libzip >= 0.8)
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index 86c6fe7..c8bc239 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -75,7 +75,11 @@
notified = 1;
}
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+static void status_cb(const char *operation, plist_t status, void *unused)
+#else
static void status_cb(const char *operation, plist_t status)
+#endif
{
if (status && operation) {
plist_t npercent = plist_dict_get_item(status, "PercentComplete");
@@ -665,17 +669,29 @@
}
if (install_mode) {
printf("Installing '%s'\n", pkgname);
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_install(ipc, pkgname, client_opts, status_cb, NULL);
+#else
instproxy_install(ipc, pkgname, client_opts, status_cb);
+#endif
} else {
printf("Upgrading '%s'\n", pkgname);
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_upgrade(ipc, pkgname, client_opts, status_cb, NULL);
+#else
instproxy_upgrade(ipc, pkgname, client_opts, status_cb);
+#endif
}
instproxy_client_options_free(client_opts);
free(pkgname);
wait_for_op_complete = 1;
notification_expected = 1;
} else if (uninstall_mode) {
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_uninstall(ipc, appid, NULL, status_cb, NULL);
+#else
instproxy_uninstall(ipc, appid, NULL, status_cb);
+#endif
wait_for_op_complete = 1;
notification_expected = 1;
} else if (list_archives_mode) {
@@ -834,7 +850,11 @@
}
}
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_archive(ipc, appid, client_opts, status_cb, NULL);
+#else
instproxy_archive(ipc, appid, client_opts, status_cb);
+#endif
instproxy_client_options_free(client_opts);
wait_for_op_complete = 1;
if (skip_uninstall) {
@@ -968,11 +988,19 @@
}
goto leave_cleanup;
} else if (restore_mode) {
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_restore(ipc, appid, NULL, status_cb, NULL);
+#else
instproxy_restore(ipc, appid, NULL, status_cb);
+#endif
wait_for_op_complete = 1;
notification_expected = 1;
} else if (remove_archive_mode) {
+#ifdef HAVE_LIBIMOBILEDEVICE_1_1
+ instproxy_remove_archive(ipc, appid, NULL, status_cb, NULL);
+#else
instproxy_remove_archive(ipc, appid, NULL, status_cb);
+#endif
wait_for_op_complete = 1;
} else {
printf