From 314c794db78d2c5e8cfa2010ec5a707fe15f4105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Mon, 25 Sep 2023 17:50:56 +0200 Subject: [PATCH 1/2] Fix crash on iOS 17 when avatar was not downloaded before MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- NextcloudTalk/RoomsTableViewController.m | 25 +++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/NextcloudTalk/RoomsTableViewController.m b/NextcloudTalk/RoomsTableViewController.m index 4b2517c2e..309c3115c 100644 --- a/NextcloudTalk/RoomsTableViewController.m +++ b/NextcloudTalk/RoomsTableViewController.m @@ -439,21 +439,24 @@ - (void)updateAccountPickerMenu for (TalkAccount *account in [[NCDatabaseManager sharedInstance] allAccounts]) { NSString *accountName = account.userDisplayName; UIImage *accountImage = [[NCAPIController sharedInstance] userProfileImageForAccount:account withStyle:self.traitCollection.userInterfaceStyle]; - accountImage = [NCUtils roundedImageFromImage:accountImage]; - // Draw a red circle to the image in case we have unread notifications for that account - if (account.unreadNotification) { - UIGraphicsBeginImageContextWithOptions(CGSizeMake(82, 82), NO, 3); - CGContextRef context = UIGraphicsGetCurrentContext(); - [accountImage drawInRect:CGRectMake(0, 4, 78, 78)]; - CGContextSaveGState(context); + if (accountImage) { + accountImage = [NCUtils roundedImageFromImage:accountImage]; - CGContextSetFillColorWithColor(context, [UIColor systemRedColor].CGColor); - CGContextFillEllipseInRect(context, CGRectMake(52, 0, 30, 30)); + // Draw a red circle to the image in case we have unread notifications for that account + if (account.unreadNotification) { + UIGraphicsBeginImageContextWithOptions(CGSizeMake(82, 82), NO, 3); + CGContextRef context = UIGraphicsGetCurrentContext(); + [accountImage drawInRect:CGRectMake(0, 4, 78, 78)]; + CGContextSaveGState(context); - accountImage = UIGraphicsGetImageFromCurrentImageContext(); + CGContextSetFillColorWithColor(context, [UIColor systemRedColor].CGColor); + CGContextFillEllipseInRect(context, CGRectMake(52, 0, 30, 30)); - UIGraphicsEndImageContext(); + accountImage = UIGraphicsGetImageFromCurrentImageContext(); + + UIGraphicsEndImageContext(); + } } UIAction *switchAccountAction = [UIAction actionWithTitle:accountName image:accountImage identifier:nil handler:^(UIAction *action) { From d0d369c59938aad8c4364484b32da999dfec2d9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Tue, 26 Sep 2023 00:06:56 +0200 Subject: [PATCH 2/2] Fix test compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- NextcloudTalk/NCCameraController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NextcloudTalk/NCCameraController.swift b/NextcloudTalk/NCCameraController.swift index 28ae15b81..709bcd5b6 100644 --- a/NextcloudTalk/NCCameraController.swift +++ b/NextcloudTalk/NCCameraController.swift @@ -220,9 +220,9 @@ class NCCameraController: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate self.session?.sessionPreset = .inputPriority if self.usingFrontCamera { - self.session?.addInput(getFrontCameraInput()) + self.session?.addInput(self.getFrontCameraInput()) } else { - self.session?.addInput(getBackCameraInput()) + self.session?.addInput(self.getBackCameraInput()) } let output = AVCaptureVideoDataOutput()