Skip to content

Commit

Permalink
Merge pull request #1208 from wutschel/coding_styles
Browse files Browse the repository at this point in the history
  • Loading branch information
kambala-decapitator authored Jan 16, 2025
2 parents c69de5f + fe3252a commit 085dd07
Show file tree
Hide file tree
Showing 19 changed files with 154 additions and 156 deletions.
6 changes: 3 additions & 3 deletions XBMC Remote/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -5640,10 +5640,10 @@ - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(N
#pragma mark - Playlist Artist Albums
playlistArtistAlbums = [menu_Music copy];

#pragma mark - Plalist Movies
#pragma mark - Playlist Movies
playlistMovies = [menu_Movies copy];

#pragma mark - Plalist Movies
#pragma mark - Playlist Movies
playlistMusicVideos = [menu_Videos copy];

#pragma mark - Playlist TV Shows
Expand Down Expand Up @@ -6428,7 +6428,7 @@ - (void)saveServerList {
}

- (void)clearDiskCacheAtPath:(NSString*)cachePath {
[[NSFileManager defaultManager] removeItemAtPath:cachePath error:nil];
[[NSFileManager defaultManager] removeItemAtPath:cachePath error:NULL];
[[NSFileManager defaultManager] createDirectoryAtPath:cachePath
withIntermediateDirectories:YES
attributes:nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ - (void)buildIndexLabels {

NSMutableArray *workingLabels = [NSMutableArray arrayWithCapacity:self.indexTitles.count];
for (NSString *indexTitle in self.indexTitles) {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
UILabel *label = [UILabel new];
label.text = indexTitle;
label.font = [UIFont boldSystemFontOfSize:11];
label.minimumScaleFactor = FONT_SCALING_NONE;
Expand Down
3 changes: 1 addition & 2 deletions XBMC Remote/DetailViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
@interface DetailViewController : UIViewController <UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UISearchControllerDelegate, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout, UISearchResultsUpdating, SFSafariViewControllerDelegate> {
IBOutlet UITableView *dataList;
IBOutlet jsonDataCell *jsonCell;
NSMutableArray *filteredListContent;
NSMutableArray *filteredListContent;
NSMutableArray *storeRichResults;
IBOutlet UIActivityIndicatorView *activityIndicatorView;
NSMutableDictionary *sections;
Expand Down Expand Up @@ -121,7 +121,6 @@
dispatch_queue_t epglockqueue;
LogoBackgroundType logoBackgroundMode;
BOOL showkeyboard;
__weak UIAlertController *actionView;
NSIndexPath *selectedIndexPath;
NSNumber *processAllItemsInSection;
}
Expand Down
41 changes: 21 additions & 20 deletions XBMC Remote/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ - (NSMutableArray*)getPlaylistActions:(NSMutableArray*)sheetActions item:(NSDict
return sheetActions;
}

#pragma mark - UICollectionView FlowLayout deleagate
#pragma mark - UICollectionView FlowLayout delegate

- (CGSize)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section {
if ((enableCollectionView && self.sectionArray.count > 1 && section > 0) || [self doesShowSearchResults]) {
Expand Down Expand Up @@ -2856,7 +2856,7 @@ - (NSInteger)getFirstListedSeason:(NSArray*)array {

- (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)section {
if (albumView && self.richResults.count > 0) {
UIImageView *thumbImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
UIImageView *thumbImageView = [UIImageView new];
UIView *albumDetailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewWidth, albumViewHeight)];

NSDictionary *item = self.richResults[0];
Expand Down Expand Up @@ -2897,7 +2897,7 @@ - (UIView*)tableView:(UITableView*)tableView viewForHeaderInSection:(NSInteger)s
return albumDetailView;
}
else if (episodesView && self.sectionArray.count > section && ![self doesShowSearchResults]) {
UIImageView *thumbImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
UIImageView *thumbImageView = [UIImageView new];
UIView *albumDetailView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, viewWidth, albumViewHeight)];
albumDetailView.tag = section;

Expand Down Expand Up @@ -3336,8 +3336,7 @@ - (void)handleLongPress:(UILongPressGestureRecognizer*)activeRecognizer {
- (void)showActionSheetOptions:(NSString*)title options:(NSArray*)sheetActions recording:(BOOL)isRecording origin:(CGPoint)origin fromview:(UIView*)fromview {
NSInteger numActions = sheetActions.count;
if (numActions) {
UIAlertController *actionTemp = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
actionView = actionTemp;
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *action_cancel = [UIAlertAction actionWithTitle:LOCALIZED_STR(@"Cancel") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
forceMusicAlbumMode = NO;
Expand All @@ -3352,18 +3351,18 @@ - (void)showActionSheetOptions:(NSString*)title options:(NSArray*)sheetActions r
UIAlertAction *action = [UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self actionSheetHandler:actiontitle origin:origin fromview:fromview];
}];
[actionView addAction:action];
[alertCtrl addAction:action];
}
[actionView addAction:action_cancel];
actionView.modalPresentationStyle = UIModalPresentationPopover;
[alertCtrl addAction:action_cancel];
alertCtrl.modalPresentationStyle = UIModalPresentationPopover;

UIViewController *fromctrl = [Utilities topMostController];
UIPopoverPresentationController *popPresenter = [actionView popoverPresentationController];
UIPopoverPresentationController *popPresenter = [alertCtrl popoverPresentationController];
if (popPresenter != nil) {
popPresenter.sourceView = fromview;
popPresenter.sourceRect = CGRectMake(origin.x, origin.y, 1, 1);
}
[fromctrl presentViewController:actionView animated:YES completion:nil];
[fromctrl presentViewController:alertCtrl animated:YES completion:nil];
}
}

Expand Down Expand Up @@ -3510,7 +3509,7 @@ - (void)actionSheetHandler:(NSString*)actiontitle origin:(CGPoint)origin fromvie
if (!sheetActions.count) {
return;
}
UIAlertController *actionView = [UIAlertController alertControllerWithTitle:LOCALIZED_STR(@"Play using...") message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:LOCALIZED_STR(@"Play using...") message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *action_cancel = [UIAlertAction actionWithTitle:LOCALIZED_STR(@"Cancel") style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
forceMusicAlbumMode = NO;
Expand All @@ -3521,18 +3520,18 @@ - (void)actionSheetHandler:(NSString*)actiontitle origin:(CGPoint)origin fromvie
UIAlertAction *action = [UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self addPlayback:item indexPath:selectedIndexPath using:actiontitle shuffle:NO];
}];
[actionView addAction:action];
[alertCtrl addAction:action];
}
[actionView addAction:action_cancel];
actionView.modalPresentationStyle = UIModalPresentationPopover;
[alertCtrl addAction:action_cancel];
alertCtrl.modalPresentationStyle = UIModalPresentationPopover;

UIViewController *fromctrl = [Utilities topMostController];
UIPopoverPresentationController *popPresenter = [actionView popoverPresentationController];
UIPopoverPresentationController *popPresenter = [alertCtrl popoverPresentationController];
if (popPresenter != nil) {
popPresenter.sourceView = fromview;
popPresenter.sourceRect = CGRectMake(origin.x, origin.y, 1, 1);
}
[fromctrl presentViewController:actionView animated:YES completion:nil];
[fromctrl presentViewController:alertCtrl animated:YES completion:nil];
}
}];
}
Expand Down Expand Up @@ -5798,8 +5797,11 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];

