QR code generation: skip fields with default values
Currently the QR code contains:
{"port": 22, "timeout": 5000, "require_wifi": false}
This fields can be omitted for the default values. It would be great to have same for the boolean fields but they still are added even when have the false value.
I do not see that a port == 0 will be omited from the QR code: https://github.com/mwarning/trigger/blob/master/app/src/main/kotlin/app/trigger/QRShowActivity.kt#L52
But I haev not tested it yet - tomorrow.
To remove Boolean that are false and integers that are 0 would rely on that those are always defaults. D different trigger versions might have different defaults. Without a good reason I would keep them.
The timeout change is fine.
Yes, for now all Door siblings (Nuki, SSH, HTTPS and MQTT) have bool fields defaults to false and int fields defaults to 0 except of the app_id=2342 but it's unlikely that someone will have the app_id=0.
This is a good convention to follow anyway.
It is a good convention to keep defaults to false and 0. But there is no guarantee. Unless there is a very good reason, I would like to keep all configuration arguments explicit.
If defaults are changed, then we end up with bug tickets. This should never happen.
there is no guarantee
yeah, still if you know this then it's kind of safe. Anyway, this is minor issue so I'll close the PR
sorry I had to veto against the approach. I had a very similar idea back then. But then decided to play it safe.