-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
} | ||
|
||
|
||
private fun updateUI() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar blocks of code found in 2 locations. Consider refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left 2 minor remarks relating to documentation and code-formatting (for higher coverage). But since there will be a second PR adding more tests, the current state LGTM.
|
||
// taskSnapshot.metadata contains file metadata such as size, content-type, etc. | ||
uploadTask.addOnSuccessListener { taskSnapshot -> | ||
callback() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know you will add the task later but you can put everything in one line here since the callback() is short, it will not affect the readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Also, since testing these calls is hard, maybe consider concatenating some operations or lines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also agreed, it's an easy way to make the coverage of external calls better.
|
||
class Util { | ||
companion object { | ||
fun createNewId(): String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider adding documentation for this (explaining the form of the id, etc)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
|
||
|
||
private fun updateUI() { | ||
findViewById<TextView>(R.id.uploadStatus).text = "Upload OK" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use strings.xml resources here instead of hardcoding. Let's keep it clean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me overall. If you can quickly remove the hardcoded string for convenience sake, and check if you can shorten the untested code lines, it'd be amazing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The coverage is not an issue since you will do another PR with more tests, but in the meantime you can squish into fewer lines some functions that you cannot test.
…-image' into laurislopata/upload-image
Code Climate has analyzed commit 5699a4d and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 36.3% (80% is the threshold). This pull request will bring the total coverage in the repository to 87.6% (-0.9% change). View more on Code Climate. |
In this PR, I added a simple image selection and storage to firebase. Due to a lack of time this week I was unable to work more on it (connecting it with the user profile). I will finish that over the break as to why the coverage is low, these functions mainly use firebase and built-in activities like opening the default photos viewing app.