Reduce code duplication
Description
These refactors were done by GLM-4.6 using jscpd output as a guide. I'd like to integrate jscpd into our CI pipeline somehow too.
Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more