Skip to content

Commit

Permalink
CC-6981: Resolve default value updating when migrating from existing …
Browse files Browse the repository at this point in the history
…user

(cherry picked from commit d1a2822)
  • Loading branch information
dg-mega committed Apr 19, 2024
1 parent ade1959 commit d9a6bd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit d9a6bd1

Please sign in to comment.