Skip to content

Commit

Permalink
Change temperature delta label to degrees Celsius (project-chip#9427)
Browse files Browse the repository at this point in the history
* Change temperature delta label to degrees celsius

* Rename Fahrenheit in identifiers to Celsius

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
tewarid and restyled-commits authored Sep 13, 2021
1 parent 5c864e4 commit f9de0af
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ @interface TemperatureSensorViewController ()
@property (nonatomic, strong) UILabel * temperatureLabel;
@property (nonatomic, strong) UITextField * minIntervalInSecondsTextField;
@property (nonatomic, strong) UITextField * maxIntervalInSecondsTextField;
@property (nonatomic, strong) UITextField * deltaInFahrenheitTextField;
@property (nonatomic, strong) UITextField * deltaInCelsiusTextField;
@property (nonatomic, strong) UIButton * sendReportingSetup;
@end

Expand Down Expand Up @@ -51,7 +51,7 @@ - (void)dismissKeyboard
{
[_minIntervalInSecondsTextField resignFirstResponder];
[_maxIntervalInSecondsTextField resignFirstResponder];
[_deltaInFahrenheitTextField resignFirstResponder];
[_deltaInCelsiusTextField resignFirstResponder];
}

- (void)setupUI
Expand Down Expand Up @@ -120,15 +120,15 @@ - (void)setupUI
[maxIntervalInSecondsView.trailingAnchor constraintEqualToAnchor:stackView.trailingAnchor].active = YES;

// Delta
_deltaInFahrenheitTextField = [UITextField new];
_deltaInFahrenheitTextField.keyboardType = UIKeyboardTypeNumberPad;
UILabel * deltaInFahrenheitLabel = [UILabel new];
[deltaInFahrenheitLabel setText:@"Delta (F):"];
UIView * deltaInFahrenheitView = [CHIPUIViewUtils viewWithLabel:deltaInFahrenheitLabel textField:_deltaInFahrenheitTextField];
[stackView addArrangedSubview:deltaInFahrenheitView];
_deltaInCelsiusTextField = [UITextField new];
_deltaInCelsiusTextField.keyboardType = UIKeyboardTypeNumberPad;
UILabel * deltaInCelsiusLabel = [UILabel new];
[deltaInCelsiusLabel setText:@"Delta (°C):"];
UIView * deltaInCelsiusView = [CHIPUIViewUtils viewWithLabel:deltaInCelsiusLabel textField:_deltaInCelsiusTextField];
[stackView addArrangedSubview:deltaInCelsiusView];

deltaInFahrenheitView.translatesAutoresizingMaskIntoConstraints = false;
[deltaInFahrenheitView.trailingAnchor constraintEqualToAnchor:stackView.trailingAnchor].active = YES;
deltaInCelsiusView.translatesAutoresizingMaskIntoConstraints = false;
[deltaInCelsiusView.trailingAnchor constraintEqualToAnchor:stackView.trailingAnchor].active = YES;

// Reporting button
_sendReportingSetup = [UIButton new];
Expand Down Expand Up @@ -194,10 +194,10 @@ - (void)reportFromUserEnteredSettings
{
int minIntervalSeconds = [_minIntervalInSecondsTextField.text intValue];
int maxIntervalSeconds = [_maxIntervalInSecondsTextField.text intValue];
int deltaInFahrenheit = [_deltaInFahrenheitTextField.text intValue];
int deltaInCelsius = [_deltaInCelsiusTextField.text intValue];

NSLog(@"Sending temp reporting values: min %@ max %@ value %@", @(minIntervalSeconds), @(maxIntervalSeconds),
@(deltaInFahrenheit));
NSLog(
@"Sending temp reporting values: min %@ max %@ value %@", @(minIntervalSeconds), @(maxIntervalSeconds), @(deltaInCelsius));

if (CHIPGetConnectedDevice(^(CHIPDevice * _Nullable chipDevice, NSError * _Nullable error) {
if (chipDevice) {
Expand All @@ -207,7 +207,7 @@ - (void)reportFromUserEnteredSettings
[cluster
configureAttributeMeasuredValueWithMinInterval:minIntervalSeconds
maxInterval:maxIntervalSeconds
change:deltaInFahrenheit
change:deltaInCelsius
responseHandler:^(NSError * error, NSDictionary * values) {
if (error == nil)
return;
Expand Down

0 comments on commit f9de0af

Please sign in to comment.