Copynpaste cell to logout all accounts (IOS-245)
This commit is contained in:
parent
099411b435
commit
381bbb6b7c
|
@ -173,6 +173,7 @@
|
|||
D8D688F92AB8B970000F651A /* SearchResultOverviewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D688F82AB8B970000F651A /* SearchResultOverviewCoordinator.swift */; };
|
||||
D8E5C346296DAB84007E76A7 /* DataSourceFacade+Status+History.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E5C345296DAB84007E76A7 /* DataSourceFacade+Status+History.swift */; };
|
||||
D8E5C349296DB8A3007E76A7 /* StatusEditHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E5C348296DB8A3007E76A7 /* StatusEditHistoryViewController.swift */; };
|
||||
D8E64F412BA84F80003A4539 /* LogoutOfAllAccountsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E64F402BA84F80003A4539 /* LogoutOfAllAccountsCell.swift */; };
|
||||
D8ECC8102AC31EA400AE0818 /* NotificationSettingsDisabledTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8ECC80F2AC31EA400AE0818 /* NotificationSettingsDisabledTableViewCell.swift */; };
|
||||
D8F0372C29D232730027DE2E /* HashtagIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0372B29D232730027DE2E /* HashtagIntentHandler.swift */; };
|
||||
D8F8A03A29CA5C15000195DD /* HashtagWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */; };
|
||||
|
@ -812,6 +813,7 @@
|
|||
D8D688F82AB8B970000F651A /* SearchResultOverviewCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultOverviewCoordinator.swift; sourceTree = "<group>"; };
|
||||
D8E5C345296DAB84007E76A7 /* DataSourceFacade+Status+History.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceFacade+Status+History.swift"; sourceTree = "<group>"; };
|
||||
D8E5C348296DB8A3007E76A7 /* StatusEditHistoryViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusEditHistoryViewController.swift; sourceTree = "<group>"; };
|
||||
D8E64F402BA84F80003A4539 /* LogoutOfAllAccountsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogoutOfAllAccountsCell.swift; sourceTree = "<group>"; };
|
||||
D8ECC80F2AC31EA400AE0818 /* NotificationSettingsDisabledTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationSettingsDisabledTableViewCell.swift; sourceTree = "<group>"; };
|
||||
D8F0372B29D232730027DE2E /* HashtagIntentHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagIntentHandler.swift; sourceTree = "<group>"; };
|
||||
D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidgetView.swift; sourceTree = "<group>"; };
|
||||
|
@ -2709,6 +2711,7 @@
|
|||
children = (
|
||||
DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */,
|
||||
DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */,
|
||||
D8E64F402BA84F80003A4539 /* LogoutOfAllAccountsCell.swift */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
|
@ -3799,6 +3802,7 @@
|
|||
85BC11B32932414900E191CD /* AltTextViewController.swift in Sources */,
|
||||
DB63F775279A997D00455B82 /* NotificationTableViewCell+ViewModel.swift in Sources */,
|
||||
DB98EB5927B109890082E365 /* ReportSupplementaryViewController.swift in Sources */,
|
||||
D8E64F412BA84F80003A4539 /* LogoutOfAllAccountsCell.swift in Sources */,
|
||||
DB0617EB277EF3820030EE79 /* GradientBorderView.swift in Sources */,
|
||||
DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */,
|
||||
DBEFCD7D282A2A3B00C0ABEA /* ReportServerRulesViewController.swift in Sources */,
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
//
|
||||
// AddAccountTableViewCell.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-14.
|
||||
//
|
||||
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import MetaTextKit
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
|
@ -15,10 +9,8 @@ import MastodonUI
|
|||
|
||||
final class AddAccountTableViewCell: UITableViewCell {
|
||||
|
||||
private var _disposeBag = Set<AnyCancellable>()
|
||||
|
||||
let iconImageView: UIImageView = {
|
||||
let image = UIImage(systemName: "plus.circle.fill")!
|
||||
let image = UIImage(systemName: "plus")!
|
||||
let imageView = UIImageView(image: image)
|
||||
imageView.tintColor = Asset.Colors.Label.primary.color
|
||||
return imageView
|
||||
|
@ -30,24 +22,11 @@ final class AddAccountTableViewCell: UITableViewCell {
|
|||
label.text = L10n.Scene.AccountList.addAccount
|
||||
return label
|
||||
}()
|
||||
let usernameLabel = MetaLabel(style: .accountListUsername)
|
||||
let separatorLine = UIView.separatorLine
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
_init()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
_init()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension AddAccountTableViewCell {
|
||||
|
||||
private func _init() {
|
||||
backgroundColor = .secondarySystemGroupedBackground
|
||||
|
||||
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
|
@ -55,8 +34,8 @@ extension AddAccountTableViewCell {
|
|||
NSLayoutConstraint.activate([
|
||||
iconImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
iconImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor, multiplier: 1.0).priority(.required - 1),
|
||||
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30).priority(.required - 1),
|
||||
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor),
|
||||
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30)
|
||||
])
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
|
@ -96,13 +75,16 @@ extension AddAccountTableViewCell {
|
|||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||
])
|
||||
|
||||
accessibilityTraits.insert(.button)
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) { fatalError() }
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
//
|
||||
// AddAccountTableViewCell.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by Cirno MainasuK on 2021-9-14.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Combine
|
||||
import MetaTextKit
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
||||
final class LogoutOfAllAccountsCell: UITableViewCell {
|
||||
|
||||
static let reuseIdentifier = "LogoutOfAllAccountsCell"
|
||||
|
||||
let iconImageView: UIImageView = {
|
||||
let image = UIImage(systemName: "rectangle.portrait.and.arrow.forward")!
|
||||
let imageView = UIImageView(image: image)
|
||||
imageView.tintColor = .systemRed
|
||||
return imageView
|
||||
}()
|
||||
let titleLabel: UILabel = {
|
||||
let label = UILabel()
|
||||
label.font = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .regular), maximumPointSize: 22)
|
||||
label.textColor = .systemRed
|
||||
label.text = "Logout of all accounts"
|
||||
return label
|
||||
}()
|
||||
let separatorLine = UIView.separatorLine
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
|
||||
backgroundColor = .secondarySystemGroupedBackground
|
||||
|
||||
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(iconImageView)
|
||||
NSLayoutConstraint.activate([
|
||||
iconImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||
iconImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor),
|
||||
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30)
|
||||
])
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||
|
||||
// layout the same placeholder UI from `AccountListTableViewCell`
|
||||
let placeholderLabelContainerStackView = UIStackView()
|
||||
placeholderLabelContainerStackView.axis = .vertical
|
||||
placeholderLabelContainerStackView.distribution = .equalCentering
|
||||
placeholderLabelContainerStackView.spacing = 2
|
||||
placeholderLabelContainerStackView.distribution = .fillProportionally
|
||||
placeholderLabelContainerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(placeholderLabelContainerStackView)
|
||||
NSLayoutConstraint.activate([
|
||||
placeholderLabelContainerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
|
||||
placeholderLabelContainerStackView.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 10),
|
||||
contentView.bottomAnchor.constraint(equalTo: placeholderLabelContainerStackView.bottomAnchor, constant: 10),
|
||||
iconImageView.heightAnchor.constraint(equalTo: placeholderLabelContainerStackView.heightAnchor, multiplier: 0.8).priority(.required - 10),
|
||||
])
|
||||
let _nameLabel = MetaLabel(style: .accountListName)
|
||||
_nameLabel.configure(content: PlaintextMetaContent(string: " "))
|
||||
let _usernameLabel = MetaLabel(style: .accountListUsername)
|
||||
_usernameLabel.configure(content: PlaintextMetaContent(string: " "))
|
||||
placeholderLabelContainerStackView.addArrangedSubview(_nameLabel)
|
||||
placeholderLabelContainerStackView.addArrangedSubview(_usernameLabel)
|
||||
placeholderLabelContainerStackView.isHidden = true
|
||||
|
||||
titleLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(titleLabel)
|
||||
NSLayoutConstraint.activate([
|
||||
titleLabel.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 15),
|
||||
titleLabel.leadingAnchor.constraint(equalTo: iconImageView.trailingAnchor, constant: 10),
|
||||
contentView.bottomAnchor.constraint(equalTo: titleLabel.bottomAnchor, constant: 15),
|
||||
// iconImageView.heightAnchor.constraint(equalTo: titleLabel.heightAnchor, multiplier: 1.0).priority(.required - 10),
|
||||
titleLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
])
|
||||
|
||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(separatorLine)
|
||||
NSLayoutConstraint.activate([
|
||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||
])
|
||||
|
||||
accessibilityTraits.insert(.button)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) { fatalError() }
|
||||
}
|
||||
|
Loading…
Reference in New Issue