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
import UIKit | |
fileprivate class ImageSelectionController: NSObject { | |
static let shared = ImageSelectionController() | |
fileprivate var completionHandler: (UIImage?) -> Void = { _ in } | |
func selectImage(with sourceType: UIImagePickerControllerSourceType, in viewController: UIViewController, completionHandler: @escaping (UIImage?) -> Void) { | |
guard UIImagePickerController.isSourceTypeAvailable(sourceType) else { | |
completionHandler(nil) |
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
{ | |
"content": [{ | |
"sport": "BOXING", | |
"score": 1400, | |
"rank": 21, | |
"user": { | |
"id": "5966030e857aba0001bbf4c9", | |
"msisdn": null, | |
"firstName": null, | |
"lastName": null, |
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
func apply(viewModel: ViewModel) {} | |
apply(viewModel: .serverError(showRetryButton: true)) | |
apply(viewModel: .error(title: "Oops", description: "Something went wrong", showRetryButton: 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
enum ViewModel { | |
case normal(model: Model) | |
case error(title: String, description: String, showRetryButton: Bool) | |
} | |
extension ViewModel { | |
static func serverError(showRetryButton: Bool) -> ViewModel { | |
return .error(title: "Oops", description: "Something went wrong", showRetryButton: showRetryButton) | |
} | |
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
func apply(viewModel: ViewModel) {} | |
apply(viewModel: .serverError(showRetryButton: 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
enum ViewModel { | |
case normal(model: Model) | |
case error(title: String, description: String, showRetryButton: Bool) | |
} |
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
enum ViewModel { | |
case normal(model: Model) | |
case serverError(showRetryButton: Bool) | |
case noInternetConnection(showRetryButton: Bool) | |
} |
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
2017/07/11 17:00:54:970 Moya_Logger: [11/07/2017 17:00:54] Request: https://ranking.piq.com/api/ranking/rank/SKIING/friend/5964d221a7b11b0001a1d62d?forUserId=5964d169a7b11b0001a1d61c | |
2017/07/11 17:00:54:970 Moya_Logger: [11/07/2017 17:00:54] Request Headers: ["X-ISO-DATE": "2017-07-11T14:00:54.966Z", "X-DEBUG": "97b546ca-b1e5-4652-bcfa-e1f01e45a50f1499781654961RANKING/api/ranking/rank/SKIING/friend/5964d221a7b11b0001a1d62d", "X-SPORT": "RANKING", "X-AUTH": "DEVICE 97b546ca-b1e5-4652-bcfa-e1f01e45a50f:1373feeab8cd59cf0314174fed2cc904", "X-BUILD": "I_1.0_Device_iPhone 6s_en_US", "X-DATE": "1499781654961"] | |
2017/07/11 17:00:54:970 Moya_Logger: [11/07/2017 17:00:54] HTTP Request Method: GET | |
2017/07/11 17:00:54:984 Moya_Logger: [11/07/2017 17:00:54] Request: https://ranking.piq.com/api/ranking/argument/5964d221a7b11b0001a1d62d/finished | |
2017/07/11 17:00:54:984 Moya_Logger: [11/07/2017 17:00:54] Request Headers: ["X-ISO-DATE": "2017-07-11T14:00:54.982Z", "X-DEBUG": "97b546ca-b1e5-4652-bcfa-e1f01e45a50f1499781654 |
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
2017/07/11 16:35:40:878 Moya_Logger: [11/07/2017 16:35:40] Request: https://ranking.piq.com/api/ranking/rank/GOLF/friend/5964d169a7b11b0001a1d61c?forUserId=5964d169a7b11b0001a1d61c | |
2017/07/11 16:35:40:878 Moya_Logger: [11/07/2017 16:35:40] Request Headers: ["X-ISO-DATE": "2017-07-11T13:35:40.875Z", "X-DEBUG": "97b546ca-b1e5-4652-bcfa-e1f01e45a50f1499780140872RANKING/api/ranking/rank/GOLF/friend/5964d169a7b11b0001a1d61c", "X-SPORT": "RANKING", "X-AUTH": "DEVICE 97b546ca-b1e5-4652-bcfa-e1f01e45a50f:61a39d4f293afdd77ff6d8cc58072be8", "X-BUILD": "I_1.0_Device_iPhone 6s_en_US", "X-DATE": "1499780140872"] | |
2017/07/11 16:35:40:932 Moya_Logger: [11/07/2017 16:35:40] Response: <NSHTTPURLResponse: 0x17083f8c0> { URL: https://ranking.piq.com/api/ranking/rank/GOLF/friend/5964d169a7b11b0001a1d61c?forUserId=5964d169a7b11b0001a1d61c } { status code: 400, headers { | |
Connection = "keep-alive"; | |
"Content-Length" = 78; | |
"Content-Type" = "application/json"; | |
Date = "Tue, 11 Jul 2017 13:34:04 GMT"; | |
Server = "ngi |
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
017/07/10 12:32:57:651 Moya_Logger: [10/07/2017 12:32:57] Request: https://ranking.piq.com/api/ranking/argument/vote | |
2017/07/10 12:32:57:651 Moya_Logger: [10/07/2017 12:32:57] Request Headers: ["Content-Type": "application/json", "X-ISO-DATE": "2017-07-10T09:32:57.649Z", "X-AUTH": "DEVICE aa39cc82-94bf-4577-9957-690984ea425b:4d6ead0cc2d54e190d5bd94242a9e85f", "X-SPORT": "RANKING", "X-BUILD": "I_1.0_Device_iPhone 6s_ru_RU", "X-DATE": "1499679177647", "X-DEBUG": "aa39cc82-94bf-4577-9957-690984ea425b1499679177647RANKING/api/ranking/argument/vote"] | |
2017/07/10 12:32:57:651 Moya_Logger: [10/07/2017 12:32:57] HTTP Request Method: POST | |
2017/07/10 12:32:57:651 Moya_Logger: [10/07/2017 12:32:57] Request Body: {"argumentId":"596349b1a7b11b0001a1d502","userId":"595e58c2a7b11b0001d7ff9c","voteForUserId":"595e58c2a7b11b0001d7ff9c"} | |
2017/07/10 12:32:58:154 Moya_Logger: [10/07/2017 12:32:58] Response: <NSHTTPURLResponse: 0x17023efc0> { URL: https://ranking.piq.com/api/ranking/argument/vote } { status code: 200, headers |