optimizing settings for automatic file upload

This commit is contained in:
Danmei Chen 2018-12-11 16:32:36 +01:00
parent f5bdbb04e8
commit 1c492208c0
3 changed files with 45 additions and 7 deletions

View file

@ -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"];

View file

@ -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;
}

View file

@ -5,16 +5,32 @@
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>DefaultValue</key>
<string>Never</string>
<key>Key</key>
<string>auto_download_mode</string>
<key>Title</key>
<string>Auto Download</string>
<string>Auto download incoming files policy</string>
<key>Titles</key>
<array>
<string>Never</string>
<string>Always</string>
<string>If lighter than given size (see below setting)</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
<string>Never</string>
<string>Always</string>
<string>Customize</string>
</array>
</dict>
<dict>
<key>Key</key>
<string>auto_download_incoming_files_max_size</string>
<key>Title</key>
<string>Files max size</string>
<string>Max size in bytes</string>
<key>DefaultValue</key>
<integer>-1</integer>
<key>Type</key>