mirror of
https://github.com/mastodon/mastodon-ios
synced 2025-04-11 22:58:02 +02:00
Merge pull request #1154 from mastodon/authentication-fixes
Authentication/Profile Fixes
This commit is contained in:
commit
a77db7c1ea
@ -57,25 +57,19 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell {
|
||||
checkmark.isAccessibilityElement = true
|
||||
checkmark.accessibilityTraits = .none
|
||||
keyMetaLabel.accessibilityTraits = .none
|
||||
keyMetaLabel.linkDelegate = self
|
||||
valueMetaLabel.linkDelegate = self
|
||||
|
||||
|
||||
// containerStackView: V - [ metaContainer | plainContainer ]
|
||||
let containerStackView = UIStackView()
|
||||
containerStackView.axis = .vertical
|
||||
|
||||
contentView.preservesSuperviewLayoutMargins = true
|
||||
containerStackView.preservesSuperviewLayoutMargins = true
|
||||
containerStackView.isLayoutMarginsRelativeArrangement = true
|
||||
containerStackView.translatesAutoresizingMaskIntoConstraints = false
|
||||
containerStackView.axis = .vertical
|
||||
containerStackView.preservesSuperviewLayoutMargins = true
|
||||
|
||||
contentView.addSubview(containerStackView)
|
||||
NSLayoutConstraint.activate([
|
||||
containerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 8),
|
||||
containerStackView.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
|
||||
contentView.trailingAnchor.constraint(equalTo: containerStackView.trailingAnchor),
|
||||
contentView.bottomAnchor.constraint(equalTo: containerStackView.bottomAnchor, constant: 8),
|
||||
checkmark.heightAnchor.constraint(equalToConstant: 22),
|
||||
checkmark.widthAnchor.constraint(equalTo: checkmark.heightAnchor),
|
||||
])
|
||||
|
||||
contentView.preservesSuperviewLayoutMargins = true
|
||||
|
||||
// metaContainer: h - [ keyValueContainer | checkmark ]
|
||||
let metaContainer = UIStackView()
|
||||
metaContainer.axis = .horizontal
|
||||
@ -95,8 +89,14 @@ final class ProfileFieldCollectionViewCell: UICollectionViewCell {
|
||||
metaContainer.addArrangedSubview(keyValueContainer)
|
||||
metaContainer.addArrangedSubview(checkmark)
|
||||
|
||||
keyMetaLabel.linkDelegate = self
|
||||
valueMetaLabel.linkDelegate = self
|
||||
NSLayoutConstraint.activate([
|
||||
containerStackView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: 11),
|
||||
containerStackView.leadingAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leadingAnchor),
|
||||
containerStackView.trailingAnchor.constraint(equalTo: contentView.layoutMarginsGuide.trailingAnchor),
|
||||
contentView.bottomAnchor.constraint(equalTo: containerStackView.bottomAnchor, constant: 11),
|
||||
checkmark.heightAnchor.constraint(equalToConstant: 22),
|
||||
checkmark.widthAnchor.constraint(equalTo: checkmark.heightAnchor),
|
||||
])
|
||||
|
||||
isAccessibilityElement = true
|
||||
}
|
||||
|
@ -66,6 +66,7 @@ extension ProfileAboutViewModel {
|
||||
$emojiMeta.removeDuplicates()
|
||||
)
|
||||
.throttle(for: 0.3, scheduler: DispatchQueue.main, latest: true)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] isEditing, createdAt, fields, emojiMeta in
|
||||
guard let self = self else { return }
|
||||
guard let diffableDataSource = self.diffableDataSource else { return }
|
||||
|
@ -178,12 +178,11 @@ class ProfileViewModel: NSObject {
|
||||
|
||||
// fetch profile info before edit
|
||||
func fetchEditProfileInfo() -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Account>, Error> {
|
||||
guard let me = me,
|
||||
let mastodonAuthentication = me.mastodonAuthentication
|
||||
else {
|
||||
guard let me else {
|
||||
return Fail(error: APIService.APIError.implicit(.authenticationMissing)).eraseToAnyPublisher()
|
||||
}
|
||||
|
||||
let mastodonAuthentication = authContext.mastodonAuthenticationBox.authentication
|
||||
let authorization = Mastodon.API.OAuth.Authorization(accessToken: mastodonAuthentication.userAccessToken)
|
||||
return context.apiService.accountVerifyCredentials(domain: me.domain, authorization: authorization)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user