// Dismiss any visible action sheet as the origin is not corrected in fullscreen
if (IS_IPAD && stackscrollFullscreen && [actionView isViewLoaded]) {
[actionView dismissViewControllerAnimated:YES completion:nil];
if (IS_IPAD && stackscrollFullscreen) {
UIViewController *topMostCtrl = [Utilities topMostController];
if ([topMostCtrl isKindOfClass:[UIAlertController class]]) {
[topMostCtrl dismissViewControllerAnimated:YES completion:nil];
}
}

// Force reloading of index overlay after rotation
Expand All @@ -5813,7 +5815,7 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
}
activeLayoutView.contentOffset = CGPointMake(0, iOSYDelta);
}
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {}];
completion:nil];
}

- (void)updateSearchResultsForSearchController:(UISearchController*)searchController {
Expand Down Expand Up @@ -5924,7 +5926,6 @@ - (void)viewDidLoad {

[button7 addTarget:self action:@selector(handleChangeSortLibrary) forControlEvents:UIControlEventTouchUpInside];
self.edgesForExtendedLayout = UIRectEdgeNone;
dataList.backgroundView = [[UIView alloc] initWithFrame:CGRectZero];
dataList.indicatorStyle = UIScrollViewIndicatorStyleDefault;

CGRect frame = dataList.frame;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
}
[self adjustLayout];

[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {}
[coordinator animateAlongsideTransition:nil
completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
self.topView.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.layer.bounds].CGPath;
self.topView.layer.shouldRasterize = NO;
Expand Down
16 changes: 8 additions & 8 deletions XBMC Remote/HostManagementViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,14 @@ - (void)viewDidLoad {
}

- (void)powerControl {
UIAlertController *actionView;
UIAlertController *alertCtrl;
if (AppDelegate.instance.obj.serverIP.length == 0) {
actionView = [Utilities createAlertOK:LOCALIZED_STR(@"Select an XBMC Server from the list") message:nil];
alertCtrl = [Utilities createAlertOK:LOCALIZED_STR(@"Select an XBMC Server from the list") message:nil];
}
else {
actionView = [Utilities createPowerControl];
alertCtrl = [Utilities createPowerControl];
}
[self presentViewController:actionView animated:YES completion:nil];
[self presentViewController:alertCtrl animated:YES completion:nil];
}

- (void)viewDidDisappear:(BOOL)animated {
Expand Down Expand Up @@ -749,9 +749,9 @@ - (void)enableTCPconnection {
[[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillEnterForegroundNotification object:nil userInfo:nil];
}
else {
UIAlertController *alertView = [Utilities createAlertOK:LOCALIZED_STR(@"Cannot do that") message:nil];
UIAlertController *alertCtrl = [Utilities createAlertOK:LOCALIZED_STR(@"Cannot do that") message:nil];
id presentingView = self.presentingViewController == nil ? self : self.presentingViewController;
[presentingView presentViewController:alertView animated:YES completion:nil];
[presentingView presentViewController:alertCtrl animated:YES completion:nil];
}
}
];
Expand All @@ -763,8 +763,8 @@ - (void)connectionError:(NSNotification*)note {
}

- (void)authFailed:(NSNotification*)note {
UIAlertController *alertView = [Utilities createAlertOK:LOCALIZED_STR(@"Authentication Failed") message:LOCALIZED_STR(@"Incorrect Username or Password.\nCheck your settings.")];
[self presentViewController:alertView animated:YES completion:nil];
UIAlertController *alertCtrl = [Utilities createAlertOK:LOCALIZED_STR(@"Authentication Failed") message:LOCALIZED_STR(@"Incorrect Username or Password.\nCheck your settings.")];
[self presentViewController:alertCtrl animated:YES completion:nil];

// Deselect the server which causes the authentication error to allow to correct the credentials
NSIndexPath *selection = [serverListTableView indexPathForSelectedRow];
Expand Down
2 changes: 1 addition & 1 deletion XBMC Remote/KenBurns/JBKenBurnsView.m
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ - (void)_animate:(NSNumber*)num {
CGAffineTransform transform = CGAffineTransformConcat(zoomIn, combo1);
imageView.transform = transform;
}
completion:^(BOOL finished) {}];
completion:nil];
[self performSelector:@selector(_notifyDelegate:) withObject:num afterDelay:self.timeTransition];
}

