Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions DadJokes/DadJokes/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,6 @@
</label>
</subviews>
</tableViewCellContentView>
<connections>
<segue destination="CIX-hh-4eC" kind="show" id="idT-nb-BtE"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
Expand All @@ -305,7 +302,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="60" translatesAutoresizingMaskIntoConstraints="NO" id="z9y-IH-k5P">
<rect key="frame" x="16" y="128" width="382" height="134.5"/>
<rect key="frame" x="16" y="84" width="382" height="134.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Question" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="HXR-3A-pxm">
<rect key="frame" x="0.0" y="0.0" width="382" height="43"/>
Expand Down
5 changes: 5 additions & 0 deletions DadJokes/DadJokes/Helpers/DJErrorMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ enum DJError: String, Error {
case invalidEmail = "The email you entered is not valid. Please try again."
case emailAlreadyInUse = "The email you entered is already in use. Please use a different email address."
case generalSignUpError = "There was an issue trying to sign up. Please try again."

// Sign Out alert
case signoutError = "There was an error signing out!"
// Signup alert
case singupError = "To view more or add dad jokes please sign up, under private tab."
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import UIKit
import CoreData
import Firebase

class PrivateJokesTableViewController: UITableViewController {

Expand Down Expand Up @@ -39,8 +40,15 @@ class PrivateJokesTableViewController: UITableViewController {
tableView.reloadData()
}

// Sign out firebase
@IBAction func signOutTapped(_ sender: Any) {
self.navigationController?.popToRootViewController(animated: true)
let firebaseAuth = Auth.auth()
do {
try firebaseAuth.signOut()
self.navigationController?.popToRootViewController(animated: true)
} catch {
presentDJAlertOnMainThread(title: "Error", message: DJError.signoutError.rawValue, buttonTitle: "Ok")
}
}

// MARK: - Table view data source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,38 @@ class PublicJokesTableViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
// var jokesTest = [String]()

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

// jokesTest = ["Joke1", "Joke2", "Joke3"]

}

// MARK: - Table view data source

// override func numberOfSections(in tableView: UITableView) -> Int {
// return 1 // test
// }
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// return jokesTest.count
return 0
}

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "PublicJokeCell", for: indexPath)

// cell.textLabel?.text = jokesTest[indexPath.row]

return cell
}

// Alert
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {

self.presentDJAlertOnMainThread(title: "Sign Up Alert!", message: DJError.singupError.rawValue, buttonTitle: "Ok")
}

/*
// MARK: - Navigation
Expand Down