Skip to content

Commit

Permalink
Remove availability check for iOS 15
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Müller <[email protected]>
  • Loading branch information
SystemKeeper committed Sep 26, 2023
1 parent 8f0672a commit 72d6f74
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
18 changes: 5 additions & 13 deletions NextcloudTalk/ChatTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,12 @@ - (UIMenu *)getDeferredUserMenuForMessage:(NCChatMessage *)message

UIDeferredMenuElement *deferredMenuElement;

if (@available(iOS 15.0, *)) {
// When iOS 15 is available, we can use an uncached provider so local time is not cached for example
deferredMenuElement = [UIDeferredMenuElement elementWithUncachedProvider:^(void (^ _Nonnull completion)(NSArray<UIMenuElement *> * _Nonnull)) {
[self getMenuUserActionsForMessage:message withCompletionBlock:^(NSArray *menuItems) {
completion(menuItems);
}];
}];
} else {
deferredMenuElement = [UIDeferredMenuElement elementWithProvider:^(void (^ _Nonnull completion)(NSArray<UIMenuElement *> * _Nonnull)) {
[self getMenuUserActionsForMessage:message withCompletionBlock:^(NSArray *menuItems) {
completion(menuItems);
}];
// Use an uncached provider so local time is not cached
deferredMenuElement = [UIDeferredMenuElement elementWithUncachedProvider:^(void (^ _Nonnull completion)(NSArray<UIMenuElement *> * _Nonnull)) {
[self getMenuUserActionsForMessage:message withCompletionBlock:^(NSArray *menuItems) {
completion(menuItems);
}];
}
}];

return [UIMenu menuWithTitle:message.actorDisplayName children:@[deferredMenuElement]];
}
Expand Down
6 changes: 2 additions & 4 deletions NextcloudTalk/NCChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,8 @@ - (void)viewDidLoad
[self.autoCompletionView registerClass:[ChatMessageTableViewCell class] forCellReuseIdentifier:AutoCompletionCellIdentifier];
[self registerPrefixesForAutoCompletion:@[@"@"]];
self.autoCompletionView.backgroundColor = [UIColor secondarySystemBackgroundColor];

if (@available(iOS 15.0, *)) {
self.autoCompletionView.sectionHeaderTopPadding = 0;
}
self.autoCompletionView.sectionHeaderTopPadding = 0;

// Align separators to ChatMessageTableViewCell's title label
self.autoCompletionView.separatorInset = UIEdgeInsetsMake(0, 50, 0, 0);

Expand Down
6 changes: 2 additions & 4 deletions NextcloudTalk/RoomsTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,8 @@ - (void)updateAccountPickerMenu
[[NCSettingsController sharedInstance] setActiveAccountWithAccountId:account.accountId];
}];

if (@available(iOS 15.0, *)) {
if (account.unreadBadgeNumber > 0) {
switchAccountAction.subtitle = [NSString localizedStringWithFormat:NSLocalizedString(@"%ld notifications", nil), (long)account.unreadBadgeNumber];
}
if (account.unreadBadgeNumber > 0) {
switchAccountAction.subtitle = [NSString localizedStringWithFormat:NSLocalizedString(@"%ld notifications", nil), (long)account.unreadBadgeNumber];
}

if (account.active) {
Expand Down

0 comments on commit 72d6f74

Please sign in to comment.