From ea52e71cae19a4f91b3e7763ff3c68f5137c0540 Mon Sep 17 00:00:00 2001 From: ylecollen Date: Wed, 21 Jan 2015 14:11:58 +0100 Subject: [PATCH 1/3] The clear cache button did not recompute the true cache size. --- matrixConsole/API/MediaManager.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/matrixConsole/API/MediaManager.m b/matrixConsole/API/MediaManager.m index 2e9991c05..07c12b61c 100644 --- a/matrixConsole/API/MediaManager.m +++ b/matrixConsole/API/MediaManager.m @@ -384,6 +384,8 @@ static NSMutableDictionary* uploadTableById = nil; } mediaCachePath = nil; + // force to recompute the cache size at next cacheSize call + storageCacheSize = 0; } + (NSString*)getCachePath { From 7ffcd500f27412e51c9dd8327c35ff0f719c3646 Mon Sep 17 00:00:00 2001 From: ylecollen Date: Wed, 21 Jan 2015 15:08:29 +0100 Subject: [PATCH 2/3] -> Increase the max Cache size cell height to improve the UX -> The max/min values were not checked each time the user updated them. --- matrixConsole/Base.lproj/Main.storyboard | 17 +++++++------ .../ViewController/SettingsViewController.m | 25 ++++++++++++++----- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/matrixConsole/Base.lproj/Main.storyboard b/matrixConsole/Base.lproj/Main.storyboard index de5ff108e..d29fcd405 100644 --- a/matrixConsole/Base.lproj/Main.storyboard +++ b/matrixConsole/Base.lproj/Main.storyboard @@ -1150,33 +1150,34 @@ - + - - + - + - + - + diff --git a/matrixConsole/ViewController/SettingsViewController.m b/matrixConsole/ViewController/SettingsViewController.m index 992c660d2..79740a02f 100644 --- a/matrixConsole/ViewController/SettingsViewController.m +++ b/matrixConsole/ViewController/SettingsViewController.m @@ -574,9 +574,23 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl - (IBAction)onSliderValueChange:(id)sender { if (sender == maxCacheSizeCell.settingSlider) { - [[MatrixHandler sharedHandler] setCurrentMaxCachesSize:maxCacheSizeCell.settingSlider.value]; - maxCacheSizeCell.settingLabel.text = [NSString stringWithFormat:@"Set the maximum cache size (current %@)", [NSByteCountFormatter stringFromByteCount:[MatrixHandler sharedHandler].currentMaxCachesSize countStyle:NSByteCountFormatterCountStyleFile]]; + MatrixHandler* mxHandler = [MatrixHandler sharedHandler]; + UISlider* slider = maxCacheSizeCell.settingSlider; + + // check if the upper bounds have been updated + if (slider.maximumValue != mxHandler.maxAllowedCachesSize) { + slider.maximumValue = mxHandler.maxAllowedCachesSize; + } + + // check if the value does not exceed the bounds + if (slider.value < mxHandler.minCachesSize) { + slider.value = mxHandler.minCachesSize; + } + + [[MatrixHandler sharedHandler] setCurrentMaxCachesSize:slider.value]; + + maxCacheSizeCell.settingLabel.text = [NSString stringWithFormat:@"Maximum cache size (%@)", [NSByteCountFormatter stringFromByteCount:mxHandler.currentMaxCachesSize countStyle:NSByteCountFormatterCountStyleFile]]; } } @@ -722,7 +736,7 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl return 44; } else if (indexPath.section == SETTINGS_SECTION_ROOMS_INDEX) { if (indexPath.row == SETTINGS_SECTION_ROOMS_SET_CACHE_SIZE_INDEX) { - return 60; + return 88; } return 44; } else if (indexPath.section == SETTINGS_SECTION_CONFIGURATION_INDEX) { @@ -833,11 +847,10 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl cell.selectionStyle = UITableViewCellSelectionStyleNone; maxCacheSizeCell = (SettingsCellWithLabelAndSlider*)cell; - maxCacheSizeCell.settingSlider.minimumValue = [MatrixHandler sharedHandler].minCachesSize; - maxCacheSizeCell.settingSlider.maximumValue = [MatrixHandler sharedHandler].maxAllowedCachesSize; + maxCacheSizeCell.settingSlider.minimumValue = 0; maxCacheSizeCell.settingSlider.value = [MatrixHandler sharedHandler].currentMaxCachesSize; - maxCacheSizeCell.settingLabel.text = [NSString stringWithFormat:@"Set the maximum cache size (current %@)", [NSByteCountFormatter stringFromByteCount:[MatrixHandler sharedHandler].currentMaxCachesSize countStyle:NSByteCountFormatterCountStyleFile]]; + [self onSliderValueChange:maxCacheSizeCell.settingSlider]; } else { SettingsTableCellWithSwitch *roomsSettingCell = [tableView dequeueReusableCellWithIdentifier:@"SettingsCellWithSwitch" forIndexPath:indexPath]; From 03922c5f5326835b9af946396c9d1595a8a8fcea Mon Sep 17 00:00:00 2001 From: ylecollen Date: Wed, 21 Jan 2015 16:52:36 +0100 Subject: [PATCH 3/3] Should fix SYIOS-61 - Chat room : cannot scroll to bottom when keyboard is opened whereas the growing textview contains multi-lines text. --- .../ViewController/RoomViewController.m | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/matrixConsole/ViewController/RoomViewController.m b/matrixConsole/ViewController/RoomViewController.m index 03dca8a93..82687a81d 100644 --- a/matrixConsole/ViewController/RoomViewController.m +++ b/matrixConsole/ViewController/RoomViewController.m @@ -1395,14 +1395,19 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; return; } - UIEdgeInsets insets = self.messagesTableView.contentInset; - // Handle portrait/landscape mode - insets.bottom = (endRect.origin.y == 0) ? endRect.size.width : endRect.size.height; + CGFloat keyboardHeight = (endRect.origin.y == 0) ? endRect.size.width : endRect.size.height; // bottom view offset // Don't forget the offset related to tabBar - CGFloat nextBottomViewContanst = insets.bottom - [AppDelegate theDelegate].masterTabBarController.tabBar.frame.size.height; - + CGFloat nextBottomViewContanst = keyboardHeight - [AppDelegate theDelegate].masterTabBarController.tabBar.frame.size.height; + + // the tableview bottom inset must also be updated + UIEdgeInsets insets = self.messagesTableView.contentInset; + // insets.bottom is the bottom part of the tableview content size which is not displayed + // The bottom margin is equal to the keyboard height + controlview part which is greather than the tableview bottom margin. + // The tableview bottom margin has the same value as the defauft bottom view height; + insets.bottom = keyboardHeight + self.controlView.frame.size.height - defaultMessagesTableViewBottomConstraint; + // get the animation info NSNumber *curveValue = [[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey]; UIViewAnimationCurve animationCurve = curveValue.intValue; @@ -1483,7 +1488,10 @@ NSString *const kCmdResetUserPowerLevel = @"/deop"; } UIEdgeInsets insets = self.messagesTableView.contentInset; - insets.bottom = self.controlView.frame.size.height; + // insets.bottom is the bottom part of the tableview content size which is not displayed + // The bottom margin is equal to the tabbar height + controlview part which is greather than the tableview bottom margin. + // The tableview bottom margin has the same value as the defauft bottom view height. + insets.bottom = [AppDelegate theDelegate].masterTabBarController.tabBar.frame.size.height + (self.controlView.frame.size.height - defaultMessagesTableViewBottomConstraint); isKeyboardDisplayed = NO;