Githawk: Linking to Repos in App

Created on 9 Oct 2018  ·  14Comments  ·  Source: GitHawkApp/GitHawk

Do you all think it would be a good idea to intercept links to repos in repository ReadMe's and open a RepositoryViewController instead of re-directing the user to Github.com? Eg when a user clicks the Apollo Codegen link in GitHawk's ReadMe? There's already a workflow in place that we use for shortlinks, seems like it would be a matter of writing a regex and wiring it up.

🆕 feature request 🐞 github bug

Most helpful comment

Ya I almost think adding the ability to init a new repo VC without a branch would be good. Make it optional and the VC fetches it?

Sent with GitHawk

All 14 comments

for further clarification:

instead of opening repo links in safari:
ezgif com-video-to-gif 2

we could open the links in GitHawk:
ezgif com-video-to-gif 3

@BrianLitwin yes! that would be great

@rnystrom @Huddie After the user clicks a repository link, we gotta go grab the defaultBranchRef + hasIssuesEnabled info from graphql before opening the RepositoryViewController... I'm currently throwing a spinner here... lmk y'alls thoughts or if you have a better idea of how to keep the UI interactive while this quick fetch happens -->

ezgif com-video-to-gif 4

screenshot 2018-10-14 08 54 03

The reason I use a .largeWhite spinner instead of a smaller one like we use elsewhere is because we are overlaying the spinner on top of text, ie for visibility. Most of the other places we use spinners they are against a white background.

Cool stuff! The spinner seems different from the regular one which Idk how I feel about. I get that throwing a spinner on the view could get lost in the text and that’s why you prob opted to go with a spinner with a background view behind it.
Maybe open repositoryViewController right away and have it load then? So it’s empty with the regular spinner rather than waiting on the previous page for the load.

Kind of link how the redirect works currently. Opens safari right away and then loads the webpage.

Sent with GitHawk

Ya I almost think adding the ability to init a new repo VC without a branch would be good. Make it optional and the VC fetches it?

Sent with GitHawk

^^ yup

Sent with GitHawk

@Huddie @rnystrom .. I'm fine with that.. only caveat is that after fetching the graphql info, graphql could return an error or "repo not found" and the process would like:

  • user taps link
  • segue to empty repo view controller
  • fetch repo info
  • fetch fails
  • segue to safari view controller

An example of that is with our Apollo-codegen link.. the repo was renamed and GraphQL responds with "repo not found"

I think the empty vc approach is still the right move, just have to make it seamless if loading the repo fails.

You could present the Safari VC as a modal with a fade, then pop the repo view controller without animation once the Safari VC is completely visible.

🤔 maybe an alert saying “repo not found, try opening in web” with a button that when clicked will redirect you? Or I guess you could just redirect them 🤷‍♂️

Sent with GitHawk

@BrianLitwin so V3 handles the rename but GraphQL doesn't?

@rnystrom yes that seems to be the case that the renamed repo works w/ v3 but not GraphQL.

I'll try to file an issue w/ GitHub on this

Haha @rnystrom if you/they want a test case to copy/paste in the GraphQL Explorer:

query($owner:String!, $name:String!) {
repository(owner:$owner, name:$name) {
    hasIssuesEnabled
  }
}
{ "owner": "apollographql", "name": "apollo-codegen" }



md5-0890978384c620b70feee15af091a2c0



Could not resolve to a Repository with the name 'apollo-codegen'

just to track my thinking/progress on this:

the repoDetails object that a RepoViewController needs to initialize is:

struct RepositoryDetails: Codable, Equatable {
    let owner: String
    let name: String
    let defaultBranch: String
    let hasIssuesEnabled: Bool
}

If we recognize a url that looks like a repository url in the markdown of a README, we can get owner and name. Now if somebody taps the link we want to push a RepositoryViewController instead of linking to a safari webview.

RepositoryViewController currently looks like:

    private let repo: RepositoryDetails
    private let client: GithubClient
    private let controllers: [UIViewController] 
    private var bookmarkNavController: BookmarkNavigationController?
    public private(set) var branch: String

    init(client: GithubClient, repo: RepositoryDetails) { ... }

Ya I almost think adding the ability to init a new repo VC without a branch would be good. Make it optional and the VC fetches it?

So I'm hesitant to use a failable initializer/ fetching defaultBranch and hasIssuesEnabled from RepoVC because we'd have to change let repo: RepositoryDetails to var repo: RepositoryDetails?' and make let controllers a var too (since it requires hasIssuesEnabled to know whether to include an IssuesVC). That feels like a compromise that out-weighs the benefits.

I haven't had any luck tho pushing an empty VC w/ a loading spinner and then pushing the RepoVC on top of it with no animation or a fade-in. It looks okay but not sharp.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BasThomas picture BasThomas  ·  3Comments

BasThomas picture BasThomas  ·  3Comments

rnystrom picture rnystrom  ·  3Comments

rizwankce picture rizwankce  ·  3Comments

jessesquires picture jessesquires  ·  3Comments