FeedbackViewController.swift 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2023 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. import UIKit
  15. class FeedbackViewController: UIViewController {
  16. // TODO: Consider the situations where this instance is initiated once, and used
  17. // multiple times.
  18. var viewDidDisappearCallback: () -> Void = {}
  19. // (TODO) Can we make feedbackName and additionalFormText non-null?
  20. var releaseName: String?
  21. var additionalFormText: String?
  22. var image: UIImage?
  23. @IBOutlet var screenshotUIImageView: UIImageView!
  24. @IBOutlet var additionalFormTextLabel: UILabel!
  25. @IBOutlet var feedbackTextView: UITextView!
  26. @IBOutlet var navigationBar: UINavigationBar!
  27. override func viewDidLoad() {
  28. super.viewDidLoad()
  29. // Do any additional setup after loading the view.
  30. let additionalFormText = additionalFormText
  31. if additionalFormText != nil {
  32. additionalFormTextLabel.text = additionalFormText
  33. }
  34. let image = image
  35. if image != nil {
  36. screenshotUIImageView.image = image
  37. }
  38. }
  39. override func viewWillAppear(_ animated: Bool) {
  40. screenshotUIImageView.image = image
  41. image = nil
  42. }
  43. @IBAction func tappedSend(_ sender: Any) {}
  44. @IBAction func tappedCancel(_ sender: Any) {
  45. dismiss(animated: true)
  46. }
  47. override func viewDidDisappear(_ animated: Bool) {
  48. viewDidDisappearCallback()
  49. }
  50. }