Skip to content

youtube_lectures#18

Merged
Trosper3 merged 4 commits into
mainfrom
youtube_lectures
Apr 27, 2026
Merged

youtube_lectures#18
Trosper3 merged 4 commits into
mainfrom
youtube_lectures

Conversation

@jerrya-code

Copy link
Copy Markdown
Collaborator

Thanks for using StudentProductivityApp!

Here's what's new:

  • You can now add assignments directly from Canvas using your Access Token!
  • Our video lecture search feature is up and running! (As a demo). To try it out: use this video sample: https://www.youtube.com/watch?v=xAcTmDO6NTI

Trosper3 and others added 4 commits April 9, 2026 08:44
Update agp version in gradle/libs.versions.toml from 9.0.1 to 9.1.0 to adopt the newer Android Gradle Plugin release. Keeps build tooling up-to-date and includes upstream fixes and improvements.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Canvas “to-do assignments” sync flow (via personal access token) and updates the video lecture demo to load a YouTube video and search within a locally loaded transcript.

Changes:

  • Add Canvas Retrofit API client/models and a token-entry dialog to sync upcoming assignments into the Room DB.
  • Update VideoLectureActivity to embed YouTube videos by ID and search within a parsed transcript.
  • Update build tooling/dependencies (Gradle wrapper + AGP) and adjust assignment item layout constraints.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
gradle/wrapper/gradle-wrapper.properties Bumps Gradle wrapper distribution version/hash.
gradle/libs.versions.toml Updates AGP version in the version catalog.
app/src/main/res/layout/item_assignment.xml Tweaks constraints/margins for assignment list item UI.
app/src/main/java/com/example/studentproductivityapp/features/video_lectures/VideoLectureActivity.kt Switches to AppCompatActivity, embeds YouTube via iframe HTML, loads/parses a local transcript, and searches/jumps to timestamps.
app/src/main/java/com/example/studentproductivityapp/features/home/MainActivity.kt Adds Canvas sync dialog + Retrofit call to fetch assignments and insert into Room.
app/src/main/java/com/example/studentproductivityapp/CanvasAPI.kt Introduces Canvas API data models, service interface, and Retrofit client.
app/build.gradle.kts Adds additional Retrofit dependencies for Canvas API calls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/src/main/res/layout/item_assignment.xml
Comment on lines +243 to +255
private fun loadVideoAtTime(seconds: Int) {
if (currentVideoId.isEmpty()) return

val html = """
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="margin:0;padding:0;background-color:#000;">
<iframe width="100%" height="100%"
src="https://www.youtube.com/embed/$currentVideoId?start=$seconds&autoplay=1&playsinline=1&enablejsapi=1&origin=https://localhost"
frameborder="0"

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentVideoId is interpolated directly into an HTML string that is loaded into a JavaScript-enabled WebView. A crafted URL could inject characters that break out of the attribute and execute script in the page context. Validate/sanitize currentVideoId (e.g., strict YouTube video ID pattern) before using it, or URL-encode it and reject invalid input.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
distributionSha256Sum=2ab2958f2a1e51120c326cad6f385153bb11ee93b3c216c5fccebfdfbb7ec6cb
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR upgrades Gradle wrapper (9.3.1 → 9.4.1) and AGP (via version catalog) but the PR description only mentions Canvas sync and video lecture search. Toolchain upgrades can have wide impact; please document the rationale/compatibility in the PR description or split the build tool upgrade into a separate PR.

Copilot uses AI. Check for mistakes.
Comment thread app/build.gradle.kts
Comment on lines +89 to +92

//Retrofit for Canvas API Calls
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These new Retrofit dependencies duplicate the existing Retrofit dependencies already declared earlier in this same file (implementation(libs.retrofit) / implementation(libs.retrofit.gson)) and introduce a conflicting downgrade to 2.9.0 while the version catalog is 2.11.0. Remove the hard-coded entries and use the version-catalog aliases consistently to avoid dependency version conflicts.

Suggested change
//Retrofit for Canvas API Calls
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")

Copilot uses AI. Check for mistakes.
Comment on lines +270 to +281
Assignment(
title = canvasAssign.name,
courseName = "Course ID: ${canvasAssign.course_id}",
dueDateMillis = parsedMillis,
isCompleted = false
)
}
}

if (newAssignments.isNotEmpty()) {
newAssignments.forEach { assignmentDao.insert(it) }

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Canvas sync inserts all fetched assignments every time without any de-duplication key (local Assignment uses an auto-generated PK), so repeated syncs will create duplicate rows. Consider storing the Canvas assignment id (e.g., canvasId) with a UNIQUE index and using upsert, or clearing/replacing the previous Canvas-synced items before inserting.

Copilot uses AI. Check for mistakes.

@Trosper3 Trosper3 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic! Nice job with it and the idea to move it over to YouTube was excellent.

@Trosper3 Trosper3 merged commit 0859b2c into main Apr 27, 2026
5 checks passed
@Trosper3 Trosper3 deleted the youtube_lectures branch April 27, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants