From 6e40ba0607ac4e74aa3accb94662a528d1eace57 Mon Sep 17 00:00:00 2001 From: Muhammad Umer Date: Wed, 4 Oct 2023 15:00:30 +0100 Subject: [PATCH 1/2] chore: clear transcript view after controller is dismissed --- Source/VideoBlockViewController.swift | 1 + Source/VideoTranscript.swift | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/VideoBlockViewController.swift b/Source/VideoBlockViewController.swift index d70a4fa78..aa8a67b08 100644 --- a/Source/VideoBlockViewController.swift +++ b/Source/VideoBlockViewController.swift @@ -176,6 +176,7 @@ class VideoBlockViewController : OfflineSupportViewController, CourseBlockViewCo if !chromeCastManager.viewExpanded { resetChromeCast() } + videoTranscriptView = nil } override func viewDidAppear(_ animated : Bool) { diff --git a/Source/VideoTranscript.swift b/Source/VideoTranscript.swift index 4c7f6ecb9..2568a41f4 100644 --- a/Source/VideoTranscript.swift +++ b/Source/VideoTranscript.swift @@ -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) { @@ -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 @@ -116,4 +116,8 @@ class VideoTranscript: NSObject, UITableViewDelegate, UITableViewDataSource, Scr @objc func invalidateDragging(){ isTableDragged = false } + + deinit { + draggingTimer.invalidate() + } } From fbadd842af0d0e042b58da9f8e859d5f932f80ad Mon Sep 17 00:00:00 2001 From: Muhammad Umer Date: Fri, 6 Oct 2023 08:58:48 +0100 Subject: [PATCH 2/2] chore: address feedback --- Source/VideoBlockViewController.swift | 1 + Source/VideoTranscript.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/VideoBlockViewController.swift b/Source/VideoBlockViewController.swift index aa8a67b08..f27b19e04 100644 --- a/Source/VideoBlockViewController.swift +++ b/Source/VideoBlockViewController.swift @@ -176,6 +176,7 @@ class VideoBlockViewController : OfflineSupportViewController, CourseBlockViewCo if !chromeCastManager.viewExpanded { resetChromeCast() } + videoTranscriptView?.invalidateTimer() videoTranscriptView = nil } diff --git a/Source/VideoTranscript.swift b/Source/VideoTranscript.swift index 2568a41f4..432b975c8 100644 --- a/Source/VideoTranscript.swift +++ b/Source/VideoTranscript.swift @@ -117,7 +117,7 @@ class VideoTranscript: NSObject, UITableViewDelegate, UITableViewDataSource, Scr isTableDragged = false } - deinit { + func invalidateTimer() { draggingTimer.invalidate() } }