| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #import "ARDSettingsStore.h" | 11 #import "ARDSettingsStore.h" |
| 12 | 12 |
| 13 static NSString *const kUserDefaultsMediaConstraintsKey = | 13 static NSString *const kMediaConstraintsKey = @"rtc_video_resolution_media_const
raints_key"; |
| 14 @"rtc_video_resolution_media_constraints_key"; | 14 static NSString *const kBitrateKey = @"rtc_max_bitrate_key"; |
| 15 | 15 |
| 16 NS_ASSUME_NONNULL_BEGIN | 16 NS_ASSUME_NONNULL_BEGIN |
| 17 @interface ARDSettingsStore () { |
| 18 NSUserDefaults *_storage; |
| 19 } |
| 20 @property(nonatomic, strong) NSUserDefaults *storage; |
| 21 @end |
| 22 |
| 17 @implementation ARDSettingsStore | 23 @implementation ARDSettingsStore |
| 18 | 24 |
| 19 - (nullable NSString *)videoResolutionConstraintsSetting { | 25 - (NSUserDefaults *)storage { |
| 20 return [[NSUserDefaults standardUserDefaults] objectForKey:kUserDefaultsMediaC
onstraintsKey]; | 26 if (!_storage) { |
| 27 _storage = [NSUserDefaults standardUserDefaults]; |
| 28 } |
| 29 return _storage; |
| 21 } | 30 } |
| 22 | 31 |
| 23 - (void)setVideoResolutionConstraintsSetting:(NSString *)constraintsString { | 32 - (nullable NSString *)videoResolutionConstraints { |
| 24 [[NSUserDefaults standardUserDefaults] setObject:constraintsString | 33 return [self.storage objectForKey:kMediaConstraintsKey]; |
| 25 forKey:kUserDefaultsMediaConstraints
Key]; | 34 } |
| 35 |
| 36 - (void)setVideoResolutionConstraints:(NSString *)constraintsString { |
| 37 [self.storage setObject:constraintsString forKey:kMediaConstraintsKey]; |
| 38 [self.storage synchronize]; |
| 39 } |
| 40 |
| 41 - (nullable NSNumber *)maxBitrate { |
| 42 return [self.storage objectForKey:kBitrateKey]; |
| 43 } |
| 44 |
| 45 - (void)setMaxBitrate:(nullable NSNumber *)value { |
| 46 [self.storage setObject:value forKey:kBitrateKey]; |
| 47 [self.storage synchronize]; |
| 26 } | 48 } |
| 27 | 49 |
| 28 @end | 50 @end |
| 29 NS_ASSUME_NONNULL_END | 51 NS_ASSUME_NONNULL_END |
| OLD | NEW |