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

♿️ - Settings #546

Merged
merged 23 commits into from
Feb 6, 2019
Merged

♿️ - Settings #546

merged 23 commits into from
Feb 6, 2019

Conversation

dusi
Copy link
Contributor

@dusi dusi commented Jan 7, 2019

📲 What

Settings accessibility cleanup

🤔 Why

Some of our settings screens needed a bit of a11y love 🙏

🛠 How

More in-depth discussion of the change or implementation.

👀 See

#532 - Dismiss button
#534 - Settings - rows
#535 - Settings - Change email status
#537 - Settings - Change email - Current email
#545 - Settings - Change email / password input fields
#549 - Settings - Account - Privacy - Delete my KSR account button
#550 - Settings - Heading
#552 - Settings - Notifications - Manage project notifications + Email frequency
#547 - Settings - Notifications - Daily Digest picker bug
#544 - Settings - Switch toggle rows
#539 - Settings - Message banner

@dusi dusi added the WIP label Jan 7, 2019
@dusi dusi changed the title ♿️ Settings [WIP] ♿️ Settings Jan 7, 2019
@dusi dusi changed the title [WIP] ♿️ Settings [WIP] ♿️ - Settings Jan 8, 2019
@dusi dusi changed the title [WIP] ♿️ - Settings ♿️ - Settings Jan 29, 2019
@dusi dusi added needs review and removed WIP labels Jan 29, 2019
dusi and others added 11 commits January 29, 2019 09:22
* Add accessibility label to dismiss button & fix the minimum width

* Set navigation item properties using key paths
* Add button traits to settings cells

* Invert disclosure indicators in Settings > Help
* Group current email title and value for a better accessibility

