Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call Script Screen Detail #16

Merged
merged 4 commits into from
Feb 4, 2017
Merged

Call Script Screen Detail #16

merged 4 commits into from
Feb 4, 2017

Conversation

mccarron
Copy link
Collaborator

@mccarron mccarron commented Feb 4, 2017

First stab at the call script detail screen as well as hooks into the other systems.

  • Makes calls
  • Set called state on contacts and issues
  • Added checkmarks when those states are true

NOTE: Because we decided to pass around structs, we end up passing the values not references. So you'll see some messy loops through the Manager in the screen that I'll refactor into helpers on the Manager later this weekend. Wanted to make it work first.

simulator screen shot feb 4 2017 12 11 53 am

simulator screen shot feb 4 2017 12 11 11 am

simulator screen shot feb 4 2017 12 11 09 am

@subdigital
Copy link
Collaborator

ios 2017-02-04 07-10-56

Copy link
Collaborator

@subdigital subdigital left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice work! Just a few nitpicks.

.gitignore Outdated
@@ -1,6 +1,7 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
.DS_Store
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in your system gitignore ~/.gitignore_global

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL that is a thing

@IBOutlet weak var resultUnavailableBtn: UIButton!
@IBOutlet weak var resultVoicemailBtn: UIButton!
@IBOutlet weak var resultContactedBtn: UIButton!
@IBOutlet weak var resultSkipBtn: UIButton!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the interest of consistency, can you rename these to ...button ?

print("unknown button pressed")
}

// Struct passing around problems. This needs to be refactored / cleaned up.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙈 Indeed

if issuesManager.issuesList!.issues[i].id == self.issue.id {
issuesManager.issuesList!.issues[i].madeCalls = true
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I'm not married to structs tbh, it's just what I start with for JSON models. But the case could be made that we're using IssueManager.issuesList as an in memory data store, and that it should be mutable. That would avoid us having this code anywhere (helper or wherever).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing to consider is we will need some form of persistence soon, right now we use UserDefaults for your location settings which seems appropriate, but when it comes to saving these stats locally, we'll have to probably put them somewhere else (I was thinking of using @nickoneill's Pantry). However if we decided to just leverage a data store we could go with Realm or CoreData also. Food for thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oooh Pantry looks nice. All we really need to store is if we call certain issue IDs and contact IDs for those issues. Then we just need to pull in data. May try to implement that in a separate PR tonight or tomorrow.

}

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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(remove empty line)

var hasContacted: Bool
}

extension Contact: Hashable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we get Equatable for free w/ this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I forgot to pull these, I made it Hashable to put it in a Set but removed that code, but yes would make it Equatable as well.

@@ -42,6 +43,6 @@ extension Issue : JSONSerializable {

let contacts = contactsJSON.flatMap({ Contact(dictionary: $0) })

self.init(id: id, name: name, reason: reason, script: script, contacts: contacts)
self.init(id: id, name: name, reason: reason, script: script, contacts: contacts, madeCalls: false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's another thing worth considering:

  • JSON response -> structs -> immutable
  • Local app data -> classes -> mutable

Then you just merge these in view models when dealing w/ the UI. You have a lightweight set of mutable data that just refers to issue ids.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think that's the way to do it, very simple local app data that references the JSON Structs.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to handle that as a separate PR so we can merge this in? (last things I think are the padding + status bar style, which should be pretty quick)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah going to those separately. Padding is done.

@mccarron
Copy link
Collaborator Author

mccarron commented Feb 4, 2017

Padding improved!
simulator screen shot feb 4 2017 8 53 18 am

@subdigital subdigital merged commit 6b39098 into issue-detail Feb 4, 2017
@subdigital subdigital deleted the call-screen-detail branch February 4, 2017 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants