diff --git a/elpha-ios/Assets.xcassets/Icons/Direct.imageset/Contents.json b/elpha-ios/Assets.xcassets/Icons/Direct.imageset/Contents.json new file mode 100644 index 0000000..7fa4dac --- /dev/null +++ b/elpha-ios/Assets.xcassets/Icons/Direct.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "send.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/elpha-ios/Assets.xcassets/Icons/Direct.imageset/send.pdf b/elpha-ios/Assets.xcassets/Icons/Direct.imageset/send.pdf new file mode 100644 index 0000000..b462346 Binary files /dev/null and b/elpha-ios/Assets.xcassets/Icons/Direct.imageset/send.pdf differ diff --git a/elpha-ios/Assets.xcassets/Icons/Private.imageset/Contents.json b/elpha-ios/Assets.xcassets/Icons/Private.imageset/Contents.json new file mode 100644 index 0000000..3d807e7 --- /dev/null +++ b/elpha-ios/Assets.xcassets/Icons/Private.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "eye-off.pdf" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/elpha-ios/Assets.xcassets/Icons/Private.imageset/eye-off.pdf b/elpha-ios/Assets.xcassets/Icons/Private.imageset/eye-off.pdf new file mode 100644 index 0000000..93396cc Binary files /dev/null and b/elpha-ios/Assets.xcassets/Icons/Private.imageset/eye-off.pdf differ diff --git a/elpha-ios/Base.lproj/Main.storyboard b/elpha-ios/Base.lproj/Main.storyboard index 16c15f6..0fa66f5 100644 --- a/elpha-ios/Base.lproj/Main.storyboard +++ b/elpha-ios/Base.lproj/Main.storyboard @@ -1075,35 +1075,35 @@ - + - + @@ -1136,7 +1136,7 @@ - + @@ -1145,19 +1145,19 @@ - + @@ -1174,7 +1174,7 @@ - + @@ -1218,7 +1218,7 @@ - + diff --git a/elpha-ios/ComposeAccessoryView.swift b/elpha-ios/ComposeAccessoryView.swift index 1c18073..c6440ba 100644 --- a/elpha-ios/ComposeAccessoryView.swift +++ b/elpha-ios/ComposeAccessoryView.swift @@ -22,6 +22,12 @@ class ComposeAccessoryView: UIView { var delegate: ComposeAccessoryViewDelegate? = nil + var selectedVisibility: StatusVisibility = .public { + didSet { + visibilityButton.setTitle(" \(selectedVisibility.rawValue.capitalized)", for: .normal) + } + } + override init(frame: CGRect) { super.init(frame: frame) setup() @@ -36,19 +42,22 @@ class ComposeAccessoryView: UIView { Bundle.main.loadNibNamed("ComposeAccessoryView", owner: self, options: nil) addSubview(contentView) contentView.frame = self.bounds + contentView.autoresizingMask = [.flexibleWidth, .flexibleHeight] + + attachmentButton.addTarget(self, action: #selector(attachmentTapped), for: .touchUpInside) + visibilityButton.addTarget(self, action: #selector(visibilityTapped), for: .touchUpInside) + tootButton.addTarget(self, action: #selector(tootTapped), for: .touchUpInside) } - @IBAction func attachmentTapped(_ sender: Any) { - print("Attachment tapped 1") + @objc func attachmentTapped() { delegate?.attachmentTapped() } - @IBAction func visibilityTapped(_ sender: Any) { - print("Visibility tapped 1") + @objc func visibilityTapped() { delegate?.visibilityTapped() } - @IBAction func tootTapped(_ sender: Any) { + @objc func tootTapped() { delegate?.tootTapped() } } diff --git a/elpha-ios/ComposeAccessoryView.xib b/elpha-ios/ComposeAccessoryView.xib index fc4da6a..2808bcf 100644 --- a/elpha-ios/ComposeAccessoryView.xib +++ b/elpha-ios/ComposeAccessoryView.xib @@ -13,10 +13,10 @@ - + - - + + @@ -24,54 +24,35 @@ - - - - + - - - - - - + + + + + + @@ -87,5 +68,8 @@ + + + diff --git a/elpha-ios/ComposeViewController.swift b/elpha-ios/ComposeViewController.swift index 98ebe52..6639840 100644 --- a/elpha-ios/ComposeViewController.swift +++ b/elpha-ios/ComposeViewController.swift @@ -21,6 +21,7 @@ class ComposeViewController: UIViewController { @IBOutlet var bottomConstraint: NSLayoutConstraint! let characterLimit = 500 + let composeAccessoryViewHeight: CGFloat = 55.0 var feedbackGenerator: UINotificationFeedbackGenerator? = nil var replyToStatus: StatusMO? = nil var composeAccessoryView: ComposeAccessoryView? = nil @@ -36,8 +37,9 @@ class ComposeViewController: UIViewController { statusTextView.layer.cornerRadius = 10 statusTextView.layer.masksToBounds = true - composeAccessoryView = ComposeAccessoryView() + composeAccessoryView = ComposeAccessoryView(frame: CGRect(x: 0.0, y: 0.0, width: self.view.bounds.size.width, height: composeAccessoryViewHeight)) composeAccessoryView!.delegate = self + composeAccessoryView!.selectedVisibility = .public statusTextView.delegate = self statusTextView.inputAccessoryView = composeAccessoryView @@ -82,17 +84,14 @@ class ComposeViewController: UIViewController { let endFrameY = endFrame?.origin.y ?? 0 if endFrameY >= UIScreen.main.bounds.size.height { - bottomConstraint.constant = 50.0 + bottomConstraint.constant = 0 } else { - bottomConstraint.constant = (endFrame?.size.height ?? 0.0) + 15 + bottomConstraint.constant = (endFrame?.size.height ?? 0.0) - 15 } } } @IBAction func dismissTapped(_ sender: Any) { - statusTextView.inputAccessoryView = nil - statusTextView.reloadInputViews() - dismiss(animated: true) } } @@ -106,7 +105,7 @@ extension ComposeViewController: UITextViewDelegate { extension ComposeViewController: ComposeAccessoryViewDelegate { func attachmentTapped() { - print("Attachment tapped") + AlertManager.shared.show(message: "Attachment support coming soon", category: .normal) } func visibilityTapped() { diff --git a/elpha-ios/FLAnimatedImageView+SetImage.swift b/elpha-ios/FLAnimatedImageView+SetImage.swift index 8c77f0d..8952b66 100644 --- a/elpha-ios/FLAnimatedImageView+SetImage.swift +++ b/elpha-ios/FLAnimatedImageView+SetImage.swift @@ -52,8 +52,8 @@ extension FLAnimatedImageView { 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.shadowColor = UIColor(white: 0.0, alpha: 0.5).cgColor + self.layer.shadowOpacity = 1 self.layer.shadowOffset = CGSize.zero self.layer.shadowRadius = 10 } @@ -61,13 +61,14 @@ extension FLAnimatedImageView { if let data = ImageCache.get(url: url) { self.contentMode = contentMode - setShadow() if url.absoluteString.hasSuffix(".gif") { self.animatedImage = FLAnimatedImage(animatedGIFData: data) } else { self.image = UIImage(data: data) } + + setShadow() } else { setPlaceholder() @@ -77,13 +78,14 @@ extension FLAnimatedImageView { ImageCache.set(url: url, data: data) self.contentMode = contentMode - setShadow() if url.absoluteString.hasSuffix(".gif") { self.animatedImage = FLAnimatedImage(animatedGIFData: data) } else { self.image = UIImage(data: data) } + + setShadow() } } } diff --git a/elpha-ios/StatusView.swift b/elpha-ios/StatusView.swift index ccb40b8..43676d6 100644 --- a/elpha-ios/StatusView.swift +++ b/elpha-ios/StatusView.swift @@ -125,6 +125,13 @@ class StatusView: UIView { @IBAction func boostTapped(_ sender: Any) { if let status = status { + let allowedVisibility = [StatusVisibility.public, StatusVisibility.unlisted] + let visibility = StatusVisibility(rawValue: status.visibility!) + + guard allowedVisibility.contains(visibility!) else { + return + } + feedbackGenerator?.prepare() if status.reblogged { @@ -314,10 +321,19 @@ class StatusView: UIView { boostsLabel.text = NumberFormatter.localizedString(from: NSNumber(value: status.reblogsCount), number: .decimal) favoritesLabel.text = NumberFormatter.localizedString(from: NSNumber(value: status.favoritesCount), number: .decimal) - if status.reblogged { - boostsImageView.image = UIImage(named: "Boost Bold") - } else { - boostsImageView.image = UIImage(named: "Boost Regular") + let visibility = StatusVisibility(rawValue: status.visibility!) + + switch visibility! { + case .private: + boostsImageView.image = UIImage(named: "Private") + case .direct: + boostsImageView.image = UIImage(named: "Direct") + default: + if status.reblogged { + boostsImageView.image = UIImage(named: "Boost Bold") + } else { + boostsImageView.image = UIImage(named: "Boost Regular") + } } if status.favorited { diff --git a/elpha-ios/TimelineTableViewController.swift b/elpha-ios/TimelineTableViewController.swift index fe7fb50..1f5e127 100644 --- a/elpha-ios/TimelineTableViewController.swift +++ b/elpha-ios/TimelineTableViewController.swift @@ -77,12 +77,6 @@ class TimelineTableViewController: AbstractStatusTableViewController { if fetchedResultsController?.fetchedObjects?.count ?? 0 == 0 { initializeFetchedResultsController() } - - fetchTimeline { error in - if error != nil { - AlertManager.shared.show(message: error!.localizedDescription, category: .error) - } - } } override func loadMoreTapped(status: StatusMO, direction: PaginationDirection) {