TelePost - An iOs app that shows top news Headlines of what's happening around you.

in #utopian-io6 years ago (edited)

Repository

https://github.com/hitenkmr/TelePost

TelePost - An iOs App

What's about the Project?

TelePost allows users to view news that are the top headlines of the day according to their country. The news is fetched from the News API containing all the news and to let the user get to know what's happening around. This is the just starting of the app which requires the user Steemit account to login into the application. The app uses the News API's to fetch all top news of the day with the user's current region. We are planning to make the app best with Steemit account so that in the future release of the app we can add more features which allow the user to post, vote and comment on posts within the app itself.

Technology Stack

  • Xcode
  • Swift Programming Language
  • Steemit api
  • Cocoa Pods

How to fetch News using News API

In TopHeadlinesVC.swift View Controller, we get the current locale to get the region code, which will be used in the News API to fetch the news.

 let currentLocale = NSLocale.current
        if let regionCode = currentLocale.regionCode {
            self.gettopHeadlinesWith(countryCode: regionCode.lowercased())
        }

    func gettopHeadlinesWith(countryCode: String) {
        self.startAnimator()
        APIMaster.getTopHeadlinesWith(countryCode: countryCode, completion: { (json, httpResponse) in
            DispatchQueue.main.async(execute: {
                self.stopAnimator()
            })
            guard let json = json else {
                self.showAlertWith(title: "Error", message: Messages.UnableToLoadfeeds)
                return
            }
            if httpResponse.statusCode == 200 {
                if let articles = json["articles"] as? [[String : Any]] {
                    var headlines = [TopHeadline]()
                    articles.forEach({ (article) in
                        let articleModel = TopHeadline.init(info: article)
                        headlines.append(articleModel)
                    })
                    self.currentHeadlines = headlines
                }
                DispatchQueue.main.async(execute: {
                    self.countryTopHeadlinesCollectionView.reloadData()
                })
            } else {
                var errorMsg = Messages.InternalServerError
                if let message = json["message"] as? String {
                    errorMsg = message
                }
                self.showAlertWith(title: "Error", message:errorMsg)
            }
        }) { (error) in
            DispatchQueue.main.async(execute: {
                self.stopAnimator()
                self.showAlertWith(title: "Error", message:error.localizedDescription)
            })
        }
    }

In API.swift we have a method that will be passed with the countryCode parameter

func getTopHeadlinesWith(countryCode : String, completion : APICompletionHandler, failure : APIFailureHandler) {
        let urlStr = "https://newsapi.org/v2/top-headlines?country=\(countryCode)&apiKey=\(NewsApi.key)"
        let url = URL.init(string: urlStr)
        let request = URLRequest.init(url: url!)
        self.forwardRequest(request: request, httpMethod: HttpMethods.HttpMethod_GET, completion: completion, failure: failure)
    }

Now on completion handler, we will get the callback to get the JSON data, which is then used to show the news in the collectionview.

How to run the app

  • The app is currently not available in the app store but still, you can install it on your iPhone. For this you need to match the following requirements:-

  • Mac

  • Xcode

  • Apple developer account

If you match all the requirements, then download the repository to your system, open xcworkspace file in Xcode.

Now connect your device to the system, go to Xcode and build the app on your device and enjoy the app.

Roadmap

  • To include Steemit news Section into the app that will show hot, trending, new and promoted news blogs.
  • To make the News Section even better and include a section that will cover all of the news that the user might be interested in.
  • Bypass the Steemit login for users not having a Steemit account.
  • To include a section that will include Steemit posts related to news and all that.
  • To allow Non-Steemit users create the Steemit Account and then can login into the app after account creation.
  • Steemit Users can Upvote through the App.
  • Steemit Users can Comment on the post through the App.
  • Steemit users can even post on their Steemit account from the App itself.
Sort:  

Thank you for your contribution. Though in the current state, the project does not hold any great value for the Open Source. What you are actually doing is to create another Mobile Frontend for Steem where the news are being focused. Why would a person leave Steemit.com and go to the mobile app just to check News, because in that way there might be 100's of app with different tag e.g. travel, photography, sports, news etc.

Also as it is a starting point, you are just gathering a news from other source and showing it in the mobile app which also is not unique, because there are many news app available on the market.

It would be nice if you can find some uniqueness for the project and do not make it another steem mobile app focusing one tag.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @codingdefined
Here's a tip for your valuable feedback! @Utopian-io loves and incentivises informative comments.

Contributing on Utopian
Learn how to contribute on our website.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!

Good and wonderful project I wish you success

Thank you for the support.

I run the app on my iPhone after clone this repo and it runs smoothly. Excellent work!

Well done buddy.. your project looking promising. I want to see how much you bind all these things with steem blockchain.

Exellent post

Thanks. Hope it turns out be the great App.

You must chose a license and add a license file to your github!

Licence file to the github repository has successfully been added. Thanks for the Advice.

Hey @hitenkmr
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!