This repository was archived by the owner on Mar 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Develop #1
Open
intmain
wants to merge
9
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Develop #1
Changes from 7 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
b2cd611
인증 API, Issues API, Model (Issue, User) 추가.
91e816e
IssuesViewController 완
da76a5f
모든 기능 구션
fe7e016
loadmore 뷰 추가.
d7dc081
1차 추상
29bcc8e
리스트뷰 추상
bd491c1
헤더 셀 사이즈 계산 캐시.
61c3bbe
bitbucket 지원 완료
67fcdec
swiftlint 적용.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
|
|
||
| ## OS X files | ||
| .DS_Store | ||
| .DS_Store? | ||
| .Trashes | ||
| .Spotlight-V100 | ||
| *.swp | ||
|
|
||
| ## Xcode build files | ||
| DerivedData/ | ||
| build/ | ||
|
|
||
| ## Xcode private settings | ||
| *.pbxuser | ||
| !default.pbxuser | ||
| *.mode1v3 | ||
| !default.mode1v3 | ||
| *.mode2v3 | ||
| !default.mode2v3 | ||
| *.perspectivev3 | ||
| !default.perspectivev3 | ||
|
|
||
| xcuserdata/ | ||
|
|
||
| ## Other | ||
| *.xccheckout | ||
| *.moved-aside | ||
| *.xcuserstate | ||
| *.xcscmblueprint | ||
|
|
||
| ## Obj-C/Swift specific | ||
| *.hmap | ||
| *.ipa | ||
| *.dSYM.zip | ||
| *.dSYM | ||
|
|
||
| ## Swift Package Manager | ||
| .build/ | ||
|
|
||
| Pods/ | ||
| Podfile.lock |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
GithubIssues.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>BuildSystemType</key> | ||
| <string>Latest</string> | ||
| </dict> | ||
| </plist> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| // | ||
| // API.swift | ||
| // GithubIssues | ||
| // | ||
| // Created by Leonard on 2017. 9. 10.. | ||
| // Copyright © 2017년 intmain. All rights reserved. | ||
| // | ||
|
|
||
| import Foundation | ||
| import Alamofire | ||
| import SwiftyJSON | ||
|
|
||
|
|
||
| struct API { | ||
| static func getOauthKey(user: String, password: String, completionHandler: @escaping (DataResponse<JSON>) -> Void) { | ||
| var headers: HTTPHeaders = [:] | ||
| if let authorizationHeader = Request.authorizationHeader(user: user, password: password) { | ||
| headers[authorizationHeader.key] = authorizationHeader.value | ||
| } | ||
| let parameters: Parameters = ["client_secret": Router.clientSecret , "scopes": ["public_repo"], "note": "admin script" ] | ||
| Alamofire.request(Router.authKey(parameters, headers)) | ||
| .responseSwiftyJSON { json in | ||
| print(json) | ||
| completionHandler(json) | ||
| } | ||
| } | ||
|
|
||
| static func repoIssues(owner: String, repo: String, page: Int, completionHandler: @escaping (DataResponse<[Model.Issue]>) -> Void) { | ||
| let parameters: Parameters = ["page": page, "state": "all"] | ||
| Alamofire.request(Router.repoIssues(owner: owner, repo: repo, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| let result = dataResponse.map({ (json: JSON) -> [Model.Issue] in | ||
| return json.arrayValue.map{ | ||
| Model.Issue(json: $0) | ||
| } | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
| } | ||
|
|
||
| typealias IssueResponsesHandler = (DataResponse<[Model.Issue]>) -> Void | ||
| static func repoIssues(owner: String, repo: String) -> (Int, @escaping IssueResponsesHandler) -> Void { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typealias는 class 밖에 있는게 더 읽기 편할듯?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. API. IssueResponsesHandler 보다 IssueResponsesHandler가 나아보이나요? |
||
|
|
||
| return { (page: Int, handler: @escaping IssueResponsesHandler) in | ||
| let parameters: Parameters = ["page": page, "state": "all"] | ||
| Alamofire.request(Router.repoIssues(owner: owner, repo: repo, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| let result = dataResponse.map({ (json: JSON) -> [Model.Issue] in | ||
| return json.arrayValue.map{ | ||
| Model.Issue(json: $0) | ||
| } | ||
| }) | ||
| handler(result) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| typealias CommentResponsesHandler = (DataResponse<[Model.Comment]>) -> Void | ||
|
|
||
| static func issueComment(owner: String, repo: String, number: Int) -> (Int, @escaping CommentResponsesHandler) -> Void { | ||
| return { page, handler in | ||
| let parameters: Parameters = ["page": page] | ||
| Alamofire.request(Router.issueDetail(owner: owner, repo: repo, number: number, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| let result = dataResponse.map({ (json: JSON) -> [Model.Comment] in | ||
| return json.arrayValue.map{ | ||
| Model.Comment(json: $0) | ||
| } | ||
| }) | ||
| handler(result) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| static func issueDetail(owner: String, repo: String, number: Int, page: Int, completionHandler: @escaping (DataResponse<[Model.Comment]>) -> Void) { | ||
| let parameters: Parameters = ["page": page] | ||
| Alamofire.request(Router.issueDetail(owner: owner, repo: repo, number: number, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| let result = dataResponse.map({ (json: JSON) -> [Model.Comment] in | ||
| return json.arrayValue.map{ | ||
| Model.Comment(json: $0) | ||
| } | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
| } | ||
|
|
||
| static func createComment(owner: String, repo: String, number: Int, comment: String, completionHandler: @escaping (DataResponse<Model.Comment>) -> Void ) { | ||
| let parameters: Parameters = ["body": comment] | ||
| Alamofire.request(Router.createComment(owner: owner, repo: repo, number: number, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| let result = dataResponse.map({ (json: JSON) -> Model.Comment in | ||
| Model.Comment(json: json) | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
| } | ||
|
|
||
| static func createIssue(owner: String, repo: String, title: String, body: String, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void ) { | ||
| let parameters: Parameters = ["title": title, "body": body] | ||
| Alamofire.request(Router.createIssue(owner: owner, repo: repo, parameters: parameters)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| print(dataResponse.request?.url?.absoluteString) | ||
| let result = dataResponse.map({ (json: JSON) -> Model.Issue in | ||
| Model.Issue(json: json) | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
| } | ||
|
|
||
| static func closeIssue(owner: String, repo: String, number: Int, issue: Model.Issue, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void) { | ||
| var dict = issue.toDict | ||
| dict["state"] = Model.Issue.State.closed.display | ||
| Alamofire.request(Router.editIssue(owner: owner, repo: repo, number: number, parameters: dict)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| print(dataResponse.request?.url?.absoluteString) | ||
| let result = dataResponse.map({ (json: JSON) -> Model.Issue in | ||
| Model.Issue(json: json) | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| static func openIssue(owner: String, repo: String, number: Int, issue: Model.Issue, completionHandler: @escaping (DataResponse<Model.Issue>) -> Void) { | ||
| var dict = issue.toDict | ||
| dict["state"] = Model.Issue.State.open.display | ||
| Alamofire.request(Router.editIssue(owner: owner, repo: repo, number: number, parameters: dict)).responseSwiftyJSON { (dataResponse: DataResponse<JSON>) in | ||
| print(dataResponse.request?.url?.absoluteString) | ||
| let result = dataResponse.map({ (json: JSON) -> Model.Issue in | ||
| Model.Issue(json: json) | ||
| }) | ||
| completionHandler(result) | ||
| } | ||
|
|
||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,6 +16,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | |
|
|
||
| func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | ||
| // Override point for customization after application launch. | ||
|
|
||
|
|
||
| if !GlobalState.instance.isLoggedIn { | ||
| let loginViewController = LoginViewController.viewController | ||
| DispatchQueue.main.asyncAfter(deadline: .now() + 0.0, execute: { [weak self] in | ||
| self?.window?.rootViewController?.present(loginViewController, animated: false, completion: nil) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기야 말로 unowned로 써도 되겠네요? UIApplication.shared.delegate?.window?.rootViewController?.present(loginViewController, animated: false, completion: nil) |
||
| }) | ||
|
|
||
| } | ||
|
|
||
| return true | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "info" : { | ||
| "version" : 1, | ||
| "author" : "xcode" | ||
| } | ||
| } |
21 changes: 21 additions & 0 deletions
21
GithubIssues/Assets.xcassets/Octocat.imageset/Contents.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "images" : [ | ||
| { | ||
| "idiom" : "universal", | ||
| "filename" : "Octocat.png", | ||
| "scale" : "1x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "idiom" : "universal", | ||
| "scale" : "3x" | ||
| } | ||
| ], | ||
| "info" : { | ||
| "version" : 1, | ||
| "author" : "xcode" | ||
| } | ||
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뭔가 좀더 간단히 할 수 있을 것 같은데..