Wootric / WootricSDK-iOS

Wootric iOS SDK to show NPS, CSAT and CES surveys
MIT License
13 stars 24 forks source link

🙈 Dismiss Icon Is Difficult To See #90

Closed dgalasko-godaddy closed 3 years ago

dgalasko-godaddy commented 3 years ago

Hi Friends,

We have noticed an increase in negative reviews since we updated Wootric and isolated this to the difficulty in finding the dismiss icon.

As you can see in the screenshot, it's really hard to see (hint: its above the modal on the right)

Screenshot 2021-05-28 at 08 46 45

I tracked this down to + [WTRColor dismissXColor] where the value #253746 is set and so everything is actually as it should be. Only problem is this HEX color is not visible on the dark background you use. The culprit seems to be the reskin https://github.com/Wootric/WootricSDK-iOS/pull/88/

For now I suspect we need to swizzle this out but I would love to know what the thoughts or on addressing this. Happy to make a PR if need be just not sure what your chosen value would be

dgalasko-godaddy commented 3 years ago

In the interim we are swizzling the value to get it looking better.

class WootricColorSwizzler {
     @objc static func dismissColor() -> UIColor {
         .white
     }

     static let swizzle: Void = {
         guard let wtrColor: AnyClass = NSClassFromString("WTRColor") else {
             return
         }
         guard let originalMethod = class_getClassMethod(wtrColor, sel_getUid("dismissXColor")),
               let swizzled = class_getClassMethod(WootricColorSwizzler.self, #selector(WootricColorSwizzler.dismissColor)) else {
             return
         }

         method_exchangeImplementations(originalMethod, swizzled)
     }()
 }

That produces an icon that can actually be seen

Screenshot 2021-05-28 at 09 23 20
angellozano67 commented 3 years ago

How is the WootricColorSwizzler class used to overwrite the dismiss color? Just instantiating it doesn't do anything.

Disregard! Just needed to read more on Swift swizzling, worked like a charm! Thank you, @dangalasko.

diegoserranoa commented 3 years ago

Hello everyone! We've just released version 0.20.1 reverting back to the old color. Thanks for reporting this and sorry for the inconveniences.

Cheers!

dgalasko-godaddy commented 3 years ago

Wonderful thanks @diegoserranoa