Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add thermo sensor selection to Tap Settings #120

Merged
merged 3 commits into from
May 13, 2020

Conversation

johnnyruz
Copy link

Combined with PR #409 on kegbot-server, this will allow users to manage temperature sensors from the Android app similar to Flow Meters and Tap Toggles.

Sorry for all of the irrelevant tabbing, looks like Android Studio adjusted some of the indentation.

Copy link
Collaborator

@patfreeman patfreeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll give this a good test tonight.

What's up with all the whitespace changes? Any chance those can be broken out from this feature PR?
Do we have a formatting / linting standard for java like we have with black on https://github.com/Kegbot/kegbot-server?

@johnnyruz
Copy link
Author

Yeah @patfreeman that's the auto-indent that Android Studio applied, but I agree, I hate it as far as consistency and readability of the code changes.

Please give this a functional test if you can, and in the meantime I'm going to re-factor this to get rid of all that whitespace stuff.

@mik3y
Copy link
Member

mik3y commented May 12, 2020

cool feature + awesome collaboration here!

on the lint stuff - if we need to do a great big "run the linter on everything" sort of change, i'd be happy to merge - best to do that with no other functional changes in the pull request.

@mik3y
Copy link
Member

mik3y commented May 13, 2020

@johnnyruz - to get rid of the whitespace changes, something like the following could help do the trick.

starting point would be something like:

$ git checkout -b johnnyruz:try-two master
$ curl -s \
    https://patch-diff.githubusercontent.com/raw/Kegbot/kegbot-android/pull/120.diff | \
  git apply --cached --ignore-whitespace && \
  git checkout -- .

then git diff --cached and look for any dangling whitespace changes and nuke em.

(the no whitespace view of the current change looks quite sensible & could be compared against)

@patfreeman
Copy link
Collaborator

I was trying to slack him another solution, but then this happened: https://status.slack.com/2020-05/147dad376c8946ff

Copy link
Collaborator

@patfreeman patfreeman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional tests are all good.

@@ -49,6 +49,7 @@
import org.kegbot.app.util.Version;
import org.kegbot.backend.Backend;
import org.kegbot.backend.BackendException;
import org.kegbot.core.ThermoSensor;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unused import.

You should import org.kegbot.proto.Models.ThermoSensor instead. Then you can change the references from Models.ThermoSensor to just ThermoSensor.

@@ -707,6 +708,11 @@ public KegTap disconnectMeter(KegTap tap) throws BackendException {
return (KegTap) postProto("/taps/" + tap.getId() + "/disconnect-meter", KegTap.newBuilder(), null);
}

@Override
public List<Models.ThermoSensor> getThermoSensors() throws BackendException {
return getProto("/thermo-sensors/", Models.ThermoSensor.newBuilder());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment about using ThermoSensor instead.

}

@Override
public KegTap connectThermo(KegTap tap, Models.ThermoSensor thermo) throws BackendException {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment about using ThermoSensor instead.

@@ -52,6 +52,7 @@
import org.kegbot.core.KegbotCore;
import org.kegbot.core.SyncManager;
import org.kegbot.core.TapManager;
import org.kegbot.core.ThermoSensor;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same situation as KegbotApiImpl.java.

*/
package org.kegbot.app.event;

import org.kegbot.proto.Models;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import could be more specific since you are only using Models.ThermoSensor

@@ -24,6 +24,7 @@
import org.codehaus.jackson.JsonNode;
import org.kegbot.app.util.TimeSeries;
import org.kegbot.proto.Api.RecordTemperatureRequest;
import org.kegbot.proto.Models;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import could be more specific since you are only using Models.ThermoSensor

@johnnyruz
Copy link
Author

Love the feedback, working on it now!

The suggestion about the whitespace sort of worked, but I dug into the formatting settings of Android Studio and updated some of the policies so that I can just apply that setting and the indentations line up. Latest will only have real code changes and all of the whitespace mess will be cleaned up.

@johnnyruz
Copy link
Author

Updated code with whitespaces fixes and suggestions from @patfreeman

@mik3y
Copy link
Member

mik3y commented May 13, 2020

thanks johnny, and thanks for handling the review pat! LGTM

@mik3y mik3y merged commit 1c6d4cd into Kegbot:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants