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 Incorrect color for info message about screen rotation #27

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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.667",
"red" : "0.259"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.584",
"red" : "0.000"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
1 change: 1 addition & 0 deletions Core/Core/SwiftGen/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public enum CoreAssets {
public static let shadowColor = ColorAsset(name: "ShadowColor")
public static let snackbarErrorColor = ColorAsset(name: "SnackbarErrorColor")
public static let snackbarErrorTextColor = ColorAsset(name: "SnackbarErrorTextColor")
public static let snackbarInfoAlert = ColorAsset(name: "SnackbarInfoAlert")
public static let styledButtonBackground = ColorAsset(name: "StyledButtonBackground")
public static let styledButtonText = ColorAsset(name: "StyledButtonText")
public static let textPrimary = ColorAsset(name: "TextPrimary")
Expand Down
3 changes: 2 additions & 1 deletion Core/Core/View/Base/CourseButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public struct CourseButton: View {
public var body: some View {
HStack {
if isCompleted {
Image(systemName: "checkmark.circle.fill")
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
} else {
image
Expand Down
145 changes: 77 additions & 68 deletions Course/Course/Presentation/Outline/CourseBlocksView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public struct CourseBlocksView: View {
private var title: String
@ObservedObject
private var viewModel: CourseBlocksViewModel

private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }

public init(title: String,
viewModel: CourseBlocksViewModel) {
self.title = title
Expand All @@ -26,78 +27,86 @@ public struct CourseBlocksView: View {
ZStack(alignment: .top) {

// MARK: - Page name
VStack(alignment: .center) {
NavigationBar(title: title,
leftButtonAction: { viewModel.router.back() })

// MARK: - Page Body
ScrollView {
VStack(alignment: .leading) {
// MARK: - Lessons list
ForEach(viewModel.blocks, id: \.id) { block in
let index = viewModel.blocks.firstIndex(where: { $0.id == block.id })
Button(action: {
viewModel.router.showCourseUnit(blockId: block.id,
courseID: block.blockId,
sectionName: title,
blocks: viewModel.blocks)
}, label: {
HStack {
Group {
if block.completion == 1 {
CoreAssets.finished.swiftUIImage
} else {
block.type.image
}
Text(block.displayName)
.multilineTextAlignment(.leading)
.font(Theme.Fonts.titleMedium)
.multilineTextAlignment(.leading)
}.foregroundColor(CoreAssets.textPrimary.swiftUIColor)
Spacer()
if let state = viewModel.downloadState[block.id] {
switch state {
case .available:
DownloadAvailableView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
GeometryReader { proxy in
VStack(alignment: .center) {
NavigationBar(title: title,
leftButtonAction: { viewModel.router.back() })

// MARK: - Page Body
ScrollView {
VStack(alignment: .leading) {
// MARK: - Lessons list
ForEach(viewModel.blocks, id: \.id) { block in
let index = viewModel.blocks.firstIndex(where: { $0.id == block.id })
Button(action: {
viewModel.router.showCourseUnit(blockId: block.id,
courseID: block.blockId,
sectionName: title,
blocks: viewModel.blocks)
}, label: {
HStack {
Group {
if block.completion == 1 {
CoreAssets.finished.swiftUIImage
.renderingMode(.template)
.foregroundColor(.accentColor)
} else {
block.type.image
}
Text(block.displayName)
.multilineTextAlignment(.leading)
.font(Theme.Fonts.titleMedium)
.lineLimit(1)
.frame(maxWidth: idiom == .pad
? proxy.size.width * 0.5
: proxy.size.width * 0.6,
alignment: .leading)
}.foregroundColor(CoreAssets.textPrimary.swiftUIColor)
Spacer()
if let state = viewModel.downloadState[block.id] {
switch state {
case .available:
DownloadAvailableView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
.onForeground {
viewModel.onForeground()
}
case .downloading:
DownloadProgressView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
.onBackground {
viewModel.onBackground()
}
case .finished:
DownloadFinishedView()
.onTapGesture {
viewModel.onDownloadViewTap(blockId: block.id, state: state)
}
}
}
Image(systemName: "chevron.right")
.padding(.vertical, 8)
}
Image(systemName: "chevron.right")
.padding(.vertical, 8)
}).padding(.horizontal, 36)
.padding(.vertical, 14)
if index != viewModel.blocks.count - 1 {
Divider()
.frame(height: 1)
.overlay(CoreAssets.cardViewStroke.swiftUIColor)
.padding(.horizontal, 24)
}
}).padding(.horizontal, 36)
.padding(.vertical, 14)
if index != viewModel.blocks.count - 1 {
Divider()
.frame(height: 1)
.overlay(CoreAssets.cardViewStroke.swiftUIColor)
.padding(.horizontal, 24)
}
}
}
Spacer(minLength: 84)
}.frameLimit()
.onRightSwipeGesture {
viewModel.router.back()
}
Spacer(minLength: 84)
}.frameLimit()
.onRightSwipeGesture {
viewModel.router.back()
}
}
}

// MARK: - Offline mode SnackBar
Expand Down
6 changes: 6 additions & 0 deletions Course/Course/Presentation/Outline/CourseOutlineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public struct CourseOutlineView: View {
private let isVideo: Bool

@State private var openCertificateView: Bool = false
private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom }

public init(
viewModel: CourseContainerViewModel,
Expand Down Expand Up @@ -117,6 +118,11 @@ public struct CourseOutlineView: View {
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(CoreAssets.textPrimary.swiftUIColor)
Spacer()
if let state = viewModel.downloadState[child.id] {
Expand Down
Loading