disable VFS for simulators or error case

This commit is contained in:
Danmei Chen 2021-05-10 11:10:13 +02:00
parent 7183116b4b
commit d88641c31c
2 changed files with 19 additions and 6 deletions

View file

@ -269,10 +269,16 @@
#endif
if ([[LinphoneManager instance] lpConfigBoolForKey:@"vfs_enabled_preference"] && !VFSUtil.activateVFS) {
[VFSUtil oslogWithLog:@"[VFS] Error unable to activate." level:OS_LOG_TYPE_ERROR];
if ([[LinphoneManager instance] lpConfigBoolForKey:@"vfs_enabled_preference"]) {
if (TARGET_IPHONE_SIMULATOR) {
LOGW(@"[VFS] Can not active for simulators.");
[[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"vfs_enabled_preference"];
} else if (!VFSUtil.activateVFS) {
[VFSUtil oslogWithLog:@"[VFS] Error unable to activate." level:OS_LOG_TYPE_ERROR];
[[LinphoneManager instance] lpConfigSetBool:FALSE forKey:@"vfs_enabled_preference"];
}
}
UIApplication *app = [UIApplication sharedApplication];
UIApplicationState state = app.applicationState;

View file

@ -784,10 +784,17 @@
[lm lpConfigSetString:[self stringForKey:@"auto_download_mode"] forKey:@"auto_download_mode"];
BOOL vfsEnabled = [self boolForKey:@"vfs_enabled_mode"] || [lm lpConfigBoolForKey:@"vfs_enabled_preference"];
if (vfsEnabled) {
[lm lpConfigSetBool:TRUE forKey:@"vfs_enabled_preference"];
[self setBool:TRUE forKey:@"vfs_enabled_mode"];
if (!VFSUtil.activateVFS) {
if (TARGET_IPHONE_SIMULATOR) {
LOGW(@"[VFS] Can not active for simulators.");
[lm lpConfigSetBool:FALSE forKey:@"vfs_enabled_preference"];
[self setBool:FALSE forKey:@"vfs_enabled_mode"];
} else if (!VFSUtil.activateVFS) {
[VFSUtil oslogWithLog:@"[VFS] Error unable to activate." level:OS_LOG_TYPE_ERROR];
[lm lpConfigSetBool:FALSE forKey:@"vfs_enabled_preference"];
[self setBool:FALSE forKey:@"vfs_enabled_mode"];
} else {
[lm lpConfigSetBool:TRUE forKey:@"vfs_enabled_preference"];
[self setBool:TRUE forKey:@"vfs_enabled_mode"];
}
}
[lm lpConfigSetBool:[self boolForKey:@"auto_write_to_gallery_mode"] forKey:@"auto_write_to_gallery_preference"];