Expand Down
6 changes: 3 additions & 3 deletions XBMC Remote/MessagesView.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (void)showMessage:(NSString*)message timeout:(NSTimeInterval)timeout color:(UI
self.frame = CGRectMake(frame.origin.x, messageOrigin - slideHeight, frame.size.width, frame.size.height);
self.alpha = 0.0;
}
completion:^(BOOL finished) {}];
completion:nil];
viewMessage.text = message;
self.backgroundColor = color;
// then slide in
Expand All @@ -65,7 +65,7 @@ - (void)showMessage:(NSString*)message timeout:(NSTimeInterval)timeout color:(UI
self.frame = CGRectMake(frame.origin.x, messageOrigin, frame.size.width, frame.size.height);
self.alpha = 1.0;
}
completion:^(BOOL finished) {}];
completion:nil];
// then slide out again after timeout seconds
// Add timer to RunLoopCommonModes to decouple the timer from touch events like dragging
[fadeoutTimer invalidate];
Expand All @@ -82,7 +82,7 @@ - (void)fadeoutMessage:(NSTimer*)timer {
self.frame = CGRectMake(frame.origin.x, messageOrigin - slideHeight, frame.size.width, frame.size.height);
self.alpha = 0.0;
}
completion:^(BOOL finished) {}];
completion:nil];
[fadeoutTimer invalidate];
}

