diff --git a/apps/build.gradle b/apps/build.gradle
index a0b3f6aaa..e74b6b143 100644
--- a/apps/build.gradle
+++ b/apps/build.gradle
@@ -45,13 +45,6 @@ allprojects {
}
mavenCentral()
maven { url 'https://jitpack.io' }
- maven {
- credentials {
- username pspdfMavenUser
- password pspdfMavenPass
- }
- url 'https://customers.pspdfkit.com/maven/'
- }
maven { url "https://maven.google.com/" }
}
}
diff --git a/apps/buildSrc/src/main/java/GlobalDependencies.kt b/apps/buildSrc/src/main/java/GlobalDependencies.kt
index ad676509b..25aa35d53 100644
--- a/apps/buildSrc/src/main/java/GlobalDependencies.kt
+++ b/apps/buildSrc/src/main/java/GlobalDependencies.kt
@@ -24,7 +24,6 @@ object Versions {
/* Others */
const val APOLLO = "4.1.1"
- const val PSPDFKIT = "2024.8.0"
const val PHOTO_VIEW = "2.3.0"
const val MOBIUS = "1.2.1"
const val HILT = "2.52"
@@ -127,7 +126,6 @@ object Libs {
const val COMPOSE_VIEW_MODEL = "androidx.lifecycle:lifecycle-viewmodel-compose:${Versions.LIFECYCLE}"
/* Media and content handling */
- const val PSPDFKIT = "com.pspdfkit:pspdfkit:${Versions.PSPDFKIT}"
const val EXOPLAYER = "com.google.android.exoplayer:exoplayer:2.18.5" // This is deprecated, we should migrate to https://developer.android.com/guide/topics/media/media3/getting-started/migration-guide
const val MEDIA3 = "androidx.media3:media3-exoplayer:${Versions.MEDIA3}"
const val MEDIA3_UI = "androidx.media3:media3-ui:${Versions.MEDIA3}"
diff --git a/apps/parent/proguard-rules.txt b/apps/parent/proguard-rules.txt
index bde42b751..7e5a37dfe 100644
--- a/apps/parent/proguard-rules.txt
+++ b/apps/parent/proguard-rules.txt
@@ -187,16 +187,6 @@
-dontwarn okhttp3.**
-keep class okhttp3.** { *; }
-# PSPDFKit
--keep class com.pspdfkit.** { *; }
--dontwarn com.pspdfkit.**
--dontwarn sun.misc.**
--dontwarn android.view.WindowInsets
--dontwarn android.graphics.Insets
--dontwarn edu.umd.cs.findbugs.annotations.SuppressWarnings
--keepnames class io.reactivex.android.schedulers.AndroidSchedulers
--keepnames class io.reactivex.Observable
-
# RxJava
-keep class rx.internal.util.unsafe.** { *; }
diff --git a/apps/parent/src/main/java/com/instructure/parentapp/util/AppManager.kt b/apps/parent/src/main/java/com/instructure/parentapp/util/AppManager.kt
index 0efb1d333..bbb9fb82a 100644
--- a/apps/parent/src/main/java/com/instructure/parentapp/util/AppManager.kt
+++ b/apps/parent/src/main/java/com/instructure/parentapp/util/AppManager.kt
@@ -59,6 +59,6 @@ class AppManager : BaseAppManager() {
private fun initPendo() {
val options = Pendo.PendoOptions.Builder().setJetpackComposeBeta(true).build()
- Pendo.setup(this, BuildConfig.PENDO_TOKEN, options, null)
+// Pendo.setup(this, BuildConfig.PENDO_TOKEN, options, null)
}
}
\ No newline at end of file
diff --git a/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/PdfInteractionTest.kt b/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/PdfInteractionTest.kt
index 4c8d933d2..72d47e1de 100644
--- a/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/PdfInteractionTest.kt
+++ b/apps/student/src/androidTest/java/com/instructure/student/ui/interaction/PdfInteractionTest.kt
@@ -127,55 +127,6 @@ class PdfInteractionTest : StudentComposeTest() {
fileListPage.assertPdfPreviewDisplayed()
}
- @Test
- @TestMetaData(Priority.IMPORTANT, FeatureCategory.ASSIGNMENTS, TestCategory.INTERACTION, SecondaryFeatureCategory.SUBMISSIONS_ANNOTATIONS)
- fun testAnnotations_openPdfsInPSPDFKitFromLinksInAssignment() {
- // Annotation toolbar icon needs to be present, this link is specific to assignment details, as that was the advertised use case
- val data = MockCanvas.init(
- studentCount = 1,
- courseCount = 1
- )
-
- val course = data.courses.values.first()
- val student = data.students[0]
- val token = data.tokenFor(student)!!
- data.addAssignmentsToGroups(course)
- tokenLogin(data.domain, token, student)
- routeTo("courses/${course.id}/assignments", data.domain)
-
- val fileId = data.newItemId()
- val url = """https://mock-data.instructure.com/courses/${course.id}/files/${fileId}/download?"""
-
- data.addFileToCourse(
- courseId = course.id,
- displayName = pdfFileName,
- contentType = "application/pdf",
- fileId = fileId,
- url = url
- )
-
- val uniqueFileName = OpenMediaAsyncTaskLoader.makeFilenameUnique(pdfFileName, url, fileId.toString())
-
- cacheFile(student.id.toString(), uniqueFileName)
-
- val pdfUrlElementId = "testLinkElement"
- val assignmentDescriptionHtml = """pdf baby!!!"""
-
- val assignment = data.addAssignment(courseId = course.id, submissionTypeList = listOf(Assignment.SubmissionType.ONLINE_UPLOAD), description = assignmentDescriptionHtml)
-
- assignmentListPage.refreshAssignmentList()
- assignmentListPage.clickAssignment(assignment)
- assignmentDetailsPage.assertAssignmentDetails(assignment)
-
- // Scroll to the description, as it will likely be offscreen for landscape tests
- assignmentDetailsPage.scrollToAssignmentDescription()
-
- // Click the url in the description to load the pdf
- Web.onWebView(withId(R.id.contentWebView))
- .withElement(DriverAtoms.findElement(Locator.ID, pdfUrlElementId))
- .perform(DriverAtoms.webClick())
- fileListPage.assertPdfPreviewDisplayed()
- }
private fun getToCourse(): MockCanvas {
val data = MockCanvas.init(
diff --git a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListFragment.kt b/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListFragment.kt
deleted file mode 100644
index 591773fb5..000000000
--- a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListFragment.kt
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright (C) 2018 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */ package com.instructure.student.AnnotationComments
-
-import android.os.Bundle
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.app.AppCompatDialog
-import androidx.core.content.ContextCompat
-import androidx.recyclerview.widget.DefaultItemAnimator
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import com.instructure.annotations.AnnotationDialogs.AnnotationCommentDialog
-import com.instructure.annotations.createCommentReplyAnnotation
-import com.instructure.annotations.generateAnnotationId
-import com.instructure.canvasapi2.managers.CanvaDocsManager
-import com.instructure.canvasapi2.models.ApiValues
-import com.instructure.canvasapi2.models.DocSession
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.canvasapi2.utils.ApiPrefs
-import com.instructure.canvasapi2.utils.weave.awaitApi
-import com.instructure.canvasapi2.utils.weave.catch
-import com.instructure.canvasapi2.utils.weave.tryWeave
-import com.instructure.canvasapi2.utils.weave.weave
-import com.instructure.interactions.router.Route
-import com.instructure.pandautils.analytics.SCREEN_VIEW_ANNOTATION_COMMENT_LIST
-import com.instructure.pandautils.analytics.ScreenView
-import com.instructure.pandautils.binding.viewBinding
-import com.instructure.pandautils.utils.*
-import com.instructure.student.R
-import com.instructure.student.databinding.FragmentAnnotationCommentListBinding
-import com.instructure.student.fragment.ParentFragment
-import com.instructure.student.mobius.assignmentDetails.submissionDetails.content.PdfStudentSubmissionView
-import kotlinx.coroutines.Job
-import okhttp3.ResponseBody
-import org.greenrobot.eventbus.EventBus
-import java.util.*
-
-@ScreenView(SCREEN_VIEW_ANNOTATION_COMMENT_LIST)
-class AnnotationCommentListFragment : ParentFragment() {
-
- private val binding by viewBinding(FragmentAnnotationCommentListBinding::bind)
-
- private var annotations by ParcelableArrayListArg()
- private var assigneeId by LongArg()
- private var docSession by ParcelableArg()
- private var apiValues by ParcelableArg()
- private var headAnnotationId by StringArg()
- private var canComment by BooleanArg(true, CAN_COMMENT)
-
- private var recyclerAdapter: AnnotationCommentListRecyclerAdapter? = null
-
- private var sendCommentJob: Job? = null
- private var editCommentJob: Job? = null
- private var deleteCommentJob: Job? = null
-
- override fun title() = getString(R.string.comments)
-
- override fun applyTheme() {
- with (binding) {
- toolbar.title = title()
- toolbar.setupAsCloseButton(this@AnnotationCommentListFragment)
- ViewStyler.themeToolbarLight(requireActivity(), toolbar)
- }
- }
-
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? =
- layoutInflater.inflate(R.layout.fragment_annotation_comment_list, container, false)
-
- override fun onActivityCreated(savedInstanceState: Bundle?) {
- super.onActivityCreated(savedInstanceState)
- recyclerAdapter = AnnotationCommentListRecyclerAdapter(requireContext(), docSession, { annotation, position ->
- AnnotationCommentDialog.getInstance(requireFragmentManager(), annotation.contents ?: "", requireContext().getString(R.string.editComment)) { cancelled, text ->
- if(!cancelled) {
- annotation.contents = text
- editComment(annotation, position)
- }
- }.show(requireFragmentManager(), AnnotationCommentDialog::class.java.simpleName)
- }, { annotation, position ->
- val builder = AlertDialog.Builder(requireContext())
- //we want to show a different title for the root comment
- builder.setTitle(R.string.deleteComment)
- builder.setMessage(if(position == 0) R.string.deleteHeadCommentConfirmation else R.string.deleteCommentConfirmation)
- builder.setPositiveButton(getString(R.string.delete).uppercase(Locale.getDefault())) { _, _ ->
- deleteComment(annotation, position)
- }
- builder.setNegativeButton(getString(R.string.cancel).uppercase(Locale.getDefault()), null)
- val dialog = builder.create()
- dialog.setOnShowListener {
- dialog.getButton(AppCompatDialog.BUTTON_POSITIVE).setTextColor(ThemePrefs.textButtonColor)
- dialog.getButton(AppCompatDialog.BUTTON_NEGATIVE).setTextColor(ThemePrefs.textButtonColor)
- }
- dialog.show()
- })
-
- configureRecyclerView()
- applyTheme()
- setupCommentInput()
-
- if(recyclerAdapter?.size() == 0) {
- recyclerAdapter?.addAll(annotations)
- }
- }
-
- override fun onDestroyView() {
- super.onDestroyView()
- sendCommentJob?.cancel()
- editCommentJob?.cancel()
- deleteCommentJob?.cancel()
- }
-
- fun configureRecyclerView() {
- val layoutManager = LinearLayoutManager(requireContext())
- layoutManager.orientation = RecyclerView.VERTICAL
- binding.annotationCommentsRecyclerView.apply {
- this.layoutManager = layoutManager
- itemAnimator = DefaultItemAnimator()
- adapter = recyclerAdapter
- }
- }
-
- private fun setupCommentInput() = with(binding) {
- // We want users with read permission to still be able to create and respond to comments.
- if(docSession.annotationMetadata?.canRead() == false || !canComment) {
- commentInputContainer.setVisible(false)
- } else {
- sendCommentButton.imageTintList = ViewStyler.generateColorStateList(
- intArrayOf(-android.R.attr.state_enabled) to ContextCompat.getColor(requireContext(), R.color.textDark),
- intArrayOf() to ThemePrefs.textButtonColor
- )
-
- sendCommentButton.isEnabled = false
- commentEditText.onTextChanged { sendCommentButton.isEnabled = it.isNotBlank() }
- sendCommentButton.onClickWithRequireNetwork {
- sendComment(commentEditText.text.toString())
- }
- }
- }
-
- private fun showSendingStatus() = with(binding) {
- sendCommentButton.setInvisible()
- sendingProgressBar.setVisible()
- sendingProgressBar.announceForAccessibility(getString(R.string.sendingSimple))
- sendingErrorTextView.setGone()
- commentEditText.isEnabled = false
- }
-
- private fun hideSendingStatus(success: Boolean) = with(binding) {
- sendingProgressBar.setGone()
- sendCommentButton.setVisible()
- commentEditText.isEnabled = true
- if (success) {
- commentEditText.setText("")
- commentEditText.hideKeyboard()
- } else {
- sendingErrorTextView.setVisible()
- }
- }
-
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- private fun sendComment(comment: String) {
- sendCommentJob = weave {
- try {
- showSendingStatus()
- //first we need to find the root comment
- val rootComment = annotations.firstOrNull()
- if (rootComment != null) {
- val newCommentReply = awaitApi { CanvaDocsManager.putAnnotation(apiValues.sessionId, generateAnnotationId(), createCommentReplyAnnotation(comment, headAnnotationId, apiValues.documentId, ApiPrefs.user?.id.toString(), rootComment.page), apiValues.canvaDocsDomain, it) }
- // The put request doesn't return this property, so we need to set it to true
- newCommentReply.isEditable = true
- recyclerAdapter?.add(newCommentReply) //ALSO, add it to the UI
- hideSendingStatus(true)
- } else {
- hideSendingStatus(false)
- }
- } catch (e: Throwable) {
- hideSendingStatus(false)
- }
- }
- }
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- private fun editComment(annotation: CanvaDocAnnotation, position: Int) {
- editCommentJob = tryWeave {
- awaitApi { CanvaDocsManager.putAnnotation(apiValues.sessionId, annotation.annotationId, annotation, apiValues.canvaDocsDomain, it) }
- // Update the UI
- recyclerAdapter?.add(annotation)
- recyclerAdapter?.notifyItemChanged(position)
- } catch {
- hideSendingStatus(false)
- }
- }
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- private fun deleteComment(annotation: CanvaDocAnnotation, position: Int) {
- deleteCommentJob = tryWeave {
- awaitApi { CanvaDocsManager.deleteAnnotation(apiValues.sessionId, annotation.annotationId, apiValues.canvaDocsDomain, it) }
- if(annotation.annotationId == annotations.firstOrNull()?.annotationId) {
- //this is the root comment, deleting this deletes the entire thread
- headAnnotationDeleted()
- } else {
- recyclerAdapter?.remove(annotation)
- recyclerAdapter?.notifyItemChanged(position)
- }
- } catch {
- hideSendingStatus(false)
- }
- }
-
- private fun headAnnotationDeleted() {
- activity?.onBackPressed()
- }
-
- companion object {
- private const val ANNOTATIONS = "annotations"
- private const val ASSIGNEE_ID = "assigneeId"
- private const val DOC_SESSION = "docSession"
- private const val API_VALUES = "apiValues"
- private const val HEAD_ANNOTATION_ID = "headAnnotationId"
- private const val CAN_COMMENT = "canComment"
-
- fun newInstance(bundle: Bundle) = AnnotationCommentListFragment().apply { arguments = bundle }
-
- fun makeRoute(annotations: ArrayList, headAnnotationId: String, docSession: DocSession, apiValues: ApiValues, assigneeId: Long, canComment: Boolean): Route {
- val args = makeBundle(annotations, headAnnotationId, docSession, apiValues, assigneeId, canComment)
-
- return Route(null, AnnotationCommentListFragment::class.java, null, args)
- }
-
- fun validRoute(route: Route): Boolean {
- return route.arguments.containsKey(ANNOTATIONS)
- && route.arguments.containsKey(HEAD_ANNOTATION_ID)
- && route.arguments.containsKey(DOC_SESSION)
- && route.arguments.containsKey(API_VALUES)
- && route.arguments.containsKey(ASSIGNEE_ID)
- }
-
- fun newInstance(route: Route): AnnotationCommentListFragment? {
- if (!validRoute(route)) return null
- return AnnotationCommentListFragment().withArgs(route.arguments)
- }
-
- fun makeBundle(annotations: ArrayList, headAnnotationId: String, docSession: DocSession, apiValues: ApiValues, assigneeId: Long, canComment: Boolean): Bundle {
- val args = Bundle()
- args.putParcelableArrayList(ANNOTATIONS, annotations)
- args.putLong(ASSIGNEE_ID, assigneeId)
- args.putParcelable(DOC_SESSION, docSession)
- args.putParcelable(API_VALUES, apiValues)
- args.putString(HEAD_ANNOTATION_ID, headAnnotationId)
- args.putBoolean(CAN_COMMENT, canComment)
- return args
- }
- }
-}
diff --git a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListRecyclerAdapter.kt b/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListRecyclerAdapter.kt
deleted file mode 100644
index fae9684f7..000000000
--- a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentListRecyclerAdapter.kt
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2018 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.student.AnnotationComments
-
-import android.content.Context
-import android.view.View
-import com.instructure.canvasapi2.models.DocSession
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.student.adapter.BaseListRecyclerAdapter
-
-class AnnotationCommentListRecyclerAdapter(
- context: Context,
- private val docSession: DocSession,
- private val editCallback: (CanvaDocAnnotation, Int) -> Unit,
- private val deleteCallback: (CanvaDocAnnotation, Int) -> Unit
-) : BaseListRecyclerAdapter(context, CanvaDocAnnotation::class.java) {
-
- init {
- itemCallback = object : ItemComparableCallback() {
- override fun compare(item1: CanvaDocAnnotation, item2: CanvaDocAnnotation): Int {
- val createdAt1 = item1.createdAt
- val createdAt2 = item2.createdAt
-
- return if(createdAt1 != null && createdAt2 != null) {
- createdAt1.compareTo(createdAt2)
- } else if(createdAt1 != null && createdAt2 == null) {
- 1
- } else {
- -1
- }
- }
- }
- }
-
- override fun createViewHolder(v: View, viewType: Int) = AnnotationCommentViewHolder(v)
- override fun itemLayoutResId(viewType: Int) = AnnotationCommentViewHolder.holderRes
- override fun bindHolder(model: CanvaDocAnnotation, holder: AnnotationCommentViewHolder, position: Int) {
- val canDelete = docSession.annotationMetadata?.canManage() ?: false
- || (docSession.annotationMetadata?.canWrite() == true && model.userId == docSession.annotationMetadata?.userId)
- val canEdit = (docSession.annotationMetadata?.canWrite() == true
- && model.userId == docSession.annotationMetadata?.userId)
- holder.bind(model, canEdit, canDelete, editCallback, deleteCallback)
- }
-}
diff --git a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentViewHolder.kt b/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentViewHolder.kt
deleted file mode 100644
index 03aca5ef8..000000000
--- a/apps/student/src/main/java/com/instructure/student/AnnotationComments/AnnotationCommentViewHolder.kt
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2018 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.student.AnnotationComments
-
-import android.view.Gravity
-import android.view.View
-import androidx.appcompat.widget.PopupMenu
-import androidx.recyclerview.widget.RecyclerView
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.canvasapi2.utils.DateHelper
-import com.instructure.pandautils.utils.onClick
-import com.instructure.pandautils.utils.setGone
-import com.instructure.pandautils.utils.setVisible
-import com.instructure.student.R
-import com.instructure.student.databinding.ViewholderAnnotationCommentBinding
-
-class AnnotationCommentViewHolder(view: View) : RecyclerView.ViewHolder(view) {
- companion object {
- const val holderRes = R.layout.viewholder_annotation_comment
- }
-
- fun bind(annotation: CanvaDocAnnotation, canEdit: Boolean, canDelete: Boolean, editCallback: (CanvaDocAnnotation, Int) -> Unit, deleteCallback: (CanvaDocAnnotation, Int) -> Unit) = with(ViewholderAnnotationCommentBinding.bind(itemView)) {
- commentAuthorTextView.text = annotation.userName
- commentDateTextView.text = DateHelper.getMonthDayAtTime(root.context, DateHelper.stringToDateWithMillis(annotation.createdAt), root.context.getString(R.string.at))
- commentContentsTextView.text = annotation.contents
-
- commentEditIcon.setVisible((canEdit || canDelete) && !annotation.deleted)
-
- if(annotation.deleted) {
- commentRemovedLabel.setVisible()
- val date = DateHelper.getMonthDayAtTime(root.context, DateHelper.stringToDateWithMillis(annotation.deletedAt), root.context.getString(R.string.at))
- commentRemovedLabel.text = root.resources.getString(R.string.removedComment, date, annotation.deletedBy)
- } else {
- commentRemovedLabel.setGone()
- }
-
- commentEditIcon.onClick {
- val popup = PopupMenu(root.context, it, Gravity.TOP, 0,
- R.style.Base_Widget_AppCompat_PopupMenu_Overflow)
- popup.inflate(R.menu.menu_edit_annotation_comment)
- if(!canEdit) popup.menu.removeItem(R.id.edit)
- if(!canDelete) popup.menu.removeItem(R.id.delete)
- popup.setOnMenuItemClickListener {
- when(it.itemId) {
- R.id.edit -> {
- editCallback(annotation, adapterPosition)
- }
- R.id.delete -> { deleteCallback(annotation, adapterPosition) }
- }
- true
- }
- popup.show()
- }
- }
-}
diff --git a/apps/student/src/main/java/com/instructure/student/router/RouteResolver.kt b/apps/student/src/main/java/com/instructure/student/router/RouteResolver.kt
index 0052ea522..ccfc547bd 100644
--- a/apps/student/src/main/java/com/instructure/student/router/RouteResolver.kt
+++ b/apps/student/src/main/java/com/instructure/student/router/RouteResolver.kt
@@ -27,7 +27,6 @@ import com.instructure.pandautils.features.settings.inboxsignature.InboxSignatur
import com.instructure.pandautils.features.smartsearch.SmartSearchFragment
import com.instructure.pandautils.fragments.RemoteConfigParamsFragment
import com.instructure.pandautils.utils.Const
-import com.instructure.student.AnnotationComments.AnnotationCommentListFragment
import com.instructure.student.activity.NothingToSeeHereFragment
import com.instructure.student.features.coursebrowser.CourseBrowserFragment
import com.instructure.student.features.discussion.details.DiscussionDetailsFragment
@@ -168,7 +167,6 @@ object RouteResolver {
cls.isA() -> UrlSubmissionUploadFragment.newInstance(route)
cls.isA() -> PickerSubmissionUploadFragment.newInstance(route)
cls.isA() -> UploadStatusSubmissionFragment.newInstance(route)
- cls.isA() -> AnnotationCommentListFragment.newInstance(route)
cls.isA() -> NothingToSeeHereFragment.newInstance()
cls.isA() -> AnnotationSubmissionUploadFragment.newInstance(route)
cls.isA() -> PushNotificationPreferencesFragment.newInstance()
diff --git a/apps/teacher/build.gradle b/apps/teacher/build.gradle
index 39fdece2c..6f39146fc 100644
--- a/apps/teacher/build.gradle
+++ b/apps/teacher/build.gradle
@@ -58,7 +58,6 @@ android {
/* Add private data */
PrivateData.merge(project, "teacher")
- buildConfigField "String", "PSPDFKIT_LICENSE_KEY", "\"$pspdfkitLicenseKey\""
}
bundle {
diff --git a/apps/teacher/proguard-rules.txt b/apps/teacher/proguard-rules.txt
index 0157f1151..0d8b350e7 100644
--- a/apps/teacher/proguard-rules.txt
+++ b/apps/teacher/proguard-rules.txt
@@ -191,16 +191,6 @@
-dontwarn okhttp3.**
-keep class okhttp3.** { *; }
-# PSPDFKit
--keep class com.pspdfkit.** { *; }
--dontwarn com.pspdfkit.**
--dontwarn sun.misc.**
--dontwarn android.view.WindowInsets
--dontwarn android.graphics.Insets
--dontwarn edu.umd.cs.findbugs.annotations.SuppressWarnings
--keepnames class io.reactivex.android.schedulers.AndroidSchedulers
--keepnames class io.reactivex.Observable
-
# RxJava
-keep class rx.internal.util.unsafe.** { *; }
diff --git a/apps/teacher/src/main/AndroidManifest.xml b/apps/teacher/src/main/AndroidManifest.xml
index b947410ae..55ab3ed2a 100644
--- a/apps/teacher/src/main/AndroidManifest.xml
+++ b/apps/teacher/src/main/AndroidManifest.xml
@@ -194,13 +194,6 @@
android:name=".activities.InternalWebViewActivity"
android:theme="@style/AppTheme.NoActionBar" />
-
-
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListAdapter.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListAdapter.kt
deleted file mode 100644
index 93df1bea4..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListAdapter.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import android.content.Context
-import android.view.LayoutInflater
-import android.view.ViewGroup
-import androidx.viewbinding.ViewBinding
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.teacher.databinding.AdapterAnnotationCommentBinding
-import com.instructure.pandautils.blueprint.ListRecyclerAdapter
-
-class AnnotationCommentListAdapter(
- context: Context,
- presenter: AnnotationCommentListPresenter,
- private val editCallback: (CanvaDocAnnotation, Int) -> Unit,
- private val deleteCallback: (CanvaDocAnnotation, Int) -> Unit
-) : ListRecyclerAdapter(context, presenter) {
-
- override fun createViewHolder(binding: ViewBinding, viewType: Int) = AnnotationCommentViewHolder(binding as AdapterAnnotationCommentBinding)
-
- override fun bindingInflater(viewType: Int): (LayoutInflater, ViewGroup, Boolean) -> ViewBinding = AdapterAnnotationCommentBinding::inflate
-
- override fun bindHolder(model: CanvaDocAnnotation, holder: AnnotationCommentViewHolder, position: Int) {
- val annotationCommentPresenter = presenter as AnnotationCommentListPresenter
- val canDelete = annotationCommentPresenter.docSession.annotationMetadata?.canManage() == true
- || (annotationCommentPresenter.docSession.annotationMetadata?.canWrite() == true
- && model.userId == annotationCommentPresenter.docSession.annotationMetadata?.userId)
- val canEdit = annotationCommentPresenter.docSession.annotationMetadata?.canWrite() == true
- && model.userId == (annotationCommentPresenter.docSession.annotationMetadata?.userId)
-
- holder.bind(model, canEdit, canDelete, editCallback, deleteCallback)
- }
-}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListFragment.kt
deleted file mode 100644
index 7521e4049..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListFragment.kt
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import android.os.Bundle
-import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.app.AppCompatDialog
-import androidx.recyclerview.widget.DefaultItemAnimator
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import com.instructure.annotations.AnnotationDialogs.AnnotationCommentDialog
-import com.instructure.canvasapi2.models.ApiValues
-import com.instructure.canvasapi2.models.DocSession
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.pandautils.binding.viewBinding
-import com.instructure.pandautils.fragments.BaseListFragment
-import com.instructure.pandautils.utils.*
-import com.instructure.teacher.R
-import com.instructure.teacher.databinding.FragmentAnnotationCommentListBinding
-import com.instructure.teacher.utils.getColorCompat
-import com.instructure.teacher.utils.setupBackButton
-import java.util.*
-
-class AnnotationCommentListFragment : BaseListFragment<
- CanvaDocAnnotation,
- AnnotationCommentListPresenter,
- AnnotationCommentListView,
- AnnotationCommentViewHolder,
- AnnotationCommentListAdapter>(), AnnotationCommentListView {
-
- private val binding by viewBinding(FragmentAnnotationCommentListBinding::bind)
-
- private var mAnnotationList by ParcelableArrayListArg()
- private var mAssigneeId by LongArg()
- private var mDocSession by ParcelableArg()
- private var mApiValues by ParcelableArg()
- private var mHeadAnnotationId by StringArg()
-
- override fun createAdapter(): AnnotationCommentListAdapter {
- return AnnotationCommentListAdapter(requireContext(), presenter, { annotation, position ->
- AnnotationCommentDialog.getInstance(requireFragmentManager(), annotation.contents ?: "", getString(R.string.editComment)) { cancelled, text ->
- if(!cancelled) {
- annotation.contents = text
- presenter.editComment(annotation, position)
- }
- }.show(requireFragmentManager(), AnnotationCommentDialog::class.java.simpleName)
- }, { annotation, position ->
- val builder = AlertDialog.Builder(requireContext())
- //we want to show a different title for the head annotation
- builder.setTitle(if(position == 0) R.string.deleteAnnotation else R.string.deleteComment)
- builder.setMessage(if(position == 0) R.string.deleteHeadCommentConfirmation else R.string.deleteCommentConfirmation)
- builder.setPositiveButton(getString(R.string.delete).uppercase(Locale.getDefault())) { _, _ ->
- presenter.deleteComment(annotation, position)
- }
- builder.setNegativeButton(getString(R.string.cancel).uppercase(Locale.getDefault()), null)
- val dialog = builder.create()
- dialog.setOnShowListener {
- dialog.getButton(AppCompatDialog.BUTTON_POSITIVE).setTextColor(ThemePrefs.textButtonColor)
- dialog.getButton(AppCompatDialog.BUTTON_NEGATIVE).setTextColor(ThemePrefs.textButtonColor)
- }
- dialog.show()
- })
- }
-
- override val recyclerView: RecyclerView get() = binding.annotationCommentsRecyclerView
- override fun layoutResId() = R.layout.fragment_annotation_comment_list
- override fun checkIfEmpty() {} // we don't display this view if its empty, so no need to check
- override fun onRefreshFinished() {}
- override fun onRefreshStarted() {}
- override fun getPresenterFactory() = AnnotationCommentListPresenterFactory(mAnnotationList, mDocSession, mApiValues, mAssigneeId, mHeadAnnotationId)
-
- override fun onPresenterPrepared(presenter: AnnotationCommentListPresenter) {
- val layoutManager = LinearLayoutManager(requireContext())
- layoutManager.orientation = RecyclerView.VERTICAL
- recyclerView.layoutManager = layoutManager
- recyclerView.itemAnimator = DefaultItemAnimator()
- recyclerView.adapter = adapter
- }
-
- override fun onReadySetGo(presenter: AnnotationCommentListPresenter) {
- setupToolbar()
- presenter.loadData(false)
- setupCommentInput()
- }
-
- fun setupToolbar() {
- binding.toolbar.title = getString(R.string.sg_tab_comments)
- binding.toolbar.setupBackButton(this)
- ViewStyler.themeToolbarLight(requireActivity(), binding.toolbar)
- ViewStyler.setToolbarElevationSmall(requireContext(), binding.toolbar)
- }
-
- private fun setupCommentInput() {
- // We only want to enable comments if the user has write permissions or greater
- if(presenter.docSession.annotationMetadata?.canWrite() != true) {
- binding.commentInputContainer.setVisible(false)
- } else {
- binding.commentInputContainer.setVisible(true)
- binding.sendCommentButton.imageTintList = ViewStyler.generateColorStateList(
- intArrayOf(-android.R.attr.state_enabled) to requireContext().getColorCompat(R.color.textDark),
- intArrayOf() to ThemePrefs.textButtonColor
- )
-
- binding.sendCommentButton.isEnabled = false
- binding.commentEditText.onTextChanged { binding.sendCommentButton.isEnabled = it.isNotBlank() }
- binding.sendCommentButton.onClickWithRequireNetwork {
- presenter.sendComment(binding.commentEditText.text.toString())
- }
- }
- }
-
- override fun showSendingStatus() {
- binding.sendCommentButton.setInvisible()
- binding.sendingProgressBar.setVisible()
- binding.sendingProgressBar.announceForAccessibility(getString(R.string.sendingSimple))
- binding.sendingErrorTextView.setGone()
- binding.commentEditText.isEnabled = false
- }
-
- override fun hideSendingStatus(success: Boolean) {
- binding.sendingProgressBar.setGone()
- binding.sendCommentButton.setVisible()
- binding.commentEditText.isEnabled = true
- if (success) {
- binding.commentEditText.setText("")
- binding.commentEditText.hideKeyboard()
- } else {
- binding.sendingErrorTextView.setVisible()
- }
- }
-
- override fun notifyItemChanged(position: Int) {
- adapter.notifyItemChanged(position)
- }
-
- override fun headAnnotationDeleted() {
- requireActivity().onBackPressed()
- }
-
- companion object {
- @JvmStatic val ANNOTATIONS = "mAnnotationList"
- @JvmStatic val ASSIGNEE_ID = "mAssigneeId"
- @JvmStatic val DOC_SESSION = "mDocSession"
- @JvmStatic val API_VALUES = "mApiValues"
- @JvmStatic val HEAD_ANNOTATION_ID = "mHeadAnnotationId"
-
- fun newInstance(bundle: Bundle) = AnnotationCommentListFragment().apply { arguments = bundle }
-
- fun makeBundle(annotations: ArrayList, headAnnotationId: String, docSession: DocSession, apiValues: ApiValues, assigneeId: Long): Bundle {
- val args = Bundle()
- args.putParcelableArrayList(ANNOTATIONS, annotations)
- args.putLong(ASSIGNEE_ID, assigneeId)
- args.putParcelable(DOC_SESSION, docSession)
- args.putParcelable(API_VALUES, apiValues)
- args.putString(HEAD_ANNOTATION_ID, headAnnotationId)
- return args
- }
- }
-}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenter.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenter.kt
deleted file mode 100644
index a0e890e09..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenter.kt
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import com.instructure.annotations.*
-import com.instructure.canvasapi2.managers.CanvaDocsManager
-import com.instructure.canvasapi2.models.ApiValues
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.canvasapi2.models.DocSession
-import com.instructure.canvasapi2.utils.ApiPrefs
-import com.instructure.canvasapi2.utils.weave.awaitApi
-import com.instructure.canvasapi2.utils.weave.catch
-import com.instructure.canvasapi2.utils.weave.tryWeave
-import com.instructure.canvasapi2.utils.weave.weave
-import com.instructure.teacher.view.*
-import com.instructure.pandautils.blueprint.ListPresenter
-import kotlinx.coroutines.Job
-import okhttp3.ResponseBody
-import org.greenrobot.eventbus.EventBus
-
-class AnnotationCommentListPresenter(val annotations: ArrayList,
- val docSession: DocSession,
- val apiValues: ApiValues,
- val assigneeId: Long,
- val headAnnotationId: String) : ListPresenter(CanvaDocAnnotation::class.java) {
-
- private var mSendCommentJob: Job? = null
- private var mEditCommentJob: Job? = null
- private var mDeleteCommentJob: Job? = null
-
- override fun getItemId(item: CanvaDocAnnotation): Long {
- return item.annotationId.hashCode().toLong()
- }
-
- override fun loadData(forceNetwork: Boolean) {
- //this prevents deleted items from reloading on rotation
- if(data.size() == 0) {
- data.addAll(annotations)
- }
- }
-
- override fun refresh(forceNetwork: Boolean) {}
-
- override fun onDestroyed() {
- mSendCommentJob?.cancel()
- mEditCommentJob?.cancel()
- mDeleteCommentJob?.cancel()
- EventBus.getDefault().post(
- AnnotationCommentDeleteAcknowledged(
- annotations.filter { it.deleted && it.deleteAcknowledged.isNullOrEmpty() },
- assigneeId))
- super.onDestroyed()
- }
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- fun sendComment(comment: String) {
- mSendCommentJob = weave {
- try {
- viewCallback?.showSendingStatus()
- //first we need to find the root comment
- val rootComment = data[0]
- if (rootComment != null) {
- val newCommentReply = awaitApi { CanvaDocsManager.putAnnotation(apiValues.sessionId, generateAnnotationId(), createCommentReplyAnnotation(comment, headAnnotationId, apiValues.documentId, ApiPrefs.user?.id.toString(), rootComment.page), apiValues.canvaDocsDomain, it) }
- EventBus.getDefault().post(AnnotationCommentAdded(newCommentReply, assigneeId))
-
- // The put request doesn't return this property, so we need to set it to true
- newCommentReply.isEditable = true
- data.add(newCommentReply) //ALSO, add it to the UI
- viewCallback?.hideSendingStatus(true)
- } else {
- viewCallback?.hideSendingStatus(false)
- }
- } catch (e: Throwable) {
- viewCallback?.hideSendingStatus(false)
- }
- }
- }
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- fun editComment(annotation: CanvaDocAnnotation, position: Int) {
- mEditCommentJob = tryWeave {
- awaitApi { CanvaDocsManager.putAnnotation(apiValues.sessionId, annotation.annotationId, annotation, apiValues.canvaDocsDomain, it) }
- EventBus.getDefault().post(AnnotationCommentEdited(annotation, assigneeId))
-
- //ALSO, add it to the UI
- data.addOrUpdate(annotation)
- viewCallback?.notifyItemChanged(position)
- } catch {
- viewCallback?.hideSendingStatus(false)
- }
- }
-
- @Suppress("EXPERIMENTAL_FEATURE_WARNING")
- fun deleteComment(annotation: CanvaDocAnnotation, position: Int) {
- mDeleteCommentJob = tryWeave {
- awaitApi { CanvaDocsManager.deleteAnnotation(apiValues.sessionId, annotation.annotationId, apiValues.canvaDocsDomain, it) }
- if(annotation.annotationId == data[0]?.annotationId) {
- //this is the root comment, deleting this deletes the entire thread
- EventBus.getDefault().post(AnnotationCommentDeleted(annotation, true, assigneeId))
- viewCallback?.headAnnotationDeleted()
- } else {
- EventBus.getDefault().post(AnnotationCommentDeleted(annotation, false, assigneeId))
- data.remove(annotation)
- viewCallback?.notifyItemChanged(position)
- }
- } catch {
- viewCallback?.hideSendingStatus(false)
- }
- }
-
- override fun compare(item1: CanvaDocAnnotation, item2: CanvaDocAnnotation): Int {
- val createdAt1 = item1.createdAt
- val createdAt2 = item2.createdAt
-
- return if(createdAt1 != null && createdAt2 != null) {
- createdAt1.compareTo(createdAt2)
- } else if(createdAt1 != null && createdAt2 == null) {
- 1
- } else {
- -1
- }
- }
-}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenterFactory.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenterFactory.kt
deleted file mode 100644
index 994f69b3e..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListPresenterFactory.kt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import com.instructure.canvasapi2.models.ApiValues
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.canvasapi2.models.DocSession
-import com.instructure.pandautils.blueprint.PresenterFactory
-
-class AnnotationCommentListPresenterFactory(
- val annotations: ArrayList,
- val docSession: DocSession,
- val apiValues: ApiValues,
- val assigneeId: Long,
- val headAnnotationId: String): PresenterFactory {
- override fun create() = AnnotationCommentListPresenter(annotations, docSession, apiValues, assigneeId, headAnnotationId)
-}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListView.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListView.kt
deleted file mode 100644
index 0a67a5e80..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentListView.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.pandautils.blueprint.ListManager
-
-interface AnnotationCommentListView : ListManager {
- fun showSendingStatus()
- fun hideSendingStatus(success: Boolean)
- fun notifyItemChanged(position: Int)
- fun headAnnotationDeleted()
-}
-
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentViewHolder.kt b/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentViewHolder.kt
deleted file mode 100644
index 03c4108c2..000000000
--- a/apps/teacher/src/main/java/com/instructure/teacher/PSPDFKit/AnnotationComments/AnnotationCommentViewHolder.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2017 - present Instructure, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 3 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-package com.instructure.teacher.PSPDFKit.AnnotationComments
-
-import android.view.Gravity
-import androidx.appcompat.widget.PopupMenu
-import androidx.recyclerview.widget.RecyclerView
-import com.instructure.canvasapi2.models.canvadocs.CanvaDocAnnotation
-import com.instructure.canvasapi2.utils.DateHelper
-import com.instructure.pandautils.utils.onClick
-import com.instructure.pandautils.utils.setGone
-import com.instructure.pandautils.utils.setVisible
-import com.instructure.teacher.R
-import com.instructure.teacher.databinding.AdapterAnnotationCommentBinding
-
-class AnnotationCommentViewHolder(private val binding: AdapterAnnotationCommentBinding) : RecyclerView.ViewHolder(binding.root) {
- fun bind(
- annotation: CanvaDocAnnotation,
- canEdit: Boolean,
- canDelete: Boolean,
- editCallback: (CanvaDocAnnotation, Int) -> Unit,
- deleteCallback: (CanvaDocAnnotation, Int) -> Unit
- ) = with(binding) {
- val context = binding.root.context
- commentAuthorTextView.text = annotation.userName
- commentDateTextView.text = DateHelper.getMonthDayAtTime(context, DateHelper.stringToDateWithMillis(annotation.createdAt), context.getString(R.string.at))
- commentContentsTextView.text = annotation.contents
-
- commentEditIcon.setVisible((canEdit || canDelete) && !annotation.deleted)
-
- if(annotation.deleted) {
- commentRemovedLabel.setVisible()
- val date = DateHelper.getMonthDayAtTime(context, DateHelper.stringToDateWithMillis(annotation.deletedAt), context.getString(R.string.at))
- commentRemovedLabel.text = context.resources.getString(R.string.removedComment, date, annotation.deletedBy)
- } else {
- commentRemovedLabel.setGone()
- }
-
- commentEditIcon.onClick {
- val popup = PopupMenu(context, it, Gravity.TOP, 0, com.google.android.material.R.style.Widget_AppCompat_PopupMenu_Overflow)
- popup.inflate(R.menu.menu_edit_annotation_comment)
- if(!canEdit) popup.menu.removeItem(R.id.edit)
- if(!canDelete) popup.menu.removeItem(R.id.delete)
- popup.setOnMenuItemClickListener { item ->
- when (item.itemId) {
- R.id.edit -> editCallback(annotation, adapterPosition)
- R.id.delete -> deleteCallback(annotation, adapterPosition)
- }
- true
- }
- popup.show()
- }
- }
-}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/activities/SpeedGraderActivity.kt b/apps/teacher/src/main/java/com/instructure/teacher/activities/SpeedGraderActivity.kt
index e453e6296..ea1922a43 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/activities/SpeedGraderActivity.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/activities/SpeedGraderActivity.kt
@@ -83,11 +83,7 @@ import com.instructure.teacher.utils.isTalkbackEnabled
import com.instructure.teacher.utils.setupBackButton
import com.instructure.teacher.utils.setupMenu
import com.instructure.teacher.utils.toast
-import com.instructure.teacher.view.AudioPermissionGrantedEvent
-import com.instructure.teacher.view.TabSelectedEvent
-import com.instructure.teacher.view.VideoPermissionGrantedEvent
import com.instructure.teacher.viewinterface.SpeedGraderView
-import com.pspdfkit.preferences.PSPDFKitPreferences
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.delay
import org.greenrobot.eventbus.EventBus
@@ -165,10 +161,6 @@ class SpeedGraderActivity : BasePresenterActivity {
if(grantResults.all { it == PackageManager.PERMISSION_GRANTED }) {
- EventBus.getDefault().post(VideoPermissionGrantedEvent(assigneeId))
+// EventBus.getDefault().post(VideoPermissionGrantedEvent(assigneeId))
}
}
- permissions.contains(PermissionUtils.RECORD_AUDIO) -> EventBus.getDefault().post(AudioPermissionGrantedEvent(assigneeId))
+// permissions.contains(PermissionUtils.RECORD_AUDIO) -> EventBus.getDefault().post(AudioPermissionGrantedEvent(assigneeId))
}
}
}
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/dialog/SGAddMediaCommentDialog.kt b/apps/teacher/src/main/java/com/instructure/teacher/dialog/SGAddMediaCommentDialog.kt
index 6795c7136..fd7fddd3c 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/dialog/SGAddMediaCommentDialog.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/dialog/SGAddMediaCommentDialog.kt
@@ -28,7 +28,6 @@ import com.instructure.pandautils.utils.*
import com.instructure.teacher.R
import com.instructure.teacher.activities.SpeedGraderActivity
import com.instructure.teacher.databinding.DialogSgAddAttachmentCommentBinding
-import com.instructure.teacher.view.MediaCommentDialogClosedEvent
import org.greenrobot.eventbus.EventBus
class SGAddMediaCommentDialog : BaseCanvasAppCompatDialogFragment() {
@@ -77,7 +76,6 @@ class SGAddMediaCommentDialog : BaseCanvasAppCompatDialogFragment() {
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
- EventBus.getDefault().post(MediaCommentDialogClosedEvent())
}
companion object {
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/features/assignment/submission/SubmissionListFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/features/assignment/submission/SubmissionListFragment.kt
index 7dbae3a6e..092674566 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/features/assignment/submission/SubmissionListFragment.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/features/assignment/submission/SubmissionListFragment.kt
@@ -49,7 +49,6 @@ import com.instructure.teacher.events.SubmissionCommentsUpdated
import com.instructure.teacher.events.SubmissionFilterChangedEvent
import com.instructure.teacher.features.postpolicies.ui.PostPolicyFragment
import com.instructure.teacher.router.RouteMatcher
-import com.instructure.teacher.view.QuizSubmissionGradedEvent
import dagger.hilt.android.AndroidEntryPoint
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
@@ -147,12 +146,6 @@ class SubmissionListFragment : BaseCanvasFragment() {
viewModel.uiState.value.actionHandler(SubmissionListAction.Refresh)
}
- @Suppress("unused")
- @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
- fun onQuizGraded(event: QuizSubmissionGradedEvent) {
- viewModel.uiState.value.actionHandler(SubmissionListAction.Refresh)
- }
-
@Suppress("unused")
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
fun onSubmissionCommentUpdated(event: SubmissionCommentsUpdated) {
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizDetailsFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizDetailsFragment.kt
index 1fec4a9df..b209051e0 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizDetailsFragment.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizDetailsFragment.kt
@@ -77,7 +77,6 @@ import com.instructure.teacher.utils.setupBackButtonWithExpandCollapseAndBack
import com.instructure.teacher.utils.setupMenu
import com.instructure.teacher.utils.shuffleAnswersDisplayable
import com.instructure.teacher.utils.updateToolbarExpandCollapseIcon
-import com.instructure.teacher.view.QuizSubmissionGradedEvent
import com.instructure.teacher.viewinterface.QuizDetailsView
import kotlinx.coroutines.Job
import org.greenrobot.eventbus.EventBus
@@ -518,14 +517,6 @@ class QuizDetailsFragment : BasePresenterFragment<
}
}
- @Suppress("unused")
- @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
- fun onQuizGraded(event: QuizSubmissionGradedEvent) {
- event.once(javaClass.simpleName) {
- if (presenter.mQuiz.assignmentId == it.assignmentId) needToForceNetwork = true
- }
- }
-
companion object {
@JvmStatic val QUIZ_ID = "quiz_details_quiz_id"
@JvmStatic val QUIZ = "quiz_details_quiz"
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizListFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizListFragment.kt
index 6aad4ebde..edb9fdfdc 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizListFragment.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/fragments/QuizListFragment.kt
@@ -50,7 +50,6 @@ import com.instructure.teacher.presenters.QuizListPresenter
import com.instructure.teacher.router.RouteMatcher
import com.instructure.teacher.utils.RecyclerViewUtils
import com.instructure.teacher.utils.setupBackButton
-import com.instructure.teacher.view.QuizSubmissionGradedEvent
import com.instructure.teacher.viewinterface.QuizListView
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
@@ -192,12 +191,6 @@ class QuizListFragment : BaseExpandableSyncFragment<
}
}
- @Suppress("unused")
- @Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
- fun onQuizGraded(event: QuizSubmissionGradedEvent) {
- event.once(javaClass.simpleName) { needToForceNetwork = true }
- }
-
override fun onHandleBackPressed() = binding.quizListToolbar.closeSearch()
companion object {
diff --git a/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderCommentsFragment.kt b/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderCommentsFragment.kt
index 22fc3b92d..ac2990fa2 100644
--- a/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderCommentsFragment.kt
+++ b/apps/teacher/src/main/java/com/instructure/teacher/fragments/SpeedGraderCommentsFragment.kt
@@ -80,10 +80,6 @@ import com.instructure.teacher.presenters.SpeedGraderCommentsPresenter
import com.instructure.teacher.utils.RecyclerViewUtils
import com.instructure.teacher.utils.getColorCompat
import com.instructure.teacher.utils.view
-import com.instructure.teacher.view.CommentTextFocusedEvent
-import com.instructure.teacher.view.MediaCommentDialogClosedEvent
-import com.instructure.teacher.view.SubmissionSelectedEvent
-import com.instructure.teacher.view.UploadMediaCommentEvent
import com.instructure.teacher.viewinterface.SpeedGraderCommentsView
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.launch
@@ -221,13 +217,6 @@ class SpeedGraderCommentsFragment : BaseListFragment
- if (hasFocus) {
- (requireActivity() as SpeedGraderActivity).openCommentLibrary(mSubmissionId)
- EventBus.getDefault().post(CommentTextFocusedEvent(mAssignee.id))
- }
- }
-
addAttachment.onClick {
(requireActivity() as SpeedGraderActivity).closeCommentLibrary()
SGAddMediaCommentDialog.show(requireActivity().supportFragmentManager,
@@ -268,18 +257,6 @@ class SpeedGraderCommentsFragment : BaseListFragment