likhongomes / Smart-Prompter-iOS

Research project for older adults with cognitive problem
2 stars 0 forks source link

Smart-Prompter-iOS

Authors: Dr. Chiu Tan, Likhon Gomes, Sarah Lehman

This is a basic app that let’s patients respond to the alarms set by the caretake in Caretaker app.

To read the complete app documentation, go to this link: https://likhongomes.github.io/Smart-Prompter-iOS/

How to Install:

Clone the repository and open it using xcode. click the run button or press cmd+R on keyboard to run the app, on a simulator or your iPhone.

Requirement: iOS 10 or above and xcode version 10 and above.

Alarm

class Alarm: PersistableRecord, Codable, FetchableRecord

Inheritance

Codable, FetchableRecord, PersistableRecord

Initializers

init()

init()

init(label:hour:minute:year:month:day:active:)

init(label: String, hour: Int, minute: Int, year: Int, month: Int, day: Int, active: Bool)

Properties

id

var id: Int?

firebaseID

var firebaseID: String?

label

var label: String?

year

var year: Int?

month

var month: Int?

day

var day: Int?

hour

var hour: Int?

minute

var minute: Int?

active

var active: Bool?

status

var status: String?

deleteRequest

var deleteRequest: String?

Methods

encode(to:)

func encode(to container: inout PersistenceContainer)

alarmDB

let alarmDB

AlarmScheduler

Alarm scheduling class to schedule alarm

class AlarmScheduler

Methods

scheduleNotification(title:dateComponents:id:)

Function to schedule alarm for the first time after doanloaded from Firebase. Simply call this function and it will push the alarm to the OS notification center

func scheduleNotification(title: String, dateComponents: DateComponents, id: String?)

Parameters

rescheduleNotification(title:id:)

Reschedule alam once the the alarm is delayed

public func rescheduleNotification(title: String, id: String?)

Parameters

clearNotifications(title:)

Request OS to remove notification from pending list and clear the notification list already delivered

func clearNotifications(title: String)

Parameters

The alarm view controller that is show after a row on the table is tapped

class AlarmVC: UIViewController, UINavigationControllerDelegate, UIImagePickerControllerDelegate

Inheritance

UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIViewController

Properties

backButton

let backButton

saveButton

let saveButton

cancelButton

let cancelButton

deleteButton

let deleteButton

buttonStack

let buttonStack

alarmDetailsLabel

let alarmDetailsLabel

instructionLabel

let instructionLabel

dateLabel

let dateLabel

timeLabel

let timeLabel

alarmDelegate

var alarmDelegate: AlarmVCDelegate?

alarm

var alarm

alarmNameTextField

let alarmNameTextField

alarmDateTextField

let alarmDateTextField

alarmTimeTextField

let alarmTimeTextField

statusLabel

let statusLabel

statusStatusLabel

let statusStatusLabel

datePicker

let datePicker

timePicker

let timePicker

slider

let slider

pictureSlider

let pictureSlider

imageView

let imageView

notificationTitle

var notificationTitle: Any?

takenImageViewer

let takenImageViewer

alarmIndex

var alarmIndex

Methods

viewDidLoad()

Main function of the view controller, all the important UI and rest of the alarm meta data are downloaded here.

override func viewDidLoad()

imageViewSetup()

Sets up the size/location/shape and style of the imageview

func imageViewSetup()

showDatePicker()

Sets up the size/location/shape and style of the date picker

func showDatePicker()

takenImageViewSetup()

Sets up the size/location/shape and style of the imageview for take image

func takenImageViewSetup()

showTimePicker()

Sets up the size/location/shape and style of the time picker

func showTimePicker()

donedatePicker()

action when done button is tapped on date picker

@objc func donedatePicker()

donetimePicker()

action when done button is tapped on time picker

@objc func donetimePicker()

cancelDatePicker()

Action to cancel date picker and make it disappear

@objc func cancelDatePicker()

changeValue(_:)

Action when slider value is changed. Updates the current status of the alarm based on the direction of slide. If left, then add delay to the alarm. If right, update the data on firebase and prompt the user to the next step

@objc func changeValue(_ sender: UISlider)

Parameters

changeValuePictureSlider(_:)

Action when slider value is changed. Updates the current status of the alarm based on the direction of slide. If left, then add delay to the alarm. If right, update the data on firebase and prompt the user to the next step

@objc func changeValuePictureSlider(_ sender: UISlider)

Parameters

imagePickerController(_:didFinishPickingMediaWithInfo:)

Action when image picker is done picking image and returns it. It also uploads the image to firebase and updates the status of the alarm

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])

alarmDateTextFieldSetup()

Sets up the size/location/shape and style of the alarm date text field

func alarmDateTextFieldSetup()

instructionLabelSetup()

Sets up the size/location/shape and style of the instruction label

func instructionLabelSetup()

alarmDetailsLabelSetup()

Sets up the size/location/shape and style of the alarm details label

func alarmDetailsLabelSetup()

alarmNameTextFieldSetup()

Sets up the size/location/shape and style of the alarm name text field

func alarmNameTextFieldSetup()

backButtonSetup()

Sets up the size/location/shape and style of the back button

func backButtonSetup()

backButtonClicked()

