DEV Community

Cover image for Reflect for PR 4
Tong Liu
Tong Liu

Posted on

Reflect for PR 4

Links

Pull Request
issue

It was such a blast to be participating in Hacktoberfest. After I signed off this event with my last Pull Request, my effort and dedication towards Hacktoberfest have finally paid off. Hacktoberfest has not only helped me to finally get involved with the open-source community breaking me free from my comfort zone, but it also helped me to overcome my fear of being involved.

What did I do for the last PR

For my last PR, I decided to try something even bigger, so I chose an Android project named AntennaPod which has 4.5K stars with 1.2K forks. This is because I want to see how a bigger project is managed on GitHub and also how a bigger project's code framework is designed.
When I was looking for an issue to work on, I found an issue which reported a bug that when users set the default page of the app as Inbox Page, which shows all of the recently updated podcasts of the subscribed channels, the Index page will not actually show up when the app is opened. Since it was my first time contributing to this project, I have not gotten familiar with the code of this project, thus, I need a starter issue for me to get familiar with everything. This issue worked for the best because I only need to fix a bug and did not need to add new features to it.

How did I find a fix for it and how did I fix it?

After having browsed through the UI on how the settings are saved, I noticed they use an Android pre-built mechanism to save them, named PreferenceScreen. From the Android official document of Settings, I learned that all the values of those settings are saved in XML files, usually in attrs.xml. Soon I found there is a layout named preferences_user_interface.xml uses this file and also this layout file is referenced by UserInterfacePreferencesFragment which calls another function UserPreferences::setDefaultPage() to save this setting and next to it there was another function named getDefaultPage(). Now that I knew how the value is saved and read, I can check if it is the problem with the reading function or the saving function. After adding breakpoints here and there and having traced some relevant values, I noticed that the matching TAG of this setting is different between the read and save functions, which means, no matter how this setting is saved, the reading function will always not be able to find it since they are using different TAGs. Since now everything is clear, I could just either change the tag of the reading function or the saving function to get the issue solved. I chose the first and created this PR to request to merge it into the original repository. However, after the maintainer reviewed my code, they prefer to change the saving function instead of the reading function because changing the reading function breaks the naming consistency of other variables. After I reworked my fix and changed my fix on the saving function and pushed my code, my last PR was finally accepted which brought my hacktoberfest of 2022 to a successful end.

Top comments (0)