text: import React from 'react'
  import { View, StyleSheet, AsyncStorage } from 'react-native'
  import { FontAwesome, MaterialIcons, MaterialCommunityIcons } from '@expo/vector-icons'
  import { red, orange, blue, lightPurp, pink, white } from './colors'
  import { Notifications } from 'expo'
  import * as Permissions from 'expo-permissions'
  
  const NOTIFICATION_KEY = 'UdaciFitness:notifications'
  export function validateInput(value){
   if(value === undefined || value === ''){
     return false;
   }
   return true;
  }
  
  export function getDailyReminderValue () {
    return {
      today: "👋 Don't forget to log your data today!"
    }
  }
  
  export function timeToString (time = Date.now()) {
    const date = new Date(time)
    const todayUTC = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()))
    return todayUTC.toISOString().split('T')[0]
  }
  
  export function clearLocalNotification () {
    return AsyncStorage.removeItem(NOTIFICATION_KEY)
      .then(Notifications.cancelAllScheduledNotificationsAsync)
  }
  
  function createNotification () {
    return {
      title: 'Study!',
      body: "👋 don't forget to study your flashcards for today!",
      ios: {
        sound: true,
      },
      android: {
        sound: true,
        priority: 'high',
        sticky: false,
        vibrate: true,
      }
    }
  }
  
  export function setLocalNotification () {
    AsyncStorage.getItem(NOTIFICATION_KEY)
      .then(JSON.parse)
      .then((data) => {
        if (data === null) {
          Permissions.askAsync(Permissions.NOTIFICATIONS)
            .then(({ status }) => {
              if (status === 'granted') {
                Notifications.cancelAllScheduledNotificationsAsync()
  
                let tomorrow = new Date()
                tomorrow.setDate(tomorrow.getDate() + 1)
                tomorrow.setHours(20)
                tomorrow.setMintutes(0)
  
                Notifications.scheduleLocalNotificationsAsync(
                  createNotification(),
                  {
                    time: tomorrow,
                    repeat: 'day',
                  }
                )
  
                AsyncStorage.setItem(NOTIFICATION_KEY, JSON.stringify(true))
              }
            })
        }
      })
  }