Skip to content

Commit

Permalink
Integrated LetterCase
Browse files Browse the repository at this point in the history
  • Loading branch information
rwbutler committed Aug 19, 2020
1 parent b6d269e commit 4250ec5
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 52 deletions.
6 changes: 5 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,16 @@ let package = Package(
.package(
url: "https://github.com/rwbutler/Hash",
from: "1.4.0"
),
.package(
url: "https://github.com/rwbutler/LetterCase",
from: "1.3.1"
)
],
targets: [
.target(
name: "SwiftQuiz",
dependencies: ["Hash"],
dependencies: ["Hash", "LetterCase"],
path: "code"
)
]
Expand Down
2 changes: 1 addition & 1 deletion code/SwiftQuiz.swift
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public class SwiftQuiz {
let answersURL = URL(fileURLWithPath: "answers.txt")
try? submission.description.data(using: .utf8)?.write(to: answersURL)
if let slackURL = quiz.configuration.markingURL {
let messagingService = SlackMessagingService(hookURL: slackURL)
let messagingService = QuizServices.messaging(hookURL: slackURL)
messagingService.message(submission.description) {
self.invokeCallback(with: .quizComplete)
}
Expand Down
47 changes: 0 additions & 47 deletions code/parsing/KeyDecodingStrategyAdditions.swift

This file was deleted.

8 changes: 6 additions & 2 deletions code/services/QuizServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import Foundation

public struct QuizServices {

public static func accessControl(_ quiz: Quiz) -> AccessControlService {
return DefaultAccessControlService(quiz: quiz)
}

public static var parsing: ParsingService {
return CodableParsingService()
}

public static func accessControl(_ quiz: Quiz) -> AccessControlService {
return DefaultAccessControlService(quiz: quiz)
static func messaging(hookURL: URL) -> MessagingService {
return SlackMessagingService(hookURL: hookURL)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
//

import Foundation
import LetterCase

class DefaultAccessControlService: AccessControlService {

Expand Down
12 changes: 12 additions & 0 deletions code/services/messaging/definition/MessagingService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// MessagingService.swift
//
//
// Created by Ross Butler on 17/08/2020.
//

import Foundation

protocol MessagingService {
func message(_ message: String, completion: @escaping () -> Void)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Foundation

class SlackMessagingService {
class SlackMessagingService: MessagingService {
let hookURL: URL

init(hookURL: URL) {
Expand Down

0 comments on commit 4250ec5

Please sign in to comment.