mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-19 04:55:19 +00:00
COVIDSafe code from version 1.1
This commit is contained in:
commit
3640e52eb2
330 changed files with 261540 additions and 0 deletions
72
CovidSafe/Feedback/Sources/FeedbackSettings.swift
Normal file
72
CovidSafe/Feedback/Sources/FeedbackSettings.swift
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Copyright © 2020 Australian Government All rights reserved.
|
||||
|
||||
import CoreGraphics
|
||||
import Foundation
|
||||
|
||||
public var defaultFeedbackSettings: FeedbackSettings?
|
||||
|
||||
public struct FeedbackSettings {
|
||||
let JIRATarget: JMCTarget
|
||||
let issueType: String
|
||||
let issueComponents: [String]
|
||||
let customFields: [String: AnyObject]
|
||||
let reporterAvatarImage: CGImage?
|
||||
var reporterUsernameOrEmail: String?
|
||||
let getReporterInfoAsynchronously: ((@escaping (String?, URL?) -> Void) -> Void)?
|
||||
let navigationBarStyle: NavigationBarStyle
|
||||
|
||||
public init(
|
||||
JIRATarget: JMCTarget,
|
||||
issueType: String? = nil,
|
||||
issueComponents: [String]? = nil,
|
||||
customFields: [String: AnyObject]? = nil,
|
||||
navigationBarStyle: NavigationBarStyle,
|
||||
reporterAvatarImage: CGImage? = nil,
|
||||
reporterUsernameOrEmail: String? = nil,
|
||||
getReporterInfoAsynchronously: ((@escaping (_ usernameOrEmail: String?, _ avatarImageURL: URL?) -> Void) -> Void)? = nil
|
||||
) {
|
||||
let defaultIssueType = JIRAIssueType.support.rawValue
|
||||
let defaultIssueComponents = ["iOS"]
|
||||
let defaultCustomFields = [String: AnyObject]()
|
||||
|
||||
self.JIRATarget = JIRATarget
|
||||
self.issueType = (issueType ?? defaultFeedbackSettings?.issueType) ?? defaultIssueType
|
||||
self.issueComponents = (issueComponents ?? defaultFeedbackSettings?.issueComponents) ?? defaultIssueComponents
|
||||
self.customFields = (customFields ?? defaultFeedbackSettings?.customFields) ?? defaultCustomFields
|
||||
self.reporterAvatarImage = reporterAvatarImage ?? defaultFeedbackSettings?.reporterAvatarImage
|
||||
self.reporterUsernameOrEmail = reporterUsernameOrEmail ?? defaultFeedbackSettings?.reporterUsernameOrEmail
|
||||
self.getReporterInfoAsynchronously = getReporterInfoAsynchronously ?? defaultFeedbackSettings?.getReporterInfoAsynchronously
|
||||
self.navigationBarStyle = navigationBarStyle
|
||||
}
|
||||
|
||||
public init(
|
||||
issueType: String? = nil,
|
||||
issueComponents: [String]? = nil,
|
||||
customFields: [String: AnyObject]? = nil,
|
||||
navigationBarStyle: NavigationBarStyle = .defaultStyle,
|
||||
reporterAvatarImage: CGImage? = nil,
|
||||
reporterUsernameOrEmail: String? = nil,
|
||||
getReporterInfoAsynchronously: ((@escaping (_ usernameOrEmail: String?, _ avatarImageURL: URL?) -> Void) -> Void)? = nil
|
||||
) throws {
|
||||
let target = try defaultFeedbackSettings?.JIRATarget ?? JMCTarget.createTargetFromJSONOnDisk()
|
||||
self.init(
|
||||
JIRATarget: target,
|
||||
issueType: issueType,
|
||||
issueComponents: issueComponents,
|
||||
customFields: customFields,
|
||||
navigationBarStyle: navigationBarStyle,
|
||||
reporterAvatarImage: reporterAvatarImage,
|
||||
reporterUsernameOrEmail: reporterUsernameOrEmail,
|
||||
getReporterInfoAsynchronously: getReporterInfoAsynchronously
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public enum JIRAIssueType: String {
|
||||
case support = "Support"
|
||||
case bug = "Bug"
|
||||
case task = "Task"
|
||||
case improvement = "Improvement"
|
||||
case story = "Story"
|
||||
case epic = "Epic"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue