Over the course of the past week, I’ve been working on an Issue in the WordPress for Android repository. The project itself is very overwhelming because of how large it is – building the app itself took a whooping 23 mins just to be compiled. The longest one I’ve ever seen. However, the structure of the application itself is coherent – I was able to easily locate the files that needed to be fixed. To start, the Issue that I tackled can be found here.
A confusing error message
As you can see from the above GIF, when I want to change my current linked email address of my WordPress account, to an email that’s also tied to another WordPress account, the app itself only gives a vague error message that the account settings can’t be saved – it doesn’t state the fact that the email address itself is an issue and a less technical person might not be able to correctly diagnose the cause of the error.
Debugging in WordPress for Android
Now, before I’m able to produce the error message in the GIF above, I needed to create an app in the WordPress Developer App Manager. Why? Because apparently we need our own OAuth information so that the WordPress for Android app that’s installed on my emulator phone can enable to log-in to my WordPress account and test experimental features.
As seen here below, I created the app necessary to generate OAuth information:
For privacy purposes, I cleared out my own OAuth information details. When you create your own app, you’ll see your own OAuth information below and you can use the “Client ID” and “Client Secret” information fields for the app by inputting them into the gradle.properties file into the
Now that proper setup for the debugging is complete, I was now able to make changes and test them. The needed fix is a simple change to the Toast message for the app by creating a string named
error_email_used_settings in the strings.xml file and attribute the message “That e-mail address is already being used.” to it. Now that it’s in the strings.xml file, I was able to use it as an error message for the Toast. As shown below, the
ToastUtils.showtoast(getActivity(), R.string.email_used_settings, Toast.Utils.Duration.LONG) code snippet is the one responsible for generating the error message as a Toast.
A helpful error message
And now we have a more coherent error message that tells the user what exactly went wrong when they weren’t able to save their new email address.