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

ALTAPPS-1058: iOS search feature #784

Merged
merged 30 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
32a5445
Add SearchResultsDataComponent
ivan-magda Dec 7, 2023
ef3afad
Delete TopicsInteractor
ivan-magda Dec 7, 2023
bf46e58
Gamification toolbar add search message
ivan-magda Dec 8, 2023
8a42a19
SearchFeature initial commit
ivan-magda Dec 8, 2023
8acff52
Do search
ivan-magda Dec 8, 2023
5cb60dd
Add ViewState
ivan-magda Dec 8, 2023
e74e358
Handle click on search results item
ivan-magda Dec 8, 2023
641f30c
Handle retry search
ivan-magda Dec 8, 2023
1379c83
Reformat code
ivan-magda Dec 8, 2023
cd19f77
Add empty view state
ivan-magda Dec 8, 2023
04c4dca
Add string resources
ivan-magda Dec 8, 2023
8115096
Fix SearchReducer.handleSearchClickedMessage
ivan-magda Dec 8, 2023
e2ed8c8
Update SearchResult.targetType
ivan-magda Dec 11, 2023
c5ced23
Merge branch 'feature/ALTAPPS-1057/shared-search-data-component' into…
ivan-magda Dec 11, 2023
0136852
Merge remote tracking branch origin/feature/search
ivan-magda Dec 11, 2023
040b781
Add OpenStepScreenFailed view action
ivan-magda Dec 11, 2023
385b9de
Perform search requests while typing
ivan-magda Dec 11, 2023
6a2c66a
Add search bar button item
ivan-magda Dec 12, 2023
1b37dcf
Add search module
ivan-magda Dec 12, 2023
7be1289
Handle search query the same
ivan-magda Dec 12, 2023
38919e7
Delete isSearchButtonEnabled
ivan-magda Dec 12, 2023
117fc73
Merge branch 'feature/ALTAPPS-1057/shared-search-feature' into featur…
ivan-magda Dec 12, 2023
ef04c7c
Handle openStepScreen view action
ivan-magda Dec 12, 2023
db778c3
Add SearchPlaceholderLoadingView
ivan-magda Dec 12, 2023
fe1da15
Update ProfileStatisticsView position
ivan-magda Dec 12, 2023
f46e8a1
Handle CancellationException
ivan-magda Dec 12, 2023
6377824
Merge branch 'feature/ALTAPPS-1057/shared-search-feature' into featur…
ivan-magda Dec 12, 2023
11f3580
Update cancelSearchJob
ivan-magda Dec 13, 2023
ddbb064
Merge branch 'feature/ALTAPPS-1057/shared-search-feature' into featur…
ivan-magda Dec 13, 2023
09a0c33
Merge remote tracking branch origin/feature/search
ivan-magda Dec 13, 2023
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
52 changes: 52 additions & 0 deletions iosHyperskillApp/iosHyperskillApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@
2C55E1902A056AFC00FE58D7 /* ProblemsLimitSkeletonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C55E18F2A056AFC00FE58D7 /* ProblemsLimitSkeletonView.swift */; };
2C55E1922A05706300FE58D7 /* HomeSubheadlineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C55E1912A05706300FE58D7 /* HomeSubheadlineView.swift */; };
2C56611A2AEA418D00D607FB /* FillBlanksSelectCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5661192AEA418D00D607FB /* FillBlanksSelectCollectionViewCell.swift */; };
2C5837A12B28413C0096B89B /* SearchPlaceholderEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5837A02B28413C0096B89B /* SearchPlaceholderEmptyView.swift */; };
2C5837A32B2844E20096B89B /* SearchPlaceholderSuggestionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5837A22B2844E20096B89B /* SearchPlaceholderSuggestionsView.swift */; };
2C5837A62B284E570096B89B /* NavigationLink+Empty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5837A52B284E570096B89B /* NavigationLink+Empty.swift */; };
2C58DE232803BF97002A2774 /* AuthLogoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C58DE222803BF97002A2774 /* AuthLogoView.swift */; };
2C58DE252803C185002A2774 /* AuthSocialControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C58DE242803C185002A2774 /* AuthSocialControlsView.swift */; };
2C58DE292803D197002A2774 /* UIColor+DynamicColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C58DE282803D197002A2774 /* UIColor+DynamicColor.swift */; };
Expand Down Expand Up @@ -473,6 +476,7 @@
2CF41A8E28505D2C000736D6 /* LatexView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF41A8D28505D2C000736D6 /* LatexView.swift */; };
2CF4341228126C79002893CD /* View+EndEditing.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF4341128126C79002893CD /* View+EndEditing.swift */; };
2CF43414281281DB002893CD /* AuthTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF43413281281DB002893CD /* AuthTextField.swift */; };
2CF5DF912B2853DA006E4ED7 /* SearchPlaceholderLoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF5DF902B2853DA006E4ED7 /* SearchPlaceholderLoadingView.swift */; };
2CF72AA32847757300E1C192 /* StepQuizTableViewData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF72AA22847757300E1C192 /* StepQuizTableViewData.swift */; };
2CF72AA5284775BF00E1C192 /* StepQuizTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF72AA4284775BF00E1C192 /* StepQuizTableView.swift */; };
2CF72AA828477E0600E1C192 /* StepQuizTableRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2CF72AA728477E0600E1C192 /* StepQuizTableRowView.swift */; };
Expand All @@ -491,6 +495,8 @@
40D8E6EFE44EB7A6092C171B /* Pods_iosHyperskillApp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C0F8A86D62CB915A1E49CAA /* Pods_iosHyperskillApp.framework */; };
59B66CD4D1508049555D35AE /* ProgressScreenView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCC18157582494D2909B214C /* ProgressScreenView.swift */; };
60B4F143CF507F83C9581020 /* LeaderboardViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E205DEF27554501F7BE01AA /* LeaderboardViewModel.swift */; };
7A628C36D862C98ED2046D4F /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 907B10B0F7D4970530A478A2 /* SearchView.swift */; };
8E154CD6AF7D45A2CA013F85 /* SearchAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7F55BD539626D22DCF0E1344 /* SearchAssembly.swift */; };
9195A8624F8058A7D5F936F8 /* NotificationsOnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3570563AEEEEF2F5495BCA6 /* NotificationsOnboardingViewModel.swift */; };
AE0B2D1D267B8904498FA371 /* ProjectSelectionDetailsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FEDCC11294912B8656C8B264 /* ProjectSelectionDetailsViewModel.swift */; };
B2B30D0486FC13DCC80F4263 /* NotificationsOnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3944E4546DEF47A28B2E7292 /* NotificationsOnboardingView.swift */; };
Expand Down Expand Up @@ -621,6 +627,7 @@
E9FB89AC2893EA580011EFFB /* NotificationPermissionStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FB89AB2893EA580011EFFB /* NotificationPermissionStatus.swift */; };
E9FB89B02893EA900011EFFB /* UserNotificationsCenterDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9FB89AF2893EA900011EFFB /* UserNotificationsCenterDelegate.swift */; };
ECD10958C8BA7D758D3D1F66 /* ProjectSelectionDetailsAssembly.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15AD7CF422D27CCAE2839046 /* ProjectSelectionDetailsAssembly.swift */; };
ED49113F88FF32AAFE6AFFBC /* SearchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 25AEA48C62195F44E21D6491 /* SearchViewModel.swift */; };
F759010A5FC990E99AAF0D76 /* ProgressScreenViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20A5BDA1E184CA8FBAAD8584 /* ProgressScreenViewModel.swift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -668,6 +675,7 @@
1496D2AE71B028929CE863C6 /* TrackSelectionDetailsAssembly.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = TrackSelectionDetailsAssembly.swift; sourceTree = "<group>"; };
15AD7CF422D27CCAE2839046 /* ProjectSelectionDetailsAssembly.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ProjectSelectionDetailsAssembly.swift; sourceTree = "<group>"; };
20A5BDA1E184CA8FBAAD8584 /* ProgressScreenViewModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ProgressScreenViewModel.swift; sourceTree = "<group>"; };
25AEA48C62195F44E21D6491 /* SearchViewModel.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SearchViewModel.swift; sourceTree = "<group>"; };
2C005DCB27EF5B0300DC6503 /* GoogleServiceInfo.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GoogleServiceInfo.swift; sourceTree = "<group>"; };
2C0146A928FDF2350083DA9C /* StepQuizCodeFullScreenInputProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizCodeFullScreenInputProtocol.swift; sourceTree = "<group>"; };
2C023C85285D927A00D2D5A9 /* StepQuizTableAssembly.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizTableAssembly.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -850,6 +858,9 @@
2C55E18F2A056AFC00FE58D7 /* ProblemsLimitSkeletonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProblemsLimitSkeletonView.swift; sourceTree = "<group>"; };
2C55E1912A05706300FE58D7 /* HomeSubheadlineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeSubheadlineView.swift; sourceTree = "<group>"; };
2C5661192AEA418D00D607FB /* FillBlanksSelectCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillBlanksSelectCollectionViewCell.swift; sourceTree = "<group>"; };
2C5837A02B28413C0096B89B /* SearchPlaceholderEmptyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchPlaceholderEmptyView.swift; sourceTree = "<group>"; };
2C5837A22B2844E20096B89B /* SearchPlaceholderSuggestionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchPlaceholderSuggestionsView.swift; sourceTree = "<group>"; };
2C5837A52B284E570096B89B /* NavigationLink+Empty.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NavigationLink+Empty.swift"; sourceTree = "<group>"; };
2C58DE222803BF97002A2774 /* AuthLogoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthLogoView.swift; sourceTree = "<group>"; };
2C58DE242803C185002A2774 /* AuthSocialControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthSocialControlsView.swift; sourceTree = "<group>"; };
2C58DE282803D197002A2774 /* UIColor+DynamicColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+DynamicColor.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1138,6 +1149,7 @@
2CF41A8D28505D2C000736D6 /* LatexView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LatexView.swift; sourceTree = "<group>"; };
2CF4341128126C79002893CD /* View+EndEditing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+EndEditing.swift"; sourceTree = "<group>"; };
2CF43413281281DB002893CD /* AuthTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthTextField.swift; sourceTree = "<group>"; };
2CF5DF902B2853DA006E4ED7 /* SearchPlaceholderLoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchPlaceholderLoadingView.swift; sourceTree = "<group>"; };
2CF72AA22847757300E1C192 /* StepQuizTableViewData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizTableViewData.swift; sourceTree = "<group>"; };
2CF72AA4284775BF00E1C192 /* StepQuizTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizTableView.swift; sourceTree = "<group>"; };
2CF72AA728477E0600E1C192 /* StepQuizTableRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StepQuizTableRowView.swift; sourceTree = "<group>"; };
Expand All @@ -1162,6 +1174,8 @@
71D01125D308034C53D75DA6 /* ProjectSelectionDetailsView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ProjectSelectionDetailsView.swift; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* iosHyperskillApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosHyperskillApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7F55BD539626D22DCF0E1344 /* SearchAssembly.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SearchAssembly.swift; sourceTree = "<group>"; };
907B10B0F7D4970530A478A2 /* SearchView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; };
9AACF19B25D42FD4AE322D5A /* ProgressScreenAssembly.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = ProgressScreenAssembly.swift; sourceTree = "<group>"; };
9C0F8A86D62CB915A1E49CAA /* Pods_iosHyperskillApp.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_iosHyperskillApp.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C2065D585FD89A96C31C08BC /* TrackSelectionDetailsView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = TrackSelectionDetailsView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1629,6 +1643,7 @@
2C963BC82812D3410036DD53 /* ProfileSettings */,
69443CBBFA46C4A121EA173F /* ProgressScreen */,
2C5CA2452A203C4500DBF2F9 /* ProjectSelection */,
3C00014807122833363E303F /* Search */,
2C9E5E8229B211DD003AEC16 /* StageImplement */,
2CAE8CEE280525A100E6C83D /* Step */,
2C41127428376DE3004948A3 /* StepQuiz */,
Expand Down Expand Up @@ -2185,6 +2200,25 @@
path = Input;
sourceTree = "<group>";
};
2C58379F2B28412C0096B89B /* Views */ = {
isa = PBXGroup;
children = (
2C5837A02B28413C0096B89B /* SearchPlaceholderEmptyView.swift */,
2CF5DF902B2853DA006E4ED7 /* SearchPlaceholderLoadingView.swift */,
2C5837A22B2844E20096B89B /* SearchPlaceholderSuggestionsView.swift */,
907B10B0F7D4970530A478A2 /* SearchView.swift */,
);
path = Views;
sourceTree = "<group>";
};
2C5837A42B284E4C0096B89B /* NavigationLink */ = {
isa = PBXGroup;
children = (
2C5837A52B284E570096B89B /* NavigationLink+Empty.swift */,
);
path = NavigationLink;
sourceTree = "<group>";
};
2C58DE212803BE84002A2774 /* Views */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -2341,6 +2375,7 @@
2C725B5C28090CE500A49043 /* SwiftUI */ = {
isa = PBXGroup;
children = (
2C5837A42B284E4C0096B89B /* NavigationLink */,
2C323750283808300062CAF6 /* View */,
);
path = SwiftUI;
Expand Down Expand Up @@ -3511,6 +3546,16 @@
path = Injection;
sourceTree = "<group>";
};
3C00014807122833363E303F /* Search */ = {
isa = PBXGroup;
children = (
7F55BD539626D22DCF0E1344 /* SearchAssembly.swift */,
25AEA48C62195F44E21D6491 /* SearchViewModel.swift */,
2C58379F2B28412C0096B89B /* Views */,
);
path = Search;
sourceTree = "<group>";
};
46D884ECAA31C3DB83AF8E56 /* Details */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -4307,6 +4352,7 @@
2CEB50CE288AACEA0044F9AB /* StepQuizCodeFullScreenTab.swift in Sources */,
2CEB50C8288A94050044F9AB /* BlockExtensions.swift in Sources */,
2C54E4282A1F717F003406B9 /* CardView.swift in Sources */,
2C5837A62B284E570096B89B /* NavigationLink+Empty.swift in Sources */,
E9D2D675284E0B30000757AC /* StepQuizMatchingView.swift in Sources */,
2CBC97CD2A555AA20078E445 /* StageImplementProjectCompletedModalView.swift in Sources */,
2CC95C0E2A4EBB970036C73E /* ProjectLevelAvatarView.swift in Sources */,
Expand Down Expand Up @@ -4666,6 +4712,7 @@
2CA368E728EEAE09004F7FD8 /* AppView.swift in Sources */,
2C5215AA291E5B63006C2427 /* PullToRefresh.swift in Sources */,
2CAE8CF4280525D400E6C83D /* StepAssembly.swift in Sources */,
2C5837A32B2844E20096B89B /* SearchPlaceholderSuggestionsView.swift in Sources */,
2CD316C028A3B2040002B2B2 /* ApplicationTheme+SharedTheme.swift in Sources */,
2C1061A4285C34C900EBD614 /* StepQuizChildQuizOutputProtocol.swift in Sources */,
2C20FBA4284F165A006D879E /* ProcessedContent.swift in Sources */,
Expand Down Expand Up @@ -4789,9 +4836,11 @@
E9D537D42A71393A00F21828 /* ProfileBadgesGridView.swift in Sources */,
C727878256DA0342EF174A4E /* TrackSelectionDetailsView.swift in Sources */,
D9B929495D696A140BA3D150 /* TrackSelectionDetailsViewModel.swift in Sources */,
2CF5DF912B2853DA006E4ED7 /* SearchPlaceholderLoadingView.swift in Sources */,
ECD10958C8BA7D758D3D1F66 /* ProjectSelectionDetailsAssembly.swift in Sources */,
018CAC44EED7A992000ECF87 /* ProjectSelectionDetailsView.swift in Sources */,
2CB0ADEC2B04AD550089D557 /* ChallengeWidgetView.swift in Sources */,
2C5837A12B28413C0096B89B /* SearchPlaceholderEmptyView.swift in Sources */,
AE0B2D1D267B8904498FA371 /* ProjectSelectionDetailsViewModel.swift in Sources */,
2C8DD4092AFB7DFD00FD5359 /* ShareStreakModalViewController.swift in Sources */,
0809817CFCC9D4C45457B3C8 /* ProgressScreenAssembly.swift in Sources */,
Expand All @@ -4805,6 +4854,9 @@
043790C380B462AFEB2B13BC /* LeaderboardAssembly.swift in Sources */,
BAEC674E5161E8C7A10ADAAB /* LeaderboardView.swift in Sources */,
60B4F143CF507F83C9581020 /* LeaderboardViewModel.swift in Sources */,
8E154CD6AF7D45A2CA013F85 /* SearchAssembly.swift in Sources */,
7A628C36D862C98ED2046D4F /* SearchView.swift in Sources */,
ED49113F88FF32AAFE6AFFBC /* SearchViewModel.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import SwiftUI

extension NavigationLink where Label == EmptyView, Destination == EmptyView {
/// Useful in cases where a `NavigationLink` is needed but there should not be a destination. e.g. for programmatic navigation.
static var empty: NavigationLink {
self.init(destination: EmptyView(), label: { EmptyView() })
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,18 @@ enum Strings {
static let changeProject = sharedStrings.progress_screen_change_project.localized()
}
}

// MARK: - Search -

enum Search {
static let title = sharedStrings.search_title.localized()

static let placeholderEmptyTitle = sharedStrings.search_placeholder_empty_title.localized()
static let placeholderEmptySubtitle = sharedStrings.search_placeholder_empty_subtitle.localized()

static let placeholderSuggestionsTitle = sharedStrings.search_placeholder_suggestions_title.localized()
static let placeholderSuggestionsSubtitle = sharedStrings.search_placeholder_suggestions_subtitle.localized()

static let placeholderErrorDescription = sharedStrings.search_placeholder_error_description.localized()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ enum GamificationToolbarViewActionHandler {
let assembly = ProgressScreenAssembly()
stackRouter.pushViewController(assembly.makeModule())
case .showSearchScreen:
#warning("TODO: ALTAPPS-1058 show search screen")
if #available(iOS 15.0, *) {
let assembly = SearchAssembly()
stackRouter.pushViewController(assembly.makeModule())
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import SwiftUI
extension GamificationToolbarContent {
struct Appearance {
let skeletonSize = CGSize(width: 56, height: 28)

let searchImageWidthHeight: CGFloat = 16
let searchImagePadding: CGFloat = 6
let searchImageBackgroundColor = Color(ColorPalette.surface)
}
}

Expand All @@ -14,6 +18,7 @@ struct GamificationToolbarContent: ToolbarContent {

let onStreakTap: () -> Void
let onProgressTap: () -> Void
let onSearchTap: () -> Void

var body: some ToolbarContent {
ToolbarItem(placement: .primaryAction) {
Expand All @@ -22,6 +27,9 @@ struct GamificationToolbarContent: ToolbarContent {
HStack {
SkeletonRoundedView(appearance: .init(size: appearance.skeletonSize))
SkeletonRoundedView(appearance: .init(size: appearance.skeletonSize))
if #available(iOS 15.0, *) {
SkeletonRoundedView(appearance: .init(size: appearance.skeletonSize))
}
}
case .error:
HStack {}
Expand All @@ -41,6 +49,21 @@ struct GamificationToolbarContent: ToolbarContent {
isCompletedToday: data.streak.isCompleted,
onTap: onStreakTap
)

if #available(iOS 15.0, *) {
Button(
action: onSearchTap,
label: {
Image(systemName: "magnifyingglass")
.resizable()
.renderingMode(.template)
.aspectRatio(contentMode: .fit)
.frame(widthHeight: appearance.searchImageWidthHeight)
.padding(appearance.searchImagePadding)
.background(Circle().foregroundColor(appearance.searchImageBackgroundColor))
}
)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ final class HomeViewModel: FeatureViewModel<HomeFeature.ViewState, HomeFeatureMe
)
}

func doSearchBarButtonItemAction() {
onNewMessage(
HomeFeatureMessageGamificationToolbarMessage(
message: GamificationToolbarFeatureMessageClickedSearch()
)
)
}

// MARK: Analytic

func logViewedEvent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ struct HomeView: View {
GamificationToolbarContent(
viewStateKs: viewModel.gamificationToolbarViewStateKs,
onStreakTap: viewModel.doStreakBarButtonItemAction,
onProgressTap: viewModel.doProgressBarButtonItemAction
onProgressTap: viewModel.doProgressBarButtonItemAction,
onSearchTap: viewModel.doSearchBarButtonItemAction
)
}
.onAppear {
Expand Down
Loading