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

Commit

Permalink
Merge branch 'master' into app_nav
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored Aug 4, 2023
2 parents 2c13e77 + fa87add commit 2e737f7
Show file tree
Hide file tree
Showing 51 changed files with 79 additions and 1,260 deletions.
1 change: 1 addition & 0 deletions Source/CoursesContainerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ class CoursesContainerViewController: UICollectionViewController, ScrollableDele
let footerView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: EnrolledCoursesFooterView.identifier, for: indexPath) as! EnrolledCoursesFooterView
footerView.findCoursesAction = { [weak self] in
self?.environment.router?.showCourseCatalog(fromController: self, bottomBar: nil)
self?.environment.analytics.trackUserFindsCourses(self?.courses.count ?? 0)
}
return footerView
}
Expand Down
20 changes: 12 additions & 8 deletions Source/CutomePlayer/OEXVideoPlayerSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Foundation

private let cellId = "CustomCell"
let captionLanguageNone = "none"

public typealias RowType = (title: String, value: Any)
public struct OEXVideoPlayerSetting {
Expand Down Expand Up @@ -66,20 +67,23 @@ class VideoPlayerSettings : NSObject {
rows.append(item)
}
}

if !rows.isEmpty {
rows.append(RowType(title: Strings.none, value: captionLanguageNone))
}