Action for back button when clicked, takes the user back to the previous screen

@objc func backButtonClicked()

statusStatusLabelSetup()

Sets up the size/location/shape and style of the label for the status label

func statusStatusLabelSetup()

sliderSetup()

Sets up the size/location/shape and style of the slider

func sliderSetup()

pictureSliderSetup()

Sets up the size/location/shape and style of the slider

func pictureSliderSetup()

AlarmVCDelegate

protocol AlarmVCDelegate

Requirements

reloadTableDelegate()

func reloadTableDelegate()

AppDatabase

A type responsible for initializing the application database.

struct AppDatabase

See AppDelegate.setupDatabase()

Methods

openDatabase(atPath:)

Creates a fully initialized database at path

static func openDatabase(atPath path: String) throws -> DatabaseQueue

AppDelegate

@available(iOS 10.0, *) @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate

Inheritance

UIApplicationDelegate, UIResponder, UNUserNotificationCenterDelegate

Properties

window

var window: UIWindow?

Methods

application(_:didFinishLaunchingWithOptions:)

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool

application(_:performFetchWithCompletionHandler:)

Background fetch function. Tries the fetch data when the app is in background

func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void)

Parameters

applicationWillResignActive(_:)

func applicationWillResignActive(_ application: UIApplication)

applicationDidEnterBackground(_:)

func applicationDidEnterBackground(_ application: UIApplication)

applicationWillEnterForeground(_:)

func applicationWillEnterForeground(_ application: UIApplication)

applicationDidBecomeActive(_:)

func applicationDidBecomeActive(_ application: UIApplication)

applicationWillTerminate(_:)

func applicationWillTerminate(_ application: UIApplication)

application(_:didRegisterForRemoteNotificationsWithDeviceToken:)

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)

application(_:didFailToRegisterForRemoteNotificationsWithError:)

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)

setupDatabase(_:)

Sets up the internal swl database which is currently not in use

private func setupDatabase(_ application: UIApplication) throws

registerForPushNotifications()

Registers the app for push notification

func registerForPushNotifications()

getNotificationSettings()

Gets the notification settings for local notification

func getNotificationSettings()

userNotificationCenter(_:willPresent:withCompletionHandler:)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)

userNotificationCenter(_:didReceive:withCompletionHandler:)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)

downloadNotificationSound()

Download the custom notifcation sound that's to be used

func downloadNotificationSound()

FirebaseUtil

class FirebaseUtil

Methods

fetchOneObject(firebaseID:)

Fetch one particular firebase object using the given firebase ID. Returns a single alarm

func fetchOneObject(firebaseID: String) -> Alarm

Parameters

Protocols

Globals

Functions

Variables

The main view controlller of the app. Users often see this view controller as a default. This is where all the alarms are fetched from firebase and alarm requests are made to the OS.

class MainVC: UIViewController

Inheritance

AlarmVCDelegate, UITableViewDataSource, UITableViewDelegate, UIViewController, UNUserNotificationCenterDelegate

Properties

welcomeTextView

let welcomeTextView

clockLabel

let clockLabel

topBar

let topBar

timeLabel

let timeLabel

timer

var timer

date

var date

calendar

let calendar

dateFormatter

let dateFormatter

logoutButton

let logoutButton

refreshControl

var refreshControl

summaryLabel

let summaryLabel

ref

var ref: DatabaseReference!

alarmTable

let alarmTable

Methods

reloadTableDelegate()

func reloadTableDelegate()

viewDidLoad()

This is tha main function where all the important tasks are called, such as loading the UI, Fetching from firebase and loading data into array

override func viewDidLoad()

updateTimeLabel()

Updates the time label for the clock shown on screen. Also refreshes the table view after certain time period

@objc func updateTimeLabel()

reloadTable()

Reloads data in the table view

@objc func reloadTable()

summaryLabelSetup()

Sets up the summary label. This label shows how many alarms are remaining to be completed for the day.

func summaryLabelSetup()

logoutButtonClicked()

Logout button action. Logout the user from the app

@objc func logoutButtonClicked()

fetchFromFirebase()

Fetches data from firebase and loads them in an array to be supplied to table view

func fetchFromFirebase()

tableView(_:numberOfRowsInSection:)

Built in tablie view function. Determines how many rows to be shown in the table

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

Parameters

tableView(_:cellForRowAt:)

Sorts out the data to be shown in each row of the table

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

tableView(_:didSelectRowAt:)

Action to be done when a row is tapped

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

userNotificationCenter(_:willPresent:withCompletionHandler:)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void)

userNotificationCenter(_:didReceive:withCompletionHandler:)

@available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void)

logoutButtonSetup()

Sets up the size/location/shape and style of the logout button

func logoutButtonSetup()

alarmTableSetup()

Sets up the size/location/shape and style of the alarm table

func alarmTableSetup()

topViewSetup()

Sets up the size/location/shape and style of the top view

func topViewSetup()

timeLabelSetup()

Sets up the size/location/shape and style of the time label

func timeLabelSetup()

welcomeTextViewSetup()

Sets up the size/location/shape and style of the welcome text

func welcomeTextViewSetup()

clockLabelSetup()

Sets up the size/location/shape and style of the clock label

