My new Xamarin app - Easy Polish News
Tags: showdev, xamarinforms, mobile, project
Published: 2021-07-15 16:01:07

I recently finished working on the MVP version of my latest application - Easy Polish News and published it in stores. It was an interesting training project so I thought it might be good  to share more about the app and how I made it.

The idea for Easy Polish News came from a similar application I was using to study Japanese, where you could read news in Japanese and get immediate translation for the unknown vocabulary. I thought it would also be a good training project, as it would allow me to try out Azure functions, which is something I had never used before. On that note, I started planning.



## The back-end



The reason to use Azure functions was that the application was extremely simple and did not need a complicated solution. I would also be able to enhance the featureset easily and add more functions if necessary. Initially however, I only needed two functions:

* Timer triggered function to periodically update the news database
* HTTP triggered function used by the app to request news for a specific day



At first, I wanted to use an existing API to fetch the latest news from Polish websites, however I quickly found that there were very few solutions which would allow me to do that, and most of them were very expensive. In the end, there was only one API I could use, but I quickly realised the quality of the news was questionable. I was receiving a lot of irrelevant articles from silly websites which were in no way useful nor interesting. I realised I needed to create my own solution. 



The way I approached it is by using an RSS feed from one of the most popular news providers in Poland. The feed allowed me to get a list of titles and URLs to the most recent articles. They also have different feeds for specific categories such as sports, politics and so on, which leaves some room for potential new features in the future.



Using the URLs, I could then scrape the important information using XPATH queries. The HTMLAgilityPack nuget package came in very handy for that purpose. Scraping this information is not really a reliable solution, as my code will stop working the moment the website’s HTML DOM structure changes (OR if they even change elements’ ids), but with no alternatives in sight I decided this was my best option and it was also a good opportunity to learn about XPATH queries (which was surprisingly fun!).



Having all of the necessary information, I could start building a small news database using Azure Blob Storage. My own news feed would then be retrieved by the app using the HTTP triggered function.



## The application



The application is written using Xamarin Forms and consists of three screens:

* Newsfeed page
* Article page
* Notebook page



The newsfeed page is probably the most self explanatory, as it is simply displaying the latest news. I also implemented infinite scrolling using Xamarin Forms’ CollectionView where I simply request news for the previous day when the user reaches the end of their current content. There is also a search bar which allows for simple filtering of the fetched articles. In the future, I want to add the previously mentioned categories, which will allow users to choose the content they’re most interested in.



The article page is the most complex one as it features a custom selectable label (implementation described in detail [here](https://dev.to/k_bronowicka/selectable-text-with-no-context-menu-in-xamarin-forms-3bmc)) to allow the users to select words they do not understand. I then display a view where I show the base form of the word (because Polish is fun like that) and its English translation. Both of these are obtained by scraping dictionary sites, as, again, there was no useful API available. In the future, I would like to build my own dictionary database so I don’t need to rely on third parties and fickle solutions. 



The users can choose to save chosen vocabulary which is then displayed on the notebook page. The users can then study and review new words and remove them if needed. It would be a nice addition to have some sort of flashcard or spaced repetition system to help the users test themselves better.



To top it all off I also added notifications to show users new articles and remind them to study! 



## Summary



Easy Polish News was a fun little project to work on and allowed me to learn a lot of new things from Azure through web scraping all the way to custom, OS specific components in Xamarin. As fun as it was, it would be fantastic if it actually benefited someone in their studies so let’s see how that works out :)



If you want to have a look at the app, you can download it on the [App Store](https://apps.apple.com/us/app/easy-polish-news/id1573109935) or [Play Store](https://play.google.com/store/apps/details?id=com.klaudia.easypolishnews).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5w2dam34mrxb67rqru1o.png)