diff --git a/modules/juce_audio_devices/native/juce_ios_Audio.cpp b/modules/juce_audio_devices/native/juce_ios_Audio.cpp index 4168056b42..12c8b3389d 100644 --- a/modules/juce_audio_devices/native/juce_ios_Audio.cpp +++ b/modules/juce_audio_devices/native/juce_ios_Audio.cpp @@ -293,10 +293,8 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater options |= (AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetooth); - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 if (@available (iOS 10.0, *)) options |= AVAudioSessionCategoryOptionAllowBluetoothA2DP; - #endif } JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setCategory: category @@ -735,7 +733,6 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater &dataSize); if (err == noErr) { - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 if (@available (iOS 10.0, *)) { [[UIApplication sharedApplication] openURL: (NSURL*) hostUrl @@ -744,7 +741,6 @@ struct iOSAudioIODevice::Pimpl : public AsyncUpdater return; } - #endif JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") [[UIApplication sharedApplication] openURL: (NSURL*) hostUrl]; diff --git a/modules/juce_core/native/juce_mac_Files.mm b/modules/juce_core/native/juce_mac_Files.mm index aefa763178..433eada7b3 100644 --- a/modules/juce_core/native/juce_mac_Files.mm +++ b/modules/juce_core/native/juce_mac_Files.mm @@ -410,7 +410,6 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& #if JUCE_IOS ignoreUnused (parameters); - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 if (@available (iOS 10.0, *)) { [[UIApplication sharedApplication] openURL: filenameAsURL @@ -419,7 +418,6 @@ bool JUCE_CALLTYPE Process::openDocument (const String& fileName, const String& return true; } - #endif JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") return [[UIApplication sharedApplication] openURL: filenameAsURL]; diff --git a/modules/juce_gui_basics/juce_gui_basics.cpp b/modules/juce_gui_basics/juce_gui_basics.cpp index d65d67d97a..50553e409e 100644 --- a/modules/juce_gui_basics/juce_gui_basics.cpp +++ b/modules/juce_gui_basics/juce_gui_basics.cpp @@ -54,7 +54,7 @@ #import #elif JUCE_IOS - #if JUCE_PUSH_NOTIFICATIONS && defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + #if JUCE_PUSH_NOTIFICATIONS #import #endif diff --git a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp index f15365b642..8aea944804 100644 --- a/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp +++ b/modules/juce_gui_basics/native/juce_ios_ContentSharer.cpp @@ -26,10 +26,6 @@ namespace juce { -#if ! defined (__IPHONE_10_0) || __IPHONE_OS_VERSION_MAX_ALLOWED < __IPHONE_10_0 - using UIActivityType = NSString*; -#endif - class ContentSharer::ContentSharerNativeImpl : public ContentSharer::Pimpl, private Component { diff --git a/modules/juce_gui_basics/native/juce_ios_Windowing.mm b/modules/juce_gui_basics/native/juce_ios_Windowing.mm index 18bf102fb0..a64237c121 100644 --- a/modules/juce_gui_basics/native/juce_ios_Windowing.mm +++ b/modules/juce_gui_basics/native/juce_ios_Windowing.mm @@ -37,7 +37,7 @@ namespace juce Array appBecomingInactiveCallbacks; } -#if JUCE_PUSH_NOTIFICATIONS && defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 +#if JUCE_PUSH_NOTIFICATIONS @interface JuceAppStartupDelegate : NSObject #else @interface JuceAppStartupDelegate : NSObject @@ -74,13 +74,11 @@ namespace juce - (void) application: (UIApplication*) application handleActionWithIdentifier: (NSString*) identifier forLocalNotification: (UILocalNotification*) notification withResponseInfo: (NSDictionary*) responseInfo completionHandler: (void(^)()) completionHandler; -#if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - (void) userNotificationCenter: (UNUserNotificationCenter*) center willPresentNotification: (UNNotification*) notification withCompletionHandler: (void (^)(UNNotificationPresentationOptions options)) completionHandler; - (void) userNotificationCenter: (UNUserNotificationCenter*) center didReceiveNotificationResponse: (UNNotificationResponse*) response withCompletionHandler: (void(^)())completionHandler; #endif -#endif @end @@ -93,7 +91,7 @@ namespace juce self = [super init]; appSuspendTask = UIBackgroundTaskInvalid; - #if JUCE_PUSH_NOTIFICATIONS && defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 + #if JUCE_PUSH_NOTIFICATIONS [UNUserNotificationCenter currentNotificationCenter].delegate = self; #endif @@ -371,7 +369,6 @@ namespace juce } } -#if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - (void) userNotificationCenter: (UNUserNotificationCenter*) center willPresentNotification: (UNNotification*) notification withCompletionHandler: (void (^)(UNNotificationPresentationOptions options)) completionHandler { @@ -412,7 +409,6 @@ namespace juce } } #endif -#endif @end diff --git a/modules/juce_gui_extra/juce_gui_extra.cpp b/modules/juce_gui_extra/juce_gui_extra.cpp index dbb4d75a55..4f60cb8fc9 100644 --- a/modules/juce_gui_extra/juce_gui_extra.cpp +++ b/modules/juce_gui_extra/juce_gui_extra.cpp @@ -67,10 +67,7 @@ #import #if JUCE_PUSH_NOTIFICATIONS - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 - #import - #endif - + #import #include "native/juce_ios_PushNotifications.cpp" #endif diff --git a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp index df965a5413..4fa8eb8622 100644 --- a/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp +++ b/modules/juce_gui_extra/native/juce_ios_PushNotifications.cpp @@ -53,7 +53,6 @@ namespace PushNotificationsDelegateDetails } else { - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 if (a.style == Action::text) { return [UNTextInputNotificationAction actionWithIdentifier: juceStringToNS (a.identifier) @@ -66,9 +65,6 @@ namespace PushNotificationsDelegateDetails return [UNNotificationAction actionWithIdentifier: juceStringToNS (a.identifier) title: juceStringToNS (a.title) options: NSUInteger (a.destructive << 1 | (! a.triggerInBackground) << 2)]; - #else - return nullptr; - #endif } } @@ -96,7 +92,6 @@ namespace PushNotificationsDelegateDetails } else { - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 auto actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()]; for (const auto& a : c.actions) @@ -109,9 +104,6 @@ namespace PushNotificationsDelegateDetails actions: actions intentIdentifiers: @[] options: c.sendDismissAction ? UNNotificationCategoryOptionCustomDismissAction : 0]; - #else - return nullptr; - #endif } } @@ -139,7 +131,6 @@ namespace PushNotificationsDelegateDetails return notification; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 UNNotificationRequest* juceNotificationToUNNotificationRequest (const PushNotifications::Notification& n) { // content @@ -183,7 +174,6 @@ namespace PushNotificationsDelegateDetails return request; } - #endif String getUserResponseFromNSDictionary (NSDictionary* dictionary) { @@ -232,7 +222,6 @@ namespace PushNotificationsDelegateDetails } //============================================================================== - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 double getIntervalSecFromUNNotificationTrigger (UNNotificationTrigger* t) { if (t != nil) @@ -287,7 +276,6 @@ namespace PushNotificationsDelegateDetails { return unNotificationRequestToJuceNotification (n.request); } - #endif PushNotifications::Notification uiLocalNotificationToJuceNotification (UILocalNotification* n) { @@ -340,7 +328,6 @@ namespace PushNotificationsDelegateDetails return category; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 Action unNotificationActionToAction (UNNotificationAction* a) { Action action; @@ -378,7 +365,6 @@ namespace PushNotificationsDelegateDetails return category; } - #endif PushNotifications::Notification nsDictionaryToJuceNotification (NSDictionary* dictionary) { @@ -457,32 +443,20 @@ struct PushNotificationsDelegate NSDictionary* responseInfo, void (^completionHandler)()) = 0; - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 virtual void willPresentNotificationWithCompletionHandler (UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options)) = 0; virtual void didReceiveNotificationResponseWithCompletionHandler (UNNotificationResponse* response, void (^completionHandler)()) = 0; - #endif protected: - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 NSUniquePtr> delegate; - #else - NSUniquePtr> delegate; - #endif private: //============================================================================== - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 struct Class : public ObjCClass> { Class() : ObjCClass> ("JucePushNotificationsDelegate_") - #else - struct Class : public ObjCClass> - { - Class() : ObjCClass> ("JucePushNotificationsDelegate_") - #endif { addIvar ("self"); @@ -531,7 +505,6 @@ private: getThis (self). handleActionForLocalNotificationWithResponseCompletionHandler (actionIdentifier, notification, responseInfo, completionHandler); }); - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 addMethod (@selector (userNotificationCenter:willPresentNotification:withCompletionHandler:), [] (id self, SEL, UNUserNotificationCenter*, UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options)) { getThis (self).willPresentNotificationWithCompletionHandler (notification, completionHandler); @@ -541,7 +514,6 @@ private: { getThis (self).didReceiveNotificationResponseWithCompletionHandler (response, completionHandler); }); - #endif registerClass(); } @@ -599,7 +571,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate UIUserNotificationSettings* s = [UIUserNotificationSettings settingsForTypes: type categories: categories]; [[UIApplication sharedApplication] registerUserNotificationSettings: s]; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { for (const auto& c : settings.categories) @@ -619,7 +590,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate requestSettingsUsed(); }]; } - #endif [[UIApplication sharedApplication] registerForRemoteNotifications]; } @@ -639,7 +609,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.notificationSettingsReceived (settings); }); } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { @@ -662,7 +631,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate }]; } - #endif } bool areNotificationsEnabled() const { return true; } @@ -676,7 +644,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate [[UIApplication sharedApplication] scheduleLocalNotification: notification]; [notification release]; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { @@ -691,7 +658,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate NSLog (nsStringLiteral ("addNotificationRequest error: %@"), error); }]; } - #endif } void getDeliveredNotifications() const @@ -702,7 +668,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate jassertfalse; owner.listeners.call ([] (Listener& l) { l.deliveredNotificationsListReceived ({}); }); } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler: @@ -716,7 +681,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.deliveredNotificationsListReceived (notifs); }); }]; } - #endif } void removeAllDeliveredNotifications() @@ -727,12 +691,9 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate jassertfalse; } else - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 { - [[UNUserNotificationCenter currentNotificationCenter] removeAllDeliveredNotifications]; } - #endif } void removeDeliveredNotification (const String& identifier) @@ -743,7 +704,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate // Not supported on this platform jassertfalse; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { @@ -751,7 +711,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate [[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers: identifiers]; } - #endif } void setupChannels (const Array& groups, const Array& channels) @@ -770,7 +729,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.pendingLocalNotificationsListReceived (notifs); }); } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { @@ -786,7 +744,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate } ]; } - #endif } void removePendingLocalNotification (const String& identifier) @@ -796,15 +753,12 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate // Not supported on this platform jassertfalse; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { - NSArray* identifiers = [NSArray arrayWithObject: juceStringToNS (identifier)]; [[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers: identifiers]; } - #endif } void removeAllPendingLocalNotifications() @@ -813,12 +767,10 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate { [[UIApplication sharedApplication] cancelAllLocalNotifications]; } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 else { [[UNUserNotificationCenter currentNotificationCenter] removeAllPendingNotificationRequests]; } - #endif } String getDeviceToken() @@ -926,7 +878,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate completionHandler(); } - #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 void willPresentNotificationWithCompletionHandler (UNNotification* notification, void (^completionHandler)(UNNotificationPresentationOptions options)) override { @@ -964,7 +915,6 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate owner.listeners.call ([&] (Listener& l) { l.handleNotificationAction (! remote, n, actionString, responseString); }); completionHandler(); } - #endif void subscribeToTopic (const String& topic) { ignoreUnused (topic); } void unsubscribeFromTopic (const String& topic) { ignoreUnused (topic); } diff --git a/modules/juce_video/native/juce_ios_CameraDevice.h b/modules/juce_video/native/juce_ios_CameraDevice.h index cc6782c3d7..93c0ad1c6f 100644 --- a/modules/juce_video/native/juce_ios_CameraDevice.h +++ b/modules/juce_video/native/juce_ios_CameraDevice.h @@ -23,10 +23,7 @@ ============================================================================== */ -#if (defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0) - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") - #define JUCE_USE_NEW_CAMERA_API 1 -#endif +JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wdeprecated-declarations") struct CameraDevice::Pimpl { @@ -141,7 +138,6 @@ struct CameraDevice::Pimpl private: static NSArray* getDevices() { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { std::unique_ptr, NSObjectDeleter> deviceTypes ([[NSMutableArray alloc] initWithCapacity: 2]); @@ -161,7 +157,6 @@ private: return [discoverySession devices]; } - #endif return [AVCaptureDevice devicesWithMediaType: AVMediaTypeVideo]; } @@ -207,13 +202,11 @@ private: JUCE_CAMERA_LOG ("Supports custom exposure: " + String ((int)[device isExposureModeSupported: AVCaptureExposureModeCustom])); JUCE_CAMERA_LOG ("Supports point of interest exposure: " + String ((int)device.exposurePointOfInterestSupported)); - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { JUCE_CAMERA_LOG ("Device type: " + nsStringToJuce (device.deviceType)); JUCE_CAMERA_LOG ("Locking focus with custom lens position supported: " + String ((int)device.lockingFocusWithCustomLensPositionSupported)); } - #endif #if defined (__IPHONE_11_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0 if (@available (iOS 11.0, *)) @@ -238,7 +231,6 @@ private: { JUCE_CAMERA_LOG ("Media type: " + nsStringToJuce (format.mediaType)); - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { String colourSpaces; @@ -255,7 +247,6 @@ private: JUCE_CAMERA_LOG ("Supported colour spaces: " + colourSpaces); } - #endif JUCE_CAMERA_LOG ("Video field of view: " + String (format.videoFieldOfView)); JUCE_CAMERA_LOG ("Video max zoom factor: " + String (format.videoMaxZoomFactor)); @@ -592,14 +583,12 @@ private: captureOutput (createCaptureOutput()), photoOutputDelegate (nullptr) { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { static PhotoOutputDelegateClass cls; photoOutputDelegate.reset ([cls.createInstance() init]); PhotoOutputDelegateClass::setOwner (photoOutputDelegate.get(), this); } - #endif captureSession.addOutputIfPossible (captureOutput); } @@ -619,7 +608,6 @@ private: if (auto* connection = findVideoConnection (captureOutput)) { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]]) @@ -634,7 +622,6 @@ private: return; } } - #endif auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput; auto outputConnection = [stillImageOutput connectionWithMediaType: AVMediaTypeVideo]; @@ -671,17 +658,14 @@ private: private: static AVCaptureOutput* createCaptureOutput() { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) return [AVCapturePhotoOutput new]; - #endif return [AVCaptureStillImageOutput new]; } static void printImageOutputDebugInfo (AVCaptureOutput* captureOutput) { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) { if ([captureOutput isKindOfClass: [AVCapturePhotoOutput class]]) @@ -737,7 +721,6 @@ private: return; } } - #endif auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput; @@ -765,7 +748,6 @@ private: } //============================================================================== - #if JUCE_USE_NEW_CAMERA_API class API_AVAILABLE (ios (10.0)) PhotoOutputDelegateClass : public ObjCClass { public: @@ -972,7 +954,6 @@ private: } } }; - #endif //============================================================================== void callListeners (const Image& image) @@ -1023,10 +1004,8 @@ private: void startRecording (const File& file, AVCaptureVideoOrientation orientationToUse) { - #if JUCE_USE_NEW_CAMERA_API if (@available (iOS 10.0, *)) printVideoOutputDebugInfo (movieFileOutput); - #endif auto url = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName()) isDirectory: NO]; @@ -1332,6 +1311,4 @@ String CameraDevice::getFileExtension() return ".mov"; } -#if JUCE_USE_NEW_CAMERA_API - JUCE_END_IGNORE_WARNINGS_GCC_LIKE -#endif +JUCE_END_IGNORE_WARNINGS_GCC_LIKE