Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
Signed-off-by: Milen Pivchev <[email protected]>
  • Loading branch information
mpivchev committed Jul 21, 2023
commit a407ba64b6718c9184cfa7c8a09007a27d9c4bbd
27 changes: 18 additions & 9 deletions iOSClient/Settings/CCAdvanced.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ - (void)initializeForm

row = [XLFormRowDescriptor formRowDescriptorWithTag:@"chunk" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_chunk_size_mb_", nil)];
row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
//
// NSInteger chunkSize = CCUtility.getChunkSize;
//
// if (chunkSize == 0) {
// row.value = NSLocalizedString(@"disabled", nil);
// } else {
// row.value = [NSString stringWithFormat:@"%ld", chunkSize];
// }
//
row.value = [NSString stringWithFormat:@"%ld", CCUtility.getChunkSize];
[row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
[row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
Expand Down Expand Up @@ -384,15 +393,15 @@ - (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor ol

if ([rowDescriptor.tag isEqualToString:@"chunk"]) {
NSInteger chunkSize = [[rowDescriptor.value valueData] intValue];
XLFormRowDescriptor *row;

row = [XLFormRowDescriptor formRowDescriptorWithTag:@"chunk" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_chunk_size_mb_", nil)];

if (chunkSize > 100) {
[row.cellConfigAtConfigure setObject:@50 forKey:@"stepControl.stepValue"]; // Change the step value to 10 (you can adjust this value as needed)
} else {
[row.cellConfigAtConfigure setObject:@20 forKey:@"stepControl.stepValue"];
}
// XLFormRowDescriptor *row;
//
// row = [XLFormRowDescriptor formRowDescriptorWithTag:@"chunk" rowType:XLFormRowDescriptorTypeStepCounter title:NSLocalizedString(@"_chunk_size_mb_", nil)];
//
// if (chunkSize > 100) {
// [row.cellConfigAtConfigure setObject:@50 forKey:@"stepControl.stepValue"]; // Change the step value to 10 (you can adjust this value as needed)
// } else {
// [row.cellConfigAtConfigure setObject:@20 forKey:@"stepControl.stepValue"];
// }

[CCUtility setChunkSize:chunkSize];
}
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Supporting Files/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"_professional_" = "Professional";
"_current_" = "Current";
"_buy_" = "Buy";
"_disabled_" = "Disabled";

/* MARK: Files lock */

Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Utility/CCUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ + (NSInteger)getChunkSize
+ (void)setChunkSize:(NSInteger)size
{
if (size < 10) size = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the size should still be default to the minimum supported value of 5MB then if configured to be > 0.

Maybe there is some byte calculation in another place where the 5 MB -> bytes generates the wrong value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this two function and use the new algorithm


NSString *sizeString = [@(size) stringValue];
[UICKeyChainStore setString:sizeString forKey:@"chunkSize" service:NCGlobal.shared.serviceShareKeyChain];
}
Expand Down