Expand Down
32 changes: 16 additions & 16 deletions XBMC Remote/NowPlaying.m
Original file line number Diff line number Diff line change
Expand Up @@ -1459,8 +1459,8 @@ - (void)retrieveExtraInfoData:(NSString*)methodToCall parameters:(NSDictionary*)
}

- (void)somethingGoesWrong:(NSString*)message {
UIAlertController *alertView = [Utilities createAlertOK:message message:nil];
[self presentViewController:alertView animated:YES completion:nil];
UIAlertController *alertCtrl = [Utilities createAlertOK:message message:nil];
[self presentViewController:alertCtrl animated:YES completion:nil];
}

# pragma mark - animations
Expand Down Expand Up @@ -1492,7 +1492,7 @@ - (void)flipAnimButton:(UIButton*)button demo:(BOOL)demo {
[button setImage:buttonImage forState:UIControlStateHighlighted];
[button setImage:buttonImage forState:UIControlStateSelected];
}
completion:^(BOOL finished) {}
completion:nil
];
}

Expand Down Expand Up @@ -1627,7 +1627,7 @@ - (void)toggleSongDetails {
itemDescription.scrollsToTop = NO;
}
}
completion:^(BOOL finished) {}];
completion:nil];
}

- (void)toggleHighlight:(UIButton*)button {
Expand Down Expand Up @@ -1752,14 +1752,14 @@ - (void)showClearPlaylistAlert {
message = LOCALIZED_STR(@"Are you sure you want to clear the playlist?");
break;
}
UIAlertController *alertView = [UIAlertController alertControllerWithTitle:message message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:message message:nil preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *cancelButton = [UIAlertAction actionWithTitle:LOCALIZED_STR(@"Cancel") style:UIAlertActionStyleCancel handler:nil];
UIAlertAction *clearButton = [UIAlertAction actionWithTitle:LOCALIZED_STR(@"Clear Playlist") style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self clearPlaylist:currentPlaylistID];
}];
[alertView addAction:clearButton];
[alertView addAction:cancelButton];
[self presentViewController:alertView animated:YES completion:nil];
[alertCtrl addAction:clearButton];
[alertCtrl addAction:cancelButton];
[self presentViewController:alertCtrl animated:YES completion:nil];
}
}

Expand Down Expand Up @@ -1870,7 +1870,7 @@ - (IBAction)updateCurrentTime:(id)sender {

- (void)showActionNowPlaying:(NSMutableArray*)sheetActions title:(NSString*)title point:(CGPoint)origin {
if (sheetActions.count) {
UIAlertController *actionView = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
UIAlertController *alertCtrl = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];

UIAlertAction *action_cancel = [UIAlertAction actionWithTitle:LOCALIZED_STR(@"Cancel") style:UIAlertActionStyleCancel handler:nil];

Expand All @@ -1879,17 +1879,17 @@ - (void)showActionNowPlaying:(NSMutableArray*)sheetActions title:(NSString*)titl
UIAlertAction *action = [UIAlertAction actionWithTitle:actiontitle style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
[self actionSheetHandler:actiontitle];
}];
[actionView addAction:action];
[alertCtrl addAction:action];
}
[actionView addAction:action_cancel];
actionView.modalPresentationStyle = UIModalPresentationPopover;
[alertCtrl addAction:action_cancel];
alertCtrl.modalPresentationStyle = UIModalPresentationPopover;

UIPopoverPresentationController *popPresenter = [actionView popoverPresentationController];
UIPopoverPresentationController *popPresenter = [alertCtrl popoverPresentationController];
if (popPresenter != nil) {
popPresenter.sourceView = self.view;
popPresenter.sourceRect = CGRectMake(origin.x, origin.y, 1, 1);
}
[self presentViewController:actionView animated:YES completion:nil];
[self presentViewController:alertCtrl animated:YES completion:nil];
}
}

Expand Down Expand Up @@ -2646,8 +2646,8 @@ - (void)powerControl {
if (AppDelegate.instance.obj.serverIP.length == 0) {
return;
}
UIAlertController *actionView = [Utilities createPowerControl];
[self presentViewController:actionView animated:YES completion:nil];
UIAlertController *alertCtrl = [Utilities createPowerControl];
[self presentViewController:alertCtrl animated:YES completion:nil];
}

- (void)scrollViewDidEndDragging:(UIScrollView*)scrollView willDecelerate:(BOOL)decelerate {
Expand Down
Loading

0 comments on commit 085dd07

Please sign in to comment.