func clockLabelSetup()

viewWillAppear(_:)

Refreshes the data in the alarm table when the view is loaded

override func viewWillAppear(_ animated: Bool)

RewardVC

class RewardVC: UIViewController

Inheritance

UIViewController

Properties

circleHolder

let circleHolder

percentageLabel

let percentageLabel

button

let button

textView

let textView

fraction

var fraction

imageView

let imageView

imageArray

let imageArray

Methods

viewDidLoad()

override func viewDidLoad()

imageViewSetup()

Sets up the size/location/shape and style of the imageview

func imageViewSetup()

progressCircleSetup()

Sets up the size/location/shape and style of the progress circle

func progressCircleSetup()

buttonSetup()

Sets up the size/location/shape and style of the button

func buttonSetup()

buttonClicked()

Action when the button is tapped. Takes user back

@objc func buttonClicked()

textViewSetup()

Sets up the size/location/shape and style of the textview

func textViewSetup()

RootViewController

class RootViewController: UIViewController

Inheritance

UIViewController

Methods

viewDidLoad()

override func viewDidLoad()

SignInVC

class SignInVC: UIViewController

Inheritance

UIViewController

Properties

loginButton

let loginButton

signUpButton

let signUpButton

guestButton

let guestButton

emailTF

let emailTF

passwordTF

let passwordTF

backButton

let backButton

logoImage

let logoImage

errorMessageView

let errorMessageView

Methods

viewWillAppear(_:)

Adds a authentication listener to see if the user is signed in

override func viewWillAppear(_ animated: Bool)

keyboardWillShow(notification:)

Raises the view when the keybaord appears

@objc func keyboardWillShow(notification: NSNotification)

Parameters

keyboardWillHide(notification:)

Lowers the view when the keyboard disappears

@objc func keyboardWillHide(notification: NSNotification)

Parameters

viewDidLoad()

Main function of this view controller. All the important tasks are done here such as loading the UI, adding listener for the keyboard etc.

override func viewDidLoad()

errorMessageViewSetup()

Sets up the size/location/shape and style of the error message textview

func errorMessageViewSetup()

logoImageSetup()

Sets up the size/location/shape and style of the logo image

func logoImageSetup()

loginButtonSetup()

Sets up the size/location/shape and style of the login button

func loginButtonSetup()

loginButtonTapped()

Action when the login button is tapped. Checks if all of the required fields are full and checks with firebase to authenticate

@objc func loginButtonTapped()

signUpButtonSetup()

Sets up the size/location/shape and style of the signup button

func signUpButtonSetup()

signUpButtonTapped()

Action when the signup button is tapped. Registers the user in firebase

@objc func signUpButtonTapped()

emailTFSetup()

Sets up the size/location/shape and style of the email textfield

func emailTFSetup()

passwordTFSetup()

Sets up the size/location/shape and style of the password textfield

func passwordTFSetup()

backButtonSetup()

Sets up the size/location/shape and style of the back button

func backButtonSetup()

Generated at 2020-05-02T13:21:48-0400 using swift-doc 1.0.0-beta.2.

Types - [Alarm](/Alarm) - [AlarmDB](/AlarmDB) - [AlarmScheduler](/AlarmScheduler) - [AlarmVC](/AlarmVC) - [AppDatabase](/AppDatabase) - [AppDelegate](/AppDelegate) - [FirebaseUtil](/FirebaseUtil) - [MainVC](/MainVC) - [RewardVC](/RewardVC) - [RootViewController](/RootViewController) - [SignInVC](/SignInVC)
Protocols - [AlarmVCDelegate](/AlarmVCDelegate)
Global Variables - [activeAlarm](/activeAlarm) - [alarmDB](/alarmDB) - [completedTask](/completedTask) - [dbQueue](/dbQueue) - [fUtil](/fUtil) - [inactiveAlarm](/inactiveAlarm) - [ref](/ref) - [scheduler](/scheduler) - [totalTask](/totalTask) - [userID](/userID)
Global Functions - [getDocumentsDirectory()](/getDocumentsDirectory\(\))

activeAlarm

var activeAlarm

completedTask

var completedTask

dbQueue

var dbQueue: DatabaseQueue!

fUtil

let fUtil

getDocumentsDirectory()

Get the document directory

func getDocumentsDirectory() -> URL

inactiveAlarm

var inactiveAlarm

ref

var ref: DatabaseReference!

scheduler

let scheduler

totalTask

var totalTask

userID

let userID

Alarm

data structure the alarm

class Alarm: PersistableRecord, Codable, FetchableRecord

Inheritance

Codable, FetchableRecord, PersistableRecord

Initializers

init()

empty initializer

init()

init(label:hour:minute:year:month:day:active:status:)

initializer

init(label: String, hour: Int, minute: Int, year: Int, month: Int, day: Int, active: Bool, status: String)

Properties

id

var id: Int?

firebaseID

var firebaseID: String?

label

var label: String?

scheduledHour

var scheduledHour: Int?

scheduledMinute

var scheduledMinute: Int?

active

var active: Bool?

scheduledYear

var scheduledYear: Int?

scheduledMonth

var scheduledMonth: Int?

scheduledDay

var scheduledDay: Int?

