Actifit iOS App : Develpment contribution 3

in #actifit6 years ago (edited)

Repository

https://github.com/mcfarhat/actifit-ios

Introduction

I have been contributing to the Actifit iOS Application development with my past contribution link posts Post 1 and Post 2. This contribution holds new features into the iOS App like support for lower iOS versions, allowing the user to post activity once a day and adding new leaderboard screen displaying daily top 5 scorers posting from Actifit App.

About Actifit

Actifit is one of the SMT(Smart Media Token) on the top of Steemit blockchain which rewards you Actifit tokens based on your activity posted to Steemit via App. You can then use these tokens to buy sports pieces of equipment. Actifit also rewards you STEEM via upvotes on your posts on Steemit.

Technologies Used

  • Swift which has been used 100% in the project with best technologies and frameworks to track one's activity in iOS App.
  • Realm along with Core Data that has been used to store user information and Activity track of records locally and safely.

Proof of work done

Daily Leaderboard (Top 5) Commmit Link

  • We keep track of every user posting their activity on Steemit blockchain using the Actifit App and reward them based on their activities count.
  • The top Actifitians get the most number of Actifit tokens reward and every user can see that in Leaderboard section.

IMG_0324.PNG

The above image showing the Leaderboard screen with Actifitian Steemit username and the number of activities user has performed before posting it to the Steemit blockchain.

Allow a user to post only once a day Commit Link

  • User basically does his/her activity like running, jogging, etc.. keep tracking the activity while using the App and if the user reaches the 1000 activity milestone (minimum activity required to post on Steemit), then is allowed to post to the Steemit blockchain along with the post content, post title and some tags.
  • Now user only can post only once a day so that he/she can track the maximum activity of the day before posting on Steemit blockchain to gain more STEEM rewards and Actifit tokens and also to have a better chance to be on the top leaderboard list.

Adding Activity tracking support for older iPhone devices(support for iOS 9 or later)
Commit link 1

  • As Apple changes the API structure with every new iOS release, we need to add support for all the versions of iOS along with different code for different iOS versions so that API does not fail to low iOS versions.
private func checkAuthorizationStatus() {
        if #available(iOS 11.0, *) {
            switch CMMotionActivityManager.authorizationStatus() {
            case CMAuthorizationStatus.denied:
                onStop()
                stepsCountLabel.text = "Not available"
            default:break
            }
        } else {
            // Fallback on earlier versions
            self.activityManager.queryActivityStarting(from: Date(), to: Date(), to: OperationQueue.main, withHandler: { (activities: [CMMotionActivity]?, error: Error?) -> () in
                if error != nil {
                    let errorCode = (error! as NSError).code
                    if errorCode == Int(CMErrorMotionActivityNotAuthorized.rawValue) {
                        self.onStop()
                        self.stepsCountLabel.text = "Not available"
                    }
                } else {
                    print("Authorized")
                }
            })
        }
    }

The above code is for checking if the user allow the App to track user activity or not. As you can see for iOS 11.0 CMMotionActivityManager class can directly check if the user has allowed the App to track the activity. But for lower versions, we have to query activity manager for data between two dates, if there is an error CMErrorMotionActivityNotAuthorized then we stop tracking the activity otherwise we proceed tracking the activity.

Commit Link 2
Commit Link 3
Commit Link 4

IMG_0318.PNG

On iPhones with a smaller screen size like iPhone 5S and iPhone SE, the above image showing measurement fields which fits the whole screen width.

image0.png

On iPhones with bigger screens like iPhone 6, iPhone 6s, iPhone 7 and of similar category, the measurement fields which are bound in a single container have some space left on the right of the screen.

Roadmap

  • Add View Wallet section so that user can see their total awarded Actifit tokens.
  • Add a feature so that users can see all transactions history of awarded tokens.
  • Background movement tracking.
  • Switching between measurement system (Metric & US).
  • Donate rewards to charity.

Github Account

https://github.com/hitenkmr

Sort:  

Thank you for your contribution. So for checking if the user has posted or not you are using Local Time Zone Calender what will happen if the user is flying and there is a difference in TimeZone, have you thought about that scenario?

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]

Yeah you are right and we have never thought of such a scenario if peplpes can post their activities while flying and entering defferent time zone. I would take it into consideration and will try to find a solution for it. BTW thanks for reminding such a different use case.

Thank you for your review, @codingdefined!

So far this week you've reviewed 5 contributions. Keep up the good work!

Hi @hitenkmr! We are @steem-ua, a new Steem dApp, computing UserAuthority for all accounts on Steem. We are currently in test modus upvoting quality Utopian-io contributions! Nice work!

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

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

Vote for Utopian Witness!