diff --git a/Classes/LinphoneCoreSettingsStore.m b/Classes/LinphoneCoreSettingsStore.m
index 8365b0a3c..ed0c457bc 100644
--- a/Classes/LinphoneCoreSettingsStore.m
+++ b/Classes/LinphoneCoreSettingsStore.m
@@ -336,7 +336,9 @@
{
[self setInteger:linphone_core_lime_enabled(LC) forKey:@"use_lime_preference"];
[self setCString:linphone_core_get_file_transfer_server(LC) forKey:@"file_transfer_server_url_preference"];
- [self setInteger:linphone_core_get_max_size_for_auto_download_incoming_files(LC) forKey:@"auto_download_incoming_files_max_size"];
+ int maxSize = linphone_core_get_max_size_for_auto_download_incoming_files(LC);
+ [self setObject:maxSize==0 ? @"Always" : (maxSize==-1 ? @"Nerver" : @"Customize") forKey:@"auto_download_mode"];
+ [self setInteger:maxSize forKey:@"auto_download_incoming_files_max_size"];
}
// network section
@@ -785,7 +787,17 @@
[PhoneMainView.instance presentViewController:errView animated:YES completion:nil];
}
linphone_core_set_file_transfer_server(LC, [self stringForKey:@"file_transfer_server_url_preference"].UTF8String);
- linphone_core_set_max_size_for_auto_download_incoming_files(LC, [[self stringForKey:@"auto_download_incoming_files_max_size"] intValue]);
+ int maxSize;
+ NSString *downloadMode = [self stringForKey:@"auto_download_mode"];
+ if ([downloadMode isEqualToString:@"Never"]) {
+ maxSize = -1;
+ } else if ([downloadMode isEqualToString:@"Always"]) {
+ maxSize = 0;
+ } else {
+ maxSize = [[self stringForKey:@"auto_download_incoming_files_max_size"] intValue];
+ }
+ linphone_core_set_max_size_for_auto_download_incoming_files(LC, maxSize);
+ [lm lpConfigSetString:[self stringForKey:@"auto_download_mode"] forKey:@"auto_download_mode"];
// network section
BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"];
diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m
index 94d87f908..e4453b005 100644
--- a/Classes/SettingsView.m
+++ b/Classes/SettingsView.m
@@ -506,7 +506,13 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
removeFromHiddenKeys = [video_preset isEqualToString:@"custom"];
[keys addObject:@"video_preferred_fps_preference"];
[keys addObject:@"download_bandwidth_preference"];
- }
+ } else if ([@"auto_download_mode" compare:notif.object] == NSOrderedSame) {
+ NSString *download_mode = [notif.userInfo objectForKey:@"auto_download_mode"];
+ removeFromHiddenKeys = [download_mode isEqualToString:@"Customize"];
+ if (removeFromHiddenKeys)
+ [LinphoneManager.instance lpConfigSetInt:10000000 forKey:@"auto_download_incoming_files_max_size"];
+ [keys addObject:@"auto_download_incoming_files_max_size"];
+ }
for (NSString *key in keys) {
if (removeFromHiddenKeys)
@@ -702,6 +708,10 @@ void update_hash_cbs(LinphoneAccountCreator *creator, LinphoneAccountCreatorStat
[hiddenKeys addObject:@"repeat_call_notification_preference"];
}
+ if (![[lm lpConfigStringForKey:@"auto_download_mode"] isEqualToString:@"Customize"]) {
+ [hiddenKeys addObject:@"auto_download_incoming_files_max_size"];
+ }
+
return hiddenKeys;
}
diff --git a/Settings/InAppSettings.bundle/Chat.plist b/Settings/InAppSettings.bundle/Chat.plist
index 159b17e14..c9f3622a1 100644
--- a/Settings/InAppSettings.bundle/Chat.plist
+++ b/Settings/InAppSettings.bundle/Chat.plist
@@ -5,16 +5,32 @@
PreferenceSpecifiers
- Type
- PSGroupSpecifier
+ DefaultValue
+ Never
+ Key
+ auto_download_mode
Title
- Auto Download
+ Auto download incoming files policy
+ Titles
+
+ Never
+ Always
+ If lighter than given size (see below setting)
+
+ Type
+ PSMultiValueSpecifier
+ Values
+
+ Never
+ Always
+ Customize
+
Key
auto_download_incoming_files_max_size
Title
- Files max size
+ Max size in bytes
DefaultValue
-1
Type