Merge remote-tracking branch 'origin/develop' into with-contacts

This commit is contained in:
ylecollen 2015-01-22 08:16:51 +01:00
commit 9aa4dcd5a6
4 changed files with 44 additions and 20 deletions

View file

@ -384,6 +384,8 @@ static NSMutableDictionary* uploadTableById = nil;
} }
mediaCachePath = nil; mediaCachePath = nil;
// force to recompute the cache size at next cacheSize call
storageCacheSize = 0;
} }
+ (NSString*)getCachePath { + (NSString*)getCachePath {

View file

@ -1151,33 +1151,34 @@
<outlet property="settingTextField" destination="am8-vZ-baW" id="Wnw-CQ-Pe5"/> <outlet property="settingTextField" destination="am8-vZ-baW" id="Wnw-CQ-Pe5"/>
</connections> </connections>
</tableViewCell> </tableViewCell>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsCellWithLabelAndSilder" rowHeight="66" id="QHY-hk-WMS" customClass="SettingsCellWithLabelAndSlider"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="SettingsCellWithLabelAndSilder" rowHeight="88" id="QHY-hk-WMS" customClass="SettingsCellWithLabelAndSlider">
<rect key="frame" x="0.0" y="0.0" width="600" height="44"/> <rect key="frame" x="0.0" y="0.0" width="600" height="44"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QHY-hk-WMS" id="AJT-tP-w9Q"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="QHY-hk-WMS" id="AJT-tP-w9Q">
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="584" translatesAutoresizingMaskIntoConstraints="NO" id="cpJ-Gb-hqD"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="584" translatesAutoresizingMaskIntoConstraints="NO" id="cpJ-Gb-hqD">
<rect key="frame" x="8" y="0.0" width="584" height="21"/> <rect key="frame" x="8" y="8" width="584" height="34"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <constraints>
<constraint firstAttribute="height" constant="34" id="IuS-DP-f6G"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="pc0-6Y-bpz"> <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="pc0-6Y-bpz">
<rect key="frame" x="6" y="31" width="588" height="31"/> <rect key="frame" x="6" y="49" width="588" height="31"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<color key="minimumTrackTintColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/> <color key="minimumTrackTintColor" red="1" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<color key="maximumTrackTintColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/> <color key="maximumTrackTintColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections> <connections>
<action selector="onSliderValueChange:" destination="1TJ-Md-cjN" eventType="valueChanged" id="3CN-Yi-B4y"/> <action selector="onSliderValueChange:" destination="1TJ-Md-cjN" eventType="valueChanged" id="3CN-Yi-B4y"/>
</connections> </connections>
</slider> </slider>
</subviews> </subviews>
<constraints> <constraints>
<constraint firstItem="cpJ-Gb-hqD" firstAttribute="top" secondItem="AJT-tP-w9Q" secondAttribute="topMargin" constant="-8" id="0M8-6y-nCA"/> <constraint firstItem="cpJ-Gb-hqD" firstAttribute="top" secondItem="AJT-tP-w9Q" secondAttribute="topMargin" id="0M8-6y-nCA"/>
<constraint firstItem="cpJ-Gb-hqD" firstAttribute="leading" secondItem="AJT-tP-w9Q" secondAttribute="leadingMargin" id="78n-1f-l1M"/> <constraint firstItem="cpJ-Gb-hqD" firstAttribute="leading" secondItem="AJT-tP-w9Q" secondAttribute="leadingMargin" id="78n-1f-l1M"/>
<constraint firstAttribute="bottomMargin" secondItem="pc0-6Y-bpz" secondAttribute="bottom" constant="-4" id="SFS-Sa-IVI"/> <constraint firstAttribute="bottomMargin" secondItem="pc0-6Y-bpz" secondAttribute="bottom" id="SFS-Sa-IVI"/>
<constraint firstItem="pc0-6Y-bpz" firstAttribute="leading" secondItem="AJT-tP-w9Q" secondAttribute="leadingMargin" id="SL5-aC-2l1"/> <constraint firstItem="pc0-6Y-bpz" firstAttribute="leading" secondItem="AJT-tP-w9Q" secondAttribute="leadingMargin" id="SL5-aC-2l1"/>
<constraint firstAttribute="trailingMargin" secondItem="pc0-6Y-bpz" secondAttribute="trailing" id="W7H-4p-ebK"/> <constraint firstAttribute="trailingMargin" secondItem="pc0-6Y-bpz" secondAttribute="trailing" id="W7H-4p-ebK"/>
<constraint firstAttribute="trailingMargin" secondItem="cpJ-Gb-hqD" secondAttribute="trailing" id="Xxa-YE-kZ3"/> <constraint firstAttribute="trailingMargin" secondItem="cpJ-Gb-hqD" secondAttribute="trailing" id="Xxa-YE-kZ3"/>

View file

@ -1395,14 +1395,19 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
return; return;
} }
UIEdgeInsets insets = self.messagesTableView.contentInset; CGFloat keyboardHeight = (endRect.origin.y == 0) ? endRect.size.width : endRect.size.height;
// Handle portrait/landscape mode
insets.bottom = (endRect.origin.y == 0) ? endRect.size.width : endRect.size.height;
// bottom view offset // bottom view offset
// Don't forget the offset related to tabBar // 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 // get the animation info
NSNumber *curveValue = [[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey]; NSNumber *curveValue = [[notif userInfo] objectForKey:UIKeyboardAnimationCurveUserInfoKey];
UIViewAnimationCurve animationCurve = curveValue.intValue; UIViewAnimationCurve animationCurve = curveValue.intValue;
@ -1483,7 +1488,10 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
} }
UIEdgeInsets insets = self.messagesTableView.contentInset; 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; isKeyboardDisplayed = NO;

