Skip to content

Commit

Permalink
Merge branch 'develop' into saeed/pre_login_exploration
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedbashir authored Nov 22, 2023
2 parents 38cbec7 + 21e419c commit d72275c
Show file tree
Hide file tree
Showing 23 changed files with 266 additions and 151 deletions.
26 changes: 17 additions & 9 deletions Core/Core.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@
children = (
0770DE5328D0B00C006D8A5D /* swiftgen.yml */,
0770DE0A28D07831006D8A5D /* Core */,
078525AC2B0CBFF4007B4521 /* CoreTests */,
0770DE0928D07831006D8A5D /* Products */,
C9DFE47E699CFFA85A77AF2C /* Pods */,
F1620A3A2C8B0699EAA61B57 /* Frameworks */,
Expand Down Expand Up @@ -522,7 +523,6 @@
0770DE5D28D0B209006D8A5D /* Localizable.strings */,
0770DE5128D0ADFF006D8A5D /* Assets.xcassets */,
071009CF28D1E3A600344290 /* Constants.swift */,
DBFB74502B0CA508004370F9 /* Tests */,
);
path = Core;
sourceTree = "<group>";
Expand Down Expand Up @@ -597,6 +597,22 @@
path = Base;
sourceTree = "<group>";
};
078525AC2B0CBFF4007B4521 /* CoreTests */ = {
isa = PBXGroup;
children = (
078525AD2B0CC004007B4521 /* Configuration */,
);
path = CoreTests;
sourceTree = "<group>";
};
078525AD2B0CC004007B4521 /* Configuration */ = {
isa = PBXGroup;
children = (
DBF6F2472B01E20A0098414B /* ConfigTests.swift */,
);
path = Configuration;
sourceTree = "<group>";
};
C9DFE47E699CFFA85A77AF2C /* Pods */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -632,14 +648,6 @@
path = Config;
sourceTree = "<group>";
};
DBFB74502B0CA508004370F9 /* Tests */ = {
isa = PBXGroup;
children = (
DBF6F2472B01E20A0098414B /* ConfigTests.swift */,
);
path = Tests;
sourceTree = "<group>";
};
F1620A3A2C8B0699EAA61B57 /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/Extensions/UIApplicationExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extension UINavigationController {

let image = CoreAssets.arrowLeft.image
navigationBar.backIndicatorImage = image.withTintColor(CoreAssets.accentColor.color)
navigationBar.tintColor = .clear
navigationBar.backItem?.backButtonTitle = " "
navigationBar.backIndicatorTransitionMaskImage = image.withTintColor(CoreAssets.accentColor.color)
navigationBar.titleTextAttributes = [.foregroundColor: CoreAssets.textPrimary.color]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public extension UINavigationController {
duration: CFTimeInterval = 0.3
) {
addTransition(transitionType: type, duration: duration)
pushViewController(vc, animated: false)
pushViewController(vc, animated: UIAccessibility.isVoiceOverRunning)
}

private func addTransition(
Expand Down
2 changes: 1 addition & 1 deletion Core/Core/Extensions/ViewExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public extension Image {
.scaledToFit()
.frame(height: 24)
.padding(.horizontal, 8)
.padding(.top, topPadding)
.offset(y: topPadding)
.foregroundColor(color)
}
}
Expand Down
4 changes: 4 additions & 0 deletions Core/Core/View/Base/CourseCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public struct CourseCellView: View {
.cornerRadius(8)
.clipShape(RoundedRectangle(cornerRadius: Theme.Shapes.cardImageRadius))
.padding(.leading, 3)
.accessibilityElement(children: .ignore)

VStack(alignment: .leading) {
Text(courseOrg)
Expand Down Expand Up @@ -90,6 +91,8 @@ public struct CourseCellView: View {
.background(Theme.Colors.background)
.opacity(showView ? 1 : 0)
.offset(y: showView ? 0 : 20)
.accessibilityElement(children: .ignore)
.accessibilityLabel(courseName + " " + (type == .dashboard ? (courseEnd == "" ? courseStart : courseEnd) : ""))
.onAppear {
DispatchQueue.main.asyncAfter(deadline: .now()) {
withAnimation(.easeInOut(duration: (index <= 5 ? 0.3 : 0.1))
Expand All @@ -98,6 +101,7 @@ public struct CourseCellView: View {
}
}
}

VStack {
if Int(index) != cellsCount {
Divider()
Expand Down
2 changes: 2 additions & 0 deletions Core/Core/View/Base/NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ public struct NavigationBar: View {
}, label: {
CoreAssets.arrowLeft.swiftUIImage
.backButtonStyle(color: leftButtonColor)
.padding(8)
})
.foregroundColor(Theme.Colors.styledButtonText)

}.frame(minWidth: 0,
maxWidth: .infinity,
alignment: .topLeading)

}
if rightButtonType != nil {
VStack {
Expand Down
2 changes: 2 additions & 0 deletions Core/Core/View/Base/StyledButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public struct StyledButton: View {
.stroke(style: .init(lineWidth: 1, lineCap: .round, lineJoin: .round, miterLimit: 1))
.foregroundColor(isTransparent ? .white : borderColor)
)
.accessibilityElement(children: .ignore)
.accessibilityLabel(title)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public struct CourseContainerView: View {
title: title,
courseID: courseID,
isVideo: false
)
).accessibilityAction {}
.tabItem {
CoreAssets.bookCircle.swiftUIImage.renderingMode(.template)
Text(CourseLocalization.CourseContainer.course)
Expand All @@ -68,7 +68,7 @@ public struct CourseContainerView: View {
title: title,
courseID: courseID,
isVideo: true
)
).accessibilityAction {}
.tabItem {
CoreAssets.videoCircle.swiftUIImage.renderingMode(.template)
Text(CourseLocalization.CourseContainer.videos)
Expand Down
158 changes: 85 additions & 73 deletions Course/Course/Presentation/Outline/CourseOutlineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,13 @@ public struct CourseOutlineView: View {
}
Spacer(minLength: 84)
}
}.frameLimit()
}
.frameLimit()
.onRightSwipeGesture {
viewModel.router.back()
}
}.padding(.top, 8)
.accessibilityAction {}

// MARK: - Offline mode SnackBar
OfflineSnackBarView(
Expand Down Expand Up @@ -208,81 +210,91 @@ struct CourseStructureView: View {
ForEach(chapter.childs, id: \.id) { child in
let sequentialIndex = chapter.childs.firstIndex(where: { $0.id == child.id })
VStack(alignment: .leading) {
Button(
action: {
if let chapterIndex, let sequentialIndex {
viewModel.trackSequentialClicked(child)
viewModel.router.showCourseVerticalView(
courseID: viewModel.courseStructure?.id ?? "",
courseName: viewModel.courseStructure?.displayName ?? "",
title: child.displayName,
chapters: chapters,
chapterIndex: chapterIndex,
sequentialIndex: sequentialIndex
)
}
},
label: {
Group {
if child.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
} else {
child.type.image
}
Text(child.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
.lineLimit(1)
.frame(
maxWidth: idiom == .pad
? proxy.size.width * 0.5
: proxy.size.width * 0.6,
alignment: .leading
HStack {
Button(
action: {
if let chapterIndex, let sequentialIndex {
viewModel.trackSequentialClicked(child)
viewModel.router.showCourseVerticalView(
courseID: viewModel.courseStructure?.id ?? "",
courseName: viewModel.courseStructure?.displayName ?? "",
title: child.displayName,
chapters: chapters,
chapterIndex: chapterIndex,
sequentialIndex: sequentialIndex
)
}.foregroundColor(Theme.Colors.textPrimary)
Spacer()
if let state = viewModel.downloadState[child.id] {
switch state {
case .available:
DownloadAvailableView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
}
},
label: {
Group {
if child.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
} else {
child.type.image
}
Text(child.displayName)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
.lineLimit(1)
.frame(
maxWidth: idiom == .pad
? proxy.size.width * 0.5
: proxy.size.width * 0.6,
alignment: .leading
)
}.foregroundColor(Theme.Colors.textPrimary)
}) .accessibilityElement(children: .ignore)
.accessibilityLabel(child.displayName)
Spacer()
if let state = viewModel.downloadState[child.id] {
switch state {
case .available:
DownloadAvailableView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.download)
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.cancelDownload)
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.deleteDownload)
.onTapGesture {
viewModel.onDownloadViewTap(
chapter: chapter,
blockId: child.id,
state: state
)
}
}
Image(systemName: "chevron.right")
.foregroundColor(Theme.Colors.accentColor)
}).padding(.horizontal, 36)
}
Image(systemName: "chevron.right")
.foregroundColor(Theme.Colors.accentColor)
}
.padding(.horizontal, 36)
.padding(.vertical, 20)
if chapterIndex != chapters.count - 1 {
Divider()
Expand Down
15 changes: 12 additions & 3 deletions Course/Course/Presentation/Outline/CourseVerticalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public struct CourseVerticalView: View {
// MARK: - Lessons list
ForEach(viewModel.verticals, id: \.id) { vertical in
if let index = viewModel.verticals.firstIndex(where: {$0.id == vertical.id}) {
HStack {
Button(action: {
let vertical = viewModel.verticals[index]
if let block = vertical.childs.first {
Expand All @@ -74,7 +75,6 @@ public struct CourseVerticalView: View {
)
}
}, label: {
HStack {
Group {
if vertical.completion == 1 {
CoreAssets.finished.swiftUIImage
Expand All @@ -93,11 +93,15 @@ public struct CourseVerticalView: View {
.multilineTextAlignment(.leading)
.frame(maxWidth: .infinity, alignment: .leading)
}.foregroundColor(Theme.Colors.textPrimary)
}).accessibilityElement(children: .ignore)
.accessibilityLabel(vertical.displayName)
Spacer()
if let state = viewModel.downloadState[vertical.id] {
switch state {
case .available:
DownloadAvailableView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.download)
.onTapGesture {
viewModel.onDownloadViewTap(
blockId: vertical.id,
Expand All @@ -109,6 +113,8 @@ public struct CourseVerticalView: View {
}
case .downloading:
DownloadProgressView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.cancelDownload)
.onTapGesture {
viewModel.onDownloadViewTap(
blockId: vertical.id,
Expand All @@ -120,6 +126,8 @@ public struct CourseVerticalView: View {
}
case .finished:
DownloadFinishedView()
.accessibilityElement(children: .ignore)
.accessibilityLabel(CourseLocalization.Accessibility.deleteDownload)
.onTapGesture {
viewModel.onDownloadViewTap(
blockId: vertical.id,
Expand All @@ -131,7 +139,7 @@ public struct CourseVerticalView: View {
Image(systemName: "chevron.right")
.padding(.vertical, 8)
}
}).padding(.horizontal, 36)
.padding(.horizontal, 36)
.padding(.vertical, 14)
if index != viewModel.verticals.count - 1 {
Divider()
Expand All @@ -143,7 +151,8 @@ public struct CourseVerticalView: View {
}
}
Spacer(minLength: 84)
}.frameLimit()
}.accessibilityAction {}
.frameLimit()
.onRightSwipeGesture {
viewModel.router.back()
}
Expand Down
Loading

0 comments on commit d72275c

Please sign in to comment.