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

Active poll history UI (PSG-906) #7267

Merged
merged 18 commits into from
Jan 16, 2023
Merged

Conversation

alfogrillo
Copy link
Contributor

This PR:

  • Adds a new entry in the room's settings to navigate to the poll history
  • Add the UI (without any logic yet) for the active poll history
  • The poll history is visible just in debug build since it's incomplete

Result

poc

@alfogrillo alfogrillo force-pushed the alfogrillo/active_poll_history branch from 21689e4 to c7c3b85 Compare January 13, 2023 10:04
@alfogrillo alfogrillo requested review from a team and pixlwave and removed request for a team January 13, 2023 10:05
@codecov
Copy link

codecov bot commented Jan 13, 2023

Codecov Report

Base: 11.83% // Head: 11.94% // Increases project coverage by +0.10% 🎉

Coverage data is based on head (25a52a2) compared to base (dcac584).
Patch coverage: 67.52% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #7267      +/-   ##
===========================================
+ Coverage    11.83%   11.94%   +0.10%     
===========================================
  Files         1630     1637       +7     
  Lines       160317   160581     +264     
  Branches     65489    65618     +129     
===========================================
+ Hits         18977    19184     +207     
- Misses      140701   140758      +57     
  Partials       639      639              
Flag Coverage Δ
uitests 55.25% <85.11%> (+0.39%) ⬆️
unittests 5.96% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Config/BuildSettings.swift 43.07% <ø> (ø)
Riot/Modules/LocationSharing/LocationManager.swift 0.00% <0.00%> (ø)
...ot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift 0.00% <0.00%> (ø)
...RoomInfo/RoomInfoList/RoomInfoListViewAction.swift 0.00% <ø> (ø)
...Info/RoomInfoList/RoomInfoListViewController.swift 0.00% <0.00%> (ø)
...llHistory/Coordinator/PollHistoryCoordinator.swift 0.00% <0.00%> (ø)
...History/Service/MatrixSDK/PollHistoryService.swift 0.00% <0.00%> (ø)
...odules/Room/PollHistory/View/SegmentedPicker.swift 51.16% <51.16%> (ø)
...UI/Modules/Room/PollHistory/View/PollHistory.swift 90.90% <90.90%> (ø)
...I/Modules/Room/PollHistory/View/PollListItem.swift 91.66% <91.66%> (ø)
... and 45 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@pixlwave pixlwave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👏, some thoughts inline, nothing major though :)

Config/BuildSettings.swift Outdated Show resolved Hide resolved
Comment on lines +59 to +61
let enumeratedPolls = Array(viewModel.viewState.polls.enumerated())

ForEach(enumeratedPolls, id: \.offset) { _, pollData in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems more sensible to make PollListData conform to Identifiable (using the poll start event ID presumably) than enumerating them just for an index which is potentially an unstable ID for the poll if the order changed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PollListData is totally a mock for now.
This will change a lot in next PRs I guess...

Comment on lines +19 to +22
struct PollListData {
let startDate: Date
let question: String
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably go in PollHistoryModels fwiw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fell like dumb data model can stay in the same file of the view that consumes them.
Doing so you have everything you need to work on the component in a single file.
I'm not against moving it btw.


import SwiftUI

struct SegmentedPicker<Tag: Hashable>: View {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah its a shame we can't use a custom PickerStyle here to get voiceover support for free. Looks to be a private API for now 😕

Should probably add the necessary accessibility modifiers to the segments to communicate what is/isn't selected for now I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah its a shame we can't use a custom PickerStyle here to get voiceover support for free. Looks to be a private API for now

Yeah, I tried that before I invented a new component.
Apple you need to do the right thing here! 😄

Added the accessibility labels btw: 5735b5d

.font(isSelectedSegment ? theme.fonts.headline : theme.fonts.body)
.underline(isSelectedSegment)
}
.accentColor(isSelectedSegment ? theme.colors.accent : theme.colors.primaryContent)
.accessibilityLabel(segment.description + (isSelectedSegment ? "-selected" : ""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be wrong, but maybe you can use .accessibilityValue here for selected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UI tests (like they are now) fail switching to .accessibilityValue.
Why do you think it would be a better option?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed here -> 25a52a2

@sonarcloud
Copy link

sonarcloud bot commented Jan 16, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@alfogrillo alfogrillo merged commit 3b172e6 into develop Jan 16, 2023
@alfogrillo alfogrillo deleted the alfogrillo/active_poll_history branch January 16, 2023 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants