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 */; };
|
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 */; };
|
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 */; };
|
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 */; };
|
D8ECC8102AC31EA400AE0818 /* NotificationSettingsDisabledTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8ECC80F2AC31EA400AE0818 /* NotificationSettingsDisabledTableViewCell.swift */; };
|
||||||
D8F0372C29D232730027DE2E /* HashtagIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0372B29D232730027DE2E /* HashtagIntentHandler.swift */; };
|
D8F0372C29D232730027DE2E /* HashtagIntentHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F0372B29D232730027DE2E /* HashtagIntentHandler.swift */; };
|
||||||
D8F8A03A29CA5C15000195DD /* HashtagWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03929CA5C15000195DD /* HashtagWidgetView.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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
D8F8A03929CA5C15000195DD /* HashtagWidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidgetView.swift; sourceTree = "<group>"; };
|
||||||
|
@ -2709,6 +2711,7 @@
|
||||||
children = (
|
children = (
|
||||||
DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */,
|
DB9F58F026EF512300E7BBE9 /* AccountListTableViewCell.swift */,
|
||||||
DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */,
|
DBA5A53426F0A36A00CACBAA /* AddAccountTableViewCell.swift */,
|
||||||
|
D8E64F402BA84F80003A4539 /* LogoutOfAllAccountsCell.swift */,
|
||||||
);
|
);
|
||||||
path = Cell;
|
path = Cell;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -3799,6 +3802,7 @@
|
||||||
85BC11B32932414900E191CD /* AltTextViewController.swift in Sources */,
|
85BC11B32932414900E191CD /* AltTextViewController.swift in Sources */,
|
||||||
DB63F775279A997D00455B82 /* NotificationTableViewCell+ViewModel.swift in Sources */,
|
DB63F775279A997D00455B82 /* NotificationTableViewCell+ViewModel.swift in Sources */,
|
||||||
DB98EB5927B109890082E365 /* ReportSupplementaryViewController.swift in Sources */,
|
DB98EB5927B109890082E365 /* ReportSupplementaryViewController.swift in Sources */,
|
||||||
|
D8E64F412BA84F80003A4539 /* LogoutOfAllAccountsCell.swift in Sources */,
|
||||||
DB0617EB277EF3820030EE79 /* GradientBorderView.swift in Sources */,
|
DB0617EB277EF3820030EE79 /* GradientBorderView.swift in Sources */,
|
||||||
DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */,
|
DB789A1225F9F2CC0071ACA0 /* ComposeViewModel.swift in Sources */,
|
||||||
DBEFCD7D282A2A3B00C0ABEA /* ReportServerRulesViewController.swift in Sources */,
|
DBEFCD7D282A2A3B00C0ABEA /* ReportServerRulesViewController.swift in Sources */,
|
||||||
|
|
|
@ -1,12 +1,6 @@
|
||||||
//
|
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
|
||||||
// AddAccountTableViewCell.swift
|
|
||||||
// Mastodon
|
|
||||||
//
|
|
||||||
// Created by Cirno MainasuK on 2021-9-14.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
|
||||||
import MetaTextKit
|
import MetaTextKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonLocalization
|
import MastodonLocalization
|
||||||
|
@ -15,10 +9,8 @@ import MastodonUI
|
||||||
|
|
||||||
final class AddAccountTableViewCell: UITableViewCell {
|
final class AddAccountTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
private var _disposeBag = Set<AnyCancellable>()
|
|
||||||
|
|
||||||
let iconImageView: UIImageView = {
|
let iconImageView: UIImageView = {
|
||||||
let image = UIImage(systemName: "plus.circle.fill")!
|
let image = UIImage(systemName: "plus")!
|
||||||
let imageView = UIImageView(image: image)
|
let imageView = UIImageView(image: image)
|
||||||
imageView.tintColor = Asset.Colors.Label.primary.color
|
imageView.tintColor = Asset.Colors.Label.primary.color
|
||||||
return imageView
|
return imageView
|
||||||
|
@ -30,24 +22,11 @@ final class AddAccountTableViewCell: UITableViewCell {
|
||||||
label.text = L10n.Scene.AccountList.addAccount
|
label.text = L10n.Scene.AccountList.addAccount
|
||||||
return label
|
return label
|
||||||
}()
|
}()
|
||||||
let usernameLabel = MetaLabel(style: .accountListUsername)
|
|
||||||
let separatorLine = UIView.separatorLine
|
let separatorLine = UIView.separatorLine
|
||||||
|
|
||||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
_init()
|
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
super.init(coder: coder)
|
|
||||||
_init()
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension AddAccountTableViewCell {
|
|
||||||
|
|
||||||
private func _init() {
|
|
||||||
backgroundColor = .secondarySystemGroupedBackground
|
backgroundColor = .secondarySystemGroupedBackground
|
||||||
|
|
||||||
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
iconImageView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
@ -55,8 +34,8 @@ extension AddAccountTableViewCell {
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
iconImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
iconImageView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||||
iconImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
iconImageView.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||||
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor, multiplier: 1.0).priority(.required - 1),
|
iconImageView.heightAnchor.constraint(equalTo: iconImageView.widthAnchor),
|
||||||
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30).priority(.required - 1),
|
iconImageView.heightAnchor.constraint(greaterThanOrEqualToConstant: 30)
|
||||||
])
|
])
|
||||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
iconImageView.setContentHuggingPriority(.defaultLow, for: .horizontal)
|
||||||
iconImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
iconImageView.setContentHuggingPriority(.defaultLow, for: .vertical)
|
||||||
|
@ -96,13 +75,16 @@ extension AddAccountTableViewCell {
|
||||||
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
separatorLine.translatesAutoresizingMaskIntoConstraints = false
|
||||||
contentView.addSubview(separatorLine)
|
contentView.addSubview(separatorLine)
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
separatorLine.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
separatorLine.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
|
||||||
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
separatorLine.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
|
||||||
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
separatorLine.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
|
||||||
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
separatorLine.heightAnchor.constraint(equalToConstant: UIView.separatorLineHeight(of: contentView)),
|
||||||
])
|
])
|
||||||
|
|
||||||
accessibilityTraits.insert(.button)
|
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