acknowledgedDay

var acknowledgedDay: Int?

acknowledgedMonth

var acknowledgedMonth: Int?

acknowledgedYear

var acknowledgedYear: Int?

acknowledgedHour

var acknowledgedHour: Int?

acknowledgedMinute

var acknowledgedMinute: Int?

completedDay

var completedDay: Int?

completedMonth

var completedMonth: Int?

completedYear

var completedYear: Int?

completedHour

var completedHour: Int?

completedMinute

var completedMinute: Int?

status

var status: String?

deleteRequest

var deleteRequest: String?

alarmDB

let alarmDB

AppDatabase

A type responsible for initializing the application database.

struct AppDatabase

See AppDelegate.setupDatabase()

Methods

openDatabase(atPath:)

Creates a fully initialized database at path

static func openDatabase(atPath path: String) throws -> DatabaseQueue

AppDelegate

@UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate

Inheritance

UIApplicationDelegate, UIResponder

Properties

window

var window: UIWindow?

Methods

application(_:didFinishLaunchingWithOptions:)

main function of the app delegate

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool

applicationWillResignActive(_:)

func applicationWillResignActive(_ application: UIApplication)

applicationDidEnterBackground(_:)

func applicationDidEnterBackground(_ application: UIApplication)

applicationWillEnterForeground(_:)

func applicationWillEnterForeground(_ application: UIApplication)

applicationDidBecomeActive(_:)

func applicationDidBecomeActive(_ application: UIApplication)

applicationWillTerminate(_:)

func applicationWillTerminate(_ application: UIApplication)

application(_:didRegisterForRemoteNotificationsWithDeviceToken:)

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)

application(_:didFailToRegisterForRemoteNotificationsWithError:)

func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)

setupDatabase(_:)

private func setupDatabase(_ application: UIApplication) throws

registerForPushNotifications()

func registerForPushNotifications()

fetchFromFirebase()

func fetchFromFirebase()

AudioRecordVC

Class for recording audio for alarm sound

class AudioRecordVC: RootViewController, AVAudioRecorderDelegate, AVAudioPlayerDelegate

Inheritance

RootViewController, AVAudioPlayerDelegate, AVAudioRecorderDelegate

Properties

recordButton

var recordButton

playButton

let playButton

instruction

let instruction

nextButton

let nextButton

recordingSession

var recordingSession: AVAudioSession!

audioRecorder

var audioRecorder: AVAudioRecorder!

audioPlayer

var audioPlayer: AVAudioPlayer?

audioFilename

var audioFilename: URL?

Methods

viewDidLoad()

override func viewDidLoad()

loadAudioPlayer()

loads the audio player to play the sound on device

func loadAudioPlayer()

audioPlayerDidFinishPlaying(_:successfully:)

Checks if the audio player finished playing the sound, then change the play button

func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool)

loadRecordingUI()

Loads the button button to record. Sets title and adds target

func loadRecordingUI()

startRecording()

Starts the recording session on device

func startRecording()

getDocumentsDirectory()

Gets the documents directory of the audio stored

func getDocumentsDirectory() -> URL

finishRecording(success:)

Finishes the recording session and clears memory to nil

func finishRecording(success: Bool)

topLeftButtonTapped()

Action for top left button when tapped. Takes the user back to the main vc

override func topLeftButtonTapped()

recordTapped()

action for when the record button is tapped. Starts the audio session or stops

@objc func recordTapped()

audioRecorderDidFinishRecording(_:successfully:)

Checks if the audio recorder did finish recording. Sets the flag according to that

func audioRecorderDidFinishRecording(_ recorder: AVAudioRecorder, successfully flag: Bool)

uploadToFirebase()

Uploads the recorded audio to firebase

func uploadToFirebase()

playButtonSetup()

Setup function for play button on the view. Specifies the location, size and the syle of it

func playButtonSetup()

playButtonTapped()

action for when play button is tapped. Plays the audio if not playing, stops the audio if playing

@objc func playButtonTapped()

recordButtonSetup()

Setup function for record button on the view. Specifies the location, size and the syle of it

func recordButtonSetup()

instructionTextViewSetup()

Setup function for instruction text view on the view. Specifies the location, size and the syle of it

func instructionTextViewSetup()

nextButtonSetup()

Setup function for next button on the view. Specifies the location, size and the syle of it

func nextButtonSetup()

nextButtonTapped()

Action for when next buton is tapped. Takes the usre to Main VC

@objc func nextButtonTapped()

CreateNewAlarmVC

View controller for create new alarm

class CreateNewAlarmVC: RootViewController, UITextFieldDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate

Inheritance

RootViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextFieldDelegate

Properties

saveButton

let saveButton

deleteButton

let deleteButton

alarmNameLabel

let alarmNameLabel

dateLabel

let dateLabel

timeLabel

let timeLabel

imageView

let imageView

imageButtonStack

let imageButtonStack

alarmNameTextField

let alarmNameTextField

alarmDateTextField

let alarmDateTextField

alarmTimeTextField

let alarmTimeTextField

statusLabel

let statusLabel

statusStatusLabel

let statusStatusLabel

selectedTextField

var selectedTextField

datePicker

let datePicker

timePicker

