Skip to content

Commit

Permalink
Merge pull request #1377 from nextcloud/remove-ios15-handling
Browse files Browse the repository at this point in the history
Remove availability check for iOS 15
  • Loading branch information
Ivansss committed Sep 27, 2023
2 parents 81f634a + 72d6f74 commit f64831c
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 @@ -463,10 +463,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 f64831c

Please sign in to comment.