From 1c3ce135d2d19068800bae523f08b9497a825693 Mon Sep 17 00:00:00 2001 From: Hamza Israr <71447999+HamzaIsrar12@users.noreply.github.com> Date: Mon, 28 Aug 2023 16:00:00 +0500 Subject: [PATCH] feat: Update Discover Course pages by removing course path (#1817) - Update the course detail template through changes made in the config repository. - Remove the relevant code associated with the course path. Fixes: LEARNER-9525 --- .../main/java/org/edx/mobile/util/UrlUtil.java | 6 ------ .../org/edx/mobile/util/links/WebViewLink.java | 1 - .../java/org/edx/mobile/test/WebViewLinkTest.java | 15 --------------- 3 files changed, 22 deletions(-) diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/util/UrlUtil.java b/OpenEdXMobile/src/main/java/org/edx/mobile/util/UrlUtil.java index b46d10a7ea..c95107b188 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/util/UrlUtil.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/util/UrlUtil.java @@ -5,7 +5,6 @@ import androidx.annotation.NonNull; import org.edx.mobile.logger.Logger; -import org.edx.mobile.util.links.WebViewLink; import java.net.URI; import java.net.URISyntaxException; @@ -64,11 +63,6 @@ public static Map getQueryParams(@NonNull Uri uri) { for (String name : paramNames) { String value = uri.getQueryParameter(name); if (value != null) { - if (name.equals(WebViewLink.Param.PATH_ID) && - value.startsWith(WebViewLink.PATH_ID_COURSE_PREFIX)) { - // Our config already has this prefix in the URI, so we need to get rid of it here in the param's value - value = value.substring(WebViewLink.PATH_ID_COURSE_PREFIX.length()).trim(); - } paramsMap.put(name, value); } } diff --git a/OpenEdXMobile/src/main/java/org/edx/mobile/util/links/WebViewLink.java b/OpenEdXMobile/src/main/java/org/edx/mobile/util/links/WebViewLink.java index fa648b367d..11a4ab45e7 100644 --- a/OpenEdXMobile/src/main/java/org/edx/mobile/util/links/WebViewLink.java +++ b/OpenEdXMobile/src/main/java/org/edx/mobile/util/links/WebViewLink.java @@ -14,7 +14,6 @@ */ public class WebViewLink { public static final String SCHEME = "edxapp"; - public static final String PATH_ID_COURSE_PREFIX = "course/"; public enum Authority { COURSE_INFO("course_info"), diff --git a/OpenEdXMobile/src/test/java/org/edx/mobile/test/WebViewLinkTest.java b/OpenEdXMobile/src/test/java/org/edx/mobile/test/WebViewLinkTest.java index 7b5139f00a..dcd753debc 100644 --- a/OpenEdXMobile/src/test/java/org/edx/mobile/test/WebViewLinkTest.java +++ b/OpenEdXMobile/src/test/java/org/edx/mobile/test/WebViewLinkTest.java @@ -28,21 +28,6 @@ public void testWebViewLinkCorrectlyParsesCourseIdWithEmailOptIn() { assertEquals(emailOptIn, Boolean.valueOf(link.params.get(WebViewLink.Param.EMAIL_OPT))); } - @Test - public void testWebViewLinkParsesCourseIdAndRemovesCoursePrefix() { - final String courseId = "cosmology-anux-anu-astro4x"; - final Uri uri = new Uri.Builder() - .scheme(WebViewLink.SCHEME) - .authority(WebViewLink.Authority.COURSE_INFO.getKey()) - .appendQueryParameter(WebViewLink.Param.PATH_ID, - WebViewLink.PATH_ID_COURSE_PREFIX + courseId) - .build(); - final WebViewLink link = WebViewLink.parse(uri.toString()); - assertNotNull(link); - assertNotNull(link.params); - assertEquals(courseId, link.params.get(WebViewLink.Param.PATH_ID)); - } - /** * Tests our workaround for edx.org failing to encode plus signs in the course_id parameter * See https://openedx.atlassian.net/browse/MA-1901