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 @@
-
+
-
+
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
-
+
+
+
-
+
-
-
+
-
@@ -1255,7 +1232,7 @@
-
+
@@ -1263,13 +1240,26 @@
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
@@ -1285,6 +1275,7 @@
+
@@ -1292,7 +1283,7 @@
-
+
@@ -1303,7 +1294,7 @@
-
+
@@ -1351,7 +1342,6 @@
-
@@ -1724,7 +1714,7 @@
-
+
@@ -1851,6 +1841,7 @@
+
diff --git a/elpha-ios/ComposeViewController.swift b/elpha-ios/ComposeViewController.swift
index fc651ea..bf1fa53 100644
--- a/elpha-ios/ComposeViewController.swift
+++ b/elpha-ios/ComposeViewController.swift
@@ -15,16 +15,27 @@ class ComposeViewController: UIViewController {
@IBOutlet var replyToDisplayNameLabel: UILabel!
@IBOutlet var replyToUsernameLabel: UILabel!
@IBOutlet var replyToContentTextView: UITextViewFixed!
- @IBOutlet var statusTextField: UITextField!
+ @IBOutlet var statusTextView: UITextView!
@IBOutlet var statusCharacterCountLabel: UILabel!
@IBOutlet var contentWarningTextField: UITextField!
@IBOutlet var tootButton: UIButton!
+ @IBOutlet var bottomConstraint: NSLayoutConstraint!
var replyToStatus: StatusMO? = nil
override func viewDidLoad() {
super.viewDidLoad()
+ replyToAvatarImageView.layer.cornerRadius = 10
+ replyToAvatarImageView.layer.masksToBounds = true
+
+ statusTextView.layer.cornerRadius = 10
+ statusTextView.layer.masksToBounds = true
+
+ statusTextView.delegate = self
+
+ NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
+
if let replyToStatus = replyToStatus {
replyToView.isHidden = false
@@ -38,9 +49,13 @@ class ComposeViewController: UIViewController {
}
}
+ deinit {
+ NotificationCenter.default.removeObserver(self)
+ }
+
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
- statusTextField.becomeFirstResponder()
+ statusTextView.becomeFirstResponder()
}
func setupReplyTo(status: StatusMO) {
@@ -50,15 +65,30 @@ class ComposeViewController: UIViewController {
replyToUsernameLabel.text = "@\(account.acct!)"
}
- replyToContentTextView.attributedText = status.content?.htmlAttributed(size: 15.0)
+ replyToContentTextView.attributedText = status.content?.htmlAttributed(size: 13.0)
}
- @IBAction func statusTextFieldEdited(_ sender: Any) {
- let characters = statusTextField.text!.count
- statusCharacterCountLabel.text = String(500 - characters)
+ @objc func keyboardNotification(notification: NSNotification) {
+ if let userInfo = notification.userInfo {
+ let endFrame = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue
+ let endFrameY = endFrame?.origin.y ?? 0
+
+ if endFrameY >= UIScreen.main.bounds.size.height {
+ bottomConstraint.constant = 50.0
+ } else {
+ bottomConstraint.constant = endFrame?.size.height ?? 0.0
+ }
+ }
}
-
+
@IBAction func dismissTapped(_ sender: Any) {
dismiss(animated: true)
}
}
+
+extension ComposeViewController: UITextViewDelegate {
+ func textViewDidChange(_ textView: UITextView) {
+ let characters = statusTextView.text!.count
+ statusCharacterCountLabel.text = String(500 - characters)
+ }
+}
diff --git a/elpha-ios/FLAnimatedImageView+LoadImageURL.swift b/elpha-ios/FLAnimatedImageView+LoadImageURL.swift
index 93371e3..44a2339 100644
--- a/elpha-ios/FLAnimatedImageView+LoadImageURL.swift
+++ b/elpha-ios/FLAnimatedImageView+LoadImageURL.swift
@@ -63,7 +63,7 @@ extension FLAnimatedImageView {
if let data = response.data {
DispatchQueue.main.async {
ImageCache.set(url: url, data: data)
- self.contentMode = .scaleAspectFit
+ self.contentMode = .scaleAspectFill
if url.absoluteString.hasSuffix(".gif") {
self.animatedImage = FLAnimatedImage(animatedGIFData: data)
diff --git a/elpha-ios/MastodonAPI.swift b/elpha-ios/MastodonAPI.swift
index b3c618d..e5b9abb 100644
--- a/elpha-ios/MastodonAPI.swift
+++ b/elpha-ios/MastodonAPI.swift
@@ -66,7 +66,7 @@ class MastodonAPI {
return []
}
- let regex = try! NSRegularExpression(pattern: "<[\\S]+(?:max_id|since_id)=([0-9]+)[\\S]*>; rel=\"(next|prev)\"", options: .caseInsensitive)
+ let regex = try! NSRegularExpression(pattern: "<[\\S]+(?:max_id|since_id|min_id)=([0-9]+)[\\S]*>; rel=\"(next|prev)\"", options: .caseInsensitive)
let matches = regex.matches(in: link, options: [], range: NSRange(location: 0, length: link.count))
return matches.map { match in
let statusRange = match.range(at: 1)
@@ -103,7 +103,7 @@ class MastodonAPI {
if let pagination = pagination {
switch pagination.direction {
case .prev:
- parameters["since_id"] = pagination.statusID
+ parameters["min_id"] = pagination.statusID
case .next:
parameters["max_id"] = pagination.statusID
}
diff --git a/elpha-ios/StatusView.xib b/elpha-ios/StatusView.xib
index 87a936c..1e95e35 100644
--- a/elpha-ios/StatusView.xib
+++ b/elpha-ios/StatusView.xib
@@ -271,10 +271,14 @@
+
+
+
+
@@ -565,6 +569,11 @@
+
+
+
+
+
diff --git a/elpha-ios/TimelineTableViewController.swift b/elpha-ios/TimelineTableViewController.swift
index 339cf04..ee63e24 100644
--- a/elpha-ios/TimelineTableViewController.swift
+++ b/elpha-ios/TimelineTableViewController.swift
@@ -16,8 +16,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
var feedbackGenerator: UINotificationFeedbackGenerator? = nil
var fetchedResultsController: NSFetchedResultsController? = nil
- var replyToStatus: StatusMO? = nil
-
override var currentPaginationContext: String {
get {
guard let timeline = AuthenticationManager.session?.timeline, let categoryString = timeline.category else {
@@ -101,11 +99,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
}
}
- override func replyTapped(status: StatusMO) {
- replyToStatus = status
- performSegue(withIdentifier: "ComposeSegue", sender: self)
- }
-
@objc func openSettings() {
let storyboard = UIStoryboard(name: "Main", bundle: nil)
@@ -119,8 +112,11 @@ class TimelineTableViewController: AbstractStatusTableViewController {
}
@objc func compose() {
- replyToStatus = nil
- performSegue(withIdentifier: "ComposeSegue", sender: self)
+ let storyboard = UIStoryboard(name: "Main", bundle: nil)
+
+ if let controller = storyboard.instantiateViewController(withIdentifier: "ComposeViewController") as? ComposeViewController {
+ present(controller, animated: true)
+ }
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
@@ -129,12 +125,6 @@ class TimelineTableViewController: AbstractStatusTableViewController {
destination.delegate = self
}
}
-
- if segue.identifier == "ComposeSegue" {
- if let destination = segue.destination as? ComposeViewController {
- destination.replyToStatus = replyToStatus
- }
- }
}
func createDefaultTimelines(account: AccountMO) {