From d9a6bd1f76ceea24a421956df1768485a76cfeda Mon Sep 17 00:00:00 2001 From: Devyish Gandhi Date: Wed, 17 Apr 2024 22:22:41 +1200 Subject: [PATCH] CC-6981: Resolve default value updating when migrating from existing user (cherry picked from commit d1a2822a69d1143a785c7cd08c3b1555d5ee5cc9) --- .../UploadManagers/CameraUploadManager+Settings.m | 10 +++++----- .../Camera Uploads/CameraUploadsTableViewController.m | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/iMEGA/Camera uploads/UploadManagers/CameraUploadManager+Settings.m b/iMEGA/Camera uploads/UploadManagers/CameraUploadManager+Settings.m index 440f519ec5..8f8861f16b 100644 --- a/iMEGA/Camera uploads/UploadManagers/CameraUploadManager+Settings.m +++ b/iMEGA/Camera uploads/UploadManagers/CameraUploadManager+Settings.m @@ -34,14 +34,18 @@ + (BOOL)isCameraUploadEnabled { } + (void)setCameraUploadEnabled:(BOOL)cameraUploadEnabled { - [self setMigratedToCameraUploadsV2:YES]; [NSUserDefaults.standardUserDefaults setBool:cameraUploadEnabled forKey:IsCameraUploadsEnabledKey]; [self configDefaultSettingsIfNeededForCameraUpload]; [self configDefaultSharedAlbumsAndSyncedAlbumsSettingsIfNeeded]; + [self setMigratedToCameraUploadsV2:YES]; } + (void)configDefaultSettingsIfNeededForCameraUpload { if (![self isCameraUploadEnabled]) { + // Reset default value for VideoUploadsEnabled to YES, so that next time user turns on it will be the default + if([NSUserDefaults.standardUserDefaults objectForKey:IsVideoUploadsEnabledKey] == nil) { + [self setVideoUploadEnabled:YES]; + } return; } @@ -56,10 +60,6 @@ + (void)configDefaultSettingsIfNeededForCameraUpload { if ([NSUserDefaults.standardUserDefaults objectForKey:UploadAllBurstAssetsKey] == nil) { [self setUploadAllBurstPhotos:YES]; } - - if ([NSUserDefaults.standardUserDefaults objectForKey:IsVideoUploadsEnabledKey] == nil) { - [self setVideoUploadEnabled:YES]; - } } + (void)configDefaultSharedAlbumsAndSyncedAlbumsSettingsIfNeeded { diff --git a/iMEGA/My Account/Settings/Camera Uploads/CameraUploadsTableViewController.m b/iMEGA/My Account/Settings/Camera Uploads/CameraUploadsTableViewController.m index b25d0f58b9..148140611d 100644 --- a/iMEGA/My Account/Settings/Camera Uploads/CameraUploadsTableViewController.m +++ b/iMEGA/My Account/Settings/Camera Uploads/CameraUploadsTableViewController.m @@ -60,9 +60,10 @@ - (void)viewDidLoad { if (self.isPresentedModally) { self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(modalDialogDoneButtonTouched)]; - if (!CameraUploadManager.hasMigratedToCameraUploadsV2) { - [CameraUploadManager configDefaultSettingsForCameraUploadV2]; - } + } + + if (!CameraUploadManager.hasMigratedToCameraUploadsV2) { + [CameraUploadManager configDefaultSettingsForCameraUploadV2]; } [self updateAppearance];