From f64938ce4ab3d08e402fd1574329631f7aa92aae Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Mon, 16 Nov 2015 15:37:41 +0100 Subject: [PATCH] Settings: add debug option to flush all local images --- Classes/SettingsView.m | 11 +++++++++++ Settings/InAppSettings.bundle/Root.plist | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/Classes/SettingsView.m b/Classes/SettingsView.m index 72be8c491..fa63981ff 100644 --- a/Classes/SettingsView.m +++ b/Classes/SettingsView.m @@ -535,6 +535,7 @@ static UICompositeViewDescription *compositeDescription = nil; [hiddenKeys addObject:@"clear_cache_button"]; [hiddenKeys addObject:@"battery_alert_button"]; [hiddenKeys addObject:@"enable_auto_answer_preference"]; + [hiddenKeys addObject:@"flush_images_button"]; #endif if (![[LinphoneManager instance] lpConfigBoolForKey:@"debugenable_preference"]) { @@ -679,6 +680,16 @@ static UICompositeViewDescription *compositeDescription = nil; [[UIDevice currentDevice] _setBatteryLevel:0.01f]; [[NSNotificationCenter defaultCenter] postNotificationName:UIDeviceBatteryLevelDidChangeNotification object:self]; + } else if ([key isEqual:@"flush_images_button"]) { + const MSList *rooms = linphone_core_get_chat_rooms([LinphoneManager getLc]); + while (rooms) { + const MSList *messages = linphone_chat_room_get_history(rooms->data, 0); + while (messages) { + [LinphoneManager setValueInMessageAppData:nil forKey:@"localimage" inMessage:messages->data]; + messages = messages->next; + } + rooms = rooms->next; + } } #endif if ([key isEqual:@"assistant_button"]) { diff --git a/Settings/InAppSettings.bundle/Root.plist b/Settings/InAppSettings.bundle/Root.plist index 8f5f7d015..424260642 100644 --- a/Settings/InAppSettings.bundle/Root.plist +++ b/Settings/InAppSettings.bundle/Root.plist @@ -190,6 +190,14 @@ Type IASKButtonSpecifier + + Key + flush_images_button + Title + Flush downloaded images + Type + IASKButtonSpecifier + Type PSToggleSwitchSpecifier