diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java index 766698c9c7..f0c92c31f1 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/ApplicationOperationsImpl.java @@ -73,7 +73,8 @@ public class ApplicationOperationsImpl implements ApplicationOperations { getDevicesOfUser(userName); for (org.wso2.carbon.device.mgt.common.Device device : deviceList) { - if(applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ + if(MDMAppConstants.WEBAPP.equals(applicationOperationAction.getApp().getPlatform()) || + applicationOperationAction.getApp().getPlatform().equalsIgnoreCase(device.getType())){ deviceIdentifiers.add(getDeviceIdentifierByDevice(device)); } } @@ -176,8 +177,11 @@ public class ApplicationOperationsImpl implements ApplicationOperations { operation = IOSApplicationOperationUtil.createInstallAppOperation(mobileApp); } else { - operation = - IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + if (MDMAppConstants.WEBAPP.equals(app.getPlatform())) { + operation = IOSApplicationOperationUtil.createWebClipUninstallOperation(mobileApp); + } else { + operation = IOSApplicationOperationUtil.createAppUninstallOperation(mobileApp); + } } } activity = MDMServiceAPIUtils.getAppManagementService(applicationOperationAction.getTenantId()) diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java index 22c7963def..d5ae921705 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/beans/ios/RemoveApplication.java @@ -23,6 +23,15 @@ import java.io.Serializable; public class RemoveApplication implements Serializable { private String bundleId; + private String url; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } public String getBundleId() { return bundleId; diff --git a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java index 5b2dec4eb9..5e73a57759 100644 --- a/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java +++ b/components/extensions/org.wso2.carbon.appmgt.mdm.osgiconnector/src/main/java/org/wso2/carbon/appmgt/mdm/osgiconnector/mdmmgt/util/IOSApplicationOperationUtil.java @@ -111,4 +111,22 @@ public class IOSApplicationOperationUtil { return operation; } + /** + * Create uninstall operations for webclip. + * + * @param application + * @return Uninstall operation + * @throws DeviceApplicationException + */ + public static Operation createWebClipUninstallOperation(MobileApp application) throws + DeviceApplicationException { + ProfileOperation operation = new ProfileOperation(); + operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION); + operation.setType(Operation.Type.PROFILE); + RemoveApplication removeApplication = new RemoveApplication(); + removeApplication.setUrl(application.getIdentifier()); + operation.setPayLoad(removeApplication.toJSON()); + return operation; + } + }