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

handle alerts in audio cue service, add List Alerts command and settings #201833

Merged
merged 24 commits into from Jan 9, 2024

Conversation

meganrogge
Copy link
Contributor

@meganrogge meganrogge commented Jan 4, 2024

fixes #195282
fixes #201910

@meganrogge meganrogge requested a review from hediet January 4, 2024 19:46
@meganrogge meganrogge self-assigned this Jan 4, 2024
@meganrogge meganrogge added this to the December / January 2024 milestone Jan 4, 2024
@hediet
Copy link
Member

hediet commented Jan 5, 2024

Thanks for integrating the AccessibleNotificationService into the AudioCueService!

The PR is quite hard to review though, because it is a refactoring of the AccessibleNotificationService.
Can you try to revert your initial PR where you introduced AccessibleNotificationService and then rebase this PR onto that, so this PR just describes the feature implementation and not the refactoring?
That would make reviewing so much easier and is what I initially suggested. Thank you!

Copy link
Member

@hediet hediet left a comment

Choose a reason for hiding this comment

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

Please revert the introduction of IAccessibleNotificationService in a separate PR and rebase this PR again, so that it only contains the changes for the feature.

Now it is very hard to review the changes needed for the feature.

@meganrogge
Copy link
Contributor Author

meganrogge commented Jan 5, 2024

@hediet that would require reverting all 4 of these PRS, which would complicate things quite a bit. I'm happy to walk through the changes with you if you want on a call.

https://github.com/microsoft/vscode/pulls?q=is%3Apr+author%3Ameganrogge+is%3Aclosed+accessible+notification+service

I initially created the AccessibleNotificationService to handle audio cues and alerts in one place and to deal with the complexity introduced by the format/save cues which have setting values of userGesture, always, or never.

Essentially, now I call the AudioCueService instead of the AccessibleNotificationService. I cannot access the WorkingCopyService from within AudioCueService, thus the addition of the SaveAudioCueContribution.

@meganrogge meganrogge requested a review from hediet January 5, 2024 17:26
@meganrogge meganrogge changed the title handle alerts in audio cue service handle alerts in audio cue service, add List Alerts command and settings Jan 5, 2024
Copy link
Member

@hediet hediet left a comment

Choose a reason for hiding this comment

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

See comments

@hediet
Copy link
Member

hediet commented Jan 8, 2024

I initially created the AccessibleNotificationService to handle audio cues and alerts in one place and to deal with the complexity introduced by the format/save cues which have setting values of userGesture, always, or never.

I understand. I do think however that the complexity the AccessibleNotificationService added (having a separate system that is very similar to AudioCues, with parallel settings and events) is higher than the complexity it removed (dealing with userGesture etc). Also, userGesture could be relevant for audio cues as well.

Btw. thank you for all your work on audio cues! :) I really appreciate that you push this feature.
If you like we can schedule a meeting these days to go through the code and discuss how the AudioCue service could evolve to account for the new and future requirements.

@meganrogge
Copy link
Contributor Author

I understand. I do think however that the complexity the AccessibleNotificationService added (having a separate system that is very similar to AudioCues, with parallel settings and events) is higher than the complexity it removed (dealing with userGesture etc). Also, userGesture could be relevant for audio cues as well.

I agree, which is why I made the change that you suggested :)

If you like we can schedule a meeting these days to go through the code and discuss how the AudioCue service could evolve to account for the new and future requirements.

Sounds good. Do you think we should do this now or as new and future requirements arise?

@hediet
Copy link
Member

hediet commented Jan 8, 2024

Sounds good. Do you think we should do this now or as new and future requirements arise?

I'm fine with either, as you have motivation and time!

@meganrogge
Copy link
Contributor Author

I have other stuff going on this iteration, so maybe in February we should meet.

@meganrogge meganrogge requested a review from hediet January 8, 2024 16:59
@meganrogge meganrogge requested a review from hediet January 9, 2024 19:34
@meganrogge
Copy link
Contributor Author

still wip

@@ -174,7 +174,7 @@ export class AudioCueService extends Disposable implements IAudioCueService {
() => /** @description config: audioCues.enabled */ this.configurationService.getValue<'on' | 'off' | 'auto' | 'userGesture' | 'always' | 'never'>('audioCues.enabled')
);

private readonly isCueEnabledCache = new Cache((event: IAudioCueEvent) => {
private readonly isCueEnabledCache = new Cache((event: { readonly cue: AudioCue; readonly userGesture?: boolean }) => {
Copy link
Member

Choose a reason for hiding this comment

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

Now, you could shorten the type to

{ cue: AudioCue; userGesture?: boolean }

or even use a different type (and adjust callers to getValue):

[AudioCue, userGesture?: boolean]

... but that is just icing on the cake.

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 tried this to no avail 🤔

Copy link
Member

@hediet hediet left a comment

Choose a reason for hiding this comment

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

Thank you, that looks much better now!

By just looking at the code, moving out JSON.stringify from Cache to the use-sides looks like a complication of the code, but it actually reduces complexity, as you need less assumptions to understand Cache.

@hediet hediet disabled auto-merge January 9, 2024 19:54
@hediet hediet enabled auto-merge (squash) January 9, 2024 19:55
@meganrogge
Copy link
Contributor Author

Thanks for all of the reviews 👍🏼

@hediet hediet merged commit a3445c6 into main Jan 9, 2024
6 checks passed
@hediet hediet deleted the merogge/start-refactor branch January 9, 2024 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants