add a setting for auto download

This commit is contained in:
Danmei Chen 2018-10-17 15:30:11 +02:00
parent 672c8d2899
commit a45df60b87
4 changed files with 24 additions and 2 deletions

View file

@ -869,7 +869,7 @@ void on_chat_room_chat_message_received(LinphoneChatRoom *cr, const LinphoneEven
BOOL hasFile = FALSE;
// if auto_download is available and file is downloaded
if (([LinphoneManager.instance lpConfigIntForKey:@"auto_download_incoming_files_max_size" inSection:@"app"] > -1) && linphone_chat_message_get_file_transfer_information(chat))
if ((linphone_core_get_max_size_for_auto_download_incoming_files(LC) > -1) && linphone_chat_message_get_file_transfer_information(chat))
hasFile = TRUE;
if (!linphone_chat_message_is_file_transfer(chat) && !linphone_chat_message_is_text(chat) && !hasFile) /*probably an imdn*/

View file

@ -336,6 +336,7 @@
{
[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"];
}
// network section
@ -784,6 +785,7 @@
[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]);
// network section
BOOL edgeOpt = [self boolForKey:@"edge_opt_preference"];

View file

@ -1127,7 +1127,7 @@ static void linphone_iphone_popup_password_request(LinphoneCore *lc, LinphoneAut
BOOL hasFile = FALSE;
// if auto_download is available and file is downloaded
if (([LinphoneManager.instance lpConfigIntForKey:@"auto_download_incoming_files_max_size" inSection:@"app"] > -1) && linphone_chat_message_get_file_transfer_information(msg))
if ((linphone_core_get_max_size_for_auto_download_incoming_files(LC) > -1) && linphone_chat_message_get_file_transfer_information(msg))
hasFile = TRUE;
if (!linphone_chat_message_is_file_transfer(msg) && !linphone_chat_message_is_text(msg) && !hasFile)

View file

@ -4,6 +4,26 @@
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>Auto Download</string>
</dict>
<dict>
<key>Key</key>
<string>auto_download_incoming_files_max_size</string>
<key>Title</key>
<string>Files max size</string>
<key>DefaultValue</key>
<integer>-1</integer>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>KeyboardType</key>
<string>NumbersAndPunctuation</string>
<key>IASKTextAlignment</key>
<string>IASKUITextAlignmentRight</string>
</dict>
<dict>
<key>DefaultValue</key>
<string>0</string>