From 7437545b0d0ea92b247ea254dfd447f2c82faace Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Wed, 6 Nov 2019 19:30:59 +0530 Subject: [PATCH] Fix web clip uninstallation issues in ios --- .../mgt/core/impl/SubscriptionManagerImpl.java | 1 + .../device/mgt/common/app/mgt/ios/RemoveApplication.java | 9 +++++++++ .../carbon/device/mgt/core/util/MDMIOSOperationUtil.java | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index 6b68458a17b..ec5c5324750 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -985,6 +985,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { app.setType(mobileAppType); app.setIdentifier(application.getPackageName()); + app.setLocation(application.getApplicationReleases().get(0).getInstallerPath()); return MDMIOSOperationUtil.createAppUninstallOperation(app); } else { String msg = "Invalid Action is found. Action: " + action; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ios/RemoveApplication.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ios/RemoveApplication.java index c723812d48e..d16fe30c1f1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ios/RemoveApplication.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/app/mgt/ios/RemoveApplication.java @@ -25,6 +25,7 @@ import java.io.Serializable; public class RemoveApplication implements Serializable { private String bundleId; + private String url; public String getBundleId() { return bundleId; @@ -34,6 +35,14 @@ public class RemoveApplication implements Serializable { this.bundleId = bundleId; } + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + public String toJSON() { Gson gson = new Gson(); return gson.toJson(this); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMIOSOperationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMIOSOperationUtil.java index 2df0edc7797..c11c1372195 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMIOSOperationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/util/MDMIOSOperationUtil.java @@ -96,9 +96,9 @@ public class MDMIOSOperationUtil { operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION); operation.setType(Operation.Type.PROFILE); - RemoveApplication removeApplication = - new RemoveApplication(); + RemoveApplication removeApplication = new RemoveApplication(); removeApplication.setBundleId(application.getIdentifier()); + removeApplication.setUrl(application.getLocation()); operation.setPayLoad(removeApplication.toJSON()); return operation;