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

Add logic for duping radar #75

Merged
merged 1 commit into from
Jun 23, 2017
Merged

Add logic for duping radar #75

merged 1 commit into from
Jun 23, 2017

Conversation

keith
Copy link
Member

@keith keith commented Jun 21, 2017

This adds a new window for duping a radar. It takes the ID of a radar,
searches OpenRadar for the details about it, and then fills the normal
UI with the values from it.

The complex part of this is what we put into what fields in the UI from
OpenRadar. The OpenRadar API just returns one big blog of summary data
(exactly how radarweb displays it), so instead of parsing that, we're
just filling the description with that.

It ends up looking a little weird since we're only filling 1 of the 5
text views, but it shouldn't be a big deal. Also OpenRadar doesn't vend
the area field sent to radar, so to default to something we just
choose "other".

@keith
Copy link
Member Author

keith commented Jun 21, 2017

Fixes #14

@keith keith force-pushed the ks/dup-radar branch 6 times, most recently from 61685eb to 34a5242 Compare June 21, 2017 06:06
@michaelochs
Copy link

michaelochs commented Jun 22, 2017

Wouldn't it make sense to try to parse the data from open radar and put it in the right fields (as in #76), and only if this fails fall back to this behavior here?

@keith
Copy link
Member Author

keith commented Jun 23, 2017

Any particular reason you think it's worth separating the text? In the end the display ends up the same (at least from our perspective, I'm not sure about internal to Apple employees)

@keith keith force-pushed the ks/dup-radar branch 2 times, most recently from 31a2459 to 462acc3 Compare June 23, 2017 06:27
@michaelochs
Copy link

It makes editing harder if it is not parsed since you have one relatively small field with all the info.

Also, what happens if I add text to another field? Then I have this paragraph two times in the resulting radar? Also it simply looks nicer. Opening a radar and seeing everything in this one field in brisk looks like a bug at first.

@michaelochs
Copy link

(Also I think the parser doesn't need to be rock solid. There is a fallback. So the parser can be improved over time to be able to parse more radars. Looking through open radar there seem to be a few different formats that people use.)

self?.showError(title: "No OpenRadar found",
message: "Couldn't find an OpenRadar with ID #\(id)")
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I got this error when little snitch blocked the request, think it's worth separating that case?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

}
}

public func radarID(from string: String) -> String? {
Copy link
Contributor

Choose a reason for hiding this comment

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

No top-level type that makes sense to scope this under?

Copy link
Member Author

Choose a reason for hiding this comment

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

It could be on a string extension if we wanted, not strong opinion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nah was hoping there was a Radar struct or something


for component in components {
if component.characters.last == ":",
let setter = sectionToSetter[String(component.characters.dropLast()).lowercased()]
Copy link
Contributor

Choose a reason for hiding this comment

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

Would guard this instead

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@@ -1,7 +1,12 @@
// swiftlint:disable line_length
Copy link
Contributor

Choose a reason for hiding this comment

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

ಠ_ಠ

Copy link
Member Author

Choose a reason for hiding this comment

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

moved

This adds a new window for duping a radar. It takes the ID of a radar,
searches OpenRadar for the details about it, and then fills the normal
UI with the values from it.

The complex part of this is what we put into what fields in the UI from
OpenRadar. The OpenRadar API just returns one big blog of summary data
(exactly how radarweb displays it), so instead of parsing that, we're
just filling the description with that.

It ends up looking a little weird since we're only filling 1 of the 5
text views, but it shouldn't be a big deal. Also OpenRadar doesn't vend
the `area` field sent to radar, so to default to something we just
choose "other".
@keith keith merged commit 80bc799 into master Jun 23, 2017
@keith keith deleted the ks/dup-radar branch June 23, 2017 08:51
@keith
Copy link
Member Author

keith commented Jun 23, 2017

@michaelochs I ended up parsing the common case here, and falling back to putting it all in the first text view in the failure case. If you have a chance please try this out on master and let me know what you think!

@michaelochs
Copy link

michaelochs commented Jun 23, 2017

Most of the radars seem to work nice. A couple I tried run into the error: e.g. rdar://32937801, rdar://32934061 – but they use a slightly different format, so that's okay I guess! Awesome feature! (And great app btw.)

@keith
Copy link
Member Author

keith commented Jun 23, 2017

Thanks 😄

So the first one there, I think I'm fine with not parsing. Even if we were a little more accepting, we still wouldn't get the Version field right there since they have iOS Version/Build:

The second case I think we should fix. I've seen quite a few radars that have an opening paragraph, but no heading for it, and then everything else is in the right format.

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.

None yet

3 participants