aloussase / AlexandriaApp

:book: Search for books and download and convert them to different formats
MIT License
71 stars 6 forks source link

Going into Settings, crashes App #23

Closed Delorean12DMC closed 3 months ago

Delorean12DMC commented 6 months ago

When i enter the newly added configuration menu, the app crashes instantly.

Im using it on an OnePlus CPH2493 using Android 14 aarch64.

linuzzx commented 6 months ago

Same, when it finally works, I'll donate a few bucks @aloussase ✨

aloussase commented 6 months ago

I just did a fresh install from FDroid and it's working fine for me. Can't reproduce the issue. Try doing a fresh install.

Delorean12DMC commented 6 months ago

Well for me it was a fresh install too this morning, i think it has something to do with the localization settings of the phone, based on that @linuzzx has the same problems. Because his language settings should be the same.

aloussase commented 6 months ago

I just tested with my phone in German and it's working fine. The only think I can think of is that the locale language strings in your devices are different. I can make it so that the app doesn't crash in these cases, but there is not portable way of making it work on all devices.

This functionality was a temporary hack because there was no support for german in the app, but starting from version 0.3.2 we have german support, so if the issue persists I will just remove the option to set the language within the app.

Delorean12DMC commented 6 months ago

Well i don't know exactly how it works, but shouldn't it be the case, that you have a collection of different language strings and if the language matches with the device language it's applied and if it's not found it just falls back to the stock setting which in your case is spanish?

aloussase commented 6 months ago

Yes that's exactly the case. But, for example, what value should I use for english? en? en-us? Who knows. In the devices I tested it was en for english, de for german, but I can't be sure that it's like that in all devices.

NotMeyi commented 6 months ago

Hello, I am having the same issue on the latest version. My app also crashes when i try to search for a book with the search bar.

Delorean12DMC commented 6 months ago

The only solution i could think of is, that if the language code from the device is for example en-us, but your app just has en for english, it should generate an exception, in that case just implement a string comparison in the exception state, that checks if the language string contains for example en and just return that language instead, because english should have en-US and en-UK so the beginning in both strings is the same and so it is an easy comparison and decision to make and that could take care of it. I have to take a look at the code, i don't know if i'm able to successfully check it, because i'm more into C# and i don't have a development environment set up. Maybe i can help you with it, but don't take my word for granted in that case.

aloussase commented 6 months ago

I don't know. It still feels like a hack to me. And I read somewhere (here https://stackoverflow.com/questions/2900023/change-app-language-programmatically-in-android) that it's better to just rely on the system's locale settings than manually setting the application's language. We just need more people to contribute with wanted translations.

I don't really see the point of having language settings in the app.

aloussase commented 3 months ago

Hi guys, I finally got some time to work on the app again. I have added a fix to avoid crashing the app when accessing the settings screen with an unregistered locale. Expect the fix to be available from the next update on F-Droid.

Im gonna close this issue for now, but feel free to re-open it if the problems persist. Cheers!