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

Commit

Permalink
LEARNER-7049, make degree tab dependent on program (#1242)
Browse files Browse the repository at this point in the history
  • Loading branch information
salman2013 committed Feb 6, 2019
1 parent 19a4af7 commit 47f7983
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Source/DiscoveryConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DiscoveryConfig: NSObject {
init(dictionary: [String: AnyObject]) {
course = CourseDiscovery(dictionary: dictionary[DiscoveryKeys.course] as? [String: AnyObject] ?? [:])
program = ProgramDiscovery(with: course, dictionary: dictionary[DiscoveryKeys.program] as? [String: AnyObject] ?? [:])
degree = DegreeDiscovery(with: course, dictionary: dictionary[DiscoveryKeys.degree] as? [String: AnyObject] ?? [:])
degree = DegreeDiscovery(with: program, dictionary: dictionary[DiscoveryKeys.degree] as? [String: AnyObject] ?? [:])
}
}

Expand Down Expand Up @@ -83,7 +83,19 @@ class ProgramDiscovery: DiscoveryBase {
}
}

class DegreeDiscovery: ProgramDiscovery { }
class DegreeDiscovery: DiscoveryBase {

private let programDiscovery: ProgramDiscovery

init(with programDiscovery: ProgramDiscovery, dictionary: [String : AnyObject]) {
self.programDiscovery = programDiscovery
super.init(dictionary: dictionary)
}

var isEnabled: Bool {
return programDiscovery.isEnabled && type == .webview
}
}

class DiscoveryBase: NSObject {
private(set) var type: DiscoveryConfigType
Expand Down

0 comments on commit 47f7983

Please sign in to comment.