From 3422c8dbd011922ba8f422e98b862de56d333748 Mon Sep 17 00:00:00 2001 From: Francisco Gindre Date: Wed, 8 Dec 2021 16:18:08 -0300 Subject: [PATCH] Integrate onboarding to fake home show OnboadingScreen instead of OnboardingView remove Struct Type --- secant.xcodeproj/project.pbxproj | 8 ++++---- secant/Features/Home/HomeStore.swift | 10 ++++++++++ secant/Features/Home/Views/HomeView.swift | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/secant.xcodeproj/project.pbxproj b/secant.xcodeproj/project.pbxproj index d0fffb0..9cb1cb3 100644 --- a/secant.xcodeproj/project.pbxproj +++ b/secant.xcodeproj/project.pbxproj @@ -106,8 +106,8 @@ F9C165C02740403600592F76 /* ApproveView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C165B92740403600592F76 /* ApproveView.swift */; }; F9C165C22740403600592F76 /* CreateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C165BB2740403600592F76 /* CreateView.swift */; }; F9C165C42740403600592F76 /* SentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C165BD2740403600592F76 /* SentView.swift */; }; - F9EEB8162742C2210032EEB8 /* WithStateBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9EEB8152742C2210032EEB8 /* WithStateBinding.swift */; }; F9C165CB2741AB5D00592F76 /* SendView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9C165CA2741AB5D00592F76 /* SendView.swift */; }; + F9EEB8162742C2210032EEB8 /* WithStateBinding.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9EEB8152742C2210032EEB8 /* WithStateBinding.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -233,8 +233,8 @@ F9C165B92740403600592F76 /* ApproveView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ApproveView.swift; sourceTree = ""; }; F9C165BB2740403600592F76 /* CreateView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateView.swift; sourceTree = ""; }; F9C165BD2740403600592F76 /* SentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SentView.swift; sourceTree = ""; }; - F9EEB8152742C2210032EEB8 /* WithStateBinding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithStateBinding.swift; sourceTree = ""; }; F9C165CA2741AB5D00592F76 /* SendView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendView.swift; sourceTree = ""; }; + F9EEB8152742C2210032EEB8 /* WithStateBinding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WithStateBinding.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1194,7 +1194,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; @@ -1218,7 +1218,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 3; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "\"secant/Preview Content\""; DEVELOPMENT_TEAM = ""; ENABLE_PREVIEWS = YES; diff --git a/secant/Features/Home/HomeStore.swift b/secant/Features/Home/HomeStore.swift index 66b8388..c3065cb 100644 --- a/secant/Features/Home/HomeStore.swift +++ b/secant/Features/Home/HomeStore.swift @@ -5,6 +5,7 @@ struct HomeState: Equatable { enum Route: Equatable { case history case send + case onboarding } var transactionHistoryState: TransactionHistoryState var route: Route? @@ -98,4 +99,13 @@ extension HomeViewStore { } ) } + + var showOnboardingBinding: Binding { + self.binding( + get: {$0.route == .onboarding }, + send: { isActive in + return .updateRoute(isActive ? .onboarding : nil) + } + ) + } } diff --git a/secant/Features/Home/Views/HomeView.swift b/secant/Features/Home/Views/HomeView.swift index 0b4fad5..88a5d1f 100644 --- a/secant/Features/Home/Views/HomeView.swift +++ b/secant/Features/Home/Views/HomeView.swift @@ -28,6 +28,13 @@ struct HomeView: View { .primaryButtonStyle .frame(height: 50) + Button( + action: { viewStore.send(.updateRoute(.onboarding)) }, + label: { Text("Show Onboarding") } + ) + .primaryButtonStyle + .frame(height: 50) + Spacer() HStack { @@ -64,6 +71,18 @@ struct HomeView: View { ) } ) + .navigationLinkEmpty( + isActive: viewStore.showOnboardingBinding, + destination: { + OnboardingScreen( + store: Store( + initialState: OnboardingState(), + reducer: .default, + environment: () + ) + ) + } + ) .fullScreenCover( isPresented: viewStore.showHistoryBinding, content: {