Open Source Project - Crypto News App (UPDATE #2: Favourite posts Section)

in #utopian-io7 years ago (edited)

For some time now, I have been working on CryptoNews App. Check out my previous posts on the project

The aim of the application is to fetch news feed from preferred blogs and display on the application. it is structured in such a way that you can scroll through them like you would do on your social media timeline. It also leverages you the ability to read any of these news, right there on the app without having to open another browser application.

Screenshot_2018-01-31-04-37-02.png

If you would rather just test the new update and not bother about the technical explanations, download the Android apk - https://drive.google.com/file/d/1a0Nxi7ihavv7qaD0eukuDbYPs07tEgOa/view?usp=sharing

Updates and New Features

  • Favorites tab has been added to the application. You can now select favorite posts and archive them for later viewing.

Because of the frequency of new posts from the blogs, and given that the API only returns the last 10 most recent posts, its very easy to loose track of some important posts which you might want to make reference to, later on.

With this new feature, you can add posts to the favorite tab and come back to read it whenever you want to. This way, you don't need to go about searching for these posts on the website, search engine or whatsoever.

Screenshot_2018-02-12-08-02-30.png

When you click and hold a post for long, a context Menu appears, to add it to your favourite list

Screenshot_2018-02-12-08-02-44.png


Screenshot_2018-02-12-08-03-43.png

Post in favourite tab


You can also delete that post from your favourite list

Screenshot_2018-02-12-14-25-57.png

Screenshot_2018-02-12-14-26-03.png

How I implemented this

First I created a "FavouritePost" model which is exactly the same as the normal "BlogPost" model. The reason for this duplication is to have this new model have its own table on the SQLite database. This table would not be affected by the dropping and re-creation of the "BlogPost" table, thus retaining favourite posts even when the blogPosts table has been reset.
https://github.com/Johnesan/CryptoNews/blob/master/CryptoNews/CryptoNews/Models/FavouriteBlogPost.cs

Thereafter, on my blogPosts listview definition, I added a ContextAction to the viewcell

<ViewCell.ContextActions>
                                    <MenuItem Clicked="OnFavouriteClicked" CommandParameter="{Binding .}" 
                               Text="Add To Favourite" />
 </ViewCell.ContextActions>

A MenuItem is popped up when a post selection is held for long.
In the code-behind, I implemented a method to get the selected post (via the CommandParameter) and cast it into type BlogPost. Thereafter, create a new "FavouriteBlogpost" and set all its properties to that of the former, then add it to the list of favourites.

 public async void OnFavouriteClicked(object sender, EventArgs e)
        {
            var mi = ((MenuItem)sender);
            var blogPost = (BlogPost)mi.CommandParameter;
            var FavouriteBlogPost = new FavouriteBlogPost
            {
                Id = blogPost.Id,
                Title = blogPost.Title,
                BlogWebsiteName = blogPost.BlogWebsiteName,
                Date = blogPost.Date,
                Excerpt = blogPost.Excerpt,
                FeaturedImage = blogPost.FeaturedImage,
                Link = blogPost.Link,
                PrettyDate = blogPost.PrettyDate
            };
            await App.database.AddFavouriteBlogPost(FavouriteBlogPost);
            await DisplayAlert("Successful", "One post added to favourites", "OK");
        }

https://github.com/Johnesan/CryptoNews/blob/master/CryptoNews/CryptoNews/Views/BlogPosts.xaml.cs

Further details on the changes can be seen on the git commits linked below. Changes such as how the favourite tab section itself was implemented as well as its ViewModel and database setup

  • Changes to the Layout

Due to the added favourite section, there was need to redesign the user interface to allow for better experience.
I switched the layout from the normal ContentView to a Master-Detail layout which contains a navigation drawer to any of the important pages.
Screenshot_2018-02-12-14-25-01.png

Important Links

https://github.com/Johnesan/CryptoNews/commit/a044e0cca054db8063084531dbff7eff835e11a2

I intend shipping this application to the Play Store soonest; and thereafter, work on the iOS fully and also release it in the App Store so that future updates will be available to everyone who makes use of the application, as opposed to only those that see this post. However, I need to get a stable version running first.

To make your contributions, the github link again is https://github.com/Johnesan/CryptoNews You could get in touch with me, as regards any technical comments, questions or contributions you have concerning the project- [email protected]



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Very good idea and of course implementation. Congratulations!

Thank you for the contribution. It has been approved.

A few more infos in the Readme about installation and usage would be helpful.

You can contact us on Discord.
[utopian-moderator]

Hey @johnesan I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.25
TRX 0.19
JST 0.037
BTC 91726.79
ETH 3325.89
USDT 1.00
SBD 3.90