Skip to content

Commit

Permalink
ユーザーのアイコン押してもプロフィールが開かなくなっていたデグレを修正 related: #136
Browse files Browse the repository at this point in the history
  • Loading branch information
rinsuki committed Mar 19, 2019
1 parent 4b3bc99 commit 649bab5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions iMast/CustomViews/MastodonPostCellViewController.swift
Expand Up @@ -23,6 +23,7 @@ class MastodonPostCellViewController: UIViewController, Instantiatable, Injectab
v.snp.makeConstraints { make in
make.width.equalTo(v.snp.height)
}
v.isUserInteractionEnabled = true
}

var input: Input
Expand Down Expand Up @@ -61,19 +62,22 @@ class MastodonPostCellViewController: UIViewController, Instantiatable, Injectab

// layout
self.view.addSubview(iconView)
iconView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(self.iconTapped)))
iconWidthConstraint = iconView.widthAnchor.constraint(equalToConstant: 64) {
$0.isActive = true
}
iconView.snp.makeConstraints { make in
make.leading.top.equalToSuperview().offset(8)
make.bottom.lessThanOrEqualToSuperview().offset(-8)
}

let userStackView = UIStackView(arrangedSubviews: [
userNameLabel,
createdAtLabel,
]) {
$0.axis = .horizontal
}

let topStackView = ContainerView(arrangedSubviews: [
userStackView,
textView,
Expand All @@ -98,6 +102,7 @@ class MastodonPostCellViewController: UIViewController, Instantiatable, Injectab
}

func input(_ originalInput: MastodonPost) {
self.input = originalInput
let input = originalInput.repost ?? originalInput
// ブースト時の処理
if originalInput.repost != nil {
Expand Down Expand Up @@ -160,8 +165,8 @@ class MastodonPostCellViewController: UIViewController, Instantiatable, Injectab
}
}

@IBAction func iconTapped(_ sender: Any) {
let vc = openUserProfile(user: input.account)
@objc func iconTapped() {
let vc = openUserProfile(user: (input.repost ?? input).account)
self.navigationController?.pushViewController(vc, animated: true)
}
}

0 comments on commit 649bab5

Please sign in to comment.