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

refactor: removed unused and deprecated config code #1771

Merged
merged 1 commit into from
Jul 13, 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
5 changes: 2 additions & 3 deletions Source/OEXLoginViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#import "OEXGoogleSocial.h"
#import "OEXInterface.h"
#import "OEXNetworkConstants.h"
#import "OEXNetworkUtility.h"
#import "OEXSession.h"
#import "OEXUserDetails.h"
#import "OEXUserLicenseAgreementViewController.h"
Expand Down Expand Up @@ -90,11 +89,11 @@ - (void)viewWillDisappear:(BOOL)animated {
[self.view setUserInteractionEnabled:NO];
}
- (BOOL)isFacebookEnabled {
return ![OEXNetworkUtility isOnZeroRatedNetwork] && [self.environment.config facebookConfig].enabled;
return [self.environment.config facebookConfig].enabled;
}

- (BOOL)isGoogleEnabled {
return ![OEXNetworkUtility isOnZeroRatedNetwork] && [self.environment.config googleConfig].enabled;
return [self.environment.config googleConfig].enabled;
}

- (BOOL)isMicrosoftEnabled {
Expand Down
15 changes: 0 additions & 15 deletions Source/OEXNetworkUtility.h

This file was deleted.

29 changes: 0 additions & 29 deletions Source/OEXNetworkUtility.m

This file was deleted.

28 changes: 0 additions & 28 deletions Source/OEXZeroRatingConfig.h

This file was deleted.

41 changes: 0 additions & 41 deletions Source/OEXZeroRatingConfig.m

This file was deleted.

2 changes: 1 addition & 1 deletion Test/CourseContentPageViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CourseContentPageViewControllerTests: SnapshotTestCase {
let interface = OEXInterface.shared()
interface.t_setCourseEnrollments([UserCourseEnrollment(course: course)])
interface.t_setCourseVideos([course.course_id!: OEXVideoSummaryTestDataFactory.localCourseVideos(CourseOutlineTestDataFactory.knownLocalVideoID)])
environment = TestRouterEnvironment(config: OEXConfig(dictionary:["TAB_LAYOUTS_ENABLED": true]), interface: interface)
environment = TestRouterEnvironment(config: OEXConfig(dictionary:[:]), interface: interface)
environment.mockCourseDataManager.querier = CourseOutlineQuerier(courseID: course.course_id!, interface: interface, outline: outline)
router = OEXRouter(environment: environment)
}
Expand Down
7 changes: 3 additions & 4 deletions Test/CourseDashboardViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import edXCore

private extension OEXConfig {

convenience init(courseVideosEnabled: Bool = false, courseDatesEnabled: Bool = true, discussionsEnabled : Bool, courseSharingEnabled: Bool = false, isAnnouncementsEnabled: Bool = true, tabDashboardEnabled: Bool = true, certificatesEnabled: Bool = false) {
convenience init(courseVideosEnabled: Bool = false, courseDatesEnabled: Bool = true, discussionsEnabled : Bool, courseSharingEnabled: Bool = false, isAnnouncementsEnabled: Bool = true, certificatesEnabled: Bool = false) {
self.init(dictionary: [
"COURSE_VIDEOS_ENABLED" : courseVideosEnabled,
"COURSE_DATES_ENABLED" : courseDatesEnabled,
"DISCUSSIONS_ENABLED": discussionsEnabled,
"COURSE_SHARING_ENABLED": courseSharingEnabled,
"ANNOUNCEMENTS_ENABLED": isAnnouncementsEnabled,
"TAB_LAYOUTS_ENABLED": tabDashboardEnabled,
"CERTIFICATES_ENABLED": certificatesEnabled
]
)
Expand Down Expand Up @@ -92,7 +91,7 @@ class CourseDashboardViewControllerTests: SnapshotTestCase {
}

func testSnapshot() {
let config = OEXConfig(courseVideosEnabled: true, courseDatesEnabled: true, discussionsEnabled: true, courseSharingEnabled: true, isAnnouncementsEnabled: true, tabDashboardEnabled: true)
let config = OEXConfig(courseVideosEnabled: true, courseDatesEnabled: true, discussionsEnabled: true, courseSharingEnabled: true, isAnnouncementsEnabled: true)
let course = OEXCourse.freshCourse(aboutUrl: "http://www.yahoo.com")
let outline = CourseOutlineTestDataFactory.freshCourseOutline(course.course_id!)
let interface = OEXInterface.shared()
Expand Down Expand Up @@ -120,7 +119,7 @@ class CourseDashboardViewControllerTests: SnapshotTestCase {
}

func testCertificate() {
let config = OEXConfig(courseVideosEnabled: true, courseDatesEnabled: true, discussionsEnabled: true, courseSharingEnabled: true, isAnnouncementsEnabled: true, tabDashboardEnabled: true, certificatesEnabled: true)
let config = OEXConfig(courseVideosEnabled: true, courseDatesEnabled: true, discussionsEnabled: true, courseSharingEnabled: true, isAnnouncementsEnabled: true, certificatesEnabled: true)

let courseData = OEXCourse.testData()
let course = OEXCourse(dictionary: courseData)
Expand Down
2 changes: 1 addition & 1 deletion Test/CourseOutlineViewControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class CourseOutlineViewControllerTests: SnapshotTestCase {
override func setUp() {
super.setUp()
outline = CourseOutlineTestDataFactory.freshCourseOutline(course.course_id!)
let config = OEXConfig(dictionary: ["COURSE_VIDEOS_ENABLED": true, "TAB_LAYOUTS_ENABLED": true])
let config = OEXConfig(dictionary: ["COURSE_VIDEOS_ENABLED": true])
let interface = OEXInterface.shared()
environment = TestRouterEnvironment(config: config, interface: interface)
environment.mockCourseDataManager.querier = CourseOutlineQuerier(courseID: outline.root, interface: interface, outline: outline)
Expand Down
30 changes: 0 additions & 30 deletions Test/OEXConfigTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#import "OEXGoogleConfig.h"
#import "OEXNewRelicConfig.h"
#import "OEXSegmentConfig.h"
#import "OEXZeroRatingConfig.h"

@interface OEXConfigTests : XCTestCase
@end
Expand Down Expand Up @@ -140,33 +139,4 @@ -(void)testSegmentConfigEnabled{
XCTAssertNotNil(segmentConfig.apiKey,@"Segment config api key should not be nil");
}


//Zero Rating Config tests

-(void)testZeroRatingConfig{
NSDictionary *configDictionary=@{};
OEXConfig *config=[[OEXConfig alloc] initWithDictionary:configDictionary];
OEXZeroRatingConfig *zeroRatingConfig=[config zeroRatingConfig];
XCTAssert(!zeroRatingConfig.enabled,@"Zero_Rating config should not be enabled");
XCTAssert([zeroRatingConfig.carriers count]==0,@"Carriers array should be empty");
}

-(void)testZeroRatingEmptyConfig{
NSDictionary *configDictionary=@{@"ZERO_RATING":@{}};
OEXConfig *config=[[OEXConfig alloc] initWithDictionary:configDictionary];
OEXZeroRatingConfig *zeroRatingConfig=[config zeroRatingConfig];
XCTAssert(!zeroRatingConfig.enabled,@"Zero_Rating config should not be enabled");
XCTAssert([zeroRatingConfig.carriers count]==0,@"Carriers array should be empty");
}

-(void)testZeroRatingConfigEnabled{
NSDictionary *configDictionary=@{@"ZERO_RATING":@{@"ENABLED":@YES ,
@"CARRIERS":@[@"1234",
@"3242"]} };
OEXConfig *config=[[OEXConfig alloc] initWithDictionary:configDictionary];
OEXZeroRatingConfig *zeroRatingConfig=[config zeroRatingConfig];
XCTAssert(zeroRatingConfig.enabled,@" Zero_Rating config should be enabled");
XCTAssert([zeroRatingConfig.carriers count]==2,@"Carriers array should not be empty");
}

@end
2 changes: 1 addition & 1 deletion Test/VideoPlayerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class VideoPlayerTests: XCTestCase {
override func setUp() {
super.setUp()
outline = CourseOutlineTestDataFactory.freshCourseOutline(course.course_id!)
let config = OEXConfig(dictionary: ["COURSE_VIDEOS_ENABLED": true, "TAB_LAYOUTS_ENABLED": true])
let config = OEXConfig(dictionary: ["COURSE_VIDEOS_ENABLED": true])
let interface = OEXInterface.shared()
environment = TestRouterEnvironment(config: config, interface: interface)
environment.mockCourseDataManager.querier = CourseOutlineQuerier(courseID: outline.root, interface: interface, outline: outline)
Expand Down
12 changes: 0 additions & 12 deletions edX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,7 @@
B4B285DC1A9A490400DD603A /* OEXFacebookConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285DB1A9A490400DD603A /* OEXFacebookConfig.m */; };
B4B285DF1A9A493A00DD603A /* OEXNewRelicConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285DE1A9A493A00DD603A /* OEXNewRelicConfig.m */; };
B4B285E21A9A497A00DD603A /* OEXSegmentConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285E11A9A497A00DD603A /* OEXSegmentConfig.m */; };
B4B285E81A9A662600DD603A /* OEXZeroRatingConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285E71A9A662600DD603A /* OEXZeroRatingConfig.m */; };
B4B285EA1A9B182900DD603A /* OEXConfigTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285E91A9B182900DD603A /* OEXConfigTests.m */; };
B4B285ED1A9B429200DD603A /* OEXNetworkUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B285EC1A9B429200DD603A /* OEXNetworkUtility.m */; };
B4B6C80D1A9C7AEA004F0FAF /* OEXPlaceholderTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B6C80C1A9C7AEA004F0FAF /* OEXPlaceholderTextView.m */; };
B4B6D5E51A9490E9000F44E8 /* OEXLoginSplashViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B6D5E41A9490E9000F44E8 /* OEXLoginSplashViewController.m */; };
B4B6D5E91A9490FC000F44E8 /* OEXRegistrationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B4B6D5E71A9490FC000F44E8 /* OEXRegistrationViewController.m */; };
Expand Down Expand Up @@ -1719,11 +1717,7 @@
B4B285DE1A9A493A00DD603A /* OEXNewRelicConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXNewRelicConfig.m; sourceTree = "<group>"; };
B4B285E01A9A497A00DD603A /* OEXSegmentConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OEXSegmentConfig.h; sourceTree = "<group>"; };
B4B285E11A9A497A00DD603A /* OEXSegmentConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXSegmentConfig.m; sourceTree = "<group>"; };
B4B285E61A9A662600DD603A /* OEXZeroRatingConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OEXZeroRatingConfig.h; sourceTree = "<group>"; };
B4B285E71A9A662600DD603A /* OEXZeroRatingConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXZeroRatingConfig.m; sourceTree = "<group>"; };
B4B285E91A9B182900DD603A /* OEXConfigTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXConfigTests.m; sourceTree = "<group>"; };
B4B285EB1A9B429200DD603A /* OEXNetworkUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OEXNetworkUtility.h; sourceTree = "<group>"; };
B4B285EC1A9B429200DD603A /* OEXNetworkUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXNetworkUtility.m; sourceTree = "<group>"; };
B4B6C80B1A9C7AEA004F0FAF /* OEXPlaceholderTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OEXPlaceholderTextView.h; sourceTree = "<group>"; };
B4B6C80C1A9C7AEA004F0FAF /* OEXPlaceholderTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OEXPlaceholderTextView.m; sourceTree = "<group>"; };
B4B6D5E31A9490E9000F44E8 /* OEXLoginSplashViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OEXLoginSplashViewController.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3403,8 +3397,6 @@
B4B285DE1A9A493A00DD603A /* OEXNewRelicConfig.m */,
B4B285E01A9A497A00DD603A /* OEXSegmentConfig.h */,
B4B285E11A9A497A00DD603A /* OEXSegmentConfig.m */,
B4B285E61A9A662600DD603A /* OEXZeroRatingConfig.h */,
B4B285E71A9A662600DD603A /* OEXZeroRatingConfig.m */,
1A8172521C3C21DE007262AA /* TwitterConfig.swift */,
E0A2461E1D5DA12A0066C766 /* AppStoreConfig.swift */,
E06292741F7BAFFF006D5EFC /* BranchConfig.swift */,
Expand Down Expand Up @@ -3999,8 +3991,6 @@
BE0D4549192DD4F800D720D6 /* OEXNetworkInterface.m */,
9C9B7F711A8CC80E00A857B2 /* OEXURLSessionManager.h */,
9C9B7F721A8CC80E00A857B2 /* OEXURLSessionManager.m */,
B4B285EB1A9B429200DD603A /* OEXNetworkUtility.h */,
B4B285EC1A9B429200DD603A /* OEXNetworkUtility.m */,
9ED168AD1B29A4ED00AA7B5B /* UserAPI.swift */,
7C2DD54E1D4A7901006148E0 /* UserPreference.swift */,
7C2DD5501D4A790F006148E0 /* UserPreferenceAPI.swift */,
Expand Down Expand Up @@ -4930,7 +4920,6 @@
223972E11FE92BB500B2BBEC /* EnrolledTabBarViewController.swift in Sources */,
B4B6D6041A949EFC000F44E8 /* OEXRegistrationRestriction.m in Sources */,
77BFD86A1BB9E15B001D7BE5 /* Strings.swift in Sources */,
B4B285E81A9A662600DD603A /* OEXZeroRatingConfig.m in Sources */,
E0AF4E8E1BFB19CC0083753C /* PassthroughView.swift in Sources */,
BD7C6C3E1DCA32370004D135 /* OEXFonts.swift in Sources */,
E00523431CF81D9800B7F5C3 /* DiscussionBlockViewController.swift in Sources */,
Expand Down Expand Up @@ -4994,7 +4983,6 @@
E09B9D6B1D06C9700080BAE0 /* VersionUpgradeInfoController.swift in Sources */,
9E882B6A1BBA9825007347A2 /* DiscussionTopicCell.swift in Sources */,
B7CCC72C209B16B100A66923 /* ConstraintView.swift in Sources */,
B4B285ED1A9B429200DD603A /* OEXNetworkUtility.m in Sources */,
5FFB73C12849F10D000523BF /* DropDownCell.swift in Sources */,
BE0D454A192DD4F800D720D6 /* OEXNetworkInterface.m in Sources */,
B419295E1A8A3F1900448AD5 /* OEXNetworkManager.m in Sources */,
Expand Down