From d2f8b6e16036c8b65a42c73785b12576bc82d2d6 Mon Sep 17 00:00:00 2001 From: Saad Sahibjan Date: Tue, 5 Nov 2019 11:12:35 +0530 Subject: [PATCH] Fix web clips installation not working for iOS --- .../application/mgt/core/impl/SubscriptionManagerImpl.java | 4 ++++ .../org/wso2/carbon/device/mgt/common/MDMAppConstants.java | 1 + .../wso2/carbon/device/mgt/core/util/MDMIOSOperationUtil.java | 4 ++-- 3 files changed, 7 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 6e0388c843..3d71aece32 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 @@ -973,10 +973,14 @@ public class SubscriptionManagerImpl implements SubscriptionManager { .getUuid(); app.setType(mobileAppType); app.setLocation(plistDownloadEndpoint); + app.setIconImage(application.getApplicationReleases().get(0).getIconPath()); Properties properties = new Properties(); properties.put(MDMAppConstants.IOSConstants.IS_PREVENT_BACKUP, true); properties.put(MDMAppConstants.IOSConstants.IS_REMOVE_APP, true); properties.put(MDMAppConstants.IOSConstants.I_TUNES_ID, application.getPackageName()); + properties.put(MDMAppConstants.IOSConstants.LABEL, application.getName()); + properties.put(MDMAppConstants.IOSConstants.WEB_CLIP_URL, + application.getApplicationReleases().get(0).getInstallerPath()); app.setProperties(properties); return MDMIOSOperationUtil.createInstallAppOperation(app); } else if (SubAction.UNINSTALL.toString().equalsIgnoreCase(action)) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/MDMAppConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/MDMAppConstants.java index dbb4a97e33..214ed8025a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/MDMAppConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/MDMAppConstants.java @@ -33,6 +33,7 @@ public class MDMAppConstants { public static final String I_TUNES_ID = "iTunesId"; public static final String LABEL = "label"; public static final String PLIST = "plist"; + public static final String WEB_CLIP_URL = "webClipURL"; public static final String OPCODE_INSTALL_ENTERPRISE_APPLICATION = "INSTALL_ENTERPRISE_APPLICATION"; public static final String OPCODE_INSTALL_STORE_APPLICATION = "INSTALL_STORE_APPLICATION"; public static final String OPCODE_INSTALL_WEB_APPLICATION = "WEB_CLIP"; 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 13538ccea8..2df0edc779 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 @@ -73,14 +73,14 @@ public class MDMIOSOperationUtil { operation.setType(Operation.Type.COMMAND); operation.setPayLoad(appStoreApplication.toJSON()); break; - case WEBAPP: + case WEB_CLIP: WebClip webClip = new WebClip(); webClip.setIcon(application.getIconImage()); webClip.setIsRemovable(application.getProperties(). getProperty(MDMAppConstants.IOSConstants.IS_REMOVE_APP)); webClip.setLabel(application.getProperties(). getProperty(MDMAppConstants.IOSConstants.LABEL)); - webClip.setURL(application.getLocation()); + webClip.setURL(application.getProperties().getProperty(MDMAppConstants.IOSConstants.WEB_CLIP_URL)); operation.setCode(MDMAppConstants.IOSConstants.OPCODE_INSTALL_WEB_APPLICATION); operation.setType(Operation.Type.PROFILE);