Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ ShinySoundDetectedActionOption::ShinySoundDetectedActionOption(
{
{ShinySoundDetectedAction::STOP_PROGRAM, "stop", "Stop program and go Home. Send notification."},
{ShinySoundDetectedAction::NOTIFY_ON_FIRST_ONLY, "notify-first", "Keep running. Notify on first shiny sound only."},
{ShinySoundDetectedAction::NO_NOTIFICATIONS, "no-notifications", "Keep running. Track shiny sounds without sending notifications."},
// {ShinySoundDetectedAction::NOTIFY_ON_ALL, "notify-all", "Keep running. Notify on all shiny sounds."},
},
LockMode::UNLOCK_WHILE_RUNNING,
default_action
)
, TAKE_VIDEO(
"<b>Take Video:</b>",
"<b>Take Video:</b><br>"
"Records the first shiny sound using the switch capture button.<br>",
LockMode::UNLOCK_WHILE_RUNNING,
true
)
Expand Down Expand Up @@ -84,12 +86,18 @@ bool ShinySoundDetectedActionOption::on_shiny_sound(
return false;
}

if (action == ShinySoundDetectedAction::NO_NOTIFICATIONS && current_count > 1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should just be an unconditional return here. If we're ignoring shinies, we don't need to do anything 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.

What if the user selects "No Notifications" and "Take Video"
image

If the code returns here on every shiny the video would never be recorded. Maybe I should add a listener to this and hide the video option if no notifications are selected?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh lol. I intended this to be "ignore all shinies". But this works too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When reading your message
" add an extra enum that will ignore all shinies (no notifications), but it will continue counting them."
I suppose I took "(no notifications)" as the literal ask. But I could see how an ignore option would be nice especially if there are more options or additional logic added later.

I have time to change this today. Let me know what you think people would find the most useful.

  1. Leave it as it is
  2. Change to ignore shinies, hide other options to avoid the questions about "Take Video dosen't work when I ignore shinies" 😆
  3. Add another enum to support both options. "No notifications" and "Ignore shinies do nothing"

I have no opinion on what would be the best option from above. Doesn't bother me to change anything, just let me know.

return false;
}

if (TAKE_VIDEO){
context.wait_for(SCREENSHOT_DELAY);
pbf_press_button(context, BUTTON_CAPTURE, 2 * TICKS_PER_SECOND, 0);
}

send_shiny_sound_notification(env, stream, error_coefficient);
if (action != ShinySoundDetectedAction::NO_NOTIFICATIONS) {
send_shiny_sound_notification(env, stream, error_coefficient);
}

return action == ShinySoundDetectedAction::STOP_PROGRAM;
}
Expand Down Expand Up @@ -141,7 +149,13 @@ bool ShinySoundHandler::on_shiny_sound(
return false;
}

m_option.send_shiny_sound_notification(env, stream, error_coefficient);
if (action == ShinySoundDetectedAction::NO_NOTIFICATIONS && current_count > 1){
return false;
}

if (action != ShinySoundDetectedAction::NO_NOTIFICATIONS){
m_option.send_shiny_sound_notification(env, stream, error_coefficient);
}

if (m_pending_video.load(std::memory_order_acquire)){
stream.log("Back-to-back shiny sounds. Suppressing video.", COLOR_RED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum class ShinySoundDetectedAction{
STOP_PROGRAM, // stop program at first detected shiny sound
NOTIFY_ON_FIRST_ONLY, // notify user only on the first shiny sound, keep running the program
NOTIFY_ON_ALL, // notify on all shiny sounds, keep running the program
NO_NOTIFICATIONS // no notifications, still track shiny sounds
};


Expand Down