From c95f764e93d1399814fde0eabbf52969787e4b3d Mon Sep 17 00:00:00 2001 From: Ivan Magda Date: Thu, 14 Dec 2023 16:32:35 +0700 Subject: [PATCH 1/3] Reformat rename --- .../project.pbxproj | 32 +++++++++---------- .../Sources/Models/Constants/Strings.swift | 4 +-- .../Sources/Modules/App/AppViewModel.swift | 6 ++-- .../ViewControllers/AppViewController.swift | 2 +- .../AuthCredentials/Views/AuthPreviews.swift | 2 +- .../Onboarding/OnboardingAssembly.swift | 19 ----------- .../Onboarding/OnboardingOutputProtocol.swift | 7 ---- .../Modules/Onboarding/WelcomeAssembly.swift | 19 +++++++++++ .../Onboarding/WelcomeOutputProtocol.swift | 6 ++++ ...OnboardingView.swift => WelcomeView.swift} | 22 ++++++------- ...ViewModel.swift => WelcomeViewModel.swift} | 12 +++---- 11 files changed, 65 insertions(+), 66 deletions(-) delete mode 100644 iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingAssembly.swift delete mode 100644 iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingOutputProtocol.swift create mode 100644 iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift create mode 100644 iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/{OnboardingView.swift => WelcomeView.swift} (89%) rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/{OnboardingViewModel.swift => WelcomeViewModel.swift} (76%) diff --git a/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj b/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj index f757884dd7..1fcb11ffb3 100644 --- a/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj +++ b/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj @@ -545,7 +545,7 @@ E97EDB002A8F595E00CABF8E /* BadgeEarnedModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E97EDAFF2A8F595E00CABF8E /* BadgeEarnedModalViewController.swift */; }; E9802D07281BB5CC00CF3AC1 /* StepQuizChoiceView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9802D06281BB5CC00CF3AC1 /* StepQuizChoiceView.swift */; }; E9859B91292E414300857679 /* RepeatButtonInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9859B90292E414300857679 /* RepeatButtonInfo.swift */; }; - E9886D3228ABCE5C003724F9 /* OnboardingOutputProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9886D3128ABCE5C003724F9 /* OnboardingOutputProtocol.swift */; }; + E9886D3228ABCE5C003724F9 /* WelcomeOutputProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9886D3128ABCE5C003724F9 /* WelcomeOutputProtocol.swift */; }; E98BE36D2A374394000B430F /* StreakRecoveryModalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E98BE36C2A374394000B430F /* StreakRecoveryModalView.swift */; }; E993E9A928426FF2005988EC /* StepQuizSortingViewData.swift in Sources */ = {isa = PBXBuildFile; fileRef = E993E9A828426FF2005988EC /* StepQuizSortingViewData.swift */; }; E9950E9328893F1700C4D962 /* ProfileDailyStudyRemindersView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9950E9228893F1700C4D962 /* ProfileDailyStudyRemindersView.swift */; }; @@ -576,8 +576,8 @@ E9A1DA722AD00D41006A9D4B /* FirstProblemOnboardingContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A1DA712AD00D41006A9D4B /* FirstProblemOnboardingContentView.swift */; }; E9A22BA0295081BD001700B7 /* StreakFreezeModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A22B9F295081BD001700B7 /* StreakFreezeModalViewController.swift */; }; E9A3435029113FA400E0C0A4 /* StepQuizHintReactionButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A3434F29113FA400E0C0A4 /* StepQuizHintReactionButtonView.swift */; }; - E9A6250D28ABAE30009423EE /* OnboardingAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A6250C28ABAE30009423EE /* OnboardingAssembly.swift */; }; - E9A6250F28ABAE83009423EE /* OnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A6250E28ABAE83009423EE /* OnboardingViewModel.swift */; }; + E9A6250D28ABAE30009423EE /* WelcomeAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A6250C28ABAE30009423EE /* WelcomeAssembly.swift */; }; + E9A6250F28ABAE83009423EE /* WelcomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9A6250E28ABAE83009423EE /* WelcomeViewModel.swift */; }; E9AB310F29DECC7500645376 /* StudyPlanSectionHeaderStatisticsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9AB310E29DECC7500645376 /* StudyPlanSectionHeaderStatisticsView.swift */; }; E9AB311429DED7FE00645376 /* StudyPlanSectionItemIconView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9AB311329DED7FE00645376 /* StudyPlanSectionItemIconView.swift */; }; E9ACD3412937342F0005E05B /* ProblemOfDaySolvedModalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9ACD3402937342F0005E05B /* ProblemOfDaySolvedModalViewController.swift */; }; @@ -620,7 +620,7 @@ E9F655CA2875914200291143 /* StreakCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F655C92875914200291143 /* StreakCardView.swift */; }; E9F655D12875B32700291143 /* ProblemOfDayCardView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F655D02875B32700291143 /* ProblemOfDayCardView.swift */; }; E9F7A5E028AFC2000063913F /* NotificationDescriptionPlainObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F7A5DF28AFC2000063913F /* NotificationDescriptionPlainObject.swift */; }; - E9F923F628A2633D00C065A7 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F923F528A2633D00C065A7 /* OnboardingView.swift */; }; + E9F923F628A2633D00C065A7 /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9F923F528A2633D00C065A7 /* WelcomeView.swift */; }; E9FAF38F299F61AE001FC596 /* View+MeasureSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FAF38E299F61AE001FC596 /* View+MeasureSize.swift */; }; E9FB89A32893CCAF0011EFFB /* LocalNotificationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FB89A22893CCAF0011EFFB /* LocalNotificationProtocol.swift */; }; E9FB89A72893CD2C0011EFFB /* LocalNotificationsService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FB89A62893CD2C0011EFFB /* LocalNotificationsService.swift */; }; @@ -1223,7 +1223,7 @@ E97EDAFF2A8F595E00CABF8E /* BadgeEarnedModalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeEarnedModalViewController.swift; sourceTree = ""; }; E9802D06281BB5CC00CF3AC1 /* StepQuizChoiceView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizChoiceView.swift; sourceTree = ""; }; E9859B90292E414300857679 /* RepeatButtonInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RepeatButtonInfo.swift; sourceTree = ""; }; - E9886D3128ABCE5C003724F9 /* OnboardingOutputProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingOutputProtocol.swift; sourceTree = ""; }; + E9886D3128ABCE5C003724F9 /* WelcomeOutputProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeOutputProtocol.swift; sourceTree = ""; }; E98BE36C2A374394000B430F /* StreakRecoveryModalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreakRecoveryModalView.swift; sourceTree = ""; }; E993E9A828426FF2005988EC /* StepQuizSortingViewData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizSortingViewData.swift; sourceTree = ""; }; E9950E9228893F1700C4D962 /* ProfileDailyStudyRemindersView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileDailyStudyRemindersView.swift; sourceTree = ""; }; @@ -1254,8 +1254,8 @@ E9A1DA712AD00D41006A9D4B /* FirstProblemOnboardingContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstProblemOnboardingContentView.swift; sourceTree = ""; }; E9A22B9F295081BD001700B7 /* StreakFreezeModalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreakFreezeModalViewController.swift; sourceTree = ""; }; E9A3434F29113FA400E0C0A4 /* StepQuizHintReactionButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizHintReactionButtonView.swift; sourceTree = ""; }; - E9A6250C28ABAE30009423EE /* OnboardingAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingAssembly.swift; sourceTree = ""; }; - E9A6250E28ABAE83009423EE /* OnboardingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewModel.swift; sourceTree = ""; }; + E9A6250C28ABAE30009423EE /* WelcomeAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeAssembly.swift; sourceTree = ""; }; + E9A6250E28ABAE83009423EE /* WelcomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeViewModel.swift; sourceTree = ""; }; E9AB310E29DECC7500645376 /* StudyPlanSectionHeaderStatisticsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyPlanSectionHeaderStatisticsView.swift; sourceTree = ""; }; E9AB311329DED7FE00645376 /* StudyPlanSectionItemIconView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StudyPlanSectionItemIconView.swift; sourceTree = ""; }; E9ACD3402937342F0005E05B /* ProblemOfDaySolvedModalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProblemOfDaySolvedModalViewController.swift; sourceTree = ""; }; @@ -1298,7 +1298,7 @@ E9F655C92875914200291143 /* StreakCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreakCardView.swift; sourceTree = ""; }; E9F655D02875B32700291143 /* ProblemOfDayCardView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProblemOfDayCardView.swift; sourceTree = ""; }; E9F7A5DF28AFC2000063913F /* NotificationDescriptionPlainObject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationDescriptionPlainObject.swift; sourceTree = ""; }; - E9F923F528A2633D00C065A7 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = ""; }; + E9F923F528A2633D00C065A7 /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; E9FAF38E299F61AE001FC596 /* View+MeasureSize.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+MeasureSize.swift"; sourceTree = ""; }; E9FB89A22893CCAF0011EFFB /* LocalNotificationProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalNotificationProtocol.swift; sourceTree = ""; }; E9FB89A62893CD2C0011EFFB /* LocalNotificationsService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalNotificationsService.swift; sourceTree = ""; }; @@ -3972,10 +3972,10 @@ E9F923F428A2632800C065A7 /* Onboarding */ = { isa = PBXGroup; children = ( - E9A6250C28ABAE30009423EE /* OnboardingAssembly.swift */, - E9886D3128ABCE5C003724F9 /* OnboardingOutputProtocol.swift */, - E9F923F528A2633D00C065A7 /* OnboardingView.swift */, - E9A6250E28ABAE83009423EE /* OnboardingViewModel.swift */, + E9A6250C28ABAE30009423EE /* WelcomeAssembly.swift */, + E9886D3128ABCE5C003724F9 /* WelcomeOutputProtocol.swift */, + E9F923F528A2633D00C065A7 /* WelcomeView.swift */, + E9A6250E28ABAE83009423EE /* WelcomeViewModel.swift */, ); path = Onboarding; sourceTree = ""; @@ -4297,7 +4297,7 @@ 2CAFD39127FC5D5D00F88B0B /* Color+DesignSystem.swift in Sources */, 2C0F3CFA2A80A42D00947C35 /* BadgeDetailsModalViewController.swift in Sources */, 2C5CA2372A20185300DBF2F9 /* ProjectSelectionDetailsFeatureViewStateKsExtensions.swift in Sources */, - E9886D3228ABCE5C003724F9 /* OnboardingOutputProtocol.swift in Sources */, + E9886D3228ABCE5C003724F9 /* WelcomeOutputProtocol.swift in Sources */, 2C5CBBE12948EBEA00113007 /* StepQuizSQLViewDataMapper.swift in Sources */, 2CF4341228126C79002893CD /* View+EndEditing.swift in Sources */, E9F2CC5329223C0200691540 /* StyledHostingController.swift in Sources */, @@ -4430,7 +4430,7 @@ 2C005DCC27EF5B0300DC6503 /* GoogleServiceInfo.swift in Sources */, 2CBD191D291D3BF400F5FB0B /* UIKitRoundedRectangleButton.swift in Sources */, 2C078CE92AE29D0600D97E24 /* StepQuizFillBlanksViewDataMapperCache.swift in Sources */, - E9A6250F28ABAE83009423EE /* OnboardingViewModel.swift in Sources */, + E9A6250F28ABAE83009423EE /* WelcomeViewModel.swift in Sources */, 2C0F3CFC2A80A47600947C35 /* BadgeDetailsModalView.swift in Sources */, E97BEA1E2977D26F00348EEC /* TopicCompletedModalViewController.swift in Sources */, 2CEEE03128916A3100282849 /* ProblemOfDayAssembly.swift in Sources */, @@ -4439,7 +4439,7 @@ 2C55133B28B8DFE8009F7627 /* Debouncer.swift in Sources */, 2C7CB6882ADFF57D006F78DA /* FillBlanksQuizViewWrapper.swift in Sources */, 2C56611A2AEA418D00D607FB /* FillBlanksSelectCollectionViewCell.swift in Sources */, - E9A6250D28ABAE30009423EE /* OnboardingAssembly.swift in Sources */, + E9A6250D28ABAE30009423EE /* WelcomeAssembly.swift in Sources */, 2C336D172865C9CD00C91342 /* UIView+TraitCollection.swift in Sources */, 2CD48D872858639500CFCC4A /* StepQuizViewModel.swift in Sources */, E9B55A5929C8A0760066900E /* ProblemsLimitView.swift in Sources */, @@ -4469,7 +4469,7 @@ E9950E9528894F4700C4D962 /* ProfileDailyStudyRemindersHourIntervalPickerView.swift in Sources */, E9A022AE291D0E3F004317DB /* TopicsRepetitionsCardView.swift in Sources */, 2C5CBBE32948F4B600113007 /* StepQuizSQLViewModel.swift in Sources */, - E9F923F628A2633D00C065A7 /* OnboardingView.swift in Sources */, + E9F923F628A2633D00C065A7 /* WelcomeView.swift in Sources */, E9BDB4052A7BE1E30069EF98 /* BadgeImageView.swift in Sources */, 2C106D9928C1CE6E004FA584 /* SendEmailFeedbackController.swift in Sources */, 2C688C052A4E97750061AFFD /* ProgressScreenProjectProgressView.swift in Sources */, diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Strings.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Strings.swift index 6d9018afae..8d6312ae35 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Strings.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Models/Constants/Strings.swift @@ -461,9 +461,9 @@ enum Strings { } } - // MARK: - Onboarding - + // MARK: - Welcome - - enum Onboarding { + enum Welcome { static let title = sharedStrings.onboarding_title.localized() static let text = sharedStrings.onboarding_text.localized() static let primaryButton = sharedStrings.onboarding_primary_button_text.localized() diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift index 3b35e4ba39..90a19d81da 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift @@ -109,12 +109,12 @@ extension AppViewModel: AuthOutputProtocol { // MARK: - AppViewModel: OnboardingOutputProtocol - -extension AppViewModel: OnboardingOutputProtocol { - func handleOnboardingSignInRequested() { +extension AppViewModel: WelcomeOutputProtocol { + func handleWelcomeSignInRequested() { onViewAction?(AppFeatureActionViewActionNavigateToAuthScreen(isInSignUpMode: false)) } - func handleOnboardingSignUpRequested(isInSignUpMode: Bool) { + func handleWelcomeSignUpRequested(isInSignUpMode: Bool) { if isInSignUpMode { onViewAction?(AppFeatureActionViewActionNavigateToAuthScreen(isInSignUpMode: isInSignUpMode)) } else { diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/ViewControllers/AppViewController.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/ViewControllers/AppViewController.swift index 016c5ec6e6..56a5a76f75 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/ViewControllers/AppViewController.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/ViewControllers/AppViewController.swift @@ -106,7 +106,7 @@ extension AppViewController: AppViewControllerProtocol { let viewControllerToPresent: UIViewController = { switch viewAction { case .onboardingScreen: - return UIHostingController(rootView: OnboardingAssembly(output: viewModel).makeModule()) + return UIHostingController(rootView: WelcomeAssembly(output: viewModel).makeModule()) case .studyPlan: return AppTabBarController( initialTab: .studyPlan, diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthPreviews.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthPreviews.swift index aaa4d24553..6123bd076a 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthPreviews.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/AuthCredentials/Views/AuthPreviews.swift @@ -18,7 +18,7 @@ struct AuthPreviews_Previews: PreviewProvider { .makeModule() .previewDevice(previewDevice) - OnboardingAssembly() + WelcomeAssembly() .makeModule() .previewDevice(previewDevice) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingAssembly.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingAssembly.swift deleted file mode 100644 index f3fd73ffab..0000000000 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingAssembly.swift +++ /dev/null @@ -1,19 +0,0 @@ -import Foundation -import shared - -final class OnboardingAssembly: Assembly { - private weak var moduleOutput: OnboardingOutputProtocol? - - init(output: OnboardingOutputProtocol? = nil) { - self.moduleOutput = output - } - - func makeModule() -> OnboardingView { - let welcomeComponent = AppGraphBridge.sharedAppGraph.buildWelcomeComponent() - - let viewModel = OnboardingViewModel(feature: welcomeComponent.welcomeFeature) - viewModel.moduleOutput = self.moduleOutput - - return OnboardingView(viewModel: viewModel) - } -} diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingOutputProtocol.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingOutputProtocol.swift deleted file mode 100644 index fb699fb019..0000000000 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingOutputProtocol.swift +++ /dev/null @@ -1,7 +0,0 @@ -import Foundation - -protocol OnboardingOutputProtocol: AnyObject { - func handleOnboardingSignInRequested() - - func handleOnboardingSignUpRequested(isInSignUpMode: Bool) -} diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift new file mode 100644 index 0000000000..683158f99a --- /dev/null +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift @@ -0,0 +1,19 @@ +import Foundation +import shared + +final class WelcomeAssembly: Assembly { + private weak var moduleOutput: WelcomeOutputProtocol? + + init(output: WelcomeOutputProtocol? = nil) { + self.moduleOutput = output + } + + func makeModule() -> WelcomeView { + let welcomeComponent = AppGraphBridge.sharedAppGraph.buildWelcomeComponent() + + let viewModel = WelcomeViewModel(feature: welcomeComponent.welcomeFeature) + viewModel.moduleOutput = self.moduleOutput + + return WelcomeView(viewModel: viewModel) + } +} diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift new file mode 100644 index 0000000000..ded2101add --- /dev/null +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift @@ -0,0 +1,6 @@ +import Foundation + +protocol WelcomeOutputProtocol: AnyObject { + func handleWelcomeSignInRequested() + func handleWelcomeSignUpRequested(isInSignUpMode: Bool) +} diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeView.swift similarity index 89% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingView.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeView.swift index c43bfab97a..3c87d24365 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingView.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeView.swift @@ -1,7 +1,7 @@ import shared import SwiftUI -extension OnboardingView { +extension WelcomeView { struct Appearance { let contentMaxWidth: CGFloat = 400 @@ -9,10 +9,10 @@ extension OnboardingView { } } -struct OnboardingView: View { +struct WelcomeView: View { private(set) var appearance = Appearance() - @StateObject var viewModel: OnboardingViewModel + @StateObject var viewModel: WelcomeViewModel @Environment(\.horizontalSizeClass) private var horizontalSizeClass @@ -47,7 +47,7 @@ struct OnboardingView: View { PlaceholderView( configuration: .networkError( backgroundColor: .clear, - action: viewModel.doRetryLoadOnboarding + action: viewModel.doRetryContentLoading ) ) case .content: @@ -56,12 +56,12 @@ struct OnboardingView: View { Spacer() } - Text(Strings.Onboarding.title) + Text(Strings.Welcome.title) .font(.largeTitle).bold() .foregroundColor(.newPrimaryText) .multilineTextAlignment(.center) - Text(Strings.Onboarding.text) + Text(Strings.Welcome.text) .font(.title3) .foregroundColor(.newPrimaryText) .multilineTextAlignment(.center) @@ -77,7 +77,7 @@ struct OnboardingView: View { Spacer() Button( - Strings.Onboarding.primaryButton, + Strings.Welcome.primaryButton, action: { actionButtonsFeedbackGenerator.triggerFeedback() viewModel.doPrimaryButtonAction() @@ -87,7 +87,7 @@ struct OnboardingView: View { .shineEffect() Button( - Strings.Onboarding.secondaryButton, + Strings.Welcome.secondaryButton, action: { actionButtonsFeedbackGenerator.triggerFeedback() viewModel.doSecondaryButtonAction() @@ -119,16 +119,16 @@ struct OnboardingView: View { struct OnboardingView_Previews: PreviewProvider { static var previews: some View { - OnboardingAssembly() + WelcomeAssembly() .makeModule() .previewDevice(PreviewDevice(rawValue: "iPhone 13 Pro")) - OnboardingAssembly() + WelcomeAssembly() .makeModule() .previewDevice(PreviewDevice(rawValue: "iPhone SE (3rd generation)")) .preferredColorScheme(.dark) - OnboardingAssembly() + WelcomeAssembly() .makeModule() .previewDevice(PreviewDevice(rawValue: "iPad (9th generation)")) } diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingViewModel.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeViewModel.swift similarity index 76% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingViewModel.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeViewModel.swift index 1a3b908b79..44d9ac0d96 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/OnboardingViewModel.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeViewModel.swift @@ -1,12 +1,12 @@ import Foundation import shared -final class OnboardingViewModel: FeatureViewModel< +final class WelcomeViewModel: FeatureViewModel< WelcomeFeatureState, WelcomeFeatureMessage, WelcomeFeatureActionViewAction > { - weak var moduleOutput: OnboardingOutputProtocol? + weak var moduleOutput: WelcomeOutputProtocol? var stateKs: WelcomeFeatureStateKs { .init(state) } @@ -22,7 +22,7 @@ final class OnboardingViewModel: FeatureViewModel< WelcomeFeatureStateKs(oldState) != WelcomeFeatureStateKs(newState) } - func doRetryLoadOnboarding() { + func doRetryContentLoading() { onNewMessage(WelcomeFeatureMessageInitialize(forceUpdate: true)) } @@ -32,15 +32,15 @@ final class OnboardingViewModel: FeatureViewModel< func doSecondaryButtonAction() { onNewMessage(WelcomeFeatureMessageClickedSignInEventMessage()) - moduleOutput?.handleOnboardingSignInRequested() + moduleOutput?.handleWelcomeSignInRequested() } func doSignInPresentation() { - moduleOutput?.handleOnboardingSignInRequested() + moduleOutput?.handleWelcomeSignInRequested() } func doSignUpPresentation(isInSignUpMode: Bool) { - moduleOutput?.handleOnboardingSignUpRequested(isInSignUpMode: isInSignUpMode) + moduleOutput?.handleWelcomeSignUpRequested(isInSignUpMode: isInSignUpMode) } // MARK: Analytic From 2bd9fe540cf682de6a5adb5d799fce38579697f3 Mon Sep 17 00:00:00 2001 From: Ivan Magda Date: Thu, 14 Dec 2023 16:33:24 +0700 Subject: [PATCH 2/3] Refactor rename directory --- iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj | 6 +++--- .../Modules/{Onboarding => Welcome}/WelcomeAssembly.swift | 0 .../{Onboarding => Welcome}/WelcomeOutputProtocol.swift | 0 .../Modules/{Onboarding => Welcome}/WelcomeView.swift | 0 .../Modules/{Onboarding => Welcome}/WelcomeViewModel.swift | 0 5 files changed, 3 insertions(+), 3 deletions(-) rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/{Onboarding => Welcome}/WelcomeAssembly.swift (100%) rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/{Onboarding => Welcome}/WelcomeOutputProtocol.swift (100%) rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/{Onboarding => Welcome}/WelcomeView.swift (100%) rename iosHyperskillApp/iosHyperskillApp/Sources/Modules/{Onboarding => Welcome}/WelcomeViewModel.swift (100%) diff --git a/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj b/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj index 1fcb11ffb3..37164a60f1 100644 --- a/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj +++ b/iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj @@ -1637,7 +1637,6 @@ 2CB0ADE92B04AC9E0089D557 /* HomeSubmodules */, E6992F3BBF430924F32DC178 /* Leaderboard */, B58361EACE24BF4B761F10BA /* NotificationsOnboarding */, - E9F923F428A2632800C065A7 /* Onboarding */, E9B55A5329C89FFF0066900E /* ProblemsLimit */, 2C9EB95B2861BAAE007DDE44 /* Profile */, 2C963BC82812D3410036DD53 /* ProfileSettings */, @@ -1652,6 +1651,7 @@ E9F0A2A729D416AC00C4A61E /* StudyPlan */, E9A022AB291D0E1C004317DB /* TopicsRepetitions */, 2C2600862A2001E600BD3D39 /* TrackSelection */, + E9F923F428A2632800C065A7 /* Welcome */, ); path = Modules; sourceTree = ""; @@ -3969,7 +3969,7 @@ path = ProblemOfDay; sourceTree = ""; }; - E9F923F428A2632800C065A7 /* Onboarding */ = { + E9F923F428A2632800C065A7 /* Welcome */ = { isa = PBXGroup; children = ( E9A6250C28ABAE30009423EE /* WelcomeAssembly.swift */, @@ -3977,7 +3977,7 @@ E9F923F528A2633D00C065A7 /* WelcomeView.swift */, E9A6250E28ABAE83009423EE /* WelcomeViewModel.swift */, ); - path = Onboarding; + path = Welcome; sourceTree = ""; }; E9FB89A12893CC790011EFFB /* Notifications */ = { diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeAssembly.swift similarity index 100% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeAssembly.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeAssembly.swift diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeOutputProtocol.swift similarity index 100% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeOutputProtocol.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeOutputProtocol.swift diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeView.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeView.swift similarity index 100% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeView.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeView.swift diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeViewModel.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeViewModel.swift similarity index 100% rename from iosHyperskillApp/iosHyperskillApp/Sources/Modules/Onboarding/WelcomeViewModel.swift rename to iosHyperskillApp/iosHyperskillApp/Sources/Modules/Welcome/WelcomeViewModel.swift From e19686f3f9883cda215a46337ad58f72a70193ca Mon Sep 17 00:00:00 2001 From: Ivan Magda Date: Thu, 14 Dec 2023 16:35:08 +0700 Subject: [PATCH 3/3] Clean up --- .../iosHyperskillApp/Sources/Modules/App/AppViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift index 90a19d81da..34b83a365e 100644 --- a/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift +++ b/iosHyperskillApp/iosHyperskillApp/Sources/Modules/App/AppViewModel.swift @@ -107,7 +107,7 @@ extension AppViewModel: AuthOutputProtocol { } } -// MARK: - AppViewModel: OnboardingOutputProtocol - +// MARK: - AppViewModel: WelcomeOutputProtocol - extension AppViewModel: WelcomeOutputProtocol { func handleWelcomeSignInRequested() {