Hi,
I have created a Hybrid UI5 application using HAT, i am using UploadCollection control in one of the screen, the control works fine on a Browser (Desktop and Phone) but does not work when wrapped in Kapsel and Cordova. When i click on the 'Add' button it does nothing, no error on console.
Note: I have added the required Privacy Keys in my Info.plist
Is there something else i need to configure to open the Photo Library or the Camera from UploadCollection control?
this is my UploadCollection code
new sap.m.UploadCollection("UploadCollection", {
multiple: true,
uploadUrl: that.getView().getModel("mainServiceModel").sServiceUrl + "/AttachmentsSet",
numberOfAttachmentsText: "Attachments (0)",
terminationEnabled: false,
fileType: ["jpg", "txt", "ppt", "docx", "xls", "pdf", "png"],
mimeType: ["image/jpg", "image/jpeg", "application/pdf"],
noDataText: "No Data",
beforeUploadStarts: function(e) {
sap.ui.core.BusyIndicator.show(0);
// Header Slug
var oCustomerHeaderSlug = new sap.m.UploadCollectionParameter({
name: "slug",
value: workorderId + "/" + lineItem + "/" + e.getParameter("fileName") + "/Description"
});
if (sap.hybrid === null) {
var oCustomerHeaderHybrid = new sap.m.UploadCollectionParameter({
name: "X-SUP-APPCID",
value: sap.hybrid.SMP.AppContext.applicationConnectionId
});
e.getParameters().addHeaderParameter(oCustomerHeaderHybrid);
}
e.getParameters().addHeaderParameter(oCustomerHeaderSlug);
},
uploadComplete: function(e) {
sap.m.MessageToast.show("Upload Completed");
this.destroyItems();
this.bindAggregation("items", {
path: "mainServiceModel>/AttachmentsSet",
filters: [new sap.ui.model.Filter("ObjectId", sap.ui.model.FilterOperator.EQ, workorderId),
new sap.ui.model.Filter("Item", sap.ui.model.FilterOperator.EQ, lineItem)
],
template: new sap.m.UploadCollectionItem({
enableEdit: true,
enableDelete: true,
visibleEdit: true,
visibleDelete: true,
fileName: "{mainServiceModel>Filename}",
url: "{mainServiceModel>AbsoluteUrl}",
mimeType: "{mainServiceModel>ContentType}"
})
});
var aItems = sap.ui.getCore().byId("UploadCollection").getItems();
sap.ui.getCore().byId("UploadCollection").setNumberOfAttachmentsText("Attachments (" + aItems.length + ")");
sap.ui.core.BusyIndicator.hide();
this.focus();
},
change: function(e) {
var oUploadCollection = e.getSource();
// Header Token
var oCustomerHeaderToken = new sap.m.UploadCollectionParameter({
name: "x-csrf-token",
value: secToken
});
oUploadCollection.addHeaderParameter(oCustomerHeaderToken);
}
})
Add comment