Skip to content

Commit

Permalink
refactor: address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir committed Jan 15, 2024
1 parent 4779971 commit 80c7799
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 24 deletions.
5 changes: 2 additions & 3 deletions Core/Core/View/Base/WebView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ public struct WebView: UIViewRepresentable {
let isWebViewDelegateHandled = await (
parent.webViewNavDelegate?.webView(
webView,
shouldLoad: navigationAction.request, navigationAction: navigationAction) ?? false
shouldLoad: navigationAction.request,
navigationAction: navigationAction) ?? false
)

if isWebViewDelegateHandled {
Expand Down Expand Up @@ -188,8 +189,6 @@ public struct WebView: UIViewRepresentable {
webView.backgroundColor = .clear
webView.scrollView.backgroundColor = Theme.Colors.white.uiColor()
webView.scrollView.alwaysBounceVertical = false
// webView.scrollView.layer.cornerRadius = 24
// webView.scrollView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner]
webView.scrollView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: 200, right: 0)

return webView
Expand Down
5 changes: 0 additions & 5 deletions Course/Course/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

*/

"DETAILS.TITLE" = "Деталі курсу";
"DETAILS.VIEW_COURSE" = "Переглянути курс";
"DETAILS.ENROLL_NOW" = "Зареєструватися";
"DETAILS.ENROLLMENT_DATE_IS_OVER" = "Ви не можете зареєструватися на цей курс, оскільки дата реєстрації закінчилася.";

"OUTLINE.CONGRATULATIONS" = "Вітаємо!";
"OUTLINE.PASSED_THE_COURSE" = "Ви пройшли курс";
"OUTLINE.VIEW_CERTIFICATE" = "Переглянути сертифікат";
Expand Down
12 changes: 10 additions & 2 deletions Discovery/Discovery/Presentation/DiscoveryRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import Core

public protocol DiscoveryRouter: BaseRouter {
func showCourseDetais(courseID: String, title: String)
func showWebDiscoveryDetails(pathID: String, discoveryType: DiscoveryWebviewType, sourceScreen: LogistrationSourceScreen)
func showWebDiscoveryDetails(
pathID: String,
discoveryType: DiscoveryWebviewType,
sourceScreen: LogistrationSourceScreen
)
func showUpdateRequiredView(showAccountLink: Bool)
func showUpdateRecomendedView()
func showDiscoverySearch(searchQuery: String?)
Expand All @@ -32,7 +36,11 @@ public class DiscoveryRouterMock: BaseRouterMock, DiscoveryRouter {
public override init() {}

public func showCourseDetais(courseID: String, title: String) {}
public func showWebDiscoveryDetails(pathID: String, discoveryType: DiscoveryWebviewType, sourceScreen: LogistrationSourceScreen) {}
public func showWebDiscoveryDetails(
pathID: String,
discoveryType: DiscoveryWebviewType,
sourceScreen: LogistrationSourceScreen
) {}
public func showUpdateRequiredView(showAccountLink: Bool) {}
public func showUpdateRecomendedView() {}
public func showDiscoverySearch(searchQuery: String? = nil) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class DiscoveryWebviewModel: ObservableObject {
var sourceScreen: LogistrationSourceScreen

var userloggedIn: Bool {
return !(storage.user?.username?.isEmpty ?? true)
return storage.user?.username?.isEmpty == false
}

public init(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public extension URL {
}

var isValidAppURLScheme: Bool {
return scheme ?? "" == URIString.appURLScheme.rawValue ? true : false
return scheme ?? "" == URIString.appURLScheme.rawValue &&
}

Check failure on line 17 in Discovery/Discovery/Presentation/WebDiscovery/URL+PathExtension.swift

View workflow job for this annotation

GitHub Actions / Tests

expected expression after operator

Check failure on line 17 in Discovery/Discovery/Presentation/WebDiscovery/URL+PathExtension.swift

View workflow job for this annotation

GitHub Actions / Tests

expected expression after operator

var queryParameters: [String: Any]? {
Expand Down
5 changes: 5 additions & 0 deletions Discovery/Discovery/uk.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@

"ALERT.LEAVING_APP_TITLE" = "Leaving the app";
"ALERT.LEAVING_APP_MESSAGE" = "You are now leaving the app and opening a browser";

"DETAILS.TITLE" = "Деталі курсу";
"DETAILS.VIEW_COURSE" = "Переглянути курс";
"DETAILS.ENROLL_NOW" = "Зареєструватися";
"DETAILS.ENROLLMENT_DATE_IS_OVER" = "Ви не можете зареєструватися на цей курс, оскільки дата реєстрації закінчилася.";
26 changes: 14 additions & 12 deletions OpenEdX/Data/DiscoveryPersistence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,20 @@ public class DiscoveryPersistence: DiscoveryPersistenceProtocol {
let request = CDCourseDetails.fetchRequest()
request.predicate = NSPredicate(format: "courseID = %@", courseID)
guard let courseDetails = try? context.fetch(request).first else { throw NoCachedDataError() }
return CourseDetails(courseID: courseDetails.courseID ?? "",
org: courseDetails.org ?? "",
courseTitle: courseDetails.courseTitle ?? "",
courseDescription: courseDetails.courseDescription ?? "",
courseStart: courseDetails.courseStart,
courseEnd: courseDetails.courseEnd,
enrollmentStart: courseDetails.enrollmentStart,
enrollmentEnd: courseDetails.enrollmentEnd,
isEnrolled: courseDetails.isEnrolled,
overviewHTML: courseDetails.overviewHTML ?? "",
courseBannerURL: courseDetails.courseBannerURL ?? "",
courseVideoURL: nil)
return CourseDetails(
courseID: courseDetails.courseID ?? "",
org: courseDetails.org ?? "",
courseTitle: courseDetails.courseTitle ?? "",
courseDescription: courseDetails.courseDescription ?? "",
courseStart: courseDetails.courseStart,
courseEnd: courseDetails.courseEnd,
enrollmentStart: courseDetails.enrollmentStart,
enrollmentEnd: courseDetails.enrollmentEnd,
isEnrolled: courseDetails.isEnrolled,
overviewHTML: courseDetails.overviewHTML ?? "",
courseBannerURL: courseDetails.courseBannerURL ?? "",
courseVideoURL: nil
)
}

public func saveCourseDetails(course: CourseDetails) {
Expand Down

0 comments on commit 80c7799

Please sign in to comment.