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.
64 lines
2.0 KiB
64 lines
2.0 KiB
//
|
|
// ComposeViewController.swift
|
|
// elpha-ios
|
|
//
|
|
// Created by Dwayne Harris on 11/12/18.
|
|
// Copyright © 2018 Elpha. All rights reserved.
|
|
//
|
|
|
|
import FLAnimatedImage
|
|
import UIKit
|
|
|
|
class ComposeViewController: UIViewController {
|
|
@IBOutlet var replyToView: UIView!
|
|
@IBOutlet var replyToAvatarImageView: FLAnimatedImageView!
|
|
@IBOutlet var replyToDisplayNameLabel: UILabel!
|
|
@IBOutlet var replyToUsernameLabel: UILabel!
|
|
@IBOutlet var replyToContentTextView: UITextViewFixed!
|
|
@IBOutlet var statusTextField: UITextField!
|
|
@IBOutlet var statusCharacterCountLabel: UILabel!
|
|
@IBOutlet var contentWarningTextField: UITextField!
|
|
@IBOutlet var tootButton: UIButton!
|
|
|
|
var replyToStatus: StatusMO? = nil
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
if let replyToStatus = replyToStatus {
|
|
replyToView.isHidden = false
|
|
|
|
if let reblog = replyToStatus.reblog {
|
|
self.setupReplyTo(status: reblog)
|
|
} else {
|
|
self.setupReplyTo(status: replyToStatus)
|
|
}
|
|
} else {
|
|
replyToView.isHidden = true
|
|
}
|
|
}
|
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
super.viewDidAppear(animated)
|
|
statusTextField.becomeFirstResponder()
|
|
}
|
|
|
|
func setupReplyTo(status: StatusMO) {
|
|
if let account = status.account {
|
|
replyToAvatarImageView.loadImageURL(account.avatarURL!)
|
|
replyToDisplayNameLabel.text = account.displayName
|
|
replyToUsernameLabel.text = "@\(account.acct!)"
|
|
}
|
|
|
|
replyToContentTextView.attributedText = status.content?.htmlAttributed(size: 15.0)
|
|
}
|
|
|
|
@IBAction func statusTextFieldEdited(_ sender: Any) {
|
|
let characters = statusTextField.text!.count
|
|
statusCharacterCountLabel.text = String(500 - characters)
|
|
}
|
|
|
|
@IBAction func dismissTapped(_ sender: Any) {
|
|
dismiss(animated: true)
|
|
}
|
|
}
|