let timePicker

topImageView

let topImageView

addImageButton

let addImageButton

vcName

let vcName

cameraButton

let cameraButton

imagePickerButton

let imagePickerButton

imageBackButton

let imageBackButton

status

var status

editable

var editable

screenName

var screenName

alarm

var alarm

image

var image

Methods

viewDidLoad()

override func viewDidLoad()

imagePickerController(_:didFinishPickingMediaWithInfo:)

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])

imageButtonStackSetup()

Setup function for image button stacks on the view. Specifies the location, size and the syle of it

func imageButtonStackSetup()

topImageViewSetup()

Setup function for top image view on the view. Specifies the location, size and the syle of it

func topImageViewSetup()

addImageButtonSetup()

Setup function for add image button on the view. Specifies the location, size and the syle of it

func addImageButtonSetup()

addImageTapped()

action for when add image is tapped. Opens image picker

@objc func addImageTapped()

cameraButtonSetup()

Setup function for camera button on the view. Specifies the location, size and the syle of it

func cameraButtonSetup()

cameraButtonTapped()

action for when camera button is tapped. Opens the camera

@objc func cameraButtonTapped()

imagePickerButtonSetup()

Setup function for image picker button on the view. Specifies the location, size and the syle of it

func imagePickerButtonSetup()

imagePickerButtonTapped()

action for when image picker button is tapped. Set the image to be displayed

@objc func imagePickerButtonTapped()

imageBackButtonSetup()

Setup function for image back button on the view. Specifies the location, size and the syle of it

func imageBackButtonSetup()

imageBackButonTapped()

action for when image back button is tapped.

@objc func imageBackButonTapped()

topLeftButtonTapped()

action for when top left button is clicked. Takes the user back to the previous screen

override func topLeftButtonTapped()

vcNmaeSetup()

Setup function for view controller name on the view. Specifies the location, size and the syle of it

func vcNmaeSetup()

showData()

show the data in alarm textfield

func showData()

textFieldDidBeginEditing(_:)

checks if the textfield did begin editing, set the inputview accordingly

func textFieldDidBeginEditing(_ textField: UITextField)

textFieldDidEndEditing(_:)

checks if textfield did end editing then format the date accordingly

func textFieldDidEndEditing(_ textField: UITextField)

showDatePicker()

shows the date picker on screen

func showDatePicker()

donedatePicker()

done editing the date picker

@objc func donedatePicker()

donetimePicker()

done editing the time picker

@objc func donetimePicker()

cancelDatePicker()

cancels editing the date picker

@objc func cancelDatePicker()

alarmNameTextFieldSetup()

Setup function for alarm name text field on the view. Specifies the location, size and the syle of it

func alarmNameTextFieldSetup()

alarmDateTextFieldSetup()

Setup function for alarm date text field on the view. Specifies the location, size and the syle of it

func alarmDateTextFieldSetup()

alarmTimeTextFieldSetup()

Setup function for alarm time textfield on the view. Specifies the location, size and the syle of it

func alarmTimeTextFieldSetup()

alarmNameLabelSetup()

Setup function for alarm name label on the view. Specifies the location, size and the syle of it

func alarmNameLabelSetup()

dateLabelSetup()

Setup function for date label on the view. Specifies the location, size and the syle of it

func dateLabelSetup()

timeLabelSetup()

Setup function for time label on the view. Specifies the location, size and the syle of it

func timeLabelSetup()

backButtonClicked()

action for when save button is clicked

@objc func backButtonClicked()

saveButtonSetup()

Setup function for save button on the view. Specifies the location, size and the syle of it

func saveButtonSetup()

saveButtonClicked()

action for when save button is clicked. Creates an alarm and send it to firebase

@objc func saveButtonClicked()

statusStatusLabelSetup()

Setup function for lable for status label on the view. Specifies the location, size and the syle of it

func statusStatusLabelSetup()

CurrentAlarmListVC

view controller to show list of current alarms

class CurrentAlarmListVC: RootViewController, UITableViewDataSource, UITableViewDelegate

Inheritance

RootViewController, UITableViewDataSource, UITableViewDelegate

Properties

activeAlarm

var activeAlarm

alarmTable

let alarmTable

Methods

tableView(_:numberOfRowsInSection:)

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

tableView(_:cellForRowAt:)

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

tableView(_:didSelectRowAt:)

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

viewDidLoad()

override func viewDidLoad()

topLeftButtonTapped()

override func topLeftButtonTapped()

alarmTableSetup()

Setup function for alarm table on the view. Specifies the location, size and the syle of it

func alarmTableSetup()

fetchFromFirebase()

fetch data from firebase

func fetchFromFirebase()

CurrentAlarmViewVC

Current view controller that shows current alarms active

class CurrentAlarmViewVC: RootViewController, UITextFieldDelegate

Inheritance

RootViewController, UITextFieldDelegate

Properties

backButton

let backButton

saveButton

let saveButton

deleteButton

let deleteButton

alarmDetailsLabel

let alarmDetailsLabel

alarmNameLabel

let alarmNameLabel

dateLabel

let dateLabel

timeLabel

let timeLabel

imageView

let imageView

alarmNameTextField

let alarmNameTextField

alarmDateTextField