let cc = OEXVideoPlayerSetting(title: Strings.videoSettingClosedCaptions, rows: rows, isSelected: { (row) -> Bool in
var selected = false
if let selectedLanguage:String = OEXInterface.getCCSelectedLanguage() {
let lang = rows[row].value as! String
selected = selectedLanguage == lang

var selectedLanguage = OEXInterface.getCCSelectedLanguage() ?? captionLanguageNone
if selectedLanguage.isEmpty {
selectedLanguage = captionLanguageNone
}
let lang = rows[row].value as? String ?? captionLanguageNone
selected = selectedLanguage == lang
return selected
}) {[weak self] value in
var language : String = value as! String
if language == OEXInterface.getCCSelectedLanguage() && language != "" {
language = ""
}
self?.delegate?.setCaption(language: language)
self?.delegate?.setCaption(language: value as? String ?? "")
}
return [cc, speeds]
} else {
Expand Down
12 changes: 11 additions & 1 deletion Source/CutomePlayer/TranscriptManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,17 @@ class TranscriptManager: NSObject {

private var captionURL: String {
var url: String = ""
if let ccSelectedLanguage = OEXInterface.getCCSelectedLanguage(), let transcriptURL = video.summary?.transcripts?[ccSelectedLanguage] as? String, !ccSelectedLanguage.isEmpty, !transcriptURL.isEmpty{
let devicelangue = Locale.current.languageCode ?? ""

if let ccSelectedLanguage = OEXInterface.getCCSelectedLanguage(), let transcriptURL = video.summary?.transcripts?[ccSelectedLanguage] as? String, !ccSelectedLanguage.isEmpty, !transcriptURL.isEmpty, ccSelectedLanguage != captionLanguageNone {
url = transcriptURL
}
else if let transcriptURL = video.summary?.transcripts?[devicelangue] as? String,!devicelangue.isEmpty, !transcriptURL.isEmpty {
// if no language is selected, give preference to device language
url = transcriptURL
}
else if let transcriptURL = video.summary?.transcripts?["en"] as? String, !transcriptURL.isEmpty {
// if no language is selected, and transcripts are not available for device langue, look for english
url = transcriptURL
}
else if let transcriptURL = video.summary?.transcripts?.values.first as? String {
Expand Down
9 changes: 7 additions & 2 deletions Source/CutomePlayer/VideoPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ class VideoPlayer: UIViewController,VideoPlayerControlsDelegate,TranscriptManage
transcriptManager = TranscriptManager(environment: environment, video: video)
transcriptManager?.delegate = self

if let ccSelectedLanguage = OEXInterface.getCCSelectedLanguage(), let transcriptURL = video.summary?.transcripts?[ccSelectedLanguage] as? String, !ccSelectedLanguage.isEmpty, !transcriptURL.isEmpty {
if let ccSelectedLanguage = OEXInterface.getCCSelectedLanguage(), let transcriptURL = video.summary?.transcripts?[ccSelectedLanguage] as? String, !ccSelectedLanguage.isEmpty, !transcriptURL.isEmpty, ccSelectedLanguage != captionLanguageNone {
controls?.activateSubTitles()
}
}
Expand Down Expand Up @@ -660,9 +660,14 @@ class VideoPlayer: UIViewController,VideoPlayerControlsDelegate,TranscriptManage
}

func captionUpdate(playerControls: VideoPlayerControls, language: String) {
let alreadySelectedLanguage = OEXInterface.getCCSelectedLanguage() ?? ""
OEXInterface.setCCSelectedLanguage(language)
if language.isEmpty {

if alreadySelectedLanguage == language { return }

if language == captionLanguageNone {
playerControls.deAvtivateSubTitles()
transcriptManager?.loadTranscripts()
}
else {
transcriptManager?.loadTranscripts()
Expand Down
3 changes: 0 additions & 3 deletions Source/EnrolledTabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,6 @@ class EnrolledTabBarViewController: UITabBarController, InterfaceOrientationOver
extension EnrolledTabBarViewController: UITabBarControllerDelegate {
func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) {
navigationItem.title = viewController.navigationItem.title
if TabBarOptions.options[tabBarController.selectedIndex] == .CourseCatalog {
environment.analytics.trackUserFindsCourses()
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/OEXAnalytics.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN

- (void)trackUserDoesNotHaveAccount;

- (void)trackUserFindsCourses;
- (void)trackUserFindsCourses:(NSInteger) enrolledCounses;

//Discussion search screen event
- (void) trackDiscussionSearchScreenWithName:(NSString *) screenName courseId:(NSString *) courseID value:(nullable NSString *) value searchQuery:(NSString *) query;
Expand Down
4 changes: 2 additions & 2 deletions Source/OEXAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ - (void)trackUserDoesNotHaveAccount {
[self trackEvent:event forComponent:nil withInfo:@{}];
}

- (void)trackUserFindsCourses {
- (void)trackUserFindsCourses:(NSInteger) enrolledCounses {
OEXAnalyticsEvent* event = [[OEXAnalyticsEvent alloc] init];
event.name = value_find_courses;
event.displayName = @"Find Courses Clicked";
event.category = OEXAnalyticsCategoryUserEngagement;
event.label = @"course-discovery";
[self trackEvent:event forComponent:nil withInfo:@{}];
[self trackEvent:event forComponent:nil withInfo:@{@"enrolled_courses_count": [NSNumber numberWithInteger:enrolledCounses]}];
}

#pragma mark- Discussion
Expand Down
4 changes: 0 additions & 4 deletions Source/OEXAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N
});
return YES;
}
if([[NSProcessInfo processInfo].arguments containsObject:@"-END_TO_END_TEST"]) {
[[[OEXSession alloc] init] closeAndClearSession];
[OEXFileUtility nukeUserData];
}
#endif

// logout user automatically if server changed
Expand Down
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.

1 change: 0 additions & 1 deletion Source/OEXRouter+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,6 @@ extension OEXRouter {
} else {
showControllerFromStartupScreen(controller: controller)
}
self.environment.analytics.trackUserFindsCourses()
}

func discoveryViewController(bottomBar: UIView? = nil, searchQuery: String? = nil) -> UIViewController? {
Expand Down
6 changes: 5 additions & 1 deletion Source/OEXRouter.m
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ - (void)presentViewController:(UIViewController*)controller fromController:(UIVi
}

- (void)showLoggedOutScreen {
[self showLoginScreenFromController:nil completion:nil];
__block OEXRouter *blockSelf = self;
[self showLoginScreenFromController:nil completion:^{
[blockSelf showSplash];
blockSelf.logistrationCompletion = nil;
}];

}

Expand Down
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.

4 changes: 3 additions & 1 deletion Source/ValuePropCourseCardView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,15 @@ class ValuePropCourseCardView: UIView {

titleLabel.snp.makeConstraints { make in
make.leading.equalTo(lockImageView.snp.trailing).offset(StandardVerticalMargin)
make.trailing.lessThanOrEqualTo(chevronImageView).inset(StandardHorizontalMargin)
make.trailing.equalTo(chevronImageView.snp.leading).inset(StandardHorizontalMargin)
make.centerY.equalTo(lockImageView)
}

chevronImageView.snp.makeConstraints { make in
make.trailing.equalTo(containerView).inset(StandardHorizontalMargin)
make.centerY.equalTo(lockImageView)
make.height.equalTo(20)
make.width.equalTo(20)
}

tapButton.snp.makeConstraints { make in
Expand Down
2 changes: 2 additions & 0 deletions Source/ar.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/de.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/en.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/es-419.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/fr.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/he.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/ja.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/pt-BR.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/tr.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/vi.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
2 changes: 2 additions & 0 deletions Source/zh-Hans.lproj/Localizable-2.strings
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,5 @@
"DASHBOARD.RESUME_COURSE"="Resume course";
/* Course outline header gated content title */
"COURSE_OUTLINE_HEADER.GATED_CONTENT_TITLE"="Some content in this part of the course is locked for upgraded users only.";
/* None option in the caption list to de select caption language*/
"NONE"="None";
Loading

0 comments on commit 2e737f7

Please sign in to comment.