Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Part 3 sync to upstream #533

Merged
merged 4 commits into from
Oct 30, 2024
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
4 changes: 2 additions & 2 deletions Authorization/Authorization/SwiftGen/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public enum AuthLocalization {
public static let ssoHeading = AuthLocalization.tr("Localizable", "SIGN_IN.SSO_HEADING", fallback: "Start today to build your career with confidence")
/// Log in through the national unified sign-on service
public static let ssoLogInSubtitle = AuthLocalization.tr("Localizable", "SIGN_IN.SSO_LOG_IN_SUBTITLE", fallback: "Log in through the national unified sign-on service")
/// Sign IN
public static let ssoLogInTitle = AuthLocalization.tr("Localizable", "SIGN_IN.SSO_LOG_IN_TITLE", fallback: "Sign IN")
/// Sign in
public static let ssoLogInTitle = AuthLocalization.tr("Localizable", "SIGN_IN.SSO_LOG_IN_TITLE", fallback: "Sign in")
/// An integrated set of knowledge and empowerment programs to develop the components of the endowment sector and its workers
public static let ssoSupportingText = AuthLocalization.tr("Localizable", "SIGN_IN.SSO_SUPPORTING_TEXT", fallback: "An integrated set of knowledge and empowerment programs to develop the components of the endowment sector and its workers")
/// Welcome back! Sign in to access your courses.
Expand Down
2 changes: 1 addition & 1 deletion Core/Core.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2365,7 +2365,7 @@
repositoryURL = "https://github.com/facebook/facebook-ios-sdk";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 16.3.1;
minimumVersion = 17.4.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
5 changes: 4 additions & 1 deletion Core/Core/Domain/Model/CourseBlockModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public struct CourseVertical: Identifiable, Hashable {
public let type: BlockType
public let completion: Double
public var childs: [CourseBlock]
public var webUrl: String

public var isDownloadable: Bool {
return childs.first(where: { $0.isDownloadable }) != nil
Expand All @@ -178,7 +179,8 @@ public struct CourseVertical: Identifiable, Hashable {
displayName: String,
type: BlockType,
completion: Double,
childs: [CourseBlock]
childs: [CourseBlock],
webUrl: String
) {
self.blockId = blockId
self.id = id
Expand All @@ -187,6 +189,7 @@ public struct CourseVertical: Identifiable, Hashable {
self.type = type
self.completion = completion
self.childs = childs
self.webUrl = webUrl
}
}

Expand Down
8 changes: 4 additions & 4 deletions Course/Course.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
02454CA02A2618E70043052A /* YouTubeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454C9F2A2618E70043052A /* YouTubeView.swift */; };
02454CA22A26190A0043052A /* EncodedVideoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA12A26190A0043052A /* EncodedVideoView.swift */; };
02454CA42A26193F0043052A /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA32A26193F0043052A /* WebView.swift */; };
02454CA62A26196C0043052A /* UnknownView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA52A26196C0043052A /* UnknownView.swift */; };
02454CA62A26196C0043052A /* NotAvailableOnMobileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA52A26196C0043052A /* NotAvailableOnMobileView.swift */; };
02454CA82A2619890043052A /* DiscussionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA72A2619890043052A /* DiscussionView.swift */; };
02454CAA2A2619B40043052A /* LessonProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02454CA92A2619B40043052A /* LessonProgressView.swift */; };
0248C92729C097EB00DC8402 /* CourseVerticalViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0248C92629C097EB00DC8402 /* CourseVerticalViewModel.swift */; };
Expand Down Expand Up @@ -134,7 +134,7 @@
02454C9F2A2618E70043052A /* YouTubeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YouTubeView.swift; sourceTree = "<group>"; };
02454CA12A26190A0043052A /* EncodedVideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EncodedVideoView.swift; sourceTree = "<group>"; };
02454CA32A26193F0043052A /* WebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
02454CA52A26196C0043052A /* UnknownView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnknownView.swift; sourceTree = "<group>"; };
02454CA52A26196C0043052A /* NotAvailableOnMobileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotAvailableOnMobileView.swift; sourceTree = "<group>"; };
02454CA72A2619890043052A /* DiscussionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiscussionView.swift; sourceTree = "<group>"; };
02454CA92A2619B40043052A /* LessonProgressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LessonProgressView.swift; sourceTree = "<group>"; };
0248C92629C097EB00DC8402 /* CourseVerticalViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseVerticalViewModel.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -285,7 +285,7 @@
02454C9F2A2618E70043052A /* YouTubeView.swift */,
02454CA12A26190A0043052A /* EncodedVideoView.swift */,
02454CA32A26193F0043052A /* WebView.swift */,
02454CA52A26196C0043052A /* UnknownView.swift */,
02454CA52A26196C0043052A /* NotAvailableOnMobileView.swift */,
02454CA72A2619890043052A /* DiscussionView.swift */,
02454CA92A2619B40043052A /* LessonProgressView.swift */,
BAD9CA2C2B2736BB00DE790A /* LessonLineProgressView.swift */,
Expand Down Expand Up @@ -951,7 +951,7 @@
BA58CF5D2B3D804D005B102E /* CourseStorage.swift in Sources */,
067B7B502BED339200D1768F /* PlayerControllerProtocol.swift in Sources */,
067B7B4E2BED339200D1768F /* PlayerTrackerProtocol.swift in Sources */,
02454CA62A26196C0043052A /* UnknownView.swift in Sources */,
02454CA62A26196C0043052A /* NotAvailableOnMobileView.swift in Sources */,
0766DFD0299AB29000EBEF6A /* PlayerViewController.swift in Sources */,
022C64DC29ACFDEE000F532B /* Data_HandoutsResponse.swift in Sources */,
022C64D829ACEC48000F532B /* HandoutsView.swift in Sources */,
Expand Down
6 changes: 4 additions & 2 deletions Course/Course/Data/CourseRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ public class CourseRepository: CourseRepositoryProtocol {
displayName: sequential.displayName,
type: BlockType(rawValue: sequential.type) ?? .unknown,
completion: sequential.completion ?? 0,
childs: childs
childs: childs,
webUrl: sequential.webUrl
)
}