* Simplify the way we set accessibility label on current email container
* Accessibility - Settings - Dismiss button (#532)

* Add accessibility label to dismiss button & fix the minimum width

* Set navigation item properties using key paths

* Accessibility - Settings - Rows (#534)

* Add button traits to settings cells

* Invert disclosure indicators in Settings > Help

* Add accessibility hint in case email is unverified (#535)

* Focuses Voice Over on the banner when presented

* Delay banner dismissal a bit more when VoiceOver is ON

* Localize banner message
* Accessibility - Settings - Dismiss button (#532)

* Add accessibility label to dismiss button & fix the minimum width

* Set navigation item properties using key paths

* Accessibility - Settings - Rows (#534)

* Add button traits to settings cells

* Invert disclosure indicators in Settings > Help

* Accessibility - Settings - Dismiss button (#532)

* Add accessibility label to dismiss button & fix the minimum width

* Set navigation item properties using key paths

* Accessibility - Settings - Rows (#534)

* Add button traits to settings cells

* Invert disclosure indicators in Settings > Help

* Add accessibility hint in case email is unverified (#535)

* Accessibility - Settings - Change email - Current email (#537)

* Group current email title and value for a better accessibility

* Simplify the way we set accessibility label on current email container

* a11y for notification settings

* swiftlint fix
* textfield a11y improvement in change email and password screens

* change stackview alignment

* new snapshots

* fixed strings
* Fix newsletter switch cell accessibility

* Fix project notifications switch cell accessibility

* Fix settings privacy switch cell accessibility

* Refocus VoiceOver on the cell when the confirmation dialog disappears

* Place UIAccessibility notification behind a VoiceOver running check

* Prevent refreshing the following cell when confirming the alert dialogue

* Alphabetize properties

* Localize properly
* corrected picker view hidden in iphone X in VM

* Library tests

* Update snapshot tests

* vm and snapshot tests

* snapshot tests

* wip - digest picker is selected

* properly aligned tableview constraint

* removed output to hide picker

* emailPickerViewHeight

* VoiceOver re-focuses on the Email frequency cell

* adjusted animation added guard

* changed comment

* Update Kickstarter-iOS/Views/Controllers/SettingsNotificationsViewController.swift

Co-Authored-By: cdolm92 <cdolm92@gmail.com>

* Apply suggestions from code review

comments adjustment

Co-Authored-By: cdolm92 <cdolm92@gmail.com>

* Update Kickstarter-iOS/Views/Controllers/SettingsNotificationsViewController.swift

Co-Authored-By: cdolm92 <cdolm92@gmail.com>
…frequency (#552)

* Add button traits to project notifications & email frequency rows

* Remove unused accessibility hint

* Remove accessibility value
Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

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

Cool, some suggestions!

@@ -63,6 +76,10 @@ internal final class SettingsFollowCell: UITableViewCell, ValueCell {
self.followingSwitch.rac.on = self.viewModel.outputs.followingPrivacyOn
}

func toggleOn(animated: Bool = true) {
self.followingSwitch.setOn(true, animated: animated)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is true hard-coded here 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question. So this method could be more generic (i.e. toggle(on: Bool, animated: Bool)) but since we only ever need to toggle back ON we have used more specific function named toggleOn which implies that we're switching the toggle ON...hence setOn(true, ...)

UIView.animate(
withDuration: duration,
delay: 0.0,
options: UIView.AnimationOptions.curveEaseInOut,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this infer .curveEaseInOut or [.curveEaseInOut]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hopefully it won't break the compiler :trollface:

animations: { [weak self] in
guard let self = self else { return }

if !isHidden {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we combine the nested ifs here into one? if !isHidden && AppEnvironment.current.isVoiceOverRunning(), also on line 115.

@@ -53,14 +54,34 @@ MessageBannerViewModelInputs, MessageBannerViewModelOutputs {
self.messageTextAlignment = bannerType.map { $0.textAlignment }

self.bannerMessage = self.messageBannerConfiguration.signal.skipNil().map(second)
self.bannerMessageAccessibilityLabel = self.bannerMessage
// todo: Needs to be localized - Strings.banner_tap_to_dismiss
.map { "\($0), double tap to dismiss" }
Copy link
Contributor

Choose a reason for hiding this comment

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

Has this been added to our strings yet?

I think it's always a good idea to use the localizedString() function directly if we don't yet have it in Strings.swift that way if we forget about this it's going to use localization or if we need an easy way to find it later we can just search for uses of localizedString().

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 completely forgot about this...good catch Justin.

Created https://github.com/kickstarter/kickstarter/pull/14146 and will block this PR until we have those strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also I had to update the string to be in form of a sentence to better match server response..

Before
screen shot 2019-01-31 at 11 19 02 am

After
screen shot 2019-01-31 at 11 27 03 am

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also note that we should remove project_count_projects_backed when https://github.com/kickstarter/kickstarter/pull/13979#pullrequestreview-198853575 gets merged

let dismissBanner = self.bannerViewIsHiddenProperty.signal
.filter(isFalse)

// Dismisses the banner after 4 seconds when VoiceOver is OFF
Copy link
Contributor

Choose a reason for hiding this comment

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

Were we certain about the use of debounce here vs delay? I remember chatting about it but can't recall 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we actually really want to use debounce. The banner was showing a weird behaviour when using delay.

@dusi dusi added blocked a PR that is blocked for external reasons and removed needs review labels Jan 31, 2019
@dusi
Copy link
Contributor Author

dusi commented Feb 4, 2019

Addressed all outstanding feedback

@@ -247,6 +247,7 @@
"Manage_your_pledge_below" = "Folgenden Beitrag verwalten";
"Manage_your_reward" = "Belohnung verwalten";
"Message_backer" = "Nachricht an Unterstützer senden";
"Message_banner.accessibility.Double_tap_to_dismiss" = "Double tap to dismiss.";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently this string is not localized, but based on the conversation we had with @peat it should not delay merging stuff to master/:shipit:

@dusi dusi removed the blocked a PR that is blocked for external reasons label Feb 4, 2019
Copy link
Contributor

@justinswart justinswart 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, minor comments!

}

self.emailPickerViewTopConstraint.constant = isHidden ? 0 : self.emailFrequencyPickerView.frame.height
self.view.setNeedsLayout()
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tested without setNeedsLayout()? I think we only need layoutIfNeeded().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not originally my code...but have tried removing and it looks like everything works. Agree that we should only need to call layoutIfNeeded().

@@ -53,14 +54,33 @@ MessageBannerViewModelInputs, MessageBannerViewModelOutputs {
self.messageTextAlignment = bannerType.map { $0.textAlignment }

self.bannerMessage = self.messageBannerConfiguration.signal.skipNil().map(second)
self.bannerMessageAccessibilityLabel = self.bannerMessage
.map { "\($0) \(Strings.Message_banner_accessibility_Double_tap_to_dismiss())" }
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we don't have much choice here but just something to bear in mind is that string concatenation can break translations for languages where the direction isn't left to right.

self.didCancelSocialOptOutProperty.signal,
self.didConfirmSocialOptOutProperty.signal
)
.filter { _ in AppEnvironment.current.isVoiceOverRunning() }
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we align the . with the last parenthesis?

Copy link
Contributor

@justinswart justinswart left a comment

Choose a reason for hiding this comment

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

Great work!

@dusi dusi merged commit d2cf6f9 into master Feb 6, 2019
@dusi dusi deleted the a11y-settings branch February 6, 2019 22:39
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.

3 participants