From 76db54bee81d6d46985e1688909c43df73a6c645 Mon Sep 17 00:00:00 2001 From: Dwayne Harris Date: Tue, 13 Nov 2018 01:21:45 -0800 Subject: [PATCH] Update Compose view controller --- .../AbstractStatusTableViewController.swift | 21 +-- elpha-ios/AttachmentManager.swift | 1 + elpha-ios/Base.lproj/Main.storyboard | 137 ++++++++---------- elpha-ios/ComposeViewController.swift | 44 +++++- .../FLAnimatedImageView+LoadImageURL.swift | 2 +- elpha-ios/MastodonAPI.swift | 4 +- elpha-ios/StatusView.xib | 9 ++ elpha-ios/TimelineTableViewController.swift | 20 +-- 8 files changed, 130 insertions(+), 108 deletions(-) diff --git a/elpha-ios/AbstractStatusTableViewController.swift b/elpha-ios/AbstractStatusTableViewController.swift index 8ea8ef3..c547278 100644 --- a/elpha-ios/AbstractStatusTableViewController.swift +++ b/elpha-ios/AbstractStatusTableViewController.swift @@ -26,19 +26,19 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega } } + func storyboard() -> UIStoryboard { + return UIStoryboard(name: "Main", bundle: nil) + } + func accountTapped(account: AccountMO) { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - - if let controller = storyboard.instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController { + if let controller = storyboard().instantiateViewController(withIdentifier: "AccountTableViewController") as? AccountTableViewController { controller.account = account self.navigationController?.pushViewController(controller, animated: true) } } func statusTapped(status: StatusMO) { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - - if let controller = storyboard.instantiateViewController(withIdentifier: "StatusTableViewController") as? StatusTableViewController { + if let controller = storyboard().instantiateViewController(withIdentifier: "StatusTableViewController") as? StatusTableViewController { controller.status = status self.navigationController?.pushViewController(controller, animated: true) } @@ -49,13 +49,14 @@ class AbstractStatusTableViewController: UITableViewController, StatusViewDelega } func replyTapped(status: StatusMO) { - performSegue(withIdentifier: "ComposeSegue", sender: self) + if let controller = storyboard().instantiateViewController(withIdentifier: "ComposeViewController") as? ComposeViewController { + controller.replyToStatus = status + present(controller, animated: true) + } } func attachmentTapped(status: StatusMO, index: Int) { - let storyboard = UIStoryboard(name: "Main", bundle: nil) - - if let controller = storyboard.instantiateViewController(withIdentifier: "AttachmentPageViewController") as? AttachmentPageViewController { + if let controller = storyboard().instantiateViewController(withIdentifier: "AttachmentPageViewController") as? AttachmentPageViewController { controller.status = status controller.attachmentIndex = index diff --git a/elpha-ios/AttachmentManager.swift b/elpha-ios/AttachmentManager.swift index dd059b6..23f5514 100644 --- a/elpha-ios/AttachmentManager.swift +++ b/elpha-ios/AttachmentManager.swift @@ -40,6 +40,7 @@ class AttachmentManager: NSObject { case 1: let attachment = attachments.firstObject as! AttachmentMO let imageView = FLAnimatedImageView() + imageView.contentMode = UIImageView.ContentMode.scaleAspectFill let tapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(attachmentTapped)) tapGestureRecognizer.delegate = self diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index a681866..e7b311c 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -1062,78 +1062,56 @@ - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - + - + - - + + - + @@ -1149,7 +1127,7 @@ - + @@ -1159,47 +1137,38 @@ - + - + - - - - - - - - - - + - + - + - +