Skip to content

Commit

Permalink
[#26] Add Survey Detail with navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
blyscuit committed Jan 17, 2023
1 parent ab3001d commit 5911cfc
Show file tree
Hide file tree
Showing 28 changed files with 506 additions and 16 deletions.
62 changes: 61 additions & 1 deletion iosApp/Survey.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,18 @@
09D09DB92963EC39009F88AF /* Image+Url.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DB82963EC39009F88AF /* Image+Url.swift */; };
09D09DFA296E4B85009F88AF /* ResetPasswordSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DF9296E4B85009F88AF /* ResetPasswordSpec.swift */; };
09D09E0C296EBA20009F88AF /* TimeInterval+Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09C2F4012934588400F44818 /* TimeInterval+Constants.swift */; };
09D09DBC2967E843009F88AF /* SurveyDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DBB2967E843009F88AF /* SurveyDetailView.swift */; };
09D09DBE2967EA5F009F88AF /* ViewId+SurveyDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DBD2967EA5F009F88AF /* ViewId+SurveyDetail.swift */; };
09D09DC02968039F009F88AF /* ScreenParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DBF2968039F009F88AF /* ScreenParameters.swift */; };
09D09DC429681214009F88AF /* RouterCoordinator+WithoutAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DC329681214009F88AF /* RouterCoordinator+WithoutAnimation.swift */; };
09D09DC6296812F6009F88AF /* View+ConditionalModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DC5296812F6009F88AF /* View+ConditionalModifier.swift */; };
09D09DC8296817E2009F88AF /* SurveyDetailImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DC7296817E2009F88AF /* SurveyDetailImage.swift */; };
09D09DCA29682810009F88AF /* Constants+Animation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DC929682810009F88AF /* Constants+Animation.swift */; };
09D09DCE29682B78009F88AF /* SurveyItemOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DCD29682B78009F88AF /* SurveyItemOverlayView.swift */; };
09D09DD029682C19009F88AF /* SurveyDetailSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DCB29682965009F88AF /* SurveyDetailSpec.swift */; };
09D09DD329682CAE009F88AF /* SurveyDetailScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DD129682C98009F88AF /* SurveyDetailScreen.swift */; };
09D09DD429682CBC009F88AF /* ViewId+SurveyDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DBD2967EA5F009F88AF /* ViewId+SurveyDetail.swift */; };
09D09DD529682CBF009F88AF /* ViewId+SurveyDetail.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09D09DBD2967EA5F009F88AF /* ViewId+SurveyDetail.swift */; };
09E6ABF32951D105007F1EE3 /* KIF+Swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09E6ABF12951D103007F1EE3 /* KIF+Swift.swift */; };
09E6ABFD2951D32F007F1EE3 /* ViewId.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09636B1428D8148C00A5CB97 /* ViewId.swift */; };
09E6ABFE2951D333007F1EE3 /* ViewId+General.swift in Sources */ = {isa = PBXBuildFile; fileRef = 09636B2F28D8267D00A5CB97 /* ViewId+General.swift */; };
Expand Down Expand Up @@ -281,6 +293,16 @@
09D09DB1295C56A1009F88AF /* SurveySelectionSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveySelectionSpec.swift; sourceTree = "<group>"; };
09D09DB82963EC39009F88AF /* Image+Url.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Image+Url.swift"; sourceTree = "<group>"; };
09D09DF9296E4B85009F88AF /* ResetPasswordSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ResetPasswordSpec.swift; sourceTree = "<group>"; };
09D09DBB2967E843009F88AF /* SurveyDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyDetailView.swift; sourceTree = "<group>"; };
09D09DBD2967EA5F009F88AF /* ViewId+SurveyDetail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ViewId+SurveyDetail.swift"; sourceTree = "<group>"; };
09D09DBF2968039F009F88AF /* ScreenParameters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenParameters.swift; sourceTree = "<group>"; };
09D09DC329681214009F88AF /* RouterCoordinator+WithoutAnimation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RouterCoordinator+WithoutAnimation.swift"; sourceTree = "<group>"; };
09D09DC5296812F6009F88AF /* View+ConditionalModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+ConditionalModifier.swift"; sourceTree = "<group>"; };
09D09DC7296817E2009F88AF /* SurveyDetailImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyDetailImage.swift; sourceTree = "<group>"; };
09D09DC929682810009F88AF /* Constants+Animation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Constants+Animation.swift"; sourceTree = "<group>"; };
09D09DCB29682965009F88AF /* SurveyDetailSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyDetailSpec.swift; sourceTree = "<group>"; };
09D09DCD29682B78009F88AF /* SurveyItemOverlayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyItemOverlayView.swift; sourceTree = "<group>"; };
09D09DD129682C98009F88AF /* SurveyDetailScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SurveyDetailScreen.swift; sourceTree = "<group>"; };
09E6ABE42951CF3E007F1EE3 /* SurveyKIFUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SurveyKIFUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
09E6ABF12951D103007F1EE3 /* KIF+Swift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KIF+Swift.swift"; sourceTree = "<group>"; };
09E6AC0B2951D5DD007F1EE3 /* AccountSpec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountSpec.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -520,6 +542,7 @@
09D09DB82963EC39009F88AF /* Image+Url.swift */,
09636AF828D47A4D00A5CB97 /* Font+Extensions.swift */,
09CE772428E2C1C600EAA9EE /* View+HideBackButtonTitle.swift */,
09D09DC5296812F6009F88AF /* View+ConditionalModifier.swift */,
09CE772628E2C44D00EAA9EE /* View+BackButton.swift */,
09636B0E28D80B8500A5CB97 /* View+KeyboardDismiss.swift */,
09495FCA291107760036BDFB /* Image+Constants.swift */,
Expand Down Expand Up @@ -561,6 +584,7 @@
children = (
09636B1428D8148C00A5CB97 /* ViewId.swift */,
09CE771428E1AB0B00EAA9EE /* ViewId+ResetPassword.swift */,
09D09DBD2967EA5F009F88AF /* ViewId+SurveyDetail.swift */,
09495F2928EC43760036BDFB /* ViewId+SurveyLoading.swift */,
09636B1628D815D100A5CB97 /* ViewId+Login.swift */,
09636B2F28D8267D00A5CB97 /* ViewId+General.swift */,
Expand Down Expand Up @@ -677,7 +701,7 @@
09E6AC112951D950007F1EE3 /* SurveySelectionContainerView.swift */,
09FE26CC294B1EE3005A7F85 /* SurveySelectionView+DataSource.swift */,
0982A7FB29278E9000FC1976 /* SurveyHeader */,
0982A7FD29278E9000FC1976 /* SurveyItemView.swift */,
09D09DCF29682B93009F88AF /* SurveyItem */,
0982A7FE29278E9000FC1976 /* SurveyLoading */,
);
path = SurveySelection;
Expand Down Expand Up @@ -707,6 +731,7 @@
09A9F8D42952B3F8009DE583 /* LoginScreen.swift */,
09A9F8DA2952B54F009DE583 /* SurveyScreen.swift */,
09A9F8DD2952B582009DE583 /* AccountScreen.swift */,
09D09DD129682C98009F88AF /* SurveyDetailScreen.swift */,
09A9F8D72952B42D009DE583 /* GenericScreen.swift */,
);
path = Screens;
Expand Down Expand Up @@ -776,6 +801,7 @@
children = (
09CE770B28E191B400EAA9EE /* AppCoordinator.swift */,
0982A7E229222EFF00FC1976 /* RouteCoordinator.swift */,
09D09DC329681214009F88AF /* RouterCoordinator+WithoutAnimation.swift */,
09CE770D28E1921700EAA9EE /* Screens */,
);
path = Coordinator;
Expand All @@ -785,6 +811,7 @@
isa = PBXGroup;
children = (
09CE770E28E1922000EAA9EE /* Screen.swift */,
09D09DBF2968039F009F88AF /* ScreenParameters.swift */,
);
path = Screens;
sourceTree = "<group>";
Expand Down Expand Up @@ -833,6 +860,24 @@
path = Koin;
sourceTree = "<group>";
};
09D09DBA2967E833009F88AF /* SurveyDetail */ = {
isa = PBXGroup;
children = (
09D09DBB2967E843009F88AF /* SurveyDetailView.swift */,
09D09DC7296817E2009F88AF /* SurveyDetailImage.swift */,
);
path = SurveyDetail;
sourceTree = "<group>";
};
09D09DCF29682B93009F88AF /* SurveyItem */ = {
isa = PBXGroup;
children = (
0982A7FD29278E9000FC1976 /* SurveyItemView.swift */,
09D09DCD29682B78009F88AF /* SurveyItemOverlayView.swift */,
);
path = SurveyItem;
sourceTree = "<group>";
};
09E6ABE52951CF3E007F1EE3 /* SurveyKIFUITests */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -898,6 +943,7 @@
09E6AC0B2951D5DD007F1EE3 /* AccountSpec.swift */,
09D09DF9296E4B85009F88AF /* ResetPasswordSpec.swift */,
09D09DB1295C56A1009F88AF /* SurveySelectionSpec.swift */,
09D09DCB29682965009F88AF /* SurveyDetailSpec.swift */,
);
path = Module;
sourceTree = "<group>";
Expand Down Expand Up @@ -1097,6 +1143,7 @@
71A1F95D20E1E58589F4CD31 /* Constants.swift */,
09495FC8291106A00036BDFB /* Constants+SystemImage.swift */,
0964B1CD294054B300946FA1 /* Double+AnimationDuration.swift */,
09D09DC929682810009F88AF /* Constants+Animation.swift */,
);
path = Constants;
sourceTree = "<group>";
Expand Down Expand Up @@ -1183,6 +1230,7 @@
B7707C4371EA10EA47E7E7B4 /* Modules */ = {
isa = PBXGroup;
children = (
09D09DBA2967E833009F88AF /* SurveyDetail */,
0982A7F929278E9000FC1976 /* SurveySelection */,
09CE771128E1A93600EAA9EE /* ResetPassword */,
09495F6D28FFDE8C0036BDFB /* Login */,
Expand Down Expand Up @@ -1784,16 +1832,19 @@
09D09DFA296E4B85009F88AF /* ResetPasswordSpec.swift in Sources */,
09E6ABFE2951D333007F1EE3 /* ViewId+General.swift in Sources */,
09E6AC012951D333007F1EE3 /* ViewId+Login.swift in Sources */,
09D09DD329682CAE009F88AF /* SurveyDetailScreen.swift in Sources */,
09E6ABFF2951D333007F1EE3 /* ViewId+SurveySelection.swift in Sources */,
09D09E0C296EBA20009F88AF /* TimeInterval+Constants.swift in Sources */,
09D09DB2295C56A1009F88AF /* SurveySelectionSpec.swift in Sources */,
09D09DD429682CBC009F88AF /* ViewId+SurveyDetail.swift in Sources */,
09E6AC042951D333007F1EE3 /* ViewId+Splash.swift in Sources */,
09E6ABF32951D105007F1EE3 /* KIF+Swift.swift in Sources */,
09E6ABFD2951D32F007F1EE3 /* ViewId.swift in Sources */,
098832B029713BAD0015BAC2 /* AA_AppLoadSpec.swift in Sources */,
09A9F8DC2952B574009DE583 /* SurveyScreen.swift in Sources */,
09E6AC002951D333007F1EE3 /* ViewId+SurveyLoading.swift in Sources */,
09A9F8DF2952B585009DE583 /* AccountScreen.swift in Sources */,
09D09DD029682C19009F88AF /* SurveyDetailSpec.swift in Sources */,
09A9F8D92952B431009DE583 /* GenericScreen.swift in Sources */,
09E6AC022951D333007F1EE3 /* ViewId+ResetPassword.swift in Sources */,
);
Expand All @@ -1810,9 +1861,13 @@
09636B0D28D4917200A5CB97 /* OverlayButton.swift in Sources */,
09495FC9291106A00036BDFB /* Constants+SystemImage.swift in Sources */,
09E6AC102951D8B5007F1EE3 /* AccountView.swift in Sources */,
09D09DCE29682B78009F88AF /* SurveyItemOverlayView.swift in Sources */,
09D09DC429681214009F88AF /* RouterCoordinator+WithoutAnimation.swift in Sources */,
09D09DC8296817E2009F88AF /* SurveyDetailImage.swift in Sources */,
686B2C185816765B3E124776 /* IOSApp.swift in Sources */,
09CE771328E1A94600EAA9EE /* ResetPasswordView.swift in Sources */,
09FE26CD294B1EE3005A7F85 /* SurveySelectionView+DataSource.swift in Sources */,
09D09DCA29682810009F88AF /* Constants+Animation.swift in Sources */,
09636B3028D8267D00A5CB97 /* ViewId+General.swift in Sources */,
09636B0228D4876100A5CB97 /* PrimaryButton.swift in Sources */,
09CE770C28E191B400EAA9EE /* AppCoordinator.swift in Sources */,
Expand All @@ -1825,6 +1880,7 @@
09495F0928E410A00036BDFB /* PageControlView.swift in Sources */,
09636AFD28D484CA00A5CB97 /* R+SwiftUI.swift in Sources */,
09495FCB291107760036BDFB /* Image+Constants.swift in Sources */,
09D09DC02968039F009F88AF /* ScreenParameters.swift in Sources */,
09636B0F28D80B8500A5CB97 /* View+KeyboardDismiss.swift in Sources */,
09495F84290110640036BDFB /* AppDelegate.swift in Sources */,
09CE773428E2ED2300EAA9EE /* Typealias+Koin.swift in Sources */,
Expand All @@ -1842,6 +1898,7 @@
0982A880292F847900FC1976 /* ResetPassword+DataSource.swift in Sources */,
0964B1D92946FA8100946FA1 /* SplashView+DataSource.swift in Sources */,
0982A80429278E9000FC1976 /* SurveyItemView.swift in Sources */,
09D09DBC2967E843009F88AF /* SurveyDetailView.swift in Sources */,
09636B1528D8148C00A5CB97 /* ViewId.swift in Sources */,
0982A80529278E9000FC1976 /* SurveyLoading.swift in Sources */,
0982A7E029222EB900FC1976 /* ViewId+Splash.swift in Sources */,
Expand All @@ -1850,6 +1907,7 @@
09CE770F28E1922000EAA9EE /* Screen.swift in Sources */,
09CE772528E2C1C600EAA9EE /* View+HideBackButtonTitle.swift in Sources */,
09CE771528E1AB0B00EAA9EE /* ViewId+ResetPassword.swift in Sources */,
09D09DC6296812F6009F88AF /* View+ConditionalModifier.swift in Sources */,
09636B0B28D48CFD00A5CB97 /* Typealiases.swift in Sources */,
0982A7F6292371F000FC1976 /* StringResource+Localized.swift in Sources */,
0964B1CE294054B300946FA1 /* Double+AnimationDuration.swift in Sources */,
Expand All @@ -1860,6 +1918,7 @@
870924447B8C177450E77414 /* Optional+Unwrap.swift in Sources */,
0982A7E72922357C00FC1976 /* Font+Extensions.swift in Sources */,
0964B1C62940514000946FA1 /* LaunchArgument.swift in Sources */,
09D09DBE2967EA5F009F88AF /* ViewId+SurveyDetail.swift in Sources */,
09CE772328E2B87700EAA9EE /* LoadingDialog.swift in Sources */,
09636AF628D47A1500A5CB97 /* R.generated.swift in Sources */,
09D09DB92963EC39009F88AF /* Image+Url.swift in Sources */,
Expand All @@ -1878,6 +1937,7 @@
098CC7AD294C266000C3A6A5 /* XCTestCase+PermissionInteruption.swift in Sources */,
09495F1828E4461C0036BDFB /* SurveySelectionScreen.swift in Sources */,
09636B3228D8272200A5CB97 /* ScreenProtocol.swift in Sources */,
09D09DD529682CBF009F88AF /* ViewId+SurveyDetail.swift in Sources */,
0982A79E2921DF7E00FC1976 /* SurveySelectionSpec.swift in Sources */,
09C2F4032934588B00F44818 /* TimeInterval+Constants.swift in Sources */,
0964B1CA294051CE00946FA1 /* ArgumentedXCUIApplication.swift in Sources */,
Expand Down
15 changes: 15 additions & 0 deletions iosApp/Survey/Sources/Constants/Constants+Animation.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// Constants+Animation.swift
// Survey
//
// Created by Bliss on 6/1/23.
// Copyright © 2023 Nimble. All rights reserved.
//

import SwiftUI

extension Animation {

/// ease in 500 ms
static var easeInViewTransition: Self { .easeIn(duration: .viewTransition) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ extension Double {
static var fast: Self { 0.2.speedModified }
/// 0.3
static var `default`: Self { 0.3.speedModified }
/// 0.5
static var viewTransition: Self { 0.5.speedModified }
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ struct AppCoordinator: View {
SplashView(coordinator: coordinator)
case .surveySelection:
SurveySelectionContainerView(coordinator: coordinator)
case let .surveyDetail(parameters):
SurveyDetailView(
survey: parameters.survey,
coordinator: coordinator
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,21 @@ extension RouteCoordinator: AccountCoordinator {
showLogin()
}
}

extension RouteCoordinator: SurveySelectionCoordinator {

func showSurveyDetail(_ parameters: ScreenParameters.SurveyDetail) {
withoutAnimation {
self.routes.presentCover(.surveyDetail(parameters), embedInNavigationView: true)
}
}
}

extension RouteCoordinator: SurveyDetailCoordinator {

func backToHome() {
withoutAnimation {
self.routes.dismiss()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// RouterCoordinator+WithoutAnimation.swift
// Survey
//
// Created by Bliss on 6/1/23.
// Copyright © 2023 Nimble. All rights reserved.
//

import SwiftUI

extension RouteCoordinator {

func withoutAnimation(action: @escaping () -> Void) {
var transaction = Transaction()
transaction.disablesAnimations = true
withTransaction(transaction) {
action()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ enum Screen {
case splash
case resetPassword
case surveySelection
case surveyDetail(_ parameters: ScreenParameters.SurveyDetail)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// ScreenParameters.swift
// Survey
//
// Created by Bliss on 6/1/23.
// Copyright © 2023 Nimble. All rights reserved.
//

import Shared

enum ScreenParameters {

struct SurveyDetail {

let survey: SurveyUiModel
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// SurveyDetailImage.swift
// Survey
//
// Created by Bliss on 6/1/23.
// Copyright © 2023 Nimble. All rights reserved.
//

import Shared
import SwiftUI

struct SurveyDetailImage: View {

@Binding var isAnimating: Bool

let survey: SurveyUiModel
let scaleEffect = 1.42

var body: some View {
ZStack {

GeometryReader { geometry in
Image.url(survey.largeImageUrl)
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: geometry.size.width, height: geometry.size.height)
.scaleEffect(isAnimating ? 1.0 : scaleEffect, anchor: .topTrailing)
.accessibility(.surveyDetail(.mainImage))
}
.ignoresSafeArea()

SurveyItemOverlayView()
.ignoresSafeArea()
}
.accessibilityElement(children: .contain)
}
}
Loading

0 comments on commit 5911cfc

Please sign in to comment.