[ABANDONED] Mastodon iOS client.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.7 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // AttachmentViewController.swift
  3. // elpha-ios
  4. //
  5. // Created by Dwayne Harris on 11/1/18.
  6. // Copyright © 2018 Elpha. All rights reserved.
  7. //
  8. import Kingfisher
  9. import UIKit
  10. class AttachmentViewController: UIViewController {
  11. @IBOutlet var attachmentScrollView: UIScrollView!
  12. @IBOutlet var attachmentImageView: UIImageView!
  13. @IBOutlet var statusTextView: UITextView!
  14. var attachment: AttachmentMO?
  15. @IBAction func closeTapped(_ sender: Any) {
  16. if let controller = self.parent as? AttachmentPageViewController {
  17. controller.dismissController()
  18. }
  19. }
  20. @IBAction func shareTapped(_ sender: Any) {
  21. if let image = attachmentImageView.image {
  22. let controller = UIActivityViewController(activityItems: [image], applicationActivities: nil)
  23. present(controller, animated: true)
  24. }
  25. }
  26. override func viewDidLoad() {
  27. super.viewDidLoad()
  28. if let attachment = attachment {
  29. attachmentScrollView.delegate = self
  30. attachmentImageView.kf.indicatorType = .activity
  31. attachmentImageView.kf.setImage(with: attachment.url!)
  32. if let content = attachment.status?.content {
  33. statusTextView.attributedText = content.htmlAttributed(size: 14, centered: true, color: UIColor.white)
  34. }
  35. }
  36. }
  37. override var preferredStatusBarStyle: UIStatusBarStyle {
  38. return .lightContent
  39. }
  40. override var prefersStatusBarHidden: Bool {
  41. return true
  42. }
  43. }
  44. extension AttachmentViewController: UIScrollViewDelegate {
  45. func viewForZooming(in scrollView: UIScrollView) -> UIView? {
  46. return attachmentImageView
  47. }
  48. }