View file

@ -574,9 +574,23 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
- (IBAction)onSliderValueChange:(id)sender { - (IBAction)onSliderValueChange:(id)sender {
if (sender == maxCacheSizeCell.settingSlider) { 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; return 44;
} else if (indexPath.section == SETTINGS_SECTION_ROOMS_INDEX) { } else if (indexPath.section == SETTINGS_SECTION_ROOMS_INDEX) {
if (indexPath.row == SETTINGS_SECTION_ROOMS_SET_CACHE_SIZE_INDEX) { if (indexPath.row == SETTINGS_SECTION_ROOMS_SET_CACHE_SIZE_INDEX) {
return 60; return 88;
} }
return 44; return 44;
} else if (indexPath.section == SETTINGS_SECTION_CONFIGURATION_INDEX) { } else if (indexPath.section == SETTINGS_SECTION_CONFIGURATION_INDEX) {
@ -833,11 +847,10 @@ NSString* const kCommandsDescriptionText = @"The following commands are availabl
cell.selectionStyle = UITableViewCellSelectionStyleNone; cell.selectionStyle = UITableViewCellSelectionStyleNone;
maxCacheSizeCell = (SettingsCellWithLabelAndSlider*)cell; maxCacheSizeCell = (SettingsCellWithLabelAndSlider*)cell;
maxCacheSizeCell.settingSlider.minimumValue = [MatrixHandler sharedHandler].minCachesSize; maxCacheSizeCell.settingSlider.minimumValue = 0;
maxCacheSizeCell.settingSlider.maximumValue = [MatrixHandler sharedHandler].maxAllowedCachesSize;
maxCacheSizeCell.settingSlider.value = [MatrixHandler sharedHandler].currentMaxCachesSize; 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 { } else {
SettingsTableCellWithSwitch *roomsSettingCell = [tableView dequeueReusableCellWithIdentifier:@"SettingsCellWithSwitch" forIndexPath:indexPath]; SettingsTableCellWithSwitch *roomsSettingCell = [tableView dequeueReusableCellWithIdentifier:@"SettingsCellWithSwitch" forIndexPath:indexPath];