Browse Source

Add a bunch of autos.

tags/2021-05-28
Lukasz Kozakiewicz 7 years ago
parent
commit
072a56cf16
1 changed files with 15 additions and 15 deletions
  1. +15
    -15
      modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp

+ 15
- 15
modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp View File

@@ -41,7 +41,7 @@ namespace PushNotificationsDelegateDetails
{ {
if (iOSEarlierThan10) if (iOSEarlierThan10)
{ {
UIMutableUserNotificationAction* action = [[UIMutableUserNotificationAction alloc] init];
auto* action = [[UIMutableUserNotificationAction alloc] init];
action.identifier = juceStringToNS (a.identifier); action.identifier = juceStringToNS (a.identifier);
action.title = juceStringToNS (a.title); action.title = juceStringToNS (a.title);
@@ -81,14 +81,14 @@ namespace PushNotificationsDelegateDetails
{ {
if (iOSEarlierThan10) if (iOSEarlierThan10)
{ {
UIMutableUserNotificationCategory* category = [[UIMutableUserNotificationCategory alloc] init];
auto* category = [[UIMutableUserNotificationCategory alloc] init];
category.identifier = juceStringToNS (c.identifier); category.identifier = juceStringToNS (c.identifier);
NSMutableArray* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
auto* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
for (const auto& a : c.actions) for (const auto& a : c.actions)
{ {
UIUserNotificationAction* action = (UIUserNotificationAction*) actionToNSAction (a, iOSEarlierThan10);
auto* action = (UIUserNotificationAction*) actionToNSAction (a, iOSEarlierThan10);
[actions addObject: action]; [actions addObject: action];
} }
@@ -102,11 +102,11 @@ namespace PushNotificationsDelegateDetails
else else
{ {
#if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
NSMutableArray* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
auto* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()];
for (const auto& a : c.actions) for (const auto& a : c.actions)
{ {
UNNotificationAction* action = (UNNotificationAction*) actionToNSAction (a, iOSEarlierThan10);
auto* action = (UNNotificationAction*) actionToNSAction (a, iOSEarlierThan10);
[actions addObject: action]; [actions addObject: action];
} }
@@ -123,7 +123,7 @@ namespace PushNotificationsDelegateDetails
//============================================================================== //==============================================================================
UILocalNotification* juceNotificationToUILocalNotification (const PushNotifications::Notification& n) UILocalNotification* juceNotificationToUILocalNotification (const PushNotifications::Notification& n)
{ {
UILocalNotification* notification = [[UILocalNotification alloc] init];
auto* notification = [[UILocalNotification alloc] init];
notification.alertTitle = juceStringToNS (n.title); notification.alertTitle = juceStringToNS (n.title);
notification.alertBody = juceStringToNS (n.body); notification.alertBody = juceStringToNS (n.body);
@@ -148,7 +148,7 @@ namespace PushNotificationsDelegateDetails
UNNotificationRequest* juceNotificationToUNNotificationRequest (const PushNotifications::Notification& n) UNNotificationRequest* juceNotificationToUNNotificationRequest (const PushNotifications::Notification& n)
{ {
// content // content
UNMutableNotificationContent* content = [[UNMutableNotificationContent alloc] init];
auto* content = [[UNMutableNotificationContent alloc] init];
content.title = juceStringToNS (n.title); content.title = juceStringToNS (n.title);
content.subtitle = juceStringToNS (n.subtitle); content.subtitle = juceStringToNS (n.subtitle);
@@ -164,7 +164,7 @@ namespace PushNotificationsDelegateDetails
else if (soundToPlayString.isNotEmpty()) else if (soundToPlayString.isNotEmpty())
content.sound = [UNNotificationSound soundNamed: juceStringToNS (soundToPlayString)]; content.sound = [UNNotificationSound soundNamed: juceStringToNS (soundToPlayString)];
NSMutableDictionary* propsDict = (NSMutableDictionary*) varObjectToNSDictionary (n.properties);
auto* propsDict = (NSMutableDictionary*) varObjectToNSDictionary (n.properties);
[propsDict setObject: juceStringToNS (soundToPlayString) forKey: nsStringLiteral ("com.juce.soundName")]; [propsDict setObject: juceStringToNS (soundToPlayString) forKey: nsStringLiteral ("com.juce.soundName")];
content.userInfo = propsDict; content.userInfo = propsDict;
@@ -244,12 +244,12 @@ namespace PushNotificationsDelegateDetails
{ {
if ([t isKindOfClass: [UNTimeIntervalNotificationTrigger class]]) if ([t isKindOfClass: [UNTimeIntervalNotificationTrigger class]])
{ {
UNTimeIntervalNotificationTrigger* trigger = (UNTimeIntervalNotificationTrigger*) t;
auto* trigger = (UNTimeIntervalNotificationTrigger*) t;
return trigger.timeInterval; return trigger.timeInterval;
} }
else if ([t isKindOfClass: [UNCalendarNotificationTrigger class]]) else if ([t isKindOfClass: [UNCalendarNotificationTrigger class]])
{ {
UNCalendarNotificationTrigger* trigger = (UNCalendarNotificationTrigger*) t;
auto* trigger = (UNCalendarNotificationTrigger*) t;
NSDate* date = [trigger.dateComponents date]; NSDate* date = [trigger.dateComponents date];
NSDate* dateNow = [NSDate date]; NSDate* dateNow = [NSDate date];
return [dateNow timeIntervalSinceDate: date]; return [dateNow timeIntervalSinceDate: date];
@@ -355,7 +355,7 @@ namespace PushNotificationsDelegateDetails
if ([a isKindOfClass: [UNTextInputNotificationAction class]]) if ([a isKindOfClass: [UNTextInputNotificationAction class]])
{ {
UNTextInputNotificationAction* textAction = (UNTextInputNotificationAction*)a;
auto* textAction = (UNTextInputNotificationAction*)a;
action.style = Action::text; action.style = Action::text;
action.textInputButtonText = nsStringToJuce (textAction.textInputButtonTitle); action.textInputButtonText = nsStringToJuce (textAction.textInputButtonTitle);
@@ -589,13 +589,13 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate
{ {
settings = settingsToUse; settings = settingsToUse;
NSMutableSet* categories = [NSMutableSet setWithCapacity: (NSUInteger) settings.categories.size()];
auto* categories = [NSMutableSet setWithCapacity: (NSUInteger) settings.categories.size()];
if (iOSEarlierThan10) if (iOSEarlierThan10)
{ {
for (const auto& c : settings.categories) for (const auto& c : settings.categories)
{ {
UIUserNotificationCategory* category = (UIUserNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c, iOSEarlierThan10);
auto* category = (UIUserNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c, iOSEarlierThan10);
[categories addObject: category]; [categories addObject: category];
} }
@@ -611,7 +611,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate
{ {
for (const auto& c : settings.categories) for (const auto& c : settings.categories)
{ {
UNNotificationCategory* category = (UNNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c, iOSEarlierThan10);
auto* category = (UNNotificationCategory*) PushNotificationsDelegateDetails::categoryToNSCategory (c, iOSEarlierThan10);
[categories addObject: category]; [categories addObject: category];
} }


Loading…
Cancel
Save