KayelGee / control-concealer

MIT License
1 stars 1 forks source link

Suppress notifications #11

Open Baxmann opened 2 years ago

Baxmann commented 2 years ago

I keep getting spammy notifications for Control Concealer.

KayelGee commented 2 years ago

With no information on what notifications you're getting I would guess that it's probably something related to #9 and #8. One of your modules is adding their controls after the hook and control concealer is not detecting them correctly. While I have currently no solution you could try to find out which module it is.

Baxmann commented 2 years ago

Hey sorry for the late reply. I located the Button it keeps failing to find: It's Small Time. Unhiding the button seems to have resolved it.

Baxmann commented 2 years ago

Ok now I get the yellow one I change to any tab. I'm not getting any logs in the chat.

KayelGee commented 2 years ago

what dows it say?

Baxmann commented 2 years ago

Enhanced Terrain Layer is Prone to causing the yellow notifications to pop up any time any button is pressed.

GizmoNomical commented 2 years ago

This bug also bothered me.

I realized when looking through the code, that showing a blatant red error warning when something could NOT be fixed was a good notification to show to the user.

But I could not see the reason to display a yellow warning every time the module 'fixed' the error and things were just fine. This seemed more like debug code that wasn't removed for production. Something like this could be logged to the console instead.

So an easy fix for this, is to simply comment out one line of code.

//ui.notifications.warn(game.i18n.localize("CONTROLCONCEALER.warning.ControlMissmatchFixed"));

This suppressed all the redundant yellow warning labels for random modules that didn't want to behave together.

Enjoy!

if(hasControlMissmatch){
                if(hasUnfixedControlMissmatch){
                    ui.notifications.error(game.i18n.localize("CONTROLCONCEALER.error.ControlMissmatch"));
                }else{
                    //ui.notifications.warn(game.i18n.localize("CONTROLCONCEALER.warning.ControlMissmatchFixed"));
                    await this.saveHiddenElements();
                }
            }
KayelGee commented 2 years ago

The warning is intentional. I wanted users to notify me when that pops up so I can take a look and see if my logic is flawed somewhere. With enough modules adding their buttons in weird ways I'm not sure how to handle I guess I should add a setting to opt out of the warning.

GizmoNomical commented 2 years ago

I totally understand. It seemed more like a bit of debug code than anything. Very helpful for the developer, not as much for the end user. But either way, an opt out setting would be pretty nice to have in the future.

Figured I'd offer up a temporary solution to those who love the module (myself included), but didn't want to have the yellow warnings pop up non stop.

Thanks KayelGee!