From 84644004a50bc8b0715039491ac8c25dadf97ec5 Mon Sep 17 00:00:00 2001 From: James Sullivan Date: Tue, 8 Jun 2021 18:42:51 +0200 Subject: [PATCH 1/3] enable component for use in communities --- .../default/classes/VideoViewerController.cls | 10 +- .../main/default/lwc/videoViewer/utils.js | 6 +- .../lwc/videoViewer/videoViewer.js-meta.xml | 323 ++++++++++++------ 3 files changed, 223 insertions(+), 116 deletions(-) mode change 100755 => 100644 force-app/main/default/classes/VideoViewerController.cls mode change 100755 => 100644 force-app/main/default/lwc/videoViewer/videoViewer.js-meta.xml diff --git a/force-app/main/default/classes/VideoViewerController.cls b/force-app/main/default/classes/VideoViewerController.cls old mode 100755 new mode 100644 index 9659dc7..ef5d78d --- a/force-app/main/default/classes/VideoViewerController.cls +++ b/force-app/main/default/classes/VideoViewerController.cls @@ -33,6 +33,12 @@ public with sharing class VideoViewerController { @AuraEnabled(cacheable=true) public static String getBaseUrl() { - return System.URL.getOrgDomainUrl().toExternalForm(); + if(Network.getNetworkId() == null){ + String baseURL = System.URL.getSalesforceBaseUrl().toExternalForm(); + baseURL = baseURL.split('\\.')[0]; + return baseURL+'--c'+'.documentforce.com'; + }else{ + return System.URL.getSalesforceBaseUrl().toExternalForm(); + } } -} +} \ No newline at end of file diff --git a/force-app/main/default/lwc/videoViewer/utils.js b/force-app/main/default/lwc/videoViewer/utils.js index 1459e7f..e8294b2 100644 --- a/force-app/main/default/lwc/videoViewer/utils.js +++ b/force-app/main/default/lwc/videoViewer/utils.js @@ -8,15 +8,13 @@ /** * Util methods */ -const CUSTOM_PART = "--c"; const DOWNLOAD_PART = - ".documentforce.com/sfc/servlet.shepherd/document/download/"; + "/sfc/servlet.shepherd/document/download/"; // Returns either an empty string or the org's base video download url export function getBaseVideoUrl(baseUrl) { if (baseUrl) { - const domain = baseUrl.split(".")[0]; - return `${domain}${CUSTOM_PART}${DOWNLOAD_PART}`; + return `${baseUrl}${DOWNLOAD_PART}`; } return ""; } diff --git a/force-app/main/default/lwc/videoViewer/videoViewer.js-meta.xml b/force-app/main/default/lwc/videoViewer/videoViewer.js-meta.xml old mode 100755 new mode 100644 index fbed0b2..90437d9 --- a/force-app/main/default/lwc/videoViewer/videoViewer.js-meta.xml +++ b/force-app/main/default/lwc/videoViewer/videoViewer.js-meta.xml @@ -1,110 +1,213 @@ - - - 48.0 - Video Viewer - View videos attached to record detail pages, chatter or file detail pages. - true - - lightning__RecordPage - - - - - - - - - - - - - - - - - - - - - - - + + + 52.0 + Video Viewer + View videos attached to record detail pages, chatter or file detail pages. + true + + lightning__RecordPage + lightningCommunity__Page + lightningCommunity__Default + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d82acf160136851a6220c559b00e30e52d0ebe49 Mon Sep 17 00:00:00 2001 From: James Sullivan Date: Tue, 13 Jul 2021 17:02:43 +0200 Subject: [PATCH 2/3] add option to component to show or hide the no-videos error --- .../default/lwc/videoViewer/videoViewer.html | 160 ++++--- .../default/lwc/videoViewer/videoViewer.js | 4 + .../lwc/videoViewer/videoViewer.js-meta.xml | 441 +++++++++--------- 3 files changed, 315 insertions(+), 290 deletions(-) mode change 100755 => 100644 force-app/main/default/lwc/videoViewer/videoViewer.html mode change 100755 => 100644 force-app/main/default/lwc/videoViewer/videoViewer.js diff --git a/force-app/main/default/lwc/videoViewer/videoViewer.html b/force-app/main/default/lwc/videoViewer/videoViewer.html old mode 100755 new mode 100644 index 2d207ef..6e6468f --- a/force-app/main/default/lwc/videoViewer/videoViewer.html +++ b/force-app/main/default/lwc/videoViewer/videoViewer.html @@ -1,88 +1,94 @@