[WIP] Refactor networking to shared lib (#1602)

* [WIP] Refactor networking to shared lib

* notification models as codable and tests

* default request params

* break out into files

* fix tests

* check notification values

* add milestones

* add milestone response

* repo notifications

* refactor v3 response

* refactor to support passing response to response initializer

* add release fetch and model

* add examples from githawk

* notifications working

* almost all notifications requests migrated

* finish notification migration, add graphql request/response

* replace issue requests

* replace milestones request

* fetch assignees migrated

* readme fetch migrated

* migrate badge request

* delete unused request from client

* remove paging

* nearly done w/ migration

* local build green

* refactor gql fetches, replace mutations

* build green, slim down client

* strip session manager from client

* everything working
This commit is contained in:
Ryan Nystrom
2018-03-04 21:35:36 -05:00
committed by GitHub
parent 9bd61354dd
commit 45335eb4a0
203 changed files with 24309 additions and 3742 deletions

View File

@@ -8,6 +8,7 @@
import UIKit
import IGListKit
import GitHubAPI
class RepositoryOverviewViewController: BaseListViewController<NSString>,
BaseListViewControllerDataSource {
@@ -40,20 +41,22 @@ BaseListViewControllerDataSource {
override func fetch(page: NSString?) {
let repo = self.repo
let width = view.bounds.width
client.fetchReadme { [weak self] result in
client.githubClient.client
.send(V3RepositoryReadmeRequest(owner: repo.owner, repo: repo.name)) { [weak self] result in
switch result {
case .error:
self?.error(animated: trueUnlessReduceMotionEnabled)
case .success(let readme):
case .success(let response):
DispatchQueue.global().async {
let options = GitHubMarkdownOptions(owner: repo.owner, repo: repo.name, flavors: [.baseURL])
let models = CreateCommentModels(markdown: readme, width: width, options: options)
let models = CreateCommentModels(markdown: response.data.content, width: width, options: options)
let model = RepositoryReadmeModel(models: models)
DispatchQueue.main.async { [weak self] in
self?.readme = model
self?.update(animated: trueUnlessReduceMotionEnabled)
}
}
case .failure:
self?.error(animated: trueUnlessReduceMotionEnabled)
}
}
}