HacktoberFest: PR#3

For hacktoberfest 2019, my third PR was for an app called Shoot I Smoke App. It is a pretty famous and a useful application. It lets the user know how many cigarettes is the user smoking based upon the quality of air around the user. It is built in React-native, typescript. It uses user’s location and uses the open Algolia places API to get the current air quality and then calculates the number of cigarettes that accounts to.

Issue

The owner of the app wanted to add a new feature of notifications, in which user could set their preference and get notifications daily, weekly or monthly basis. Notification would tell the user how many cigarettes are they currently smoking.

https://github.com/amaurymartiny/shoot-i-smoke/issues/236

Process

I started this issue by looking into expo notification API and then looking into react-native picker. I added a picker with storing the selected value into async storage of users device. Then I dug deep into notification API. Apparently we could schedule notifications, so I added a utils class which receives user’s preference and scheduled the notification accordingly. I got curious and as expected it is kind of a cron job behind the expo curtains.

PR

https://github.com/amaurymartiny/shoot-i-smoke/pull/292

Work in Progress

Expo notification API accepts a JSON of the data for notification which is displayed at the scheduled time. But we need to fetch the latest data at the time of notification and display that. I and the owner of the repo went back and forth a number of times discussing possible solutions, and currently I am looking into expo background fetch or having a backend for it. I got the initial base set up , and now lets see how we would implement this amazing feature to this amazing application.

Learning Outcomes

  • Learnt a big deal about Expo API’s
  • Learnt how to handle async storage for a react native app
  • Learning about Expo background fetch

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: