| @@ -890,7 +890,7 @@ public: | |||
| for (auto i = 0u; i < n; ++i) | |||
| { | |||
| if (auto* viewConfiguration = [configs objectAtIndex:i]) | |||
| if (auto viewConfiguration = [configs objectAtIndex: i]) | |||
| { | |||
| if (editor->supportsHostMIDIControllerPresence ([viewConfiguration hostHasController] == YES)) | |||
| { | |||
| @@ -59,7 +59,7 @@ static inline NSURL* createNSURLFromFile (const File& f) | |||
| static inline NSArray* createNSArrayFromStringArray (const StringArray& strings) | |||
| { | |||
| auto* array = [[NSMutableArray alloc] init]; | |||
| auto array = [[NSMutableArray alloc] init]; | |||
| for (auto string: strings) | |||
| [array addObject:juceStringToNS (string)]; | |||
| @@ -71,7 +71,7 @@ static NSArray* varArrayToNSArray (const var& varToParse); | |||
| static NSDictionary* varObjectToNSDictionary (const var& varToParse) | |||
| { | |||
| auto* dictionary = [NSMutableDictionary dictionary]; | |||
| auto dictionary = [NSMutableDictionary dictionary]; | |||
| if (varToParse.isObject()) | |||
| { | |||
| @@ -118,7 +118,7 @@ static NSArray* varArrayToNSArray (const var& varToParse) | |||
| const auto* varArray = varToParse.getArray(); | |||
| auto* array = [NSMutableArray arrayWithCapacity: (NSUInteger) varArray->size()]; | |||
| auto array = [NSMutableArray arrayWithCapacity: (NSUInteger) varArray->size()]; | |||
| for (const auto& aVar : *varArray) | |||
| { | |||
| @@ -574,11 +574,11 @@ public: | |||
| BOOL isBookmarkStale = false; | |||
| NSError* error = nil; | |||
| auto* nsURL = [NSURL URLByResolvingBookmarkData: bookmark | |||
| options: 0 | |||
| relativeToURL: nil | |||
| bookmarkDataIsStale: &isBookmarkStale | |||
| error: &error]; | |||
| auto nsURL = [NSURL URLByResolvingBookmarkData: bookmark | |||
| options: 0 | |||
| relativeToURL: nil | |||
| bookmarkDataIsStale: &isBookmarkStale | |||
| error: &error]; | |||
| if (error == nil) | |||
| { | |||
| @@ -589,7 +589,7 @@ public: | |||
| } | |||
| else | |||
| { | |||
| auto* desc = [error localizedDescription]; | |||
| auto desc = [error localizedDescription]; | |||
| ignoreUnused (desc); | |||
| jassertfalse; | |||
| } | |||
| @@ -607,10 +607,10 @@ private: | |||
| BOOL isBookmarkStale = false; | |||
| NSError* error = nil; | |||
| auto* nsURL = [NSURL URLByResolvingBookmarkData: bookmark | |||
| options: 0 | |||
| relativeToURL: nil | |||
| bookmarkDataIsStale: &isBookmarkStale | |||
| auto nsURL = [NSURL URLByResolvingBookmarkData: bookmark | |||
| options: 0 | |||
| relativeToURL: nil | |||
| bookmarkDataIsStale: &isBookmarkStale | |||
| error: &error]; | |||
| if (error == nil) | |||
| @@ -624,7 +624,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| auto* desc = [error localizedDescription]; | |||
| auto desc = [error localizedDescription]; | |||
| ignoreUnused (desc); | |||
| jassertfalse; | |||
| } | |||
| @@ -45,7 +45,7 @@ public: | |||
| void shareFiles (const Array<URL>& files) override | |||
| { | |||
| auto* urls = [NSMutableArray arrayWithCapacity: (NSUInteger) files.size()]; | |||
| auto urls = [NSMutableArray arrayWithCapacity: (NSUInteger) files.size()]; | |||
| for (const auto& f : files) | |||
| { | |||
| @@ -86,7 +86,7 @@ public: | |||
| void shareText (const String& text) override | |||
| { | |||
| auto* array = [NSArray arrayWithObject: juceStringToNS (text)]; | |||
| auto array = [NSArray arrayWithObject: juceStringToNS (text)]; | |||
| share (array); | |||
| } | |||
| @@ -222,7 +222,7 @@ private: | |||
| NSArray<NSFileAccessIntent*>* intents = @[fileAccessIntent]; | |||
| auto* fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter: nil]; | |||
| auto fileCoordinator = [[NSFileCoordinator alloc] initWithFilePresenter: nil]; | |||
| [fileCoordinator coordinateAccessWithIntents: intents queue: [NSOperationQueue mainQueue] byAccessor: ^(NSError* err) | |||
| { | |||
| @@ -251,7 +251,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| auto* desc = [error localizedDescription]; | |||
| auto desc = [error localizedDescription]; | |||
| ignoreUnused (desc); | |||
| jassertfalse; | |||
| } | |||
| @@ -260,7 +260,7 @@ private: | |||
| } | |||
| else | |||
| { | |||
| auto* desc = [err localizedDescription]; | |||
| auto desc = [err localizedDescription]; | |||
| ignoreUnused (desc); | |||
| jassertfalse; | |||
| } | |||
| @@ -227,7 +227,7 @@ private: | |||
| else | |||
| { | |||
| auto* openPanel = (NSOpenPanel*) panel; | |||
| auto* urls = [openPanel URLs]; | |||
| auto urls = [openPanel URLs]; | |||
| for (unsigned int i = 0; i < [urls count]; ++i) | |||
| addURLResult ([urls objectAtIndex: i]); | |||
| @@ -33,11 +33,11 @@ struct JuceMainMenuBarHolder : private DeletedAtShutdown | |||
| JuceMainMenuBarHolder() | |||
| : mainMenuBar ([[NSMenu alloc] initWithTitle: nsStringLiteral ("MainMenu")]) | |||
| { | |||
| auto* item = [mainMenuBar addItemWithTitle: nsStringLiteral ("Apple") | |||
| action: nil | |||
| auto item = [mainMenuBar addItemWithTitle: nsStringLiteral ("Apple") | |||
| action: nil | |||
| keyEquivalent: nsEmptyString()]; | |||
| auto* appMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Apple")]; | |||
| auto appMenu = [[NSMenu alloc] initWithTitle: nsStringLiteral ("Apple")]; | |||
| [NSApp performSelector: @selector (setAppleMenu:) withObject: appMenu]; | |||
| [mainMenuBar setSubmenu: appMenu forItem: item]; | |||
| @@ -277,9 +277,9 @@ public: | |||
| } | |||
| else | |||
| { | |||
| auto* item = [[NSMenuItem alloc] initWithTitle: text | |||
| action: @selector (menuItemInvoked:) | |||
| keyEquivalent: nsEmptyString()]; | |||
| auto item = [[NSMenuItem alloc] initWithTitle: text | |||
| action: @selector (menuItemInvoked:) | |||
| keyEquivalent: nsEmptyString()]; | |||
| [item setTag: topLevelIndex]; | |||
| [item setEnabled: i.isEnabled]; | |||
| @@ -478,9 +478,9 @@ private: | |||
| { | |||
| if (isPositiveAndBelow (menuItemIndex, (int) [parentMenu numberOfItems])) | |||
| { | |||
| auto* menuItem = [parentMenu itemAtIndex:menuItemIndex]; | |||
| auto menuItem = [parentMenu itemAtIndex:menuItemIndex]; | |||
| if (auto* submenu = [menuItem submenu]) | |||
| if (auto submenu = [menuItem submenu]) | |||
| removeItemRecursive (submenu); | |||
| [parentMenu removeItem:menuItem]; | |||
| @@ -706,7 +706,7 @@ namespace MainMenuHelpers | |||
| { | |||
| if ([mainMenu numberOfItems] > 0) | |||
| { | |||
| if (auto* appMenu = [[mainMenu itemAtIndex:0] submenu]) | |||
| if (auto appMenu = [[mainMenu itemAtIndex: 0] submenu]) | |||
| { | |||
| [appMenu removeAllItems]; | |||
| MainMenuHelpers::createStandardAppMenu (appMenu, app->getApplicationName(), extraItems); | |||
| @@ -1056,7 +1056,7 @@ public: | |||
| { | |||
| if (isSharedWindow) | |||
| { | |||
| auto* newWindow = [view window]; | |||
| auto newWindow = [view window]; | |||
| bool shouldSetVisible = (window == nullptr && newWindow != nullptr); | |||
| window = newWindow; | |||
| @@ -260,7 +260,7 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text, Co | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| { | |||
| if (auto* event = [[view window] currentEvent]) | |||
| if (auto event = [[view window] currentEvent]) | |||
| { | |||
| id helper = [draggingSourceHelper.createInstance() init]; | |||
| NSDraggingSourceHelper::setText (helper, text); | |||
| @@ -269,18 +269,18 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text, Co | |||
| if (callback != nullptr) | |||
| NSDraggingSourceHelper::setCompletionCallback (helper, callback); | |||
| auto* pasteboardItem = [[NSPasteboardItem new] autorelease]; | |||
| auto pasteboardItem = [[NSPasteboardItem new] autorelease]; | |||
| [pasteboardItem setDataProvider: helper | |||
| forTypes: [NSArray arrayWithObjects: NSPasteboardTypeString, nil]]; | |||
| auto* dragItem = [[[NSDraggingItem alloc] initWithPasteboardWriter: pasteboardItem] autorelease]; | |||
| auto dragItem = [[[NSDraggingItem alloc] initWithPasteboardWriter: pasteboardItem] autorelease]; | |||
| NSImage* image = [[NSWorkspace sharedWorkspace] iconForFile: nsEmptyString()]; | |||
| [dragItem setDraggingFrame: getDragRect (view, event) contents: image]; | |||
| if (auto* session = [view beginDraggingSessionWithItems: [NSArray arrayWithObject: dragItem] | |||
| event: event | |||
| source: helper]) | |||
| if (auto session = [view beginDraggingSessionWithItems: [NSArray arrayWithObject: dragItem] | |||
| event: event | |||
| source: helper]) | |||
| { | |||
| session.animatesToStartingPositionsOnCancelOrFail = YES; | |||
| session.draggingFormation = NSDraggingFormationNone; | |||
| @@ -304,20 +304,20 @@ bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& fi | |||
| { | |||
| JUCE_AUTORELEASEPOOL | |||
| { | |||
| if (auto* event = [[view window] currentEvent]) | |||
| if (auto event = [[view window] currentEvent]) | |||
| { | |||
| auto* dragItems = [[[NSMutableArray alloc] init] autorelease]; | |||
| auto dragItems = [[[NSMutableArray alloc] init] autorelease]; | |||
| for (auto& filename : files) | |||
| { | |||
| auto* nsFilename = juceStringToNS (filename); | |||
| auto* fileURL = [NSURL fileURLWithPath: nsFilename]; | |||
| auto* dragItem = [[NSDraggingItem alloc] initWithPasteboardWriter: fileURL]; | |||
| auto fileURL = [NSURL fileURLWithPath: nsFilename]; | |||
| auto dragItem = [[NSDraggingItem alloc] initWithPasteboardWriter: fileURL]; | |||
| auto eventPos = [event locationInWindow]; | |||
| auto dragRect = [view convertRect: NSMakeRect (eventPos.x - 16.0f, eventPos.y - 16.0f, 32.0f, 32.0f) | |||
| fromView: nil]; | |||
| auto* dragImage = [[NSWorkspace sharedWorkspace] iconForFile: nsFilename]; | |||
| auto dragImage = [[NSWorkspace sharedWorkspace] iconForFile: nsFilename]; | |||
| [dragItem setDraggingFrame: dragRect | |||
| contents: dragImage]; | |||
| @@ -325,7 +325,7 @@ bool DragAndDropContainer::performExternalDragDropOfFiles (const StringArray& fi | |||
| [dragItem release]; | |||
| } | |||
| auto* helper = [draggingSourceHelper.createInstance() autorelease]; | |||
| auto helper = [draggingSourceHelper.createInstance() autorelease]; | |||
| if (callback != nullptr) | |||
| NSDraggingSourceHelper::setCompletionCallback (helper, callback); | |||
| @@ -158,14 +158,14 @@ void RecentlyOpenedFilesList::forgetRecentFileNatively (const File& file) | |||
| // from the recent list, so we clear them all and add them back excluding | |||
| // the specified file | |||
| auto* sharedDocController = [NSDocumentController sharedDocumentController]; | |||
| auto* recentDocumentURLs = [sharedDocController recentDocumentURLs]; | |||
| auto sharedDocController = [NSDocumentController sharedDocumentController]; | |||
| auto recentDocumentURLs = [sharedDocController recentDocumentURLs]; | |||
| [sharedDocController clearRecentDocuments: nil]; | |||
| auto* nsFile = createNSURLFromFile (file); | |||
| auto* reverseEnumerator = [recentDocumentURLs reverseObjectEnumerator]; | |||
| auto reverseEnumerator = [recentDocumentURLs reverseObjectEnumerator]; | |||
| for (NSURL* url : reverseEnumerator) | |||
| if (! [url isEqual:nsFile]) | |||
| @@ -37,7 +37,7 @@ namespace PushNotificationsDelegateDetails | |||
| { | |||
| if (iOSEarlierThan10) | |||
| { | |||
| auto* action = [[UIMutableUserNotificationAction alloc] init]; | |||
| auto action = [[UIMutableUserNotificationAction alloc] init]; | |||
| action.identifier = juceStringToNS (a.identifier); | |||
| action.title = juceStringToNS (a.title); | |||
| @@ -77,10 +77,10 @@ namespace PushNotificationsDelegateDetails | |||
| { | |||
| if (iOSEarlierThan10) | |||
| { | |||
| auto* category = [[UIMutableUserNotificationCategory alloc] init]; | |||
| auto category = [[UIMutableUserNotificationCategory alloc] init]; | |||
| category.identifier = juceStringToNS (c.identifier); | |||
| auto* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()]; | |||
| auto actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()]; | |||
| for (const auto& a : c.actions) | |||
| { | |||
| @@ -98,7 +98,7 @@ namespace PushNotificationsDelegateDetails | |||
| else | |||
| { | |||
| #if defined (__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0 | |||
| auto* actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()]; | |||
| auto actions = [NSMutableArray arrayWithCapacity: (NSUInteger) c.actions.size()]; | |||
| for (const auto& a : c.actions) | |||
| { | |||
| @@ -119,7 +119,7 @@ namespace PushNotificationsDelegateDetails | |||
| //============================================================================== | |||
| UILocalNotification* juceNotificationToUILocalNotification (const PushNotifications::Notification& n) | |||
| { | |||
| auto* notification = [[UILocalNotification alloc] init]; | |||
| auto notification = [[UILocalNotification alloc] init]; | |||
| notification.alertTitle = juceStringToNS (n.title); | |||
| notification.alertBody = juceStringToNS (n.body); | |||
| @@ -144,7 +144,7 @@ namespace PushNotificationsDelegateDetails | |||
| UNNotificationRequest* juceNotificationToUNNotificationRequest (const PushNotifications::Notification& n) | |||
| { | |||
| // content | |||
| auto* content = [[UNMutableNotificationContent alloc] init]; | |||
| auto content = [[UNMutableNotificationContent alloc] init]; | |||
| content.title = juceStringToNS (n.title); | |||
| content.subtitle = juceStringToNS (n.subtitle); | |||
| @@ -585,7 +585,7 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate | |||
| { | |||
| settings = settingsToUse; | |||
| auto* categories = [NSMutableSet setWithCapacity: (NSUInteger) settings.categories.size()]; | |||
| auto categories = [NSMutableSet setWithCapacity: (NSUInteger) settings.categories.size()]; | |||
| if (iOSEarlierThan10) | |||
| { | |||
| @@ -36,7 +36,7 @@ namespace PushNotificationsDelegateDetailsOsx | |||
| bool isEarlierThanMavericks, | |||
| bool isEarlierThanYosemite) | |||
| { | |||
| auto* notification = [[NSUserNotification alloc] init]; | |||
| auto notification = [[NSUserNotification alloc] init]; | |||
| notification.title = juceStringToNS (n.title); | |||
| notification.subtitle = juceStringToNS (n.subtitle); | |||
| @@ -48,7 +48,7 @@ namespace PushNotificationsDelegateDetailsOsx | |||
| if (n.repeat && n.triggerIntervalSec >= 60) | |||
| { | |||
| auto* dateComponents = [[NSDateComponents alloc] init]; | |||
| auto dateComponents = [[NSDateComponents alloc] init]; | |||
| auto intervalSec = NSInteger (n.triggerIntervalSec); | |||
| dateComponents.second = intervalSec; | |||
| dateComponents.nanosecond = NSInteger ((n.triggerIntervalSec - intervalSec) * 1000000000); | |||
| @@ -115,7 +115,7 @@ namespace PushNotificationsDelegateDetailsOsx | |||
| { | |||
| if (n.actions.size() > 1) | |||
| { | |||
| auto* additionalActions = [NSMutableArray arrayWithCapacity: (NSUInteger) n.actions.size() - 1]; | |||
| auto additionalActions = [NSMutableArray arrayWithCapacity: (NSUInteger) n.actions.size() - 1]; | |||
| for (int a = 1; a < n.actions.size(); ++a) | |||
| [additionalActions addObject: [NSUserNotificationAction actionWithIdentifier: juceStringToNS (n.actions[a].identifier) | |||
| @@ -469,10 +469,10 @@ struct PushNotifications::Pimpl : private PushNotificationsDelegate | |||
| //PushNotificationsDelegate | |||
| void registeredForRemoteNotifications (NSData* deviceTokenToUse) override | |||
| { | |||
| auto* deviceTokenString = [[[[deviceTokenToUse description] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral ("<") withString: nsStringLiteral ("")] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral (">") withString: nsStringLiteral ("")] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral (" ") withString: nsStringLiteral ("")]; | |||
| auto deviceTokenString = [[[[deviceTokenToUse description] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral ("<") withString: nsStringLiteral ("")] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral (">") withString: nsStringLiteral ("")] | |||
| stringByReplacingOccurrencesOfString: nsStringLiteral (" ") withString: nsStringLiteral ("")]; | |||
| deviceToken = nsStringToJuce (deviceTokenString); | |||
| @@ -177,7 +177,7 @@ static bool checkPeerIsValid (OpenGLContext* context) | |||
| #if JUCE_MAC || JUCE_IOS | |||
| if (auto* nsView = (JUCE_IOS_MAC_VIEW*) peer->getNativeHandle()) | |||
| { | |||
| if (auto* nsWindow = [nsView window]) | |||
| if (auto nsWindow = [nsView window]) | |||
| { | |||
| #if JUCE_MAC | |||
| return ([nsWindow isVisible] | |||
| @@ -178,7 +178,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| void getProductsInformation (const StringArray& productIdentifiers) | |||
| { | |||
| auto* productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithArray: createNSArrayFromStringArray (productIdentifiers)]]; | |||
| auto productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithArray: createNSArrayFromStringArray (productIdentifiers)]]; | |||
| pendingProductInfoRequests.add (new PendingProductInfoRequest { PendingProductInfoRequest::Type::query, | |||
| std::unique_ptr<SKProductsRequest, NSObjectDeleter> (productsRequest) }); | |||
| @@ -195,8 +195,8 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| return; | |||
| } | |||
| auto* productIdentifiers = [NSArray arrayWithObject: juceStringToNS (productIdentifier)]; | |||
| auto* productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]]; | |||
| auto productIdentifiers = [NSArray arrayWithObject: juceStringToNS (productIdentifier)]; | |||
| auto productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithArray:productIdentifiers]]; | |||
| pendingProductInfoRequests.add (new PendingProductInfoRequest { PendingProductInfoRequest::Type::purchase, | |||
| std::unique_ptr<SKProductsRequest, NSObjectDeleter> (productsRequest) }); | |||
| @@ -213,7 +213,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| } | |||
| else | |||
| { | |||
| auto* receiptRequest = [[SKReceiptRefreshRequest alloc] init]; | |||
| auto receiptRequest = [[SKReceiptRefreshRequest alloc] init]; | |||
| pendingReceiptRefreshRequests.add (new PendingReceiptRefreshRequest { subscriptionsSharedSecret, | |||
| std::unique_ptr<SKReceiptRefreshRequest, NSObjectDeleter> ([receiptRequest retain]) }); | |||
| @@ -377,7 +377,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| jassert ([products count] == 1); | |||
| auto* product = products[0]; | |||
| auto* payment = [SKPayment paymentWithProduct: product]; | |||
| auto payment = [SKPayment paymentWithProduct: product]; | |||
| [[SKPaymentQueue defaultQueue] addPayment: payment]; | |||
| } | |||
| else | |||
| @@ -525,9 +525,9 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| //============================================================================== | |||
| void processReceiptRefreshResponseWithSubscriptionsSharedSecret (const String& secret) | |||
| { | |||
| auto* receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; | |||
| auto receiptURL = [[NSBundle mainBundle] appStoreReceiptURL]; | |||
| if (auto* receiptData = [NSData dataWithContentsOfURL: receiptURL]) | |||
| if (auto receiptData = [NSData dataWithContentsOfURL: receiptURL]) | |||
| fetchReceiptDetailsFromAppStore (receiptData, secret); | |||
| else | |||
| owner.listeners.call ([&] (Listener& l) { l.purchasesListRestored ({}, false, NEEDS_TRANS ("Receipt fetch failed")); }); | |||
| @@ -535,16 +535,16 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| void fetchReceiptDetailsFromAppStore (NSData* receiptData, const String& secret) | |||
| { | |||
| auto* requestContents = [NSMutableDictionary dictionaryWithCapacity: (NSUInteger) (secret.isNotEmpty() ? 2 : 1)]; | |||
| auto requestContents = [NSMutableDictionary dictionaryWithCapacity: (NSUInteger) (secret.isNotEmpty() ? 2 : 1)]; | |||
| [requestContents setObject: [receiptData base64EncodedStringWithOptions:0] forKey: nsStringLiteral ("receipt-data")]; | |||
| if (secret.isNotEmpty()) | |||
| [requestContents setObject: juceStringToNS (secret) forKey: nsStringLiteral ("password")]; | |||
| NSError* error; | |||
| auto* requestData = [NSJSONSerialization dataWithJSONObject: requestContents | |||
| options: 0 | |||
| error: &error]; | |||
| auto requestData = [NSJSONSerialization dataWithJSONObject: requestContents | |||
| options: 0 | |||
| error: &error]; | |||
| if (requestData == nil) | |||
| { | |||
| sendReceiptFetchFail(); | |||
| @@ -558,28 +558,28 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| #endif | |||
| // TODO: use juce URL here | |||
| auto* storeRequest = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: nsStringLiteral (storeURL)]]; | |||
| auto storeRequest = [NSMutableURLRequest requestWithURL: [NSURL URLWithString: nsStringLiteral (storeURL)]]; | |||
| [storeRequest setHTTPMethod: nsStringLiteral ("POST")]; | |||
| [storeRequest setHTTPBody: requestData]; | |||
| auto* task = [[NSURLSession sharedSession] dataTaskWithRequest: storeRequest | |||
| completionHandler: | |||
| ^(NSData* data, NSURLResponse*, NSError* connectionError) | |||
| { | |||
| if (connectionError != nil) | |||
| { | |||
| sendReceiptFetchFail(); | |||
| } | |||
| else | |||
| { | |||
| NSError* err; | |||
| if (NSDictionary* receiptDetails = [NSJSONSerialization JSONObjectWithData: data options: 0 error: &err]) | |||
| processReceiptDetails (receiptDetails); | |||
| else | |||
| sendReceiptFetchFail(); | |||
| } | |||
| }]; | |||
| auto task = [[NSURLSession sharedSession] dataTaskWithRequest: storeRequest | |||
| completionHandler: | |||
| ^(NSData* data, NSURLResponse*, NSError* connectionError) | |||
| { | |||
| if (connectionError != nil) | |||
| { | |||
| sendReceiptFetchFail(); | |||
| } | |||
| else | |||
| { | |||
| NSError* err; | |||
| if (NSDictionary* receiptDetails = [NSJSONSerialization JSONObjectWithData: data options: 0 error: &err]) | |||
| processReceiptDetails (receiptDetails); | |||
| else | |||
| sendReceiptFetchFail(); | |||
| } | |||
| }]; | |||
| [task resume]; | |||
| } | |||
| @@ -656,7 +656,7 @@ struct InAppPurchases::Pimpl : public SKDelegateAndPaymentObserver | |||
| } | |||
| else if (auto dateAsString = getAs<NSString> (date)) | |||
| { | |||
| auto* formatter = [[NSNumberFormatter alloc] init]; | |||
| auto formatter = [[NSNumberFormatter alloc] init]; | |||
| [formatter setNumberStyle: NSNumberFormatterDecimalStyle]; | |||
| dateAsNumber = [formatter numberFromString: dateAsString]; | |||
| [formatter release]; | |||
| @@ -402,7 +402,7 @@ private: | |||
| dispatch_async (captureSessionQueue,^ | |||
| { | |||
| cameraDevice = [AVCaptureDevice deviceWithUniqueID: juceStringToNS (cameraIdToUse)]; | |||
| auto* audioDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeAudio]; | |||
| auto audioDevice = [AVCaptureDevice defaultDeviceWithMediaType: AVMediaTypeAudio]; | |||
| [captureSession.get() beginConfiguration]; | |||
| @@ -507,8 +507,8 @@ private: | |||
| { | |||
| NSError* error = nil; | |||
| auto* input = [AVCaptureDeviceInput deviceInputWithDevice: device | |||
| error: &error]; | |||
| auto input = [AVCaptureDeviceInput deviceInputWithDevice: device | |||
| error: &error]; | |||
| if (error != nil) | |||
| return nsStringToJuce (error.localizedDescription); | |||
| @@ -629,7 +629,7 @@ private: | |||
| if (Pimpl::getIOSVersion().major >= 10 && [captureOutput isKindOfClass: [AVCapturePhotoOutput class]]) | |||
| { | |||
| auto* photoOutput = (AVCapturePhotoOutput*) captureOutput; | |||
| auto* outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| auto outputConnection = [photoOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| outputConnection.videoOrientation = orientationToUse; | |||
| [photoOutput capturePhotoWithSettings: [AVCapturePhotoSettings photoSettings] | |||
| @@ -640,7 +640,7 @@ private: | |||
| #endif | |||
| auto* stillImageOutput = (AVCaptureStillImageOutput*) captureOutput; | |||
| auto* outputConnection = [stillImageOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| auto outputConnection = [stillImageOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| outputConnection.videoOrientation = orientationToUse; | |||
| [stillImageOutput captureStillImageAsynchronouslyFromConnection: connection completionHandler: | |||
| @@ -925,7 +925,7 @@ private: | |||
| } | |||
| NSData* origImageData = [AVCapturePhotoOutput JPEGPhotoDataRepresentationForJPEGSampleBuffer: imageBuffer previewPhotoSampleBuffer: imagePreviewBuffer]; | |||
| auto* origImage = [UIImage imageWithData: origImageData]; | |||
| auto origImage = [UIImage imageWithData: origImageData]; | |||
| auto imageOrientation = uiImageOrientationToCGImageOrientation (origImage.imageOrientation); | |||
| auto* uiImage = getImageWithCorrectOrientation (imageOrientation, origImage.CGImage); | |||
| @@ -1009,10 +1009,10 @@ private: | |||
| if (Pimpl::getIOSVersion().major >= 10) | |||
| printVideoOutputDebugInfo (movieFileOutput); | |||
| auto* url = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName()) | |||
| isDirectory: NO]; | |||
| auto url = [NSURL fileURLWithPath: juceStringToNS (file.getFullPathName()) | |||
| isDirectory: NO]; | |||
| auto* outputConnection = [movieFileOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| auto outputConnection = [movieFileOutput connectionWithMediaType: AVMediaTypeVideo]; | |||
| outputConnection.videoOrientation = orientationToUse; | |||
| [movieFileOutput startRecordingToOutputFileURL: url recordingDelegate: delegate.get()]; | |||
| @@ -1307,7 +1307,7 @@ struct CameraDevice::ViewerComponent : public UIViewComponent | |||
| // Initial size that can be overriden later. | |||
| setSize (640, 480); | |||
| auto* view = [cls.createInstance() init]; | |||
| auto view = [cls.createInstance() init]; | |||
| setView (view); | |||
| auto* previewLayer = device.pimpl->captureSession.createPreviewLayer(); | |||
| @@ -71,7 +71,7 @@ struct CameraDevice::Pimpl | |||
| if (imageOutput == nil) | |||
| { | |||
| imageOutput = [[AVCaptureStillImageOutput alloc] init]; | |||
| auto* imageSettings = [[NSDictionary alloc] initWithObjectsAndKeys: AVVideoCodecJPEG, AVVideoCodecKey, nil]; | |||
| auto imageSettings = [[NSDictionary alloc] initWithObjectsAndKeys: AVVideoCodecJPEG, AVVideoCodecKey, nil]; | |||
| [imageOutput setOutputSettings: imageSettings]; | |||
| [imageSettings release]; | |||
| [session addOutput: imageOutput]; | |||
| @@ -292,7 +292,7 @@ private: | |||
| void loadAsync (URL url) | |||
| { | |||
| auto* nsUrl = [NSURL URLWithString: juceStringToNS (url.toString (true))]; | |||
| auto nsUrl = [NSURL URLWithString: juceStringToNS (url.toString (true))]; | |||
| asset.reset ([[AVURLAsset alloc] initWithURL: nsUrl options: nil]); | |||
| [asset.get() loadValuesAsynchronouslyForKeys: assetKeys.get() | |||
| @@ -612,7 +612,7 @@ private: | |||
| Result load (NSURL* url) | |||
| { | |||
| if (auto* player = [AVPlayer playerWithURL: url]) | |||
| if (auto player = [AVPlayer playerWithURL: url]) | |||
| { | |||
| setPlayer (player); | |||
| return Result::ok(); | |||