-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Brenner
committed
Jun 7, 2020
0 parents
commit ecfc48a
Showing
112 changed files
with
20,302 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
GitIssues.xcodeproj/project.xcworkspace/contents.xcworkspacedata
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
GitIssues.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains 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>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+32.5 KB
...odeproj/project.xcworkspace/xcuserdata/brenner.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
GitIssues.xcodeproj/xcuserdata/brenner.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains 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,14 @@ | ||
<?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>SchemeUserState</key> | ||
<dict> | ||
<key>GitIssues.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>3</integer> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+21.8 KB
GitIssues.xcworkspace/xcuserdata/brenner.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
Binary file not shown.
This file contains 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,37 @@ | ||
// | ||
// AppDelegate.swift | ||
// GitIssues | ||
// | ||
// Created by Brenner on 07/06/20. | ||
// Copyright © 2020 Brenner. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
|
||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
// Override point for customization after application launch. | ||
return true | ||
} | ||
|
||
// MARK: UISceneSession Lifecycle | ||
|
||
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { | ||
// Called when a new scene session is being created. | ||
// Use this method to select a configuration to create the new scene with. | ||
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) | ||
} | ||
|
||
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { | ||
// Called when the user discards a scene session. | ||
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. | ||
// Use this method to release any resources that were specific to the discarded scenes, as they will not return. | ||
} | ||
|
||
|
||
} | ||
|
98 changes: 98 additions & 0 deletions
98
GitIssues/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains 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,98 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "2x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"scale" : "3x", | ||
"size" : "60x60" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "20x20" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "29x29" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "40x40" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "1x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "76x76" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"scale" : "2x", | ||
"size" : "83.5x83.5" | ||
}, | ||
{ | ||
"idiom" : "ios-marketing", | ||
"scale" : "1x", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
This file contains 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" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
GitIssues/Assets.xcassets/gitHub - logo.imageset/Contents.json
This file contains 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" : [ | ||
{ | ||
"filename" : "b15eedbdafbbdbca3249e3942f4faf3b.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+46.4 KB
...ues/Assets.xcassets/gitHub - logo.imageset/b15eedbdafbbdbca3249e3942f4faf3b.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
GitIssues/Assets.xcassets/github-issues.imageset/Contents.json
This file contains 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" : [ | ||
{ | ||
"filename" : "github-issues.jpeg", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains 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,71 @@ | ||
// | ||
// GitIssuesDetailsViewController.swift | ||
// Challenge_GitIssues | ||
// | ||
// Created by Brenner on 06/06/20. | ||
// Copyright © 2020 Brenner. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
|
||
class GitIssuesDetailsViewController: UIViewController { | ||
|
||
@IBOutlet weak var ivAvatar: UIImageView! | ||
@IBOutlet weak var lbTitle: UILabel! | ||
@IBOutlet weak var lbCreatedAt: UILabel! | ||
@IBOutlet weak var lbBy: UILabel! | ||
@IBOutlet weak var tvDescription: UITextView! | ||
@IBOutlet weak var aiLoading: UIActivityIndicatorView! | ||
|
||
var userHtmlUrl: String! | ||
var issueHtmlUrl: String! | ||
var issue: Issue! | ||
let alamofireServices = AlamofireServices() | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
renderDetails() | ||
} | ||
|
||
|
||
@IBAction func openOnNavigator(_ sender: Any) { | ||
UIApplication.shared.open(URL(string: issue.htmlUrl)!, options: [:], completionHandler: nil) | ||
} | ||
|
||
@IBAction func goAuthorProfile(_ sender: Any) { | ||
UIApplication.shared.open(URL(string: issue.user.htmlUrl)!, options: [:], completionHandler: nil) | ||
|
||
} | ||
|
||
func formatDate(date: String) -> String { | ||
let formatter = DateFormatter() | ||
formatter.locale = Locale(identifier: "en_US_POSIX") // set locale to reliable US_POSIX | ||
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" | ||
let date = formatter.date(from: date)! | ||
formatter.dateFormat = "dd/MM/yyyy" | ||
formatter.locale = Locale(identifier: "pt-BR") // reset the locale | ||
let dateString = formatter.string(from: date) | ||
return dateString | ||
} | ||
|
||
func loadAvatar(){ | ||
aiLoading.startAnimating() | ||
alamofireServices.loadAvatar(imageUrl: issue.user.avatarUrl) { (image) in | ||
DispatchQueue.main.async { | ||
self.ivAvatar.image = image | ||
self.aiLoading.stopAnimating() | ||
self.aiLoading.isHidden = true | ||
} | ||
} | ||
} | ||
private func renderDetails(){ | ||
loadAvatar() | ||
lbTitle.text = issue.title | ||
tvDescription.text = issue.body | ||
lbBy.text = "By " + issue.user.login | ||
lbCreatedAt.text = "Created at: " + formatDate(date: issue.createdAt) | ||
} | ||
|
||
|
||
} |
This file contains 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,75 @@ | ||
// | ||
// GitIssuesTableViewController.swift | ||
// Challenge_GitIssues | ||
// | ||
// Created by Brenner on 06/06/20. | ||
// Copyright © 2020 Brenner. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
|
||
class GitIssuesTableViewController: UITableViewController { | ||
|
||
let alamofireServices = AlamofireServices() | ||
|
||
var issues: [Issue] = [] | ||
|
||
let spinner = UIActivityIndicatorView(style: .medium) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
} | ||
override func viewWillAppear(_ animated: Bool) { | ||
super.viewWillAppear(animated) | ||
|
||
self.spinner.startAnimating() | ||
self.tableView.backgroundView = self.spinner | ||
|
||
alamofireServices.loadIssues(onSuccess: { (issues) in | ||
self.issues = issues | ||
DispatchQueue.main.async { | ||
self.tableView.reloadData() | ||
self.spinner.stopAnimating() | ||
self.spinner.isHidden = true | ||
} | ||
}) { (error) in | ||
let alert = UIAlertController(title: "Something happened :(", message: "Restart the application and try again!", preferredStyle: .alert) | ||
let doneButton = UIAlertAction(title: "Ok!", style: .default, handler: nil) | ||
alert.addAction(doneButton) | ||
self.present(alert, animated: true, completion: nil) | ||
} | ||
} | ||
|
||
// MARK: - Table view data source | ||
|
||
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
// #warning Incomplete implementation, return the number of rows | ||
return issues.count | ||
} | ||
|
||
|
||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseCell", for: indexPath) | ||
|
||
let issue = issues[indexPath.row] | ||
cell.textLabel?.text = issue.title | ||
if IssueStatus.closed.rawValue == issue.state{ | ||
cell.detailTextLabel?.textColor = #colorLiteral(red: 1, green: 0, blue: 0, alpha: 1) | ||
} else{ | ||
cell.detailTextLabel?.textColor = #colorLiteral(red: 0.1960784346, green: 0.3411764801, blue: 0.1019607857, alpha: 1) | ||
|
||
} | ||
cell.detailTextLabel?.text = issue.state.uppercased() | ||
|
||
return cell | ||
} | ||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | ||
if segue.identifier == "detailsPage" { | ||
|
||
let vc = segue.destination as! GitIssuesDetailsViewController | ||
vc.issue = issues[tableView.indexPathForSelectedRow!.row] | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.