Open Source Project - Crypto News App (UPDATE #3: Share Post Functionality)

in utopian-io •  7 years ago  (edited)

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

Previous Updates

Updated Android Apk: https://drive.google.com/file/d/1zrVIimlgXqleVi_M2pGXGHVzoIytv577/view?usp=sharing

New Features

  • Share functionality:
    In view of making the application as interactive as possible, I have added a share functionality. Previously, when users found news that they were particularly interested in, and wanted to share with friends, they had to manually go to the blog website and sift through the multitude of posts there to find the link they wanted to share.

With this new update, users would only need to click the share button and have the ability to share across several different platforms. "Share" is now one of the Menu contexts for both the latest blog posts feed as well as the favorite section.

Screenshot_2018-02-20-04-15-49.png

Screenshot_2018-02-20-04-16-11.png

Screenshot_2018-02-20-04-45-02.png

Screenshot_2018-02-20-04-45-13.png

Different platform options to share post to


Screenshot_2018-02-20-04-48-33.png

Post Shared on Whatsapp

How I Implemented This

I added a context menu to the existing menu in both blogPosts.xaml and favouriteBlogPosts.xaml

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

The code to handle this action implemented in the pages' code-behind. The first thing I do is to check if the user's device platform supports the Share Plugin I used. If supported, I got the selected post's properties using the CommandParameter, then cast it to the appropriate model.
Thereafter, create a new ShareMessage from the properties of the post and pass it to the Plugin Share Manager to broadcast.


        public async void OnShareClicked(object sender, EventArgs e)
        {
            if (!CrossShare.IsSupported)
            {
                await DisplayAlert("Error", "This Device Platform does not support sharing", "OK");
                return;
            }
            var mi = ((MenuItem)sender);
            var blogPost = (BlogPost)mi.CommandParameter;
            await CrossShare.Current.Share(new Plugin.Share.Abstractions.ShareMessage
            {
                Title = blogPost.Title,
                Text = blogPost.Excerpt + "..." + "(By " + blogPost.BlogWebsiteName + ")",
                Url = blogPost.Link
            });
        }

*Further details on the changes and modifications can be seen on the git commits linked below. *

Important Links



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

It's a good initiative, thanks for sharing.

Thank you for the contribution. It has been approved.

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

t's wonderful, what a good inciiative, so unbelievable. I really like your idea.

I invite you to vote for my last post, please. Greetings.