Skip to content

Commit

Permalink
Windowing: Fix deprecation warnings for iOS 17
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Oct 29, 2024
1 parent dbe74e9 commit eb6ebaf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
5 changes: 1 addition & 4 deletions modules/juce_gui_basics/juce_gui_basics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
21 changes: 19 additions & 2 deletions modules/juce_gui_basics/native/juce_Windowing_ios.mm
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,27 @@ - (void) applicationWillEnterForeground: (UIApplication*) application
app->resumed();
}

- (void) applicationDidBecomeActive: (UIApplication*) application
struct BadgeUpdateTrait
{
application.applicationIconBadgeNumber = 0;
#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
{
ifelse_17_0<BadgeUpdateTrait> (application);
isIOSAppActive = true;
}

Expand Down

0 comments on commit eb6ebaf

Please sign in to comment.