Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

chore: clear transcript view after video controller is dismissed #1807

Merged
merged 3 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Source/VideoBlockViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ class VideoBlockViewController : OfflineSupportViewController, CourseBlockViewCo
if !chromeCastManager.viewExpanded {
resetChromeCast()
}
videoTranscriptView?.invalidateTimer()
videoTranscriptView = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to invalidate the timer there otherwise deinit will call after the invalidating of timer.

}

override func viewDidAppear(_ animated : Bool) {
Expand Down
8 changes: 6 additions & 2 deletions Source/VideoTranscript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ class VideoTranscript: NSObject, UITableViewDelegate, UITableViewDataSource, Scr
self.environment = environment
super.init()
setupTable(tableView: transcriptTableView)
transcriptTableView.dataSource = self
transcriptTableView.delegate = self
}

private func setupTable(tableView: UITableView) {
Expand All @@ -52,6 +50,8 @@ class VideoTranscript: NSObject, UITableViewDelegate, UITableViewDataSource, Scr
tableView.rowHeight = UITableView.automaticDimension
tableView.estimatedRowHeight = 44
tableView.isHidden = true
tableView.dataSource = self
tableView.delegate = self
}

//MARK: - UITableview methods
Expand Down Expand Up @@ -116,4 +116,8 @@ class VideoTranscript: NSObject, UITableViewDelegate, UITableViewDataSource, Scr
@objc func invalidateDragging(){
isTableDragged = false
}

func invalidateTimer() {
draggingTimer.invalidate()
}
}
Loading