From b7adb9d374b1a861c2561fe9de4bfd48539a8a81 Mon Sep 17 00:00:00 2001 From: Tamas Kozmer Date: Fri, 9 Dec 2022 11:50:12 +0100 Subject: [PATCH 1/3] Updated version --- apps/student/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/student/build.gradle b/apps/student/build.gradle index 92f0a2c62c..f00a8e1d9c 100644 --- a/apps/student/build.gradle +++ b/apps/student/build.gradle @@ -55,8 +55,8 @@ android { applicationId "com.instructure.candroid" minSdkVersion Versions.MIN_SDK targetSdkVersion Versions.TARGET_SDK - versionCode = 244 - versionName = '6.21.0' + versionCode = 245 + versionName = '6.21.1' vectorDrawables.useSupportLibrary = true multiDexEnabled = true From cda1148009287f1de51426567576323080dfd1db Mon Sep 17 00:00:00 2001 From: Tamas Kozmer Date: Fri, 9 Dec 2022 12:12:18 +0100 Subject: [PATCH 2/3] Fixed webview loading crashes. --- .../student/fragment/AssignmentBasicFragment.kt | 2 +- .../instructure/student/fragment/CalendarEventFragment.kt | 6 +++--- .../student/fragment/DiscussionDetailsFragment.kt | 8 +++++--- .../instructure/student/fragment/PageDetailsFragment.kt | 2 +- .../mobius/assignmentDetails/ui/AssignmentDetailsView.kt | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/student/src/main/java/com/instructure/student/fragment/AssignmentBasicFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/AssignmentBasicFragment.kt index b239a34472..a118ccc2ee 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/AssignmentBasicFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/AssignmentBasicFragment.kt @@ -137,7 +137,7 @@ class AssignmentBasicFragment : ParentFragment() { } loadHtmlJob = assignmentWebViewWrapper.webView.loadHtmlWithIframes(requireContext(), description, { - assignmentWebViewWrapper.loadHtml(it, assignment.name) + assignmentWebViewWrapper?.loadHtml(it, assignment.name) }, { LtiLaunchFragment.routeLtiLaunchFragment(requireContext(), canvasContext, it) }) diff --git a/apps/student/src/main/java/com/instructure/student/fragment/CalendarEventFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/CalendarEventFragment.kt index e1f6dde4c7..7f6c377103 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/CalendarEventFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/CalendarEventFragment.kt @@ -233,9 +233,9 @@ class CalendarEventFragment : ParentFragment() { } private fun loadCalendarHtml(html: String, contentDescription: String?) { - calendarEventWebViewWrapper.setVisible() - calendarEventWebViewWrapper.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.backgroundLightest)) - calendarEventWebViewWrapper.loadHtml(html, contentDescription, baseUrl = scheduleItem?.htmlUrl) + calendarEventWebViewWrapper?.setVisible() + calendarEventWebViewWrapper?.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.backgroundLightest)) + calendarEventWebViewWrapper?.loadHtml(html, contentDescription, baseUrl = scheduleItem?.htmlUrl) } private fun setUpCallback() { diff --git a/apps/student/src/main/java/com/instructure/student/fragment/DiscussionDetailsFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/DiscussionDetailsFragment.kt index 304d56a6da..f4a05def5d 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/DiscussionDetailsFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/DiscussionDetailsFragment.kt @@ -716,8 +716,10 @@ class DiscussionDetailsFragment : ParentFragment(), Bookmarkable { } private fun loadHTMLTopic(html: String, contentDescription: String?) { - setupHeaderWebView() - discussionTopicHeaderWebViewWrapper.loadHtml(html, contentDescription, baseUrl = discussionTopicHeader.htmlUrl) + if (discussionTopicHeaderWebViewWrapper != null) { + setupHeaderWebView() + discussionTopicHeaderWebViewWrapper.loadHtml(html, contentDescription, baseUrl = discussionTopicHeader.htmlUrl) + } } private fun loadDiscussionTopicViews(html: String) { @@ -725,7 +727,7 @@ class DiscussionDetailsFragment : ParentFragment(), Bookmarkable { discussionProgressBar.setGone() loadHeaderHtmlJob = discussionRepliesWebViewWrapper.webView.loadHtmlWithIframes(requireContext(), html, { - discussionRepliesWebViewWrapper.loadDataWithBaseUrl(CanvasWebView.getReferrer(true), html, "text/html", "UTF-8", null) + discussionRepliesWebViewWrapper?.loadDataWithBaseUrl(CanvasWebView.getReferrer(true), html, "text/html", "UTF-8", null) }) swipeRefreshLayout.isRefreshing = false diff --git a/apps/student/src/main/java/com/instructure/student/fragment/PageDetailsFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/PageDetailsFragment.kt index 901ba86d92..42879dd2e3 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/PageDetailsFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/PageDetailsFragment.kt @@ -204,7 +204,7 @@ class PageDetailsFragment : InternalWebviewFragment(), Bookmarkable { // Load the html with the helper function to handle iframe cases loadHtmlJob = canvasWebViewWrapper.webView.loadHtmlWithIframes(requireContext(), body, { - canvasWebViewWrapper.loadHtml(it, page.title, baseUrl = page.htmlUrl) + canvasWebViewWrapper?.loadHtml(it, page.title, baseUrl = page.htmlUrl) }) { LtiLaunchFragment.routeLtiLaunchFragment(requireContext(), canvasContext, it) } diff --git a/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/AssignmentDetailsView.kt b/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/AssignmentDetailsView.kt index 76a077997b..88abbe0d42 100644 --- a/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/AssignmentDetailsView.kt +++ b/apps/student/src/main/java/com/instructure/student/mobius/assignmentDetails/ui/AssignmentDetailsView.kt @@ -233,7 +233,7 @@ class AssignmentDetailsView( } private fun loadDescriptionHtml(html: String, contentDescription: String?, baseUrl: String?) { - descriptionWebViewWrapper.loadHtml(html, contentDescription, baseUrl = baseUrl) + descriptionWebViewWrapper?.loadHtml(html, contentDescription, baseUrl = baseUrl) } private fun renderQuizDetails(quizDescriptionViewState: QuizDescriptionViewState) { From 212d5a42e4000aa0345a3aa48050421ca92853ab Mon Sep 17 00:00:00 2001 From: Tamas Kozmer Date: Fri, 9 Dec 2022 12:57:47 +0100 Subject: [PATCH 3/3] Fixed filtering crasg and stubbed flaky test. --- .../ui/renderTests/TextSubmissionViewRenderTest.kt | 2 ++ .../student/fragment/AssignmentListFragment.kt | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/renderTests/TextSubmissionViewRenderTest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/renderTests/TextSubmissionViewRenderTest.kt index 26c24050bd..c7b7aeb336 100644 --- a/apps/student/src/androidTest/java/com/instructure/student/ui/renderTests/TextSubmissionViewRenderTest.kt +++ b/apps/student/src/androidTest/java/com/instructure/student/ui/renderTests/TextSubmissionViewRenderTest.kt @@ -16,6 +16,7 @@ package com.instructure.student.ui.renderTests import android.os.Build +import com.instructure.canvas.espresso.Stub import com.instructure.student.espresso.StudentRenderTest import com.instructure.student.mobius.assignmentDetails.submissionDetails.content.TextSubmissionViewFragment import com.instructure.student.ui.pages.renderPages.TextSubmissionViewRenderPage @@ -27,6 +28,7 @@ class TextSubmissionViewRenderTest : StudentRenderTest() { private val page = TextSubmissionViewRenderPage() + @Stub @Test fun displaysProgressBarPriorToLoading() { loadPageWithHtml("Sample Text") diff --git a/apps/student/src/main/java/com/instructure/student/fragment/AssignmentListFragment.kt b/apps/student/src/main/java/com/instructure/student/fragment/AssignmentListFragment.kt index a3e210bc27..1ea10ea0f8 100644 --- a/apps/student/src/main/java/com/instructure/student/fragment/AssignmentListFragment.kt +++ b/apps/student/src/main/java/com/instructure/student/fragment/AssignmentListFragment.kt @@ -215,10 +215,12 @@ class AssignmentListFragment : ParentFragment(), Bookmarkable { backgroundColor = requireContext().getColor(R.color.backgroundInfo) } } - if (filterPosition == 0) { - BadgeUtils.detachBadgeDrawable(badgeDrawable, toolbar, R.id.menu_filter_assignments) - } else { - BadgeUtils.attachBadgeDrawable(badgeDrawable!!, toolbar, R.id.menu_filter_assignments) + toolbar?.let { + if (filterPosition == 0) { + BadgeUtils.detachBadgeDrawable(badgeDrawable, it, R.id.menu_filter_assignments) + } else { + BadgeUtils.attachBadgeDrawable(badgeDrawable!!, it, R.id.menu_filter_assignments) + } } }, 100) }