diff options
| author | 2009-12-31 14:29:05 +0100 | |
|---|---|---|
| committer | 2010-01-04 07:33:25 -0800 | |
| commit | daee8be013dae3821463fd85f4076ca2ab3adce6 (patch) | |
| tree | f27a4efdc316a35f70e2aaf5a5f231b89dfbb298 | |
| parent | dd3d8700dcdc7acc28e2db58405f247bb98228ab (diff) | |
| download | libimobiledevice-daee8be013dae3821463fd85f4076ca2ab3adce6.tar.gz libimobiledevice-daee8be013dae3821463fd85f4076ca2ab3adce6.tar.bz2 | |
Add options to instproxy_archive function
This change allows to specify the following options:
INSTPROXY_ARCHIVE_APP_ONLY - Archive only the application data
INSTPROXY_ARCHIVE_SKIP_UNINSTALL - Do not uninstall the application.
Combine these options with logical OR to specify both. These two options
combined are used by iTunes to create app archives of on-device downloaded
apps that are later copied as *.ipa files to the computer.
[#104 state:resolved]
Signed-off-by: Matt Colyer <matt@colyer.name>
| -rw-r--r-- | include/libiphone/installation_proxy.h | 5 | ||||
| -rw-r--r-- | src/InstallationProxy.c | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/include/libiphone/installation_proxy.h b/include/libiphone/installation_proxy.h index dcf668f..f432e8a 100644 --- a/include/libiphone/installation_proxy.h +++ b/include/libiphone/installation_proxy.h | |||
| @@ -47,6 +47,9 @@ typedef enum { | |||
| 47 | INSTPROXY_APPTYPE_USER = 2 | 47 | INSTPROXY_APPTYPE_USER = 2 |
| 48 | } instproxy_apptype_t; | 48 | } instproxy_apptype_t; |
| 49 | 49 | ||
| 50 | #define INSTPROXY_ARCHIVE_APP_ONLY (1 << 0) | ||
| 51 | #define INSTPROXY_ARCHIVE_SKIP_UNINSTALL (1 << 1) | ||
| 52 | |||
| 50 | struct instproxy_client_int; | 53 | struct instproxy_client_int; |
| 51 | typedef struct instproxy_client_int *instproxy_client_t; | 54 | typedef struct instproxy_client_int *instproxy_client_t; |
| 52 | 55 | ||
| @@ -62,7 +65,7 @@ instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_p | |||
| 62 | instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); | 65 | instproxy_error_t instproxy_uninstall(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); |
| 63 | 66 | ||
| 64 | instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t *result); | 67 | instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t *result); |
| 65 | instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); | 68 | instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, uint32_t options, instproxy_status_cb_t status_cb); |
| 66 | instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); | 69 | instproxy_error_t instproxy_restore(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); |
| 67 | instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); | 70 | instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb); |
| 68 | 71 | ||
diff --git a/src/InstallationProxy.c b/src/InstallationProxy.c index 7a8ef5a..917886d 100644 --- a/src/InstallationProxy.c +++ b/src/InstallationProxy.c | |||
| @@ -676,6 +676,11 @@ leave_unlock: | |||
| 676 | * | 676 | * |
| 677 | * @param client The connected installation proxy client | 677 | * @param client The connected installation proxy client |
| 678 | * @param appid ApplicationIdentifier of the app to archive. | 678 | * @param appid ApplicationIdentifier of the app to archive. |
| 679 | * @param options This is either 0 for default behaviour (make an archive | ||
| 680 | * including app/user settings etc. AND uninstall the application), | ||
| 681 | * or one or a combination of the following options: | ||
| 682 | * INSTPROXY_ARCHIVE_APP_ONLY (1) | ||
| 683 | * INSTPROXY_ARCHIVE_SKIP_UNINSTALL (2) | ||
| 679 | * @param status_cb Callback function for progress and status information. If | 684 | * @param status_cb Callback function for progress and status information. If |
| 680 | * NULL is passed, this function will run synchronously. | 685 | * NULL is passed, this function will run synchronously. |
| 681 | * | 686 | * |
| @@ -687,7 +692,7 @@ leave_unlock: | |||
| 687 | * created successfully; any error occuring during the operation has to be | 692 | * created successfully; any error occuring during the operation has to be |
| 688 | * handled inside the specified callback function. | 693 | * handled inside the specified callback function. |
| 689 | */ | 694 | */ |
| 690 | instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, instproxy_status_cb_t status_cb) | 695 | instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid, uint32_t options, instproxy_status_cb_t status_cb) |
| 691 | { | 696 | { |
| 692 | if (!client || !client->connection || !appid) | 697 | if (!client || !client->connection || !appid) |
| 693 | return INSTPROXY_E_INVALID_ARG; | 698 | return INSTPROXY_E_INVALID_ARG; |
| @@ -700,6 +705,16 @@ instproxy_error_t instproxy_archive(instproxy_client_t client, const char *appid | |||
| 700 | 705 | ||
| 701 | plist_t dict = plist_new_dict(); | 706 | plist_t dict = plist_new_dict(); |
| 702 | plist_dict_insert_item(dict, "ApplicationIdentifier", plist_new_string(appid)); | 707 | plist_dict_insert_item(dict, "ApplicationIdentifier", plist_new_string(appid)); |
| 708 | if (options > 0) { | ||
| 709 | plist_t client_opts = plist_new_dict(); | ||
| 710 | if (options & INSTPROXY_ARCHIVE_APP_ONLY) { | ||
| 711 | plist_dict_insert_item(client_opts, "ArchiveType", plist_new_string("ApplicationOnly")); | ||
| 712 | } | ||
| 713 | if (options & INSTPROXY_ARCHIVE_SKIP_UNINSTALL) { | ||
| 714 | plist_dict_insert_item(client_opts, "SkipUninstall", plist_new_bool(1)); | ||
| 715 | } | ||
| 716 | plist_dict_insert_item(dict, "ClientOptions", client_opts); | ||
| 717 | } | ||
| 703 | plist_dict_insert_item(dict, "Command", plist_new_string("Archive")); | 718 | plist_dict_insert_item(dict, "Command", plist_new_string("Archive")); |
| 704 | 719 | ||
| 705 | instproxy_lock(client); | 720 | instproxy_lock(client); |
