1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

Windowing: Fix deprecation warnings for iOS 17

This commit is contained in:
reuk 2024-10-27 18:05:04 +00:00
parent dbe74e9f5d
commit eb6ebaf5af
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 20 additions and 6 deletions

View file

@ -75,10 +75,7 @@
#endif
#elif JUCE_IOS
#if JUCE_PUSH_NOTIFICATIONS
#import <UserNotifications/UserNotifications.h>
#endif
#import <UserNotifications/UserNotifications.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#import <MetalKit/MetalKit.h>
#import <UIKit/UIActivityViewController.h>

View file

@ -168,10 +168,27 @@ namespace juce
app->resumed();
}
struct BadgeUpdateTrait
{
#if defined (__IPHONE_16_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_16_0
API_AVAILABLE (ios (16))
static void newFn (UIApplication*)
{
[[UNUserNotificationCenter currentNotificationCenter] setBadgeCount: 0 withCompletionHandler: nil];
}
#endif
static void oldFn (UIApplication* app)
{
JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations")
app.applicationIconBadgeNumber = 0;
JUCE_END_IGNORE_WARNINGS_GCC_LIKE
}
};
- (void) applicationDidBecomeActive: (UIApplication*) application
{
application.applicationIconBadgeNumber = 0;
ifelse_17_0<BadgeUpdateTrait> (application);
isIOSAppActive = true;
}