mirror of
https://github.com/AU-COVIDSafe/mobile-ios.git
synced 2025-04-20 05:25: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
57
CovidSafe/Feedback/Sources/ViewControllerFactory.swift
Normal file
57
CovidSafe/Feedback/Sources/ViewControllerFactory.swift
Normal file
|
@ -0,0 +1,57 @@
|
|||
// Copyright © 2020 Australian Government All rights reserved.
|
||||
|
||||
import UIKit
|
||||
|
||||
class ViewControllerFactory {
|
||||
|
||||
func createPropmtController(_ useCustomTransition: Bool, settings: FeedbackSettings? = nil) -> UIViewController {
|
||||
let title = NSLocalizedString("entryPrompt_alert_title",
|
||||
tableName: "Feedback",
|
||||
bundle: Bundle.main,
|
||||
comment: "Title for initial alert when feedback is launched"
|
||||
)
|
||||
|
||||
let message = NSLocalizedString("entryPrompt_alert_message",
|
||||
tableName: "Feedback",
|
||||
bundle: Bundle.main,
|
||||
comment: "Prompt message for initial alert when feedback is launched"
|
||||
)
|
||||
|
||||
let alertController: AlertController
|
||||
if UIScreen.main.traitCollection.horizontalSizeClass == .regular {
|
||||
alertController = AlertController.createAlertController(localizedTitle: title, localizedMessage: message)
|
||||
} else {
|
||||
alertController = AlertController.createAlertSheetController(localizedTitle: title, localizedMessage: message)
|
||||
}
|
||||
alertController.feedbackSettings = settings
|
||||
alertController.addNewFeedbackFlowAction()
|
||||
alertController.addCancelAction()
|
||||
alertController.useCustomTransition = useCustomTransition
|
||||
|
||||
return alertController
|
||||
}
|
||||
|
||||
func createNewFeedbackFlowControllerForScreenshotView(
|
||||
_ viewForScreenshot: UIView,
|
||||
settings: FeedbackSettings? = nil,
|
||||
onFlowDidFinish: (() -> Void)? = nil,
|
||||
onComplete: @escaping (NewFeedbackFlowController) -> Void
|
||||
) {
|
||||
// No-op
|
||||
}
|
||||
|
||||
func createNewFeedbackFlowController(
|
||||
_ settings: FeedbackSettings? = nil,
|
||||
onFlowDidFinish: (() -> Void)? = nil,
|
||||
onComplete: (NewFeedbackFlowController) -> Void
|
||||
) {
|
||||
do {
|
||||
let flowController = try NewFeedbackFlowController(screenshot: nil, settings: settings)
|
||||
flowController.onDidFinish = onFlowDidFinish
|
||||
onComplete(flowController)
|
||||
} catch {
|
||||
assertionFailure("\(error)".formattedLoggingStatement)
|
||||
onFlowDidFinish?()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue