From 483497bef87b0a4912f19fde4b4f2519669ae361 Mon Sep 17 00:00:00 2001 From: Ivan Magda Date: Thu, 28 Sep 2023 12:31:49 +0400 Subject: [PATCH 1/2] iOS 17 support (#676) ^ALTAPPS-827 --- .github/actions/setup-ios/action.yml | 4 +- iosHyperskillApp/Podfile | 4 +- iosHyperskillApp/Podfile.lock | 2 +- .../CodeEditor/View/SwiftUI/CodeEditor.swift | 20 ++--- .../View/SwiftUI/LatexView.swift | 22 ++--- .../Models/Constants/Images/Images.swift | 8 +- .../Sources/Modules/App/AppView.swift | 8 +- .../Views/AuthCredentialsErrorView.swift | 9 +- .../Views/AuthCredentialsFormView.swift | 59 ++++++------ .../Views/AuthCredentialsView.swift | 28 +++--- .../ProfileStatisticsItemView.swift | 46 +++++----- .../Statistics/ProfileStatisticsView.swift | 24 +++-- .../Views/ProgressScreenCardView.swift | 90 +++++++++---------- ...ressScreenProjectProgressContentView.swift | 4 +- ...ogressScreenTrackProgressContentView.swift | 56 ++++++------ ...StudyPlanSectionHeaderStatisticsView.swift | 12 +-- ...ackSelectionDetailsTrackOverviewView.swift | 36 ++++---- .../Views/SwiftUI/HyperskillLogoView.swift | 9 +- shared/build.gradle.kts | 3 + 19 files changed, 213 insertions(+), 231 deletions(-) diff --git a/.github/actions/setup-ios/action.yml b/.github/actions/setup-ios/action.yml index bbd4b1907f..f03086bdef 100644 --- a/.github/actions/setup-ios/action.yml +++ b/.github/actions/setup-ios/action.yml @@ -18,9 +18,9 @@ runs: using: "composite" steps: - name: Setup Xcode version - uses: maxim-lobanov/setup-xcode@v1.5.1 + uses: maxim-lobanov/setup-xcode@v1.6.0 with: - xcode-version: '14.3.1' + xcode-version: '15.0.0' - name: Homebrew install git-crypt run: brew install git-crypt diff --git a/iosHyperskillApp/Podfile b/iosHyperskillApp/Podfile index 842e287791..323ab9137a 100644 --- a/iosHyperskillApp/Podfile +++ b/iosHyperskillApp/Podfile @@ -44,8 +44,8 @@ end post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| - if config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"].to_f < 11.0 - config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "11.0" + if config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"].to_f < 12.0 + config.build_settings["IPHONEOS_DEPLOYMENT_TARGET"] = "12.0" end end diff --git a/iosHyperskillApp/Podfile.lock b/iosHyperskillApp/Podfile.lock index 259dcdf818..f1f105efc6 100644 --- a/iosHyperskillApp/Podfile.lock +++ b/iosHyperskillApp/Podfile.lock @@ -217,6 +217,6 @@ SPEC CHECKSUMS: SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 SwiftLint: 6b0cf1f4d619808dbc16e4fab064ce6fc79f090b -PODFILE CHECKSUM: 07869e3e16335ad018705634d83de85353158df1 +PODFILE CHECKSUM: 8c215b2f5d2b9d8faef86f0aa4f4ff03533ae1e7 COCOAPODS: 1.13.0 diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/CodeEditor/View/SwiftUI/CodeEditor.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/CodeEditor/View/SwiftUI/CodeEditor.swift index c1a2713ea7..4481113059 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/CodeEditor/View/SwiftUI/CodeEditor.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/CodeEditor/View/SwiftUI/CodeEditor.swift @@ -158,15 +158,13 @@ private extension CodeEditorView.Appearance { } } -// MARK: - CodeEditor_Previews: PreviewProvider - - -struct CodeEditor_Previews: PreviewProvider { - static var previews: some View { - CodeEditor( - code: .constant(CodeLanguageSamples.sample(for: .java)), - language: .java - ) - .frame(height: 236) - .frame(maxWidth: .infinity) - } +// MARK: - Preview - + +#Preview { + CodeEditor( + code: .constant(CodeLanguageSamples.sample(for: .java)), + language: .java + ) + .frame(height: 236) + .frame(maxWidth: .infinity) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/ContentProcessor/View/SwiftUI/LatexView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/ContentProcessor/View/SwiftUI/LatexView.swift index 9feba9dd32..f01261a7a8 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/ContentProcessor/View/SwiftUI/LatexView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Frameworks/ContentProcessor/View/SwiftUI/LatexView.swift @@ -39,14 +39,16 @@ struct LatexView: View { } } -struct LatexView_Previews: PreviewProvider { - static var previews: some View { - Group { - LatexView(text: .constant("Plain text")) - - LatexView(text: .constant("Rich text!!!")) - } - .previewLayout(.sizeThatFits) - .padding() - } +#Preview("Plain text") { + LatexView( + text: .constant("Plain text") + ) + .padding() +} + +#Preview("Rich text") { + LatexView( + text: .constant("Rich text!!!") + ) + .padding() } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Images/Images.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Images/Images.swift index 41014f4aee..4246058cb2 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Images/Images.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Images/Images.swift @@ -1,17 +1,11 @@ import Foundation +@available(*, deprecated, message: "Use Xcode 15 image resources instead") enum Images { // MARK: - Common - enum Common { - static let hyperskillLogo = "hyperskill-logo" - static let skip = "skip" - static let trophy = "trophy" - static let hammer = "hammer" - - static let topic = "topic" - static let project = "project" } // MARK: - TabBar - diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppView.swift index dbbfdbc733..12b7991796 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppView.swift @@ -115,10 +115,8 @@ extension AppView: ProgrammaticallyInitializableViewProtocol { } } -struct AppView_Previews: PreviewProvider { - static var previews: some View { - UIKitViewControllerPreview { - AppAssembly(pushNotificationData: nil).makeModule() - } +#Preview { + UIKitViewControllerPreview { + AppAssembly(pushNotificationData: nil).makeModule() } } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsErrorView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsErrorView.swift index f4339362de..b1b7c1a97b 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsErrorView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsErrorView.swift @@ -14,8 +14,9 @@ struct AuthCredentialsErrorView: View { } } -struct AuthEmailErrorView_Previews: PreviewProvider { - static var previews: some View { - AuthCredentialsErrorView(message: "Error message") - } +#Preview { + AuthCredentialsErrorView( + message: "Error message" + ) + .padding() } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsFormView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsFormView.swift index d29de23a22..682f5e0329 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsFormView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsFormView.swift @@ -97,36 +97,35 @@ struct AuthCredentialsFormView: View { } } -struct AuthEmailFormView_Previews: PreviewProvider { - static var previews: some View { - Group { - Group { - AuthCredentialsFormView( - emailText: .constant(""), - passwordText: .constant("") - ) - - AuthCredentialsFormView( - emailText: .constant(""), - passwordText: .constant(""), - errorMessage: "error" - ) - } - - Group { - AuthCredentialsFormView( - emailText: .constant(""), - passwordText: .constant("") - ) +#Preview("Light") { + Group { + AuthCredentialsFormView( + emailText: .constant(""), + passwordText: .constant("") + ) + + AuthCredentialsFormView( + emailText: .constant(""), + passwordText: .constant(""), + errorMessage: "error" + ) + } + .padding(.horizontal) +} - AuthCredentialsFormView( - emailText: .constant(""), - passwordText: .constant(""), - errorMessage: "error" - ) - } - .preferredColorScheme(.dark) - } - .padding(.horizontal) +#Preview("Dark") { + Group { + AuthCredentialsFormView( + emailText: .constant(""), + passwordText: .constant("") + ) + + AuthCredentialsFormView( + emailText: .constant(""), + passwordText: .constant(""), + errorMessage: "error" + ) } + .preferredColorScheme(.dark) + .padding(.horizontal) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsView.swift index 86a2687110..801201e9e9 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthCredentialsView.swift @@ -91,18 +91,18 @@ struct AuthCredentialsView: View { } } -struct AuthCredentialsView_Previews: PreviewProvider { - static var previews: some View { - Group { - AuthCredentialsAssembly().makeModule() - .previewDevice(PreviewDevice(rawValue: "iPhone 13 Pro")) - - AuthCredentialsAssembly().makeModule() - .previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)")) - .preferredColorScheme(.dark) - - AuthCredentialsAssembly().makeModule() - .previewDevice(PreviewDevice(rawValue: "iPad (9th generation)")) - } - } +#Preview("iPhone 15 Pro") { + AuthCredentialsAssembly().makeModule() + .previewDevice(PreviewDevice(rawValue: "iPhone 15 Pro")) +} + +#Preview("iPhone SE (Dark)") { + AuthCredentialsAssembly().makeModule() + .previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)")) + .preferredColorScheme(.dark) +} + +#Preview("iPad") { + AuthCredentialsAssembly().makeModule() + .previewDevice(PreviewDevice(rawValue: "iPad (10th generation)")) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsItemView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsItemView.swift index e882823769..ac22947f57 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsItemView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsItemView.swift @@ -41,13 +41,13 @@ struct ProfileStatisticsItemView: View { @ViewBuilder private var image: some View { switch icon.renderingMode { case .original: - Image(icon.imageName) + Image(icon.imageResource) .resizable() .renderingMode(.original) .aspectRatio(contentMode: .fit) .frame(widthHeight: appearance.iconWidthHeight) case .circleBackground: - Image(icon.imageName) + Image(icon.imageResource) .resizable() .renderingMode(.template) .aspectRatio(contentMode: .fit) @@ -60,7 +60,7 @@ struct ProfileStatisticsItemView: View { } struct Icon { - let imageName: String + let imageResource: ImageResource let renderingMode: RenderingMode enum RenderingMode { @@ -70,28 +70,26 @@ struct ProfileStatisticsItemView: View { } } -struct ProfileStatisticsItemView_Previews: PreviewProvider { - static var previews: some View { - Group { - ProfileStatisticsItemView( - icon: .init(imageName: Images.Common.project, renderingMode: .circleBackground), - title: "3", - subtitle: Strings.Profile.Statistics.passedProjects - ) +#Preview { + Group { + ProfileStatisticsItemView( + icon: .init(imageResource: .project, renderingMode: .circleBackground), + title: "3", + subtitle: Strings.Profile.Statistics.passedProjects + ) - ProfileStatisticsItemView( - icon: .init(imageName: Images.Track.track, renderingMode: .circleBackground), - title: "3", - subtitle: Strings.Profile.Statistics.passedTracks - ) + ProfileStatisticsItemView( + icon: .init(imageResource: .track, renderingMode: .circleBackground), + title: "3", + subtitle: Strings.Profile.Statistics.passedTracks + ) - ProfileStatisticsItemView( - icon: .init(imageName: Images.StepQuiz.ProblemOfDaySolvedModal.gemsBadge, renderingMode: .original), - title: "3456", - subtitle: Strings.Profile.Statistics.hypercoinsBalance - ) - } - .padding() - .background(Color.background) + ProfileStatisticsItemView( + icon: .init(imageResource: .problemOfDaySolvedModalGemsBadge, renderingMode: .original), + title: "3456", + subtitle: Strings.Profile.Statistics.hypercoinsBalance + ) } + .padding() + .background(Color.background) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsView.swift index 00bc7cee9b..51d0c4cd61 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Profile/Views/Statistics/ProfileStatisticsView.swift @@ -19,21 +19,21 @@ struct ProfileStatisticsView: View { HStack { ProfileStatisticsItemView( appearance: .init(cornerRadius: appearance.cornerRadius), - icon: .init(imageName: Images.Common.project, renderingMode: .circleBackground), + icon: .init(imageResource: .project, renderingMode: .circleBackground), title: "\(passedProjectsCount)", subtitle: Strings.Profile.Statistics.passedProjects ) ProfileStatisticsItemView( appearance: .init(cornerRadius: appearance.cornerRadius), - icon: .init(imageName: Images.Track.track, renderingMode: .circleBackground), + icon: .init(imageResource: .track, renderingMode: .circleBackground), title: "\(passedTracksCount)", subtitle: Strings.Profile.Statistics.passedTracks ) ProfileStatisticsItemView( appearance: .init(cornerRadius: appearance.cornerRadius), - icon: .init(imageName: Images.StepQuiz.ProblemOfDaySolvedModal.gemsBadge, renderingMode: .original), + icon: .init(imageResource: .problemOfDaySolvedModalGemsBadge, renderingMode: .original), title: "\(hypercoinsBalance)", subtitle: Strings.Profile.Statistics.hypercoinsBalance ) @@ -41,14 +41,12 @@ struct ProfileStatisticsView: View { } } -struct ProfileStatisticsView_Previews: PreviewProvider { - static var previews: some View { - ProfileStatisticsView( - passedProjectsCount: 3, - passedTracksCount: 3, - hypercoinsBalance: 3456 - ) - .padding() - .background(Color.background) - } +#Preview { + ProfileStatisticsView( + passedProjectsCount: 3, + passedTracksCount: 3, + hypercoinsBalance: 3456 + ) + .padding() + .background(Color.background) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/ProgressScreenCardView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/ProgressScreenCardView.swift index 515c9947af..c9fda0b593 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/ProgressScreenCardView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/ProgressScreenCardView.swift @@ -18,7 +18,7 @@ struct ProgressScreenCardView: View { let title: String let titleSecondaryText: String? - let imageName: String + let imageResource: ImageResource? var imageRenderingMode = Image.TemplateRenderingMode.template let progress: Progress? @@ -37,12 +37,14 @@ struct ProgressScreenCardView: View { Spacer() - Image(imageName) - .resizable() - .renderingMode(imageRenderingMode) - .aspectRatio(contentMode: .fit) - .frame(widthHeight: appearance.imageWidthHeight) - .foregroundColor(.primaryText) + if let imageResource { + Image(imageResource) + .resizable() + .renderingMode(imageRenderingMode) + .aspectRatio(contentMode: .fit) + .frame(widthHeight: appearance.imageWidthHeight) + .foregroundColor(.primaryText) + } } if let progress { @@ -73,45 +75,43 @@ struct ProgressScreenCardView: View { } } -struct ProgressScreenTrackCardView_Previews: PreviewProvider { - static var previews: some View { - let appearance = ProgressScreenCardView.Appearance( - spacing: LayoutInsets.defaultInset, - interitemSpacing: LayoutInsets.smallInset, - backgroundColor: Color(ColorPalette.surface), - cornerRadius: 8 +#Preview { + let appearance = ProgressScreenCardView.Appearance( + spacing: LayoutInsets.defaultInset, + interitemSpacing: LayoutInsets.smallInset, + backgroundColor: Color(ColorPalette.surface), + cornerRadius: 8 + ) + + return VStack { + ProgressScreenCardView( + appearance: appearance, + title: "48 / 149", + titleSecondaryText: "• 32%", + imageResource: .topic, + progress: .init(value: 0.322147651, isCompleted: false), + subtitle: "Completed topics" ) - VStack { - ProgressScreenCardView( - appearance: appearance, - title: "48 / 149", - titleSecondaryText: "• 32%", - imageName: Images.Common.topic, - progress: .init(value: 0.322147651, isCompleted: false), - subtitle: "Completed topics" - ) - - ProgressScreenCardView( - appearance: appearance, - title: "131 / 149", - titleSecondaryText: "• 91%", - imageName: Images.Common.topic, - progress: .init(value: 0.91, isCompleted: true), - subtitle: "Completed topics" - ) - - ProgressScreenCardView( - appearance: appearance, - title: "~ 56 h", - titleSecondaryText: nil, - imageName: Images.Step.clock, - progress: nil, - subtitle: "Time to complete the track" - ) - } - .previewLayout(.sizeThatFits) - .padding() - .background(Color.systemGroupedBackground) + ProgressScreenCardView( + appearance: appearance, + title: "131 / 149", + titleSecondaryText: "• 91%", + imageResource: .topic, + progress: .init(value: 0.91, isCompleted: true), + subtitle: "Completed topics" + ) + + ProgressScreenCardView( + appearance: appearance, + title: "~ 56 h", + titleSecondaryText: nil, + imageResource: .stepTimeToComplete, + progress: nil, + subtitle: "Time to complete the track" + ) } + .previewLayout(.sizeThatFits) + .padding() + .background(Color.systemGroupedBackground) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Project/ProgressScreenProjectProgressContentView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Project/ProgressScreenProjectProgressContentView.swift index 9ecc00ff95..5ef7f73865 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Project/ProgressScreenProjectProgressContentView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Project/ProgressScreenProjectProgressContentView.swift @@ -60,7 +60,7 @@ struct ProgressScreenProjectProgressContentView: View { appearance: appearance.cardAppearance, title: timeToCompleteLabel, titleSecondaryText: nil, - imageName: Images.Step.clock, + imageResource: .stepTimeToComplete, progress: nil, subtitle: Strings.ProgressScreen.Project.timeToCompleteProject ) @@ -70,7 +70,7 @@ struct ProgressScreenProjectProgressContentView: View { appearance: appearance.cardAppearance, title: completedStagesLabel, titleSecondaryText: nil, - imageName: "", + imageResource: nil, progress: .init(value: completedStagesProgress, isCompleted: isCompleted), subtitle: Strings.ProgressScreen.Project.stages ) diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Track/ProgressScreenTrackProgressContentView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Track/ProgressScreenTrackProgressContentView.swift index 2f5bd67ad6..f96383af49 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Track/ProgressScreenTrackProgressContentView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/ProgressScreen/Views/Track/ProgressScreenTrackProgressContentView.swift @@ -71,7 +71,7 @@ struct ProgressScreenTrackProgressContentView: View { appearance: appearance.cardAppearance, title: completedTopicsCountLabel, titleSecondaryText: completedTopicsPercentageLabel, - imageName: Images.Common.topic, + imageResource: .topic, progress: .init(value: completedTopicsPercentageProgress, isCompleted: isCompleted), subtitle: Strings.ProgressScreen.Track.completedTopics ) @@ -80,7 +80,7 @@ struct ProgressScreenTrackProgressContentView: View { appearance: appearance.cardAppearance, title: appliedTopicsCountLabel, titleSecondaryText: appliedTopicsPercentageLabel, - imageName: Images.Common.hammer, + imageResource: .hammer, progress: .init(value: appliedTopicsPercentageProgress, isCompleted: isCompleted), subtitle: Strings.ProgressScreen.Track.appliedCoreTopics ) @@ -91,7 +91,7 @@ struct ProgressScreenTrackProgressContentView: View { appearance: appearance.cardAppearance, title: timeToCompleteLabel, titleSecondaryText: nil, - imageName: Images.Step.clock, + imageResource: .stepTimeToComplete, progress: nil, subtitle: Strings.ProgressScreen.Track.timeToCompleteTrack ) @@ -101,7 +101,7 @@ struct ProgressScreenTrackProgressContentView: View { appearance: appearance.cardAppearance, title: "\(completedGraduateProjectsCount)", titleSecondaryText: nil, - imageName: Images.ProjectSelectionList.projectGraduate, + imageResource: .projectSelectionListProjectGraduate, imageRenderingMode: .original, progress: nil, subtitle: Strings.ProgressScreen.Track.completedGraduateProject @@ -111,29 +111,27 @@ struct ProgressScreenTrackProgressContentView: View { } } -struct ProgressScreenTrackProgressContentView_Previews: PreviewProvider { - static var previews: some View { - ProgressScreenTrackProgressContentView( - appearance: .init( - spacing: LayoutInsets.defaultInset, - interitemSpacing: LayoutInsets.smallInset, - cardBackgroundColor: Color(ColorPalette.surface), - cardCornerRadius: 8 - ), - avatarImageSource: "https://hyperskill.azureedge.net/media/tracks/9368deaab97441f192fd4c8db42cb9bc/python.svg", - title: "Python Core", - completedTopicsCountLabel: "0 / 149", - completedTopicsPercentageLabel: "• 98%", - completedTopicsPercentageProgress: 0, - appliedTopicsCountLabel: "0 / 138", - appliedTopicsPercentageLabel: "• 0%", - appliedTopicsPercentageProgress: 0, - timeToCompleteLabel: "~ 56 h", - completedGraduateProjectsCount: 0, - isCompleted: false, - onChangeTrackTap: {} - ) - .padding() - .background(Color.systemGroupedBackground) - } +#Preview { + ProgressScreenTrackProgressContentView( + appearance: .init( + spacing: LayoutInsets.defaultInset, + interitemSpacing: LayoutInsets.smallInset, + cardBackgroundColor: Color(ColorPalette.surface), + cardCornerRadius: 8 + ), + avatarImageSource: "https://hyperskill.azureedge.net/media/tracks/9368deaab97441f192fd4c8db42cb9bc/python.svg", + title: "Python Core", + completedTopicsCountLabel: "0 / 149", + completedTopicsPercentageLabel: "• 98%", + completedTopicsPercentageProgress: 0, + appliedTopicsCountLabel: "0 / 138", + appliedTopicsPercentageLabel: "• 0%", + appliedTopicsPercentageProgress: 0, + timeToCompleteLabel: "~ 56 h", + completedGraduateProjectsCount: 0, + isCompleted: false, + onChangeTrackTap: {} + ) + .padding() + .background(Color.systemGroupedBackground) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/StudyPlan/Views/Section/Header/StudyPlanSectionHeaderStatisticsView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/StudyPlan/Views/Section/Header/StudyPlanSectionHeaderStatisticsView.swift index d6b27f9a78..ee553e88c6 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/StudyPlan/Views/Section/Header/StudyPlanSectionHeaderStatisticsView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/StudyPlan/Views/Section/Header/StudyPlanSectionHeaderStatisticsView.swift @@ -23,19 +23,19 @@ struct StudyPlanSectionHeaderStatisticsView: View { } else { HStack(spacing: LayoutInsets.defaultInset) { if let formattedTopicsCount { - buildItemView(imageName: Images.Common.topic, title: formattedTopicsCount) + buildItemView(imageResource: .topic, title: formattedTopicsCount) } if let formattedTimeToComplete { - buildItemView(imageName: Images.Step.clock, title: formattedTimeToComplete) + buildItemView(imageResource: .stepTimeToComplete, title: formattedTimeToComplete) } } } } @ViewBuilder - private func buildItemView(imageName: String, title: String) -> some View { + private func buildItemView(imageResource: ImageResource, title: String) -> some View { HStack(spacing: appearance.statisticIconsSpacing) { - Image(imageName) + Image(imageResource) .resizable() .renderingMode(.template) .aspectRatio(contentMode: .fit) @@ -48,8 +48,8 @@ struct StudyPlanSectionHeaderStatisticsView: View { } } -struct StudyPlanSectionHeaderStatisticsView_Previews: PreviewProvider { - static var previews: some View { +#Preview { + Group { StudyPlanSectionHeaderStatisticsView( formattedTopicsCount: "5/12", formattedTimeToComplete: "13 hours" diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/TrackSelection/Details/Views/Content/TrackSelectionDetailsTrackOverviewView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/TrackSelection/Details/Views/Content/TrackSelectionDetailsTrackOverviewView.swift index fdb4bf1555..72f449b276 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/TrackSelection/Details/Views/Content/TrackSelectionDetailsTrackOverviewView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/TrackSelection/Details/Views/Content/TrackSelectionDetailsTrackOverviewView.swift @@ -65,10 +65,10 @@ struct TrackSelectionDetailsTrackOverviewView: View { ) } - buildItemView(imageName: Images.Step.clock, text: timeToComplete) - buildItemView(imageName: Images.Common.topic, text: topicsCount) - buildItemView(imageName: Images.Common.project, text: projectsCount) - buildItemView(imageName: Images.Common.trophy, text: certificateText) + buildItemView(imageResource: .stepTimeToComplete, text: timeToComplete) + buildItemView(imageResource: .topic, text: topicsCount) + buildItemView(imageResource: .project, text: projectsCount) + buildItemView(imageResource: .trophy, text: certificateText) } } .frame(maxWidth: .infinity, alignment: .leading) @@ -77,7 +77,7 @@ struct TrackSelectionDetailsTrackOverviewView: View { } @ViewBuilder - private func buildItemView(imageName: String, text: String?) -> some View { + private func buildItemView(imageResource: ImageResource, text: String?) -> some View { if let text, !text.isEmpty { Label( title: { @@ -86,7 +86,7 @@ struct TrackSelectionDetailsTrackOverviewView: View { .foregroundColor(appearance.itemForegroundColor) }, icon: { - Image(imageName) + Image(imageResource) .resizable() .renderingMode(.template) .aspectRatio(contentMode: .fill) @@ -98,18 +98,14 @@ struct TrackSelectionDetailsTrackOverviewView: View { } } -#if DEBUG -struct TrackSelectionDetailsTrackOverviewView_Previews: PreviewProvider { - static var previews: some View { - TrackSelectionDetailsTrackOverviewView( - rating: "It's new track, no rating yet", - timeToComplete: "249 hours for all learning activities", - topicsCount: "154 topics with theory and practice adapted to you level", - projectsCount: "13 projects to choose from for your portfolio", - isCertificateAvailable: true - ) - .padding() - .background(Color.systemGroupedBackground) - } +#Preview { + TrackSelectionDetailsTrackOverviewView( + rating: "It's new track, no rating yet", + timeToComplete: "249 hours for all learning activities", + topicsCount: "154 topics with theory and practice adapted to you level", + projectsCount: "13 projects to choose from for your portfolio", + isCertificateAvailable: true + ) + .padding() + .background(Color.systemGroupedBackground) } -#endif diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Views/SwiftUI/HyperskillLogoView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Views/SwiftUI/HyperskillLogoView.swift index 3dce4a5f08..8297a3a3de 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Views/SwiftUI/HyperskillLogoView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Views/SwiftUI/HyperskillLogoView.swift @@ -4,16 +4,13 @@ struct HyperskillLogoView: View { var logoWidthHeight: CGFloat = 48 var body: some View { - Image(Images.Common.hyperskillLogo) + Image(.hyperskillLogo) .resizable() .aspectRatio(contentMode: .fit) .frame(widthHeight: logoWidthHeight) } } -struct HyperskillLogoView_Previews: PreviewProvider { - static var previews: some View { - HyperskillLogoView() - .previewLayout(.sizeThatFits) - } +#Preview { + HyperskillLogoView() } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index b47712e233..ff44b53d21 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -43,6 +43,9 @@ kotlin { framework { baseName = "shared" isStatic = false + // Delete options passed to a system linker after upgrading to the Kotlin 1.9.10 + // https://youtrack.jetbrains.com/issue/KT-60230 + linkerOpts += "-ld64" } } } From ff1e9c729316b16e6c19f08c94d0ee173cd41540 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Sep 2023 15:39:26 +0700 Subject: [PATCH 2/2] GitHub Actions: Bump actions/first-interaction from 1.1.1 to 1.2.0 (#684) Bumps [actions/first-interaction](https://github.com/actions/first-interaction) from 1.1.1 to 1.2.0. - [Release notes](https://github.com/actions/first-interaction/releases) - [Commits](https://github.com/actions/first-interaction/compare/v1.1.1...v1.2.0) --- updated-dependencies: - dependency-name: actions/first-interaction dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Ivan Magda --- .github/workflows/greetings.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index 536561e3f4..b4919ca79e 100644 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -9,7 +9,7 @@ jobs: issues: write pull-requests: write steps: - - uses: actions/first-interaction@v1.1.1 + - uses: actions/first-interaction@v1.2.0 with: repo-token: ${{ secrets.GITHUB_TOKEN }} issue-message: 'Thanks for submitting your first issue, we will have a look as quickly as possible.'