Conversation
plyer/platforms/ios/proximity.py
Outdated
| else: | ||
| return str(False) | ||
| else: | ||
| return 'Proximity Sensor in present in your device.' |
| def _get_proximity(self): | ||
| if self.device.proximityMonitoringEnabled: | ||
| if self.device.proximityState: | ||
| return str(True) |
There was a problem hiding this comment.
Why now returning a string of a boolean, both platforms are coded to return a boolean value anyway?
| text: 'Does Proximity Sensor detect something?' | ||
| Label: | ||
| text: 'Yes' if root.is_near else 'No' | ||
| text: root.is_near |
There was a problem hiding this comment.
@tshirtman I was trying to remove this condition statement from here. That's why String Property.
There was a problem hiding this comment.
I don't think it's a good idea to change the api to simplify a particular example, especially since a lot of other usages would change from:
if obj.is_near:
do_something()
to
if obj.is_near == 'True':
do_something()
which is really un-pythonic, the api is better when a boolean value is represented as a boolean.
There was a problem hiding this comment.
Also, you could just change the example to this, to achieve the same effect as your previous solution.
text: str(root.is_near)
There was a problem hiding this comment.
"text: str(root.is_near)"
👍
|
If someone can test it, making the api returns a boolean again is easy, if it works it can be merged after that. |
No description provided.