Expand Down Expand Up @@ -440,7 +441,8 @@ And there are various ways of describing it-- call it oral poetry or
displayName: sequential.displayName,
type: BlockType(rawValue: sequential.type) ?? .unknown,
completion: sequential.completion ?? 0,
childs: childs
childs: childs,
webUrl: sequential.webUrl
)
}

Expand Down
3 changes: 2 additions & 1 deletion Course/Course/Domain/CourseInteractor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ public class CourseInteractor: CourseInteractorProtocol {
displayName: vertical.displayName,
type: vertical.type,
completion: vertical.completion,
childs: newChilds
childs: newChilds,
webUrl: vertical.webUrl
)
}

Expand Down
4 changes: 4 additions & 0 deletions Course/Course/Presentation/CourseRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public protocol CourseRouter: BaseRouter {
)

func showDatesAndCalendar()

func showGatedContentError(url: String)
}

// Mark - For testing and SwiftUI preview
Expand Down Expand Up @@ -122,5 +124,7 @@ public class CourseRouterMock: BaseRouterMock, CourseRouter {
) {}

public func showDatesAndCalendar() {}

public func showGatedContentError(url: String) {}
}
#endif
3 changes: 2 additions & 1 deletion Course/Course/Presentation/Outline/ContinueWithView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ struct ContinueWithView_Previews: PreviewProvider {
displayName: "Second Unit",
type: .vertical,
completion: 1,
childs: blocks
childs: blocks,
webUrl: ""
)
) { }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,10 @@ struct CourseVerticalView_Previews: PreviewProvider {
displayName: "Vertical",
type: .vertical,
completion: 0,
childs: [])
],
childs: [],
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
assignmentType: "Advanced Assessment Tools",
numPointsEarned: 1,
Expand Down
20 changes: 14 additions & 6 deletions Course/Course/Presentation/Subviews/CustomDisclosureGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ struct CustomDisclosureGroup: View {
guard let chapterIndex = chapterIndex else { return }
guard let sequentialIndex else { return }
guard let courseVertical = sequential.childs.first else { return }
guard let block = courseVertical.childs.first else { return }
guard let block = courseVertical.childs.first else {
viewModel.router.showGatedContentError(url: courseVertical.webUrl)
return
}

viewModel.trackSequentialClicked(sequential)
if viewModel.config.uiComponents.courseDropDownNavigationEnabled {
Expand Down Expand Up @@ -279,7 +282,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider {
displayName: "Vertical 1",
type: .vertical,
completion: 0,
childs: []
childs: [],
webUrl: ""
),
CourseVertical(
blockId: "1-1-2",
Expand All @@ -288,7 +292,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider {
displayName: "Vertical 2",
type: .vertical,
completion: 1.0,
childs: []
childs: [],
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
Expand All @@ -312,7 +317,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider {
displayName: "Vertical 3",
type: .vertical,
completion: 1.0,
childs: []
childs: [],
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
Expand Down Expand Up @@ -344,7 +350,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider {
displayName: "Vertical 4",
type: .vertical,
completion: 1.0,
childs: []
childs: [],
webUrl: ""
),
CourseVertical(
blockId: "2-1-2",
Expand All @@ -353,7 +360,8 @@ struct CustomDisclosureGroup_Previews: PreviewProvider {
displayName: "Vertical 5",
type: .vertical,
completion: 1.0,
childs: []
childs: [],
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
Expand Down
10 changes: 5 additions & 5 deletions Course/Course/Presentation/Unit/CourseUnitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,8 @@ public struct CourseUnitView: View {
case .unknown(let url):
if index >= viewModel.index - 1 && index <= viewModel.index + 1 {
if viewModel.connectivity.isInternetAvaliable {
UnknownView(url: url, viewModel: viewModel)
NotAvailableOnMobileView(url: url)
.frameLimit(width: reader.size.width)
Spacer()
.frame(minHeight: 100)
} else {
OfflineContentView(
isDownloadable: false
Expand Down Expand Up @@ -539,7 +537,8 @@ struct CourseUnitView_Previews: PreviewProvider {
displayName: "6",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
Expand Down Expand Up @@ -572,7 +571,8 @@ struct CourseUnitView_Previews: PreviewProvider {
displayName: "4",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
)
],
sequentialProgress: SequentialProgress(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ struct CourseUnitDropDownCell_Previews: PreviewProvider {
multiDevice: true,
offlineDownload: nil
)
]
],
webUrl: ""
)

CourseUnitDropDownCell(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
displayName: "First Unit",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "2",
Expand All @@ -128,7 +129,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
displayName: "Second Unit",
type: .vertical,
completion: 1,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "3",
Expand All @@ -137,7 +139,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
displayName: "Third Unit",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "4",
Expand All @@ -146,7 +149,8 @@ struct CourseUnitDropDownList_Previews: PreviewProvider {
displayName: "Fourth Unit",
type: .vertical,
completion: 1,
childs: blocks
childs: blocks,
webUrl: ""
)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
displayName: "First Unit",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "2",
Expand All @@ -144,7 +145,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
displayName: "Second Unit",
type: .vertical,
completion: 1,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "3",
Expand All @@ -153,7 +155,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
displayName: "Third Unit",
type: .vertical,
completion: 0,
childs: blocks
childs: blocks,
webUrl: ""
),
CourseVertical(
blockId: "4",
Expand All @@ -162,7 +165,8 @@ struct CourseUnitVerticalsDropdownView_Previews: PreviewProvider {
displayName: "Fourth Unit",
type: .vertical,
completion: 1,
childs: blocks
childs: blocks,
webUrl: ""
)
]

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// NotAvailableOnMobileView.swift
// Course
//
// Created by  Stepanok Ivan on 30.05.2023.
//

import SwiftUI
import Core
import Theme

public struct NotAvailableOnMobileView: View {
let url: String

public init(url: String) {
self.url = url
}

public var body: some View {
ZStack(alignment: .center) {
VStack(spacing: 10) {
Spacer()
CoreAssets.notAvaliable.swiftUIImage
Text(CourseLocalization.NotAvaliable.title)
.font(Theme.Fonts.titleLarge)
.multilineTextAlignment(.center)
.padding(.top, 40)
Text(CourseLocalization.NotAvaliable.description)
.font(Theme.Fonts.bodyLarge)
.multilineTextAlignment(.center)
.padding(.top, 12)
StyledButton(CourseLocalization.NotAvaliable.button, action: {
if let url = URL(string: url), UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link does not open on the simulator and iOS 18 device.

BUG IN CLIENT OF UIKIT: The caller of UIApplication.openURL(:) needs to migrate to the non-deprecated UIApplication.open(:options:completionHandler:). Force returning false (NO).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch @IvanStepanok !
This is caused by a Facebook SDK bug. To solve the problem, increase its version. Please re-check
Thank you

}
})
.frame(width: 215)
.padding(.top, 40)
Spacer()
}
.padding(24)
}
.navigationBarHidden(false)
}
}
Loading
Loading