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

Commit

Permalink
chore: update status bar color to match course dashboard header color
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed May 17, 2023
1 parent dbba6b5 commit 3c722e0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
26 changes: 26 additions & 0 deletions Source/NewCourseDashboardViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv
navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
addSubviews()
loadCourseStream()
setStatusBar(color: environment.styles.primaryLightColor())
}

override func viewWillAppear(_ animated: Bool) {
Expand All @@ -95,6 +96,10 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv
navigationController?.setNavigationBarHidden(false, animated: true)
}

override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}

private func addSubviews() {
view.backgroundColor = environment.styles.neutralWhiteT()
view.addSubview(contentView)
Expand Down Expand Up @@ -233,6 +238,7 @@ class NewCourseDashboardViewController: UIViewController, InterfaceOrientationOv

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
setupContentView()
setStatusBar(color: environment.styles.primaryLightColor())
}

private func prepareTabViewData() {
Expand Down Expand Up @@ -543,3 +549,23 @@ extension NewCourseDashboardViewController {
}
}
}

public extension UIViewController {
func setStatusBar(color: UIColor) {
DispatchQueue.main.async { [weak self] in
let tag = 123454321
let overView: UIView
if let taggedView = self?.view.viewWithTag(tag){
overView = taggedView
}
else {
overView = UIView()
overView.tag = tag
self?.view.addSubview(overView)
}

overView.frame = UIApplication.shared.window?.windowScene?.statusBarManager?.statusBarFrame ?? .zero
overView.backgroundColor = color
}
}
}
4 changes: 2 additions & 2 deletions edX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@
5F7C0C6A2534521300A344B9 /* FillBackgroundLayoutManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F7C0C692534521300A344B9 /* FillBackgroundLayoutManager.swift */; };
5F903AF4255020D7006365DE /* UIDeviceExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F903AF3255020D7006365DE /* UIDeviceExtension.swift */; };
5F99F3BD26C68308000605B4 /* VideoDownloadQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F99F3BC26C68308000605B4 /* VideoDownloadQualityViewController.swift */; };
5FA4266F2966B1110013BBA8 /* CourseAccessHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FA4266E2966B1110013BBA8 /* CourseAccessHelper.swift */; };
5F9EE5E929BE4BF300FF5A0A /* ResumeCourseHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F9EE5E829BE4BF300FF5A0A /* ResumeCourseHeaderView.swift */; };
5FA4266F2966B1110013BBA8 /* CourseAccessHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FA4266E2966B1110013BBA8 /* CourseAccessHelper.swift */; };
5FA7FEB1266A2BE5006286B6 /* BrowserViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FA7FEB0266A2BE5006286B6 /* BrowserViewController.swift */; };
5FA8F8D827C4B153006003DA /* ShimmerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FA8F8D327C4B153006003DA /* ShimmerView.swift */; };
5FAE055324EA647D00A29B1D /* CourseDates.json in Resources */ = {isa = PBXBuildFile; fileRef = 5FAE055124EA618000A29B1D /* CourseDates.json */; };
Expand Down Expand Up @@ -1232,8 +1232,8 @@
5F7C0C692534521300A344B9 /* FillBackgroundLayoutManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillBackgroundLayoutManager.swift; sourceTree = "<group>"; };
5F903AF3255020D7006365DE /* UIDeviceExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDeviceExtension.swift; sourceTree = "<group>"; };
5F99F3BC26C68308000605B4 /* VideoDownloadQualityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoDownloadQualityViewController.swift; sourceTree = "<group>"; };
5FA4266E2966B1110013BBA8 /* CourseAccessHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseAccessHelper.swift; sourceTree = "<group>"; };
5F9EE5E829BE4BF300FF5A0A /* ResumeCourseHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResumeCourseHeaderView.swift; sourceTree = "<group>"; };
5FA4266E2966B1110013BBA8 /* CourseAccessHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseAccessHelper.swift; sourceTree = "<group>"; };
5FA7FEB0266A2BE5006286B6 /* BrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BrowserViewController.swift; sourceTree = "<group>"; };
5FA8F8D327C4B153006003DA /* ShimmerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShimmerView.swift; sourceTree = "<group>"; };
5FAE055124EA618000A29B1D /* CourseDates.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CourseDates.json; sourceTree = "<group>"; };
Expand Down

0 comments on commit 3c722e0

Please sign in to comment.