make use of Obj-C's modern syntax for literals and subscripting

This commit is contained in:
fridtjof
2019-01-08 00:24:11 +01:00
parent 125e801218
commit 0e8c73344d
27 changed files with 195 additions and 197 deletions
@@ -156,7 +156,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
// sanity check
if (matrixSession.myUser && matrixSession.myUser.userId)
{
id roomTagListener = [roomTagsListenerByUserId objectForKey:matrixSession.myUser.userId];
id roomTagListener = roomTagsListenerByUserId[matrixSession.myUser.userId];
if (roomTagListener)
{
@@ -204,7 +204,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
}];
[roomTagsListenerByUserId setObject:roomTagsListener forKey:dataSource.mxSession.myUser.userId];
roomTagsListenerByUserId[dataSource.mxSession.myUser.userId] = roomTagsListener;
}
}
}
@@ -891,42 +891,42 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
if (cellDataIndex < favoriteCellDataArray.count)
{
cellData = [favoriteCellDataArray objectAtIndex:cellDataIndex];
cellData = favoriteCellDataArray[cellDataIndex];
}
}
else if (tableSection == peopleSection)
{
if (cellDataIndex < peopleCellDataArray.count)
{
cellData = [peopleCellDataArray objectAtIndex:cellDataIndex];
cellData = peopleCellDataArray[cellDataIndex];
}
}
else if (tableSection== conversationSection)
{
if (cellDataIndex < conversationCellDataArray.count)
{
cellData = [conversationCellDataArray objectAtIndex:cellDataIndex];
cellData = conversationCellDataArray[cellDataIndex];
}
}
else if (tableSection == lowPrioritySection)
{
if (cellDataIndex < lowPriorityCellDataArray.count)
{
cellData = [lowPriorityCellDataArray objectAtIndex:cellDataIndex];
cellData = lowPriorityCellDataArray[cellDataIndex];
}
}
else if (tableSection == serverNoticeSection)
{
if (cellDataIndex < serverNoticeCellDataArray.count)
{
cellData = [serverNoticeCellDataArray objectAtIndex:cellDataIndex];
cellData = serverNoticeCellDataArray[cellDataIndex];
}
}
else if (tableSection == invitesSection)
{
if (cellDataIndex < invitesCellDataArray.count)
{
cellData = [invitesCellDataArray objectAtIndex:cellDataIndex];
cellData = invitesCellDataArray[cellDataIndex];
}
}
@@ -983,7 +983,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
{
for (int index = 0; index < cellDataArray.count; index++)
{
id<MXKRecentCellDataStoring> cellDataStoring = [cellDataArray objectAtIndex:index];
id<MXKRecentCellDataStoring> cellDataStoring = cellDataArray[index];
if ([roomId isEqualToString:cellDataStoring.roomSummary.roomId] && (matrixSession == cellDataStoring.roomSummary.room.mxSession))
{
@@ -1114,7 +1114,7 @@ NSString *const kRecentsDataSourceTapOnDirectoryServerChange = @"kRecentsDataSou
if (displayedRecentsDataSourceArray.count > 0)
{
// FIXME manage multi accounts
MXKSessionRecentsDataSource *recentsDataSource = [displayedRecentsDataSourceArray objectAtIndex:0];
MXKSessionRecentsDataSource *recentsDataSource = displayedRecentsDataSourceArray[0];
MXSession* session = recentsDataSource.mxSession;
NSInteger count = recentsDataSource.numberOfCells;
@@ -893,7 +893,7 @@
NSArray<MXRoomTag*>* tags = room.accountData.tags.allValues;
if (tags.count)
{
currentTag = [tags objectAtIndex:0];
currentTag = tags[0];
}
}
@@ -243,7 +243,7 @@
// create programmatically each label
UILabel *label = [[UILabel alloc] init];
label.text = [sectionTitles objectAtIndex:index];
label.text = sectionTitles[index];
label.font = [UIFont systemFontOfSize:17];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = _sectionHeaderTintColor;
@@ -263,7 +263,7 @@
leftConstraint = [NSLayoutConstraint constraintWithItem:label
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[labels objectAtIndex:(index-1)]
toItem:labels[index - 1]
attribute:NSLayoutAttributeTrailing
multiplier:1.0
constant:0];
@@ -339,7 +339,7 @@
leftMarkerViewConstraint = [NSLayoutConstraint constraintWithItem:selectedMarkerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[sectionLabels objectAtIndex:_selectedIndex]
toItem:sectionLabels[_selectedIndex]
attribute:NSLayoutAttributeLeading
multiplier:1.0
constant:0];
@@ -386,7 +386,7 @@
if (index != NSNotFound)
{
UILabel* label = [sectionLabels objectAtIndex:index];
UILabel* label = sectionLabels[index];
label.font = [UIFont systemFontOfSize:17];
}
@@ -398,7 +398,7 @@
[NSLayoutConstraint deactivateConstraints:@[displayedVCTopConstraint, displayedVCLeftConstraint, displayedVCWidthConstraint, displayedVCHeightConstraint]];
}
UILabel* label = [sectionLabels objectAtIndex:_selectedIndex];
UILabel* label = sectionLabels[_selectedIndex];
label.font = [UIFont boldSystemFontOfSize:17];
// update the marker view position
@@ -407,7 +407,7 @@
leftMarkerViewConstraint = [NSLayoutConstraint constraintWithItem:selectedMarkerView
attribute:NSLayoutAttributeLeading
relatedBy:NSLayoutRelationEqual
toItem:[sectionLabels objectAtIndex:_selectedIndex]
toItem:sectionLabels[_selectedIndex]
attribute:NSLayoutAttributeLeading
multiplier:1.0
constant:0];
@@ -415,7 +415,7 @@
[NSLayoutConstraint activateConstraints:@[leftMarkerViewConstraint]];
// Set the new selected view controller
_selectedViewController = [viewControllers objectAtIndex:_selectedIndex];
_selectedViewController = viewControllers[_selectedIndex];
// Make iOS invoke selectedViewController viewWillAppear when the segmented view is already visible
if (isViewAppeared)