UrbanApps / Armchair

A simple yet powerful App Review Manager for iOS and OSX in Swift
MIT License
1.2k stars 137 forks source link

userHasRatedCurrentVersion private #61

Closed ed-mejia closed 8 years ago

ed-mejia commented 8 years ago

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!

coneybeare commented 8 years ago

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?)

ed-mejia commented 8 years ago

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 🤔

coneybeare commented 8 years ago

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)

ed-mejia commented 8 years ago

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.