-
-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add achievement rarity to GameCenter plugin #55
base: master
Are you sure you want to change the base?
Add achievement rarity to GameCenter plugin #55
Conversation
@Calinou Any interest in taking this one in? |
This looks good to me, but CI is failing. |
a5fe31a
to
8995bc7
Compare
|
||
NSNumber *number; | ||
#ifdef __IPHONE_17_0 | ||
if (@available(iOS 17.0, *)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need both the macro and the availability checks, the former to allow building on pre-17.0 SDKs and the latter to silence compilation warnings when building on >17.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like this will probably work without ifdefs (property should have default getter with the same name):
if ([description respondsToSelector:@selector(rarityPercent)]) {
number = [description performSelector:@selector(rarityPercent)];
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better, great suggestion! I confirmed this works with iOS 17.
Objective
Support the
rarityPercent
property that was added toGKAchievementDescription
in iOS 17.0.Doc: https://developer.apple.com/documentation/gamekit/gkachievementdescription/4273663-raritypercent
Changes
rarity_percents
to theachievement_descriptions
event dictionary and wire the value from the newly introduced property,-1
if the iOS version is below 17.0 or if the achievement doesn't have a rarity percent value (i.e.nil
is provided by GameKit).Testing
Tested with Godot 3.5.0 and iOS 17, fetching achievements that have and do not have rarities.