diff --git a/elpha-ios.xcodeproj/project.pbxproj b/elpha-ios.xcodeproj/project.pbxproj index 8f0abb7..053d252 100644 --- a/elpha-ios.xcodeproj/project.pbxproj +++ b/elpha-ios.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 15131EF6216DBA820092B252 /* AccountNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15131EF5216DBA820092B252 /* AccountNavigationController.swift */; }; 151AD4D9216899AD00F07403 /* AlamofireImage.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1517EA842159D72200DE80D6 /* AlamofireImage.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 151AD4E621689A0F00F07403 /* Alamofire.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 157405C3215890BC00EEAAEB /* Alamofire.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 15222807219D37A500D2E5A6 /* ComposeAccessoryView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */; }; 152734D22186DC74003DB3C8 /* TimelinesViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152734D12186DC74003DB3C8 /* TimelinesViewController.swift */; }; 152FB0F8218ADC1A001D6574 /* AttachmentPageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FB0F7218ADC1A001D6574 /* AttachmentPageViewController.swift */; }; 152FB0FA218ADDD0001D6574 /* AttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FB0F9218ADDD0001D6574 /* AttachmentViewController.swift */; }; @@ -25,7 +26,7 @@ 152FBCF2219818AD0079B3E8 /* FieldTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 152FBCF1219818AD0079B3E8 /* FieldTableViewCell.swift */; }; 1539509121894A38009BA6E7 /* AlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1539509021894A38009BA6E7 /* AlertManager.swift */; }; 156902A0219A7D75002BF61F /* ComposeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1569029F219A7D75002BF61F /* ComposeViewController.swift */; }; - 156902B3219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */; }; + 156902B3219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */; }; 156FF015217289380074D9CA /* AccountTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF014217289380074D9CA /* AccountTableViewCell.swift */; }; 156FF0312174797E0074D9CA /* StatusTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF0302174797E0074D9CA /* StatusTableViewController.swift */; }; 156FF04F2175CDBC0074D9CA /* MainStatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 156FF04E2175CDBC0074D9CA /* MainStatusTableViewCell.swift */; }; @@ -53,6 +54,7 @@ 15960E7E21329FED00C38CE9 /* AuthenticateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E7D21329FED00C38CE9 /* AuthenticateViewController.swift */; }; 15960E822136668500C38CE9 /* TimelinesNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E812136668500C38CE9 /* TimelinesNavigationController.swift */; }; 15960E84213774FC00C38CE9 /* InstancesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */; }; + 159B553A219D11E600964AC0 /* ComposeAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */; }; 15A79B2E215C63B6007A326E /* AlamofireImage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1517EA842159D72200DE80D6 /* AlamofireImage.framework */; }; 15A79B43215EB959007A326E /* CoreDataManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15A79B42215EB959007A326E /* CoreDataManager.swift */; }; 15B127922192467F00F4EF1D /* String+HtmlAttributed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */; }; @@ -249,6 +251,7 @@ 15131EF3216DB8B90092B252 /* AccountTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTableViewController.swift; sourceTree = ""; }; 15131EF5216DBA820092B252 /* AccountNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountNavigationController.swift; sourceTree = ""; }; 1517EA6F2159D72200DE80D6 /* AlamofireImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AlamofireImage.xcodeproj; path = Frameworks/AlamofireImage/AlamofireImage.xcodeproj; sourceTree = ""; }; + 15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeAccessoryView.swift; sourceTree = ""; }; 1522EC752193EBA10082C3FA /* AlamofireNetworkActivityIndicator.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = AlamofireNetworkActivityIndicator.xcodeproj; path = Frameworks/AlamofireNetworkActivityIndicator/AlamofireNetworkActivityIndicator.xcodeproj; sourceTree = ""; }; 152734D12186DC74003DB3C8 /* TimelinesViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesViewController.swift; sourceTree = ""; }; 152FB0F7218ADC1A001D6574 /* AttachmentPageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AttachmentPageViewController.swift; sourceTree = ""; }; @@ -259,7 +262,7 @@ 152FBCF1219818AD0079B3E8 /* FieldTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FieldTableViewCell.swift; sourceTree = ""; }; 1539509021894A38009BA6E7 /* AlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertManager.swift; sourceTree = ""; }; 1569029F219A7D75002BF61F /* ComposeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComposeViewController.swift; sourceTree = ""; }; - 156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FLAnimatedImageView+LoadImageURL.swift"; sourceTree = ""; }; + 156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FLAnimatedImageView+SetImage.swift"; sourceTree = ""; }; 156FF014217289380074D9CA /* AccountTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountTableViewCell.swift; sourceTree = ""; }; 156FF0302174797E0074D9CA /* StatusTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewController.swift; sourceTree = ""; }; 156FF04E2175CDBC0074D9CA /* MainStatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainStatusTableViewCell.swift; sourceTree = ""; }; @@ -289,6 +292,7 @@ 15960E7D21329FED00C38CE9 /* AuthenticateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthenticateViewController.swift; sourceTree = ""; }; 15960E812136668500C38CE9 /* TimelinesNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelinesNavigationController.swift; sourceTree = ""; }; 15960E83213774FC00C38CE9 /* InstancesTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstancesTableViewController.swift; sourceTree = ""; }; + 159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ComposeAccessoryView.xib; sourceTree = ""; }; 15A79B42215EB959007A326E /* CoreDataManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoreDataManager.swift; sourceTree = ""; }; 15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+HtmlAttributed.swift"; sourceTree = ""; }; 15B127A22192486200F4EF1D /* UIColor+HexString.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+HexString.swift"; sourceTree = ""; }; @@ -358,6 +362,8 @@ children = ( 15C91A03216AB32500D97DC3 /* AlertView.swift */, 15C91A01216AB2D600D97DC3 /* AlertView.xib */, + 15222806219D37A500D2E5A6 /* ComposeAccessoryView.swift */, + 159B5539219D11E600964AC0 /* ComposeAccessoryView.xib */, 15131EF1216D8D570092B252 /* StatusView.swift */, 15131ED7216D8C680092B252 /* StatusView.xib */, ); @@ -382,7 +388,7 @@ isa = PBXGroup; children = ( 159026CF2163069600D362DD /* Date+TimeAgo.swift */, - 156902B2219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift */, + 156902B2219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift */, 15B127912192467F00F4EF1D /* String+HtmlAttributed.swift */, 15B127A22192486200F4EF1D /* UIColor+HexString.swift */, ); @@ -731,6 +737,7 @@ buildActionMask = 2147483647; files = ( 15960E67213145E200C38CE9 /* LaunchScreen.storyboard in Resources */, + 159B553A219D11E600964AC0 /* ComposeAccessoryView.xib in Resources */, 15C91A02216AB2D600D97DC3 /* AlertView.xib in Resources */, 15960E64213145E200C38CE9 /* Assets.xcassets in Resources */, 157405B12151A5DA00EEAAEB /* README.md in Resources */, @@ -759,6 +766,7 @@ 15131EF4216DB8B90092B252 /* AccountTableViewController.swift in Sources */, 156902A0219A7D75002BF61F /* ComposeViewController.swift in Sources */, 15F998352162C0E8009E58DA /* MastodonDataManager.swift in Sources */, + 15222807219D37A500D2E5A6 /* ComposeAccessoryView.swift in Sources */, 15960E7A2132387A00C38CE9 /* MainTabBarController.swift in Sources */, 15960E7C213272CD00C38CE9 /* AuthenticationManager.swift in Sources */, 15B127922192467F00F4EF1D /* String+HtmlAttributed.swift in Sources */, @@ -780,7 +788,7 @@ 159026D02163069600D362DD /* Date+TimeAgo.swift in Sources */, 152FBCD2219682E80079B3E8 /* AbstractStatusTableViewController.swift in Sources */, 15A79B43215EB959007A326E /* CoreDataManager.swift in Sources */, - 156902B3219A8A1C002BF61F /* FLAnimatedImageView+LoadImageURL.swift in Sources */, + 156902B3219A8A1C002BF61F /* FLAnimatedImageView+SetImage.swift in Sources */, 15BB72AB2171A8D4002F1FA4 /* TimelinesTableViewCell.swift in Sources */, 1574148D2169AD0100C841BD /* AttachmentManager.swift in Sources */, 156FF015217289380074D9CA /* AccountTableViewCell.swift in Sources */, diff --git a/elpha-ios/AccountTableViewController.swift b/elpha-ios/AccountTableViewController.swift index 486a02f..92d505b 100644 --- a/elpha-ios/AccountTableViewController.swift +++ b/elpha-ios/AccountTableViewController.swift @@ -107,7 +107,7 @@ class AccountTableViewController: AbstractStatusTableViewController { } if let avatarURL = account.avatarURL { - avatarImageView.loadImageURL(avatarURL) + avatarImageView.setImage(withURL: avatarURL, withShadow: true) } displayNameLabel.text = account.displayName @@ -139,10 +139,6 @@ class AccountTableViewController: AbstractStatusTableViewController { refreshControl?.addTarget(self, action: #selector(self.fetch), for: .valueChanged) fieldTableViewController = FieldTableViewController() - avatarImageView.layer.shadowColor = UIColor.black.cgColor - avatarImageView.layer.shadowOpacity = 0.8 - avatarImageView.layer.shadowOffset = CGSize.zero - avatarImageView.layer.shadowRadius = 10 avatarImageView.layer.cornerRadius = 10 avatarImageView.layer.masksToBounds = true diff --git a/elpha-ios/AttachmentManager.swift b/elpha-ios/AttachmentManager.swift index 23f5514..90b25f8 100644 --- a/elpha-ios/AttachmentManager.swift +++ b/elpha-ios/AttachmentManager.swift @@ -51,7 +51,7 @@ class AttachmentManager: NSObject { imageView.addGestureRecognizer(tapGestureRecognizer) imageView.isUserInteractionEnabled = true - imageView.loadImageURL(attachment.url!) + imageView.setImage(withURL: attachment.url!) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false @@ -80,7 +80,7 @@ class AttachmentManager: NSObject { imageView.addGestureRecognizer(tapGestureRecognizer) imageView.isUserInteractionEnabled = true - imageView.loadImageURL((attachments[index] as! AttachmentMO).url!) + imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false @@ -115,7 +115,7 @@ class AttachmentManager: NSObject { imageView.addGestureRecognizer(tapGestureRecognizer) imageView.isUserInteractionEnabled = true - imageView.loadImageURL((attachments[index] as! AttachmentMO).url!) + imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false @@ -160,7 +160,7 @@ class AttachmentManager: NSObject { imageView.addGestureRecognizer(tapGestureRecognizer) imageView.isUserInteractionEnabled = true - imageView.loadImageURL((attachments[index] as! AttachmentMO).url!) + imageView.setImage(withURL: (attachments[index] as! AttachmentMO).url!) view.addSubview(imageView) imageView.translatesAutoresizingMaskIntoConstraints = false diff --git a/elpha-ios/AttachmentViewController.swift b/elpha-ios/AttachmentViewController.swift index 0910fb1..61ea4b8 100644 --- a/elpha-ios/AttachmentViewController.swift +++ b/elpha-ios/AttachmentViewController.swift @@ -34,7 +34,7 @@ class AttachmentViewController: UIViewController { if let attachment = attachment { attachmentScrollView.delegate = self - attachmentImageView.loadImageURL(attachment.url!) + attachmentImageView.setImage(withURL: attachment.url!, withShadow: false, withContentMode: .scaleAspectFit) if let content = attachment.status?.content { statusTextView.attributedText = content.htmlAttributed(size: 14, centered: true, color: UIColor.white) diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index 29de9a5..16c15f6 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -1144,44 +1144,8 @@ - - - - - - - - - - - - - - - - - - + @@ -1208,16 +1172,13 @@ - - + - - @@ -1279,7 +1240,6 @@ - @@ -1523,6 +1483,7 @@ + @@ -1653,6 +1614,11 @@ + + + + + @@ -1833,7 +1799,6 @@ - @@ -1845,7 +1810,6 @@ - diff --git a/elpha-ios/ComposeAccessoryView.swift b/elpha-ios/ComposeAccessoryView.swift new file mode 100644 index 0000000..1c18073 --- /dev/null +++ b/elpha-ios/ComposeAccessoryView.swift @@ -0,0 +1,54 @@ +// +// ComposeAccessoryView.swift +// elpha-ios +// +// Created by Dwayne Harris on 11/14/18. +// Copyright © 2018 Elpha. All rights reserved. +// + +import UIKit + +protocol ComposeAccessoryViewDelegate { + func attachmentTapped() + func visibilityTapped() + func tootTapped() +} + +class ComposeAccessoryView: UIView { + @IBOutlet var contentView: UIView! + @IBOutlet var attachmentButton: UIButton! + @IBOutlet var visibilityButton: UIButton! + @IBOutlet var tootButton: UIButton! + + var delegate: ComposeAccessoryViewDelegate? = nil + + override init(frame: CGRect) { + super.init(frame: frame) + setup() + } + + required init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + setup() + } + + private func setup() { + Bundle.main.loadNibNamed("ComposeAccessoryView", owner: self, options: nil) + addSubview(contentView) + contentView.frame = self.bounds + } + + @IBAction func attachmentTapped(_ sender: Any) { + print("Attachment tapped 1") + delegate?.attachmentTapped() + } + + @IBAction func visibilityTapped(_ sender: Any) { + print("Visibility tapped 1") + delegate?.visibilityTapped() + } + + @IBAction func tootTapped(_ sender: Any) { + delegate?.tootTapped() + } +} diff --git a/elpha-ios/ComposeAccessoryView.xib b/elpha-ios/ComposeAccessoryView.xib new file mode 100644 index 0000000..fc4da6a --- /dev/null +++ b/elpha-ios/ComposeAccessoryView.xib @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/elpha-ios/ComposeViewController.swift b/elpha-ios/ComposeViewController.swift index 7b6781d..98ebe52 100644 --- a/elpha-ios/ComposeViewController.swift +++ b/elpha-ios/ComposeViewController.swift @@ -18,12 +18,12 @@ class ComposeViewController: UIViewController { @IBOutlet var statusTextView: UITextView! @IBOutlet var statusCharacterCountLabel: UILabel! @IBOutlet var contentWarningTextField: UITextField! - @IBOutlet var tootButton: UIButton! @IBOutlet var bottomConstraint: NSLayoutConstraint! let characterLimit = 500 var feedbackGenerator: UINotificationFeedbackGenerator? = nil var replyToStatus: StatusMO? = nil + var composeAccessoryView: ComposeAccessoryView? = nil override func viewDidLoad() { super.viewDidLoad() @@ -36,7 +36,11 @@ class ComposeViewController: UIViewController { statusTextView.layer.cornerRadius = 10 statusTextView.layer.masksToBounds = true + composeAccessoryView = ComposeAccessoryView() + composeAccessoryView!.delegate = self + statusTextView.delegate = self + statusTextView.inputAccessoryView = composeAccessoryView NotificationCenter.default.addObserver(self, selector: #selector(keyboardNotification(notification:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil) @@ -64,7 +68,7 @@ class ComposeViewController: UIViewController { func setupReplyTo(status: StatusMO) { if let account = status.account { - replyToAvatarImageView.loadImageURL(account.avatarURL!) + replyToAvatarImageView.setImage(withURL: account.avatarURL!) replyToDisplayNameLabel.text = account.displayName replyToUsernameLabel.text = "@\(account.acct!)" } @@ -80,16 +84,36 @@ class ComposeViewController: UIViewController { if endFrameY >= UIScreen.main.bounds.size.height { bottomConstraint.constant = 50.0 } else { - bottomConstraint.constant = endFrame?.size.height ?? 0.0 + bottomConstraint.constant = (endFrame?.size.height ?? 0.0) + 15 } } } @IBAction func dismissTapped(_ sender: Any) { + statusTextView.inputAccessoryView = nil + statusTextView.reloadInputViews() + dismiss(animated: true) } +} + +extension ComposeViewController: UITextViewDelegate { + func textViewDidChange(_ textView: UITextView) { + let characters = statusTextView.text!.count + statusCharacterCountLabel.text = String(characterLimit - characters) + } +} + +extension ComposeViewController: ComposeAccessoryViewDelegate { + func attachmentTapped() { + print("Attachment tapped") + } + + func visibilityTapped() { + print("Visibility tapped") + } - @IBAction func tootTapped(_ sender: Any) { + func tootTapped() { if let content = statusTextView.text { if !content.isEmpty && content.count <= characterLimit { feedbackGenerator?.prepare() @@ -112,10 +136,3 @@ class ComposeViewController: UIViewController { } } } - -extension ComposeViewController: UITextViewDelegate { - func textViewDidChange(_ textView: UITextView) { - let characters = statusTextView.text!.count - statusCharacterCountLabel.text = String(characterLimit - characters) - } -} diff --git a/elpha-ios/FLAnimatedImageView+LoadImageURL.swift b/elpha-ios/FLAnimatedImageView+SetImage.swift similarity index 78% rename from elpha-ios/FLAnimatedImageView+LoadImageURL.swift rename to elpha-ios/FLAnimatedImageView+SetImage.swift index b3c6788..8c77f0d 100644 --- a/elpha-ios/FLAnimatedImageView+LoadImageURL.swift +++ b/elpha-ios/FLAnimatedImageView+SetImage.swift @@ -1,5 +1,5 @@ // -// FLAnimatedImage+LoadImageURL.swift +// FLAnimatedImage+SetImage.swift // elpha-ios // // Created by Dwayne Harris on 11/12/18. @@ -49,8 +49,20 @@ extension FLAnimatedImageView { self.image = UIImage(named: "Help") } - func loadImageURL(_ url: URL, contentMode: UIView.ContentMode = .scaleAspectFit) { + func setImage(withURL url: URL, withShadow shadow: Bool = false, withContentMode contentMode: UIView.ContentMode = .scaleAspectFill) { + func setShadow() { + if shadow { + self.layer.shadowColor = UIColor.black.cgColor + self.layer.shadowOpacity = 0.8 + self.layer.shadowOffset = CGSize.zero + self.layer.shadowRadius = 10 + } + } + if let data = ImageCache.get(url: url) { + self.contentMode = contentMode + setShadow() + if url.absoluteString.hasSuffix(".gif") { self.animatedImage = FLAnimatedImage(animatedGIFData: data) } else { @@ -63,7 +75,9 @@ extension FLAnimatedImageView { if let data = response.data { DispatchQueue.main.async { ImageCache.set(url: url, data: data) + self.contentMode = contentMode + setShadow() if url.absoluteString.hasSuffix(".gif") { self.animatedImage = FLAnimatedImage(animatedGIFData: data) diff --git a/elpha-ios/SettingsTableViewController.swift b/elpha-ios/SettingsTableViewController.swift index e5a130f..201aaef 100644 --- a/elpha-ios/SettingsTableViewController.swift +++ b/elpha-ios/SettingsTableViewController.swift @@ -21,16 +21,12 @@ class SettingsTableViewController: UITableViewController { navigationItem.title = "Settings" - avatarImageView.layer.shadowColor = UIColor.black.cgColor - avatarImageView.layer.shadowOpacity = 0.8 - avatarImageView.layer.shadowOffset = CGSize.zero - avatarImageView.layer.shadowRadius = 10 avatarImageView.layer.cornerRadius = 10 avatarImageView.layer.masksToBounds = true if let account = AuthenticationManager.session?.account { headerImageView.af_setImage(withURL: account.headerURL!) - avatarImageView.loadImageURL(account.avatarURL!) + avatarImageView.setImage(withURL: account.avatarURL!, withShadow: true) displayNameLabel.text = account.displayName usernameLabel.text = "@\(account.acct!)" } diff --git a/elpha-ios/StatusTableViewController.swift b/elpha-ios/StatusTableViewController.swift index cbad0d2..f35c0ef 100644 --- a/elpha-ios/StatusTableViewController.swift +++ b/elpha-ios/StatusTableViewController.swift @@ -120,6 +120,10 @@ class StatusTableViewController: AbstractStatusTableViewController, UIGestureRec } } + @IBAction func replyTapped(_ sender: Any) { + self.replyTapped(status: status!) + } + func fetchStatuses(completion: @escaping (Error?) -> Void) { if let status = status { loading = true @@ -263,17 +267,13 @@ extension StatusTableViewController { } cell.contentTextView.delegate = self - - cell.avatarImageView.layer.shadowColor = UIColor.black.cgColor - cell.avatarImageView.layer.shadowOpacity = 0.8 - cell.avatarImageView.layer.shadowOffset = CGSize.zero - cell.avatarImageView.layer.shadowRadius = 10 + cell.avatarImageView.layer.cornerRadius = 10 cell.avatarImageView.layer.masksToBounds = true func updateAccountView(status: StatusMO) { if let account = status.account { - cell.avatarImageView.loadImageURL(account.avatarURL!) + cell.avatarImageView.setImage(withURL: account.avatarURL!, withShadow: true) cell.displayNameLabel.text = account.displayName cell.usernameLabel.text = "@\(account.acct!)" } diff --git a/elpha-ios/StatusView.swift b/elpha-ios/StatusView.swift index 966d4b2..ccb40b8 100644 --- a/elpha-ios/StatusView.swift +++ b/elpha-ios/StatusView.swift @@ -250,7 +250,7 @@ class StatusView: UIView { func updateStatusContent(_ status: StatusMO) { if let account = status.account { - avatarImageView.loadImageURL(account.avatarURL!) + avatarImageView.setImage(withURL: account.avatarURL!) displayNameLabel.text = account.displayName usernameLabel.text = "@\(account.acct!)" } @@ -333,7 +333,7 @@ class StatusView: UIView { boostView.isHidden = false if let account = status.account { - boostAvatarImageView.loadImageURL(account.avatarURL!) + boostAvatarImageView.setImage(withURL: account.avatarURL!) boostDisplayNameLabel.text = account.displayName boostUsernameLabel.text = "@\(account.acct!)" } @@ -341,7 +341,7 @@ class StatusView: UIView { updateStatusContent(reblog) } else { if let account = status.account { - avatarImageView.loadImageURL(account.avatarURL!) + avatarImageView.setImage(withURL: account.avatarURL!) displayNameLabel.text = account.displayName usernameLabel.text = "@\(account.acct!)" } @@ -352,7 +352,7 @@ class StatusView: UIView { if let replyAccountID = status.inReplyToAccountID { if let replyAccount = MastodonDataManager.account(id: replyAccountID) { replyView.isHidden = false - replyAvatarImageView.loadImageURL(replyAccount.avatarURL!) + replyAvatarImageView.setImage(withURL: replyAccount.avatarURL!) replyDisplayNameLabel.text = replyAccount.displayName replyUsernameLabel.text = "@\(replyAccount.acct!)" }