UrbanApps/Armchair

userHasRatedCurrentVersion private

Closed this issue · 4 comments

Hey there !

In my App I display a rate button, I want to hide that button if the user already rated the actual version of the app. Looking around I found this func userHasRatedCurrentVersion which will work great but turns out it's private and there is no public access in the actual API to perform such validation.

Maybe I'm missing some another way to do this?

Thanks!

For interface elements within your app, it may be better to track the state within your app, not Armchair. To do this, setup a onDidOptToRate closure, then set a boolean you can save for your state.

Armchair.onDidOptToRate(didOptToRateClosure: ArmchairClosure?)

That might work ok, but makes the client to add much more boilerplate to keep track of versions.

Why userHasRatedCurrentVersion has to be private? is just a getter, a read only property 🤔

Most people have no reason to read this value. This is the first time ever requested, so I am reluctant to make it public.

You can also do it by checking the Armchair.userDefaultsObject() by reading the key for Armchair.keyForArmchairKeyType(ArmchairKey.RatedCurrentVersion)

Ok I get it..

I will try using Armchair.userDefaultsObject(), looks like I will be able to achieve the same result.

Thanks for your help, really appreciated.