let alarmDateTextField

alarmTimeTextField

let alarmTimeTextField

statusLabel

let statusLabel

statusStatusLabel

let statusStatusLabel

selectedTextField

var selectedTextField

datePicker

let datePicker

timePicker

let timePicker

status

var status

editable

var editable

screenName

var screenName

alarm

var alarm

Methods

viewDidLoad()

override func viewDidLoad()

topLeftButtonTapped()

action for when top left button is tapped. Takes the user back to the previous screen.

override func topLeftButtonTapped()

showData()

Show the data in textviews

func showData()

textFieldDidBeginEditing(_:)

Check if text view did beging editing, set the keyboard to date picker

func textFieldDidBeginEditing(_ textField: UITextField)

textFieldDidEndEditing(_:)

Checks if the text field did end editing. Formats the date accordingly and put on textview

func textFieldDidEndEditing(_ textField: UITextField)

imageViewSetup()

Setup function for imageview on the view. Specifies the location, size and the syle of it

func imageViewSetup()

showDatePicker()

Setup function for date picker on the view. Specifies the location, size and the syle of it

func showDatePicker()

donedatePicker()

wrapper function for when date picker is done

@objc func donedatePicker()

donetimePicker()

wrapper function for when timer is done

@objc func donetimePicker()

cancelDatePicker()

wrapper function when cancel date

@objc func cancelDatePicker()

alarmNameTextFieldSetup()

Setup function for alarm name textfield on the view. Specifies the location, size and the syle of it

func alarmNameTextFieldSetup()

alarmDateTextFieldSetup()

Setup function for alarm date textfield on the view. Specifies the location, size and the syle of it

func alarmDateTextFieldSetup()

alarmTimeTextFieldSetup()

Setup function for alarm time text field on the view. Specifies the location, size and the syle of it

func alarmTimeTextFieldSetup()

statusLabelSetup()

Setup function for logo on the view. Specifies the location, size and the syle of it

func statusLabelSetup()

alarmNameLabelSetup()

Setup function for alarm name label on the view. Specifies the location, size and the syle of it

func alarmNameLabelSetup()

alarmDetailsLabelSetup()

Setup function for alarm details label on the view. Specifies the location, size and the syle of it

func alarmDetailsLabelSetup()

dateLabelSetup()

Setup function for date label on the view. Specifies the location, size and the syle of it

func dateLabelSetup()

timeLabelSetup()

Setup function for time label on the view. Specifies the location, size and the syle of it

func timeLabelSetup()

backButtonSetup()

Setup function for back button on the view. Specifies the location, size and the syle of it

func backButtonSetup()

backButtonClicked()

action for when button is clicked

@objc func backButtonClicked()

saveButtonSetup()

Setup function for save button on the view. Specifies the location, size and the syle of it

func saveButtonSetup()

saveButtonClicked()

action button for when save button is clicked. Updates data on firebase

@objc func saveButtonClicked()

cancelButtonClicked()

actiong for when cancel button is clicked

@objc func cancelButtonClicked()

deleteButtonSetup()

Setup function for delete button on the view. Specifies the location, size and the syle of it

func deleteButtonSetup()

deleteButtonClicked()

action for when delete button is clicked. Send a request to firebase to delete the data

@objc func deleteButtonClicked()

statusStatusLabelSetup()

Setup function for label for status lable on the view. Specifies the location, size and the syle of it

func statusStatusLabelSetup()

FirebaseController

Controller for firebase actions

class FirebaseController

Initializers

init()

init()

Methods

uploadImage(image:imageName:)

upload image to firebase

func uploadImage(image: UIImage, imageName: String)

Types

Globals

Variables

The main view controller of the app, users see this viewcontroller first when they open the app

class MainVC: RootViewController

Inheritance

RootViewController

Properties

newAlarmButton

let newAlarmButton

viewAlarmButton

let viewAlarmButton

pastAlarmsButton

let pastAlarmsButton

stack

let stack

upperQuad

let upperQuad

lowerQuad

let lowerQuad

secondTextView

let secondTextView

Methods

viewDidLoad()

override func viewDidLoad()

topLeftButtonTapped()

action for when the top left button is tapped. It prompts the user to record the alarm sound and preview it

override func topLeftButtonTapped()

topRightButtonTapped()

Action for when the top right button is tapped. Here it logs out the user

override func topRightButtonTapped()

secondTextViewSetup()

Setup function for second text view on the view. Specifies the location, size and the syle of it

func secondTextViewSetup()

newAlarmButtonSetup()

Setup function for new alarm button on the view. Specifies the location, size and the syle of it

func newAlarmButtonSetup()

newAlarmButtonClicked()

Action for when new alarm button is clicked. It takes the user to Create New Alarm View Controller

@objc func newAlarmButtonClicked()

viewAlarmButtonSetup()

Setup function for view alarm button on the view. Specifies the location, size and the syle of it

func viewAlarmButtonSetup()

viewAlarmButtonClicked()

action for when the view alarm button is clicked. Takes the user to Current Alarm ListVC

@objc func viewAlarmButtonClicked()

pastAlarmsButtonSetup()

Setup function for past alarm button on the view. Specifies the location, size and the syle of it

