I'm currently tackling adding permission support for ExerciseRoutes. The way we couple permissions with records currently makes this a bit difficult as ExerciseRoutes aren't exactly records but do require permissions. I propose we use this opportunity to decouple permissions and record types a bit further.
As a first step, I would like to refactor ReactHealthRecord as an abstract utils class as it only contains static methods and rename the base interface to ReactHealthRecord (I believe it was named differently due to name clashes before).
Further changes will probably include creating enums for supported React record types and React permission types that can be used to bridge react input/outputs in a more structural manor.
UDPATE:Probably a better way might be to configure Exercise permissions to include an optional parameter? There are no direct ways to read exercise route records without reading exercises so might be better to keep record based model. Either way, this PR might be a slight improvement so feel free to review.
UPDATE 2: Okay requesting route permissions actually work very differently to all the other permissions. Depending on what the apps use these permissions for it might be best to either redirect to permission screen or request per exercise (we would need to expose a method for this).
I'm dropping work for this as forwarding users to health connect settings seem much simpler for managing permissions.
Testing
Went through the example app and verified all the existing functionality is in tact.
Summary
I'm currently tackling adding permission support for
ExerciseRoutes
. The way we couple permissions with records currently makes this a bit difficult as ExerciseRoutes aren't exactly records but do require permissions. I propose we use this opportunity to decouple permissions and record types a bit further.As a first step, I would like to refactor
ReactHealthRecord
as anabstract
utils class as it only contains static methods and rename the base interface toReactHealthRecord
(I believe it was named differently due to name clashes before).Further changes will probably include creating enums for supported React record types and React permission types that can be used to bridge react input/outputs in a more structural manor.UDPATE:
Probably a better way might be to configure Exercise permissions to include an optional parameter? There are no direct ways to read exercise route records without reading exercises so might be better to keep record based model.Either way, this PR might be a slight improvement so feel free to review.UPDATE 2: Okay requesting route permissions actually work very differently to all the other permissions. Depending on what the apps use these permissions for it might be best to either redirect to permission screen or request per exercise (we would need to expose a method for this).
I'm dropping work for this as forwarding users to health connect settings seem much simpler for managing permissions.
Testing
Went through the example app and verified all the existing functionality is in tact.