From 31282fc9420c68badfc7d3aea507268cefdc5fc5 Mon Sep 17 00:00:00 2001 From: trentschnee Date: Tue, 14 Apr 2020 15:38:52 -0500 Subject: [PATCH] fix: Fix the async function with permissions --- utils/helpers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/utils/helpers.js b/utils/helpers.js index d9613f2..9db0eb6 100644 --- a/utils/helpers.js +++ b/utils/helpers.js @@ -1,6 +1,7 @@ import React from 'react' import { View, Text, AsyncStorage } from 'react-native' -import { Notifications, Permissions } from 'expo' +import { Notifications } from 'expo' +import * as Permissions from 'expo-permissions' const FLASHCARDS_NOTIFICATION_DB = 'flashcards:notification' function createLocalNotification() { // Return an object that says don't forget to study @@ -12,8 +13,9 @@ function createLocalNotification() { export function setLocalNotification() { AsyncStorage.getItem(FLASHCARDS_NOTIFICATION_DB).then(JSON.parse).then((data) => { + if (data === null) { - Permissions.AsyncStorage(Permissions.NOTIFICATIONS).then(({ status }) => { + Permissions.getAsync(Permissions.NOTIFICATIONS).then(({ status }) => { if (status === 'granted') { Notifications.cancelAllScheduledNotificationsAsync() // Create a new data