Revert of Add bitrate section to settings view controller. (patchset #1 id:1 of https://codereview.webrtc.org/2473783003/ )
Reason for revert: The usage of UIKeyboardTypeASCIICapableNumberPad enum (available only for iOS 10.0), is breaking the build of AppRTCMobile on devices with lesser os. To re-land the UIKeyboardTypeASCIICapableNumberPad should be replaced with UIKeyboardTypeNumberPad Original issue's description: > Add bitrate section to settings view controller. > > BUG=webrtc:6654 > > Committed: https://crrev.com/3babb99039478c36be58171c5409eac07ae153e5 > Cr-Commit-Position: refs/heads/master@{#14952} TBR=magjed@webrtc.org,kthelgasson@webrtc.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=webrtc:6654 Review-Url: https://codereview.webrtc.org/2488653002 Cr-Commit-Position: refs/heads/master@{#14972}
This commit is contained in:
@ -172,7 +172,7 @@ static NSString *const barButtonImageString = @"ic_settings_black_24dp.png";
|
||||
#pragma mark - Private
|
||||
- (void)showSettings:(id)sender {
|
||||
ARDSettingsViewController *settingsController =
|
||||
[[ARDSettingsViewController alloc] initWithStyle:UITableViewStyleGrouped
|
||||
[[ARDSettingsViewController alloc] initWithStyle:UITableViewStylePlain
|
||||
mediaConstraintsModel:[[ARDMediaConstraintsModel alloc] init]];
|
||||
UINavigationController *navigationController =
|
||||
[[UINavigationController alloc] initWithRootViewController:settingsController];
|
||||
|
||||
@ -12,12 +12,6 @@
|
||||
#import "ARDMediaConstraintsModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef NS_ENUM(int, ARDSettingsSections) {
|
||||
ARDSettingsSectionMediaConstraints = 0,
|
||||
ARDSettingsSectionBitRate
|
||||
};
|
||||
|
||||
@interface ARDSettingsViewController () {
|
||||
ARDMediaConstraintsModel *_mediaConstraintsModel;
|
||||
}
|
||||
@ -85,47 +79,28 @@ typedef NS_ENUM(int, ARDSettingsSections) {
|
||||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if ([self sectionIsMediaConstraints:section]) {
|
||||
return self.mediaConstraintsArray.count;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#pragma mark - Index path helpers
|
||||
|
||||
- (BOOL)sectionIsMediaConstraints:(int)section {
|
||||
return section == ARDSettingsSectionMediaConstraints;
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.mediaConstraintsArray.count;
|
||||
}
|
||||
|
||||
- (BOOL)sectionIsBitrate:(int)section {
|
||||
return section == ARDSettingsSectionBitRate;
|
||||
#pragma mark - Table view delegate
|
||||
|
||||
- (BOOL)sectionIsMediaConstraints:(int)section {
|
||||
return section == 0;
|
||||
}
|
||||
|
||||
- (BOOL)indexPathIsMediaConstraints:(NSIndexPath *)indexPath {
|
||||
return [self sectionIsMediaConstraints:indexPath.section];
|
||||
}
|
||||
|
||||
- (BOOL)indexPathIsBitrate:(NSIndexPath *)indexPath {
|
||||
return [self sectionIsBitrate:indexPath.section];
|
||||
}
|
||||
|
||||
#pragma mark - Table view delegate
|
||||
|
||||
- (nullable NSString *)tableView:(UITableView *)tableView
|
||||
titleForHeaderInSection:(NSInteger)section {
|
||||
if ([self sectionIsMediaConstraints:section]) {
|
||||
return @"Media constraints";
|
||||
}
|
||||
|
||||
if ([self sectionIsBitrate:section]) {
|
||||
return @"Maximum bitrate";
|
||||
}
|
||||
|
||||
return @"";
|
||||
}
|
||||
|
||||
@ -134,11 +109,6 @@ typedef NS_ENUM(int, ARDSettingsSections) {
|
||||
if ([self indexPathIsMediaConstraints:indexPath]) {
|
||||
return [self mediaConstraintsTableViewCellForTableView:tableView atIndexPath:indexPath];
|
||||
}
|
||||
|
||||
if ([self indexPathIsBitrate:indexPath]) {
|
||||
return [self bitrateTableViewCellForTableView:tableView atIndexPath:indexPath];
|
||||
}
|
||||
|
||||
return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:@"identifier"];
|
||||
}
|
||||
@ -188,44 +158,5 @@ typedef NS_ENUM(int, ARDSettingsSections) {
|
||||
return indexPath;
|
||||
}
|
||||
|
||||
#pragma mark - Table view delegate(Bitrate)
|
||||
|
||||
- (UITableViewCell *)bitrateTableViewCellForTableView:(UITableView *)tableView
|
||||
atIndexPath:(NSIndexPath *)indexPath {
|
||||
NSString *dequeueIdentifier = @"ARDSettingsBitrateCellIdentifier";
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dequeueIdentifier];
|
||||
if (!cell) {
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
|
||||
reuseIdentifier:dequeueIdentifier];
|
||||
|
||||
UITextField *textField = [[UITextField alloc]
|
||||
initWithFrame:CGRectMake(10, 0, cell.bounds.size.width - 20, cell.bounds.size.height)];
|
||||
textField.placeholder = @"Enter max bit rate (kbps)";
|
||||
textField.keyboardType = UIKeyboardTypeASCIICapableNumberPad;
|
||||
|
||||
// Numerical keyboards have no return button, we need to add one manually.
|
||||
UIToolbar *numberToolbar =
|
||||
[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 50)];
|
||||
numberToolbar.items = @[
|
||||
[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
|
||||
target:nil
|
||||
action:nil],
|
||||
[[UIBarButtonItem alloc] initWithTitle:@"Apply"
|
||||
style:UIBarButtonItemStyleDone
|
||||
target:self
|
||||
action:@selector(numberTextFieldDidEndEditing:)]
|
||||
];
|
||||
[numberToolbar sizeToFit];
|
||||
|
||||
textField.inputAccessoryView = numberToolbar;
|
||||
[cell addSubview:textField];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (void)numberTextFieldDidEndEditing:(id)sender {
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
Reference in New Issue
Block a user