func pastAlarmsButtonSetup()

pastAlarmButtonClicked()

Action for when past alarm button is clicked. Presents pastAlarmVC

@objc func pastAlarmButtonClicked()

PastAlarmListVC

View controller to show list of past alarms

class PastAlarmListVC: RootViewController, UITableViewDelegate, UITableViewDataSource

Inheritance

RootViewController, UITableViewDataSource, UITableViewDelegate

Properties

inactiveAlarm

var inactiveAlarm

backButton

let backButton

alarmTable

let alarmTable

Methods

tableView(_:numberOfRowsInSection:)

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int

tableView(_:cellForRowAt:)

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell

tableView(_:didSelectRowAt:)

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

viewDidLoad()

override func viewDidLoad()

topLeftButtonTapped()

action button for top left button. Takes the user back

override func topLeftButtonTapped()

alarmTableSetup()

Setup function for table view on the view. Specifies the location, size and the syle of it

func alarmTableSetup()

fetchFromFirebase()

fetch data from firebase

func fetchFromFirebase()

PastAlarmViewVC

View controller to show past alarms

class PastAlarmViewVC: RootViewController, UITextFieldDelegate

Inheritance

RootViewController, UITextFieldDelegate

Properties

backButton

let backButton

detailTextView

let detailTextView

cancelButton

let cancelButton

deleteButton

let deleteButton

alarmDetailsLabel

let alarmDetailsLabel

alarmNameLabel

let alarmNameLabel

dateLabel

let dateLabel

timeLabel

let timeLabel

imageView

let imageView

alarmNameTextField

let alarmNameTextField

alarmDateTextField

let alarmDateTextField

alarmTimeTextField

let alarmTimeTextField

statusLabel

let statusLabel

statusStatusLabel

let statusStatusLabel

selectedTextField

var selectedTextField

status

var status

editable

var editable

screenName

var screenName

alarm

var alarm

Methods

viewDidLoad()

override func viewDidLoad()

topLeftButtonTapped()

action for when the top left button is tapped. Takes the user back to the previous view controller

override func topLeftButtonTapped()

detailTextViewSetup()

Setup function for detail text view on the view. Specifies the location, size and the syle of it

func detailTextViewSetup()

prepareDataforDetailTextView()

prepares the data to be show on detail text view

func prepareDataforDetailTextView()

imageViewSetup()

Setup function for image view on the view. Specifies the location, size and the syle of it

func imageViewSetup()

donedatePicker()

done function for when date picker is done

@objc func donedatePicker()

donetimePicker()

done function for when time picker is done

@objc func donetimePicker()

cancelDatePicker()

cancels the date picker

@objc func cancelDatePicker()

alarmNameTextFieldSetup()

Setup function for alarm name text field on the view. Specifies the location, size and the syle of it

func alarmNameTextFieldSetup()

alarmDateTextFieldSetup()

Setup function for alarm date text field on the view. Specifies the location, size and the syle of it

func alarmDateTextFieldSetup()

alarmTimeTextFieldSetup()

Setup function for alarm time text field on the view. Specifies the location, size and the syle of it

func alarmTimeTextFieldSetup()

statusLabelSetup()

Setup function for status label on the view. Specifies the location, size and the syle of it

func statusLabelSetup()

alarmNameLabelSetup()

Setup function for alarm name label on the view. Specifies the location, size and the syle of it

func alarmNameLabelSetup()

alarmDetailsLabelSetup()

Setup function for alarm detail lable on the view. Specifies the location, size and the syle of it

func alarmDetailsLabelSetup()

dateLabelSetup()

Setup function for date label on the view. Specifies the location, size and the syle of it

func dateLabelSetup()

timeLabelSetup()

Setup function for time label on the view. Specifies the location, size and the syle of it

func timeLabelSetup()

cancelButtonSetup()

Setup function for cancel button on the view. Specifies the location, size and the syle of it

func cancelButtonSetup()

cancelButtonClicked()

action for when cancel button is clicked

@objc func cancelButtonClicked()

deleteButtonSetup()

Setup function for delete button on the view. Specifies the location, size and the syle of it

func deleteButtonSetup()

deleteButtonClicked()

action place holder for delete button

@objc func deleteButtonClicked()

statusStatusLabelSetup()

Setup function for status lable on the view. Specifies the location, size and the syle of it

func statusStatusLabelSetup()

RootViewController

class RootViewController: UIViewController

Inheritance

UIViewController

Properties

topLeftButton

let topLeftButton

topRightButton

let topRightButton

viewContollerLabel

let viewContollerLabel

buttonStack

let buttonStack

topButtonSize

let topButtonSize

Methods

viewDidLoad()

override func viewDidLoad()

topLeftButtonSetup(buttonType:)

func topLeftButtonSetup(buttonType: ButtonType)

topLeftButtonTapped()

@objc func topLeftButtonTapped()

topRightButtonSetup(buttonType:)

func topRightButtonSetup(buttonType: ButtonType)

topRightButtonTapped()

@objc func topRightButtonTapped()

viewControllerLabelSetup(labelType:)

func viewControllerLabelSetup(labelType: VCType)

buttonStackSetup()

func buttonStackSetup()

RootViewController.ButtonType

enum ButtonType

Enumeration Cases

rectangle

case rectangle

square

case square

RootViewController.VCType

enum VCType

Enumeration Cases

main

case main

sub

case sub

SignInVC

View controller to handle sign in functionalities

class SignInVC: UIViewController

Inheritance

UIViewController

Properties

loginButton

let loginButton

signUpButton

let signUpButton

guestButton

let guestButton

emailTF

let emailTF

passwordTF

let passwordTF

backButton

let backButton

logoImage

let logoImage

errorMessageView

let errorMessageView

Methods

viewWillAppear(_:)

Attaches a user listener before the view appears

override func viewWillAppear(_ animated: Bool)

keyboardWillShow(notification:)

raises the view when the keyboard shows up

@objc func keyboardWillShow(notification: NSNotification)

keyboardWillHide(notification:)

lowers the view when the keyboard disappears

@objc func keyboardWillHide(notification: NSNotification)

viewDidLoad()

override func viewDidLoad()

logoImageSetup()

Setup function for logo on the view. Specifies the location, size and the syle of it

func logoImageSetup()

loginButtonSetup()

Setup function for login button on the view. Specifies the location, size and the syle of it

func loginButtonSetup()

loginButtonTapped()

action for when login button is tapped. Checks with firebase and logs the user in

@objc func loginButtonTapped()

errorMessageViewSetup()

Setup function for error mesage on the view. Specifies the location, size and the syle of it

func errorMessageViewSetup()

signUpButtonSetup()

Setup function for signup button on the view. Specifies the location, size and the syle of it

func signUpButtonSetup()

signUpButtonTapped()

action for when signup button is tapped. It registers the user on firebase

@objc func signUpButtonTapped()

emailTFSetup()

Setup function for email textfield on the view. Specifies the location, size and the syle of it

func emailTFSetup()

passwordTFSetup()

Setup function for password textfield on the view. Specifies the location, size and the syle of it

func passwordTFSetup()

backButtonSetup()

Setup function for back button on the view. Specifies the location, size and the syle of it

func backButtonSetup()

UserInfoVC

View controller that asks for user's information

class UserInfoVC: UIViewController, UITextFieldDelegate

Inheritance

UITextFieldDelegate, UIViewController

Properties

careTakerFirstNameTF

let careTakerFirstNameTF

careTakerLastNameTF

let careTakerLastNameTF

patientFirstNameTF

let patientFirstNameTF

patientLastNameTF

let patientLastNameTF

doneButton

let doneButton

informationLabel

let informationLabel

selectedTextField

var selectedTextField

Methods

viewDidLoad()

override func viewDidLoad()

textFieldDidBeginEditing(_:)

Checks when the text field begins editing, assigns the responder based on that

func textFieldDidBeginEditing(_ textField: UITextField)

keyboardWillShow(notification:)

raises the view when keyboard appears

@objc func keyboardWillShow(notification: NSNotification)

keyboardWillHide(notification:)

lowers the view when keybaord disappers

@objc func keyboardWillHide(notification: NSNotification)

informationLabelSetup()

Setup function for information label on the view. Specifies the location, size and the syle of it

func informationLabelSetup()

careTakerFirstNameTFSetup()

Setup function for caretaker first name textfield on the view. Specifies the location, size and the syle of it

func careTakerFirstNameTFSetup()

careTakerLastNameTFSetup()

Setup function for care taker last name textfield on the view. Specifies the location, size and the syle of it

func careTakerLastNameTFSetup()

patientFirstNameTFSetup()

Setup function for patient first name text field on the view. Specifies the location, size and the syle of it

func patientFirstNameTFSetup()

patientLastNameTFSetup()

Setup function for patient last name text field on the view. Specifies the location, size and the syle of it

func patientLastNameTFSetup()

doneButtonSetup()

Setup function for done button on the view. Specifies the location, size and the syle of it

func doneButtonSetup()

doneButtonClicked()

action for when the done button is tapped. It uploads the data to firebase

@objc func doneButtonClicked()

Generated at 2020-05-02T13:30:21-0400 using swift-doc 1.0.0-beta.2.

Types - [Alarm](/Alarm) - [AlarmDB](/AlarmDB) - [AppDatabase](/AppDatabase) - [AppDelegate](/AppDelegate) - [AudioRecordVC](/AudioRecordVC) - [CreateNewAlarmVC](/CreateNewAlarmVC) - [CurrentAlarmListVC](/CurrentAlarmListVC) - [CurrentAlarmViewVC](/CurrentAlarmViewVC) - [FirebaseController](/FirebaseController) - [MainVC](/MainVC) - [PastAlarmListVC](/PastAlarmListVC) - [PastAlarmViewVC](/PastAlarmViewVC) - [RootViewController](/RootViewController) - [RootViewController.ButtonType](/RootViewController_ButtonType) - [RootViewController.VCType](/RootViewController_VCType) - [SignInVC](/SignInVC) - [UserInfoVC](/UserInfoVC)
Global Variables - [alarmDB](/alarmDB) - [dbQueue](/dbQueue) - [ref](/ref) - [userID](/userID)

dbQueue

var dbQueue: DatabaseQueue!

ref

var ref: DatabaseReference!

userID

let userID