Commit 6066231b authored by Carola Nitz's avatar Carola Nitz

add voids to block that don't require parameters, make implicit selfs explicit

parent 850a3836
......@@ -128,7 +128,7 @@
double amountOfSeconds = 0.1;
dispatch_time_t delayTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(amountOfSeconds * NSEC_PER_SEC));
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
_needsNotifyDelegate = NO;
self->_needsNotifyDelegate = NO;
[self.delegate networkServerBrowserDidUpdate:self];
});
}
......
......@@ -75,10 +75,10 @@
[itemsArray addObject:[[VLCNetworkServerBrowserItemUPnP alloc] initWithBasicObject:object device:self.upnpDevice]];
}
@synchronized(_items) {
_items = [itemsArray copy];
@synchronized(self->_items) {
self->_items = [itemsArray copy];
}
_mediaList = [self buildMediaList];
self->_mediaList = [self buildMediaList];
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.delegate networkServerBrowserDidUpdate:self];
}];
......
......@@ -42,8 +42,7 @@
[excludedActivities addObject:UIActivityTypeMarkupAsPDF];
}
controller.excludedActivityTypes = excludedActivities;
controller.completionHandler = ^(UIActivityType _Nullable activityType, BOOL completed) {
controller.completionWithItemsHandler = ^(UIActivityType _Nullable activityType, BOOL completed, NSArray * _Nullable returnedItems, NSError * _Nullable activityError) {
APLog(@"UIActivityViewController finished with activity type: %@, completed: %i", activityType, completed);
// Provide feedback. This could cause a false positive if the user chose "Don't Allow" in the permissions dialog, and UIActivityViewController does not inform us of that, so check the authorization status.
......
......@@ -110,10 +110,10 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible];
// enable crash preventer
void (^setupBlock)() = ^{
void (^setupLibraryBlock)() = ^{
appCoordinator = [[AppCoordinator alloc] initWithTabBarController:rootViewController];
[appCoordinator start];
void (^setupBlock)(void) = ^{
void (^setupLibraryBlock)(void) = ^{
self->appCoordinator = [[AppCoordinator alloc] initWithTabBarController:self->rootViewController];
[self->appCoordinator start];
};
[self validatePasscodeIfNeededWithCompletion:setupLibraryBlock];
......@@ -138,7 +138,7 @@ NSString *const VLCDropboxSessionWasAuthorized = @"VLCDropboxSessionWasAuthorize
//migrate
setupBlock();
_isRunningMigration = NO;
self->_isRunningMigration = NO;
[[MLMediaLibrary sharedMediaLibrary] updateMediaDatabase];
[[VLCMediaFileDiscoverer sharedInstance] updateMediaList];
};
......
......@@ -143,7 +143,7 @@
BoxCollectionBlock success = ^(BoxCollection *collection)
{
_fileList = collection;
self->_fileList = collection;
[self _listOfGoodFilesAndFolders];
};
......@@ -254,9 +254,9 @@
BoxAPIDataProgressBlock progressBlock = ^(long long expectedTotalBytes, unsigned long long bytesReceived)
{
if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
[self calculateRemainingTime:(CGFloat)bytesReceived expectedDownloadSize:(CGFloat)expectedTotalBytes];
_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
}
CGFloat progress = (CGFloat)bytesReceived / (CGFloat)expectedTotalBytes;
......
......@@ -233,8 +233,8 @@ typedef NS_ENUM(NSUInteger, VLCDownloadScheme) {
if (!_backgroundTaskIdentifier || _backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
dispatch_block_t expirationHandler = ^{
APLog(@"Downloads were interrupted after being in background too long, time remaining: %f", [[UIApplication sharedApplication] backgroundTimeRemaining]);
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = 0;
[[UIApplication sharedApplication] endBackgroundTask:self->_backgroundTaskIdentifier];
self->_backgroundTaskIdentifier = 0;
};
_backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"VLCDownloader" expirationHandler:expirationHandler];
......
......@@ -198,12 +198,12 @@
}
[[[self client].filesRoutes listFolder:path] setResponseBlock:^(DBFILESListFolderResult * _Nullable result, DBFILESListFolderError * _Nullable routeError, DBRequestError * _Nullable networkError) {
if (result) {
_currentFileList = [result.entries sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
self->_currentFileList = [result.entries sortedArrayUsingComparator:^NSComparisonResult(id a, id b) {
NSString *first = [(DBFILESMetadata*)a name];
NSString *second = [(DBFILESMetadata*)b name];
return [first caseInsensitiveCompare:second];
}];
APLog(@"found filtered metadata for %lu files", (unsigned long)_currentFileList.count);
APLog(@"found filtered metadata for %lu files", (unsigned long)self->_currentFileList.count);
if ([self.delegate respondsToSelector:@selector(mediaListUpdated)])
[self.delegate mediaListUpdated];
} else {
......@@ -237,7 +237,7 @@
[self.delegate operationWithProgressInformationStopped];
}
_downloadInProgress = NO;
self->_downloadInProgress = NO;
[self _triggerNextDownload];
if (networkError) {
APLog(@"downloadFile failed with network error %li and error tag %li", (long)networkError.statusCode, (long)networkError.tag);
......@@ -248,9 +248,9 @@
UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, NSLocalizedString(@"GDRIVE_DOWNLOAD_SUCCESSFUL", nil));
}
if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
[self calculateRemainingTime:(CGFloat)totalBytesWritten expectedDownloadSize:(CGFloat)totalBytesExpectedToWrite];
_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
}
if ([self.delegate respondsToSelector:@selector(currentProgressInformation:)])
......
......@@ -207,7 +207,7 @@
_12K_slider.minimumValue = -20.;
_12K_slider.maximumValue = 20.;
[_12K_slider addTarget:self action:@selector(sliderChangedValue:) forControlEvents:UIControlEventValueChanged];
[self addSubview:_12K_slider],
[self addSubview:_12K_slider];
textView = [[UITextView alloc] initWithFrame:CGRectMake(horizontal_padding * 9. + sliderWidth * 9.5, frame.size.height - vertical_padding_down, 35, 25)];
textView.text = @"12K";
......
......@@ -202,9 +202,9 @@
GTLDriveFileList *fileList,
NSError *error) {
if (error == nil) {
_fileList = fileList;
_nextPageToken = fileList.nextPageToken;
_fileListTicket = nil;
self->_fileList = fileList;
self->_nextPageToken = fileList.nextPageToken;
self->_fileListTicket = nil;
[self _listOfGoodFilesAndFolders];
} else {
[self showAlert:NSLocalizedString(@"GDRIVE_ERROR_FETCHING_FILES",nil) message:error.localizedDescription];
......@@ -311,9 +311,9 @@
fetcher.downloadProgressBlock = ^(int64_t bytesWritten,
int64_t totalBytesWritten,
int64_t totalBytesExpectedToWrite) {
if ((_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - _lastStatsUpdate > .5)) || _lastStatsUpdate <= 0) {
if ((self->_lastStatsUpdate > 0 && ([NSDate timeIntervalSinceReferenceDate] - self->_lastStatsUpdate > .5)) || self->_lastStatsUpdate <= 0) {
[self calculateRemainingTime:totalBytesWritten expectedDownloadSize:totalBytesExpectedToWrite];
_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
self->_lastStatsUpdate = [NSDate timeIntervalSinceReferenceDate];
}
CGFloat progress = (CGFloat)weakFetcher.downloadedLength / (CGFloat)[file.size unsignedLongValue];
......
......@@ -174,13 +174,13 @@
self.authorizationInProgress = NO;
if (authState) {
// Upon successful completion...
_googleDriveController.driveService.authorizer = [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState];
[GTMAppAuthFetcherAuthorization saveAuthorization:(GTMAppAuthFetcherAuthorization *)_googleDriveController.driveService.authorizer
self->_googleDriveController.driveService.authorizer = [[GTMAppAuthFetcherAuthorization alloc] initWithAuthState:authState];
[GTMAppAuthFetcherAuthorization saveAuthorization:(GTMAppAuthFetcherAuthorization *)self->_googleDriveController.driveService.authorizer
toKeychainForName:kKeychainItemName];
[self updateViewAfterSessionChange];
[self.activityIndicator startAnimating];
} else {
_googleDriveController.driveService.authorizer = nil;
self->_googleDriveController.driveService.authorizer = nil;
}
}];
......
......@@ -87,8 +87,8 @@
if (!_backgroundTaskIdentifier || _backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
dispatch_block_t expirationHandler = ^{
[self changeHTTPServerState:NO];
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = 0;
[[UIApplication sharedApplication] endBackgroundTask:self->_backgroundTaskIdentifier];
self->_backgroundTaskIdentifier = 0;
};
if ([[UIApplication sharedApplication] respondsToSelector:@selector(beginBackgroundTaskWithName:expirationHandler:)]) {
_backgroundTaskIdentifier = [[UIApplication sharedApplication] beginBackgroundTaskWithName:@"VLCUploader" expirationHandler:expirationHandler];
......
......@@ -109,7 +109,7 @@ const float MediaTimerInterval = 2.f;
DISPATCH_VNODE_WRITE, DISPATCH_TARGET_QUEUE_DEFAULT);
dispatch_source_set_event_handler(_directorySource, ^(){
unsigned long const data = dispatch_source_get_data(_directorySource);
unsigned long const data = dispatch_source_get_data(self->_directorySource);
if (data & DISPATCH_VNODE_WRITE) {
// Do all the work on the main thread,
// including timer scheduling, notifications delivering
......
......@@ -16,5 +16,5 @@
@property(nonatomic) IBOutlet UILabel *statusLabel;
@property(nonatomic) IBOutlet UIActivityIndicatorView *spinner;
@property(nonatomic, copy) void (^completionHandler)();
@property(nonatomic, copy) void (^completionHandler)(void);
@end
......@@ -1695,7 +1695,7 @@ currentMediaHasTrackToChooseFrom:(BOOL)currentMediaHasTrackToChooseFrom
- (void)showOnExternalDisplay
{
UIScreen *screen = [UIScreen screens][1];
screen.overscanCompensation = UIScreenOverscanCompensationInsetApplicationFrame;
screen.overscanCompensation = UIScreenOverscanCompensationNone;
self.externalWindow = [[UIWindow alloc] initWithFrame:screen.bounds];
......
......@@ -123,7 +123,7 @@
__block BOOL controllerWasPresentedSuccessfully = NO;
dispatch_block_t controllerPresentationBlock = ^{
controllerWasPresentedSuccessfully = [_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
controllerWasPresentedSuccessfully = [self->_documentInteractionController presentOpenInMenuFromBarButtonItem:self.presentingBarButtonItem animated:YES];
if (!controllerWasPresentedSuccessfully) {
VLCAlertView *alertView = [[VLCAlertView alloc] initWithTitle:NSLocalizedString(@"SHARING_ERROR_NO_APPLICATIONS", nil)
......
......@@ -1141,10 +1141,10 @@ typedef NS_ENUM(NSUInteger, VLCAspectRatio) {
if (_needsMetadataUpdate == NO) {
_needsMetadataUpdate = YES;
dispatch_async(dispatch_get_main_queue(), ^{
[_metadata updateMetadataFromMediaPlayer:_mediaPlayer];
_needsMetadataUpdate = NO;
[self->_metadata updateMetadataFromMediaPlayer:self->_mediaPlayer];
self->_needsMetadataUpdate = NO;
if ([self.delegate respondsToSelector:@selector(displayMetadataForPlaybackController:metadata:)])
[self.delegate displayMetadataForPlaybackController:self metadata:_metadata];
[self.delegate displayMetadataForPlaybackController:self metadata:self->_metadata];
});
}
}
......
......@@ -313,7 +313,7 @@ static NSString *const VLCPlayerDisplayControllerDisplayModeKey = @"VLCPlayerDis
delay:animationDuration
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionAllowUserInteraction
animations:^{
self.bottomConstraint.constant = needsHide ? 0 : -_miniPlaybackView.frame.size.height -self.view.layoutMargins.bottom;
self.bottomConstraint.constant = needsHide ? 0 : -self->_miniPlaybackView.frame.size.height -self.view.layoutMargins.bottom;
[self.view layoutIfNeeded];
}
completion:completionBlock];
......
......@@ -500,7 +500,7 @@
videoTracks = audioTracks = spuTracks = nil;
}
void (^animationBlock)() = ^() {
void (^animationBlock)(void) = ^() {
self.metaDataLabel.hidden = !showMeta;
};
......
......@@ -490,7 +490,7 @@
} else
self.metaDataLabel.text = @"";
void (^animationBlock)() = ^() {
void (^animationBlock)(void) = ^() {
self.frame = frame;
self.metaDataLabel.hidden = metaHidden;
};
......@@ -519,7 +519,7 @@
frame.size.height = 90.;
BOOL metaHidden = YES;
void (^animationBlock)() = ^() {
void (^animationBlock)(void) = ^() {
self.frame = frame;
self.metaDataLabel.hidden = metaHidden;
};
......
......@@ -57,7 +57,7 @@
- (NSSet *)hiddenBiometryKeys
{
if (@available(iOS 11.0, *)) {
if (@available(iOS 11.0.1, *)) {
LAContext *laContext = [[LAContext alloc] init];
if ([laContext canEvaluatePolicy:LAPolicyDeviceOwnerAuthenticationWithBiometrics error:nil]) {
switch (laContext.biometryType) {
......
......@@ -87,7 +87,7 @@
self.hidden = NO;
}
void (^animationBlock)() = ^() {
void (^animationBlock)(void) = ^() {
self.alpha = alpha;
};
......
......@@ -232,7 +232,7 @@
}
self.alpha = 1.0f;
void (^animationBlock)() = ^() {
void (^animationBlock)(void) = ^() {
self.alpha = 0.0f;;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment