Add what needs to be done for better onboarding (#540)

This commit is contained in:
Nathan Mattes 2022-11-09 14:13:33 +01:00
parent 7e04dd3d31
commit 26d7287319
15 changed files with 23 additions and 9 deletions

View File

@ -149,6 +149,7 @@ extension SceneCoordinator {
case mastodonConfirmEmail(viewModel: MastodonConfirmEmailViewModel)
case mastodonResendEmail(viewModel: MastodonResendEmailViewModel)
case mastodonWebView(viewModel: WebViewModel)
//TODO: @zeitschlag new case for welcome back select your server welcome-screen + Screen and ViewModel etc.
// search
case searchDetail(viewModel: SearchDetailViewModel)

View File

@ -51,6 +51,7 @@ extension PickServerSection {
extension PickServerSection {
static func configure(cell: PickServerCell, server: Mastodon.Entity.Server, attribute: PickServerItem.ServerItemAttribute) {
//TODO: @zeitschlag configure cell if server doesn't allow registrations
cell.domainLabel.text = server.domain
cell.descriptionLabel.attributedText = {
let content: String = {

View File

@ -172,7 +172,7 @@ extension MastodonPickServerViewController {
let alertController = UIAlertController(for: error, title: "Error", preferredStyle: .alert)
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil)
alertController.addAction(okAction)
self.coordinator.present(
_ = self.coordinator.present(
scene: .alertController(alertController: alertController),
from: nil,
transition: .alertController(animated: true, completion: nil)
@ -394,7 +394,7 @@ extension MastodonPickServerViewController {
instance: response.instance.value,
applicationToken: response.applicationToken.value
)
self.coordinator.present(scene: .mastodonServerRules(viewModel: mastodonServerRulesViewModel), from: self, transition: .show)
_ = self.coordinator.present(scene: .mastodonServerRules(viewModel: mastodonServerRulesViewModel), from: self, transition: .show)
} else {
let mastodonRegisterViewModel = MastodonRegisterViewModel(
context: self.context,
@ -403,7 +403,7 @@ extension MastodonPickServerViewController {
instance: response.instance.value,
applicationToken: response.applicationToken.value
)
self.coordinator.present(scene: .mastodonRegister(viewModel: mastodonRegisterViewModel), from: nil, transition: .show)
_ = self.coordinator.present(scene: .mastodonRegister(viewModel: mastodonRegisterViewModel), from: nil, transition: .show)
}
}
.store(in: &disposeBag)
@ -499,6 +499,7 @@ extension MastodonPickServerViewController: PickServerServerSectionTableHeaderVi
}
func pickServerServerSectionTableHeaderView(_ headerView: PickServerServerSectionTableHeaderView, searchTextDidChange searchText: String?) {
//TODO: @zeitschlag Deselect server?
viewModel.searchText.send(searchText ?? "")
}
}

View File

@ -178,6 +178,7 @@ extension MastodonPickServerViewModel {
.compactMap { [weak self] searchText -> AnyPublisher<Result<Mastodon.Response.Content<[Mastodon.Entity.Server]>, Error>, Never>? in
// Check if searchText is a valid mastodon server domain
guard let self = self else { return nil }
//TODO: @zeitschlag Also allow search for incomplete URLs?
guard let domain = AuthenticationViewModel.parseDomain(from: searchText) else {
return Just(Result.failure(APIService.APIError.implicit(.badRequest))).eraseToAnyPublisher()
}

View File

@ -14,6 +14,7 @@ import Kanna
import MastodonAsset
import MastodonLocalization
//TODO: @zeitschlag Remove Delegate
protocol PickServerCellDelegate: AnyObject {
// func pickServerCell(_ cell: PickServerCell, expandButtonPressed button: UIButton)
}
@ -89,6 +90,8 @@ class PickServerCell: UITableViewCell {
return label
}()
//TODO: @zeitschlag New label for "Registrations closed"
private var collapseConstraints: [NSLayoutConstraint] = []
private var expandConstraints: [NSLayoutConstraint] = []

View File

@ -19,6 +19,7 @@ class PickServerCategoryView: UIView {
return view
}()
//TODO: @zeitschlag Remove emojiLabel
let emojiLabel: UILabel = {
let label = UILabel()
label.textAlignment = .center

View File

@ -10,6 +10,7 @@ import Combine
import MastodonAsset
import MastodonLocalization
//TODO: @zeitschlag Remove
final class MastodonRegisterAvatarTableViewCell: UITableViewCell {
static let containerSize = CGSize(width: 88, height: 88)

View File

@ -9,6 +9,7 @@ import UIKit
import MastodonAsset
import MastodonLocalization
//TODO: @zeitschlag Remove
final class MastodonRegisterPasswordHintTableViewCell: UITableViewCell {
let passwordRuleLabel: UILabel = {

View File

@ -11,7 +11,7 @@ import MastodonUI
import MastodonAsset
import MastodonLocalization
final class MastodonRegisterTextFieldTableViewCell: UITableViewCell {
//TODO: @zeitschlag Removefinal class MastodonRegisterTextFieldTableViewCell: UITableViewCell {
static let textFieldHeight: CGFloat = 50
static let textFieldLabelFont = UIFontMetrics(forTextStyle: .headline).scaledFont(for: .systemFont(ofSize: 17, weight: .semibold), maximumPointSize: 22)

View File

@ -175,6 +175,7 @@ struct MastodonRegisterView: View {
case .valid: return Color(Asset.Colors.TextField.valid.color)
}
}()
//TODO: @zeitschlag Replace shadow with border
Color(Asset.Scene.Onboarding.textFieldBackground.color)
.cornerRadius(10)
.shadow(color: shadowColor, radius: 1, x: 0, y: 2)

View File

@ -145,7 +145,7 @@ extension MastodonRegisterViewController {
let alertController = UIAlertController(for: error, title: "Sign Up Failure", preferredStyle: .alert)
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil)
alertController.addAction(okAction)
self.coordinator.present(
_ = self.coordinator.present(
scene: .alertController(alertController: alertController),
from: nil,
transition: .alertController(animated: true, completion: nil)

View File

@ -11,6 +11,7 @@ import MastodonAsset
import MastodonLocalization
extension MastodonRegisterViewModel {
//TODO: @zeitschlag Remove, as the screen is based on SwiftUI now
func setupDiffableDataSource(
tableView: UITableView
) {

View File

@ -127,7 +127,7 @@ extension MastodonServerRulesViewController {
instance: viewModel.instance,
applicationToken: viewModel.applicationToken
)
coordinator.present(scene: .mastodonRegister(viewModel: viewModel), from: self, transition: .show)
_ = coordinator.present(scene: .mastodonRegister(viewModel: viewModel), from: self, transition: .show)
}
}

View File

@ -317,12 +317,13 @@ extension WelcomeViewController {
extension WelcomeViewController {
@objc
private func signUpButtonDidClicked(_ sender: UIButton) {
coordinator.present(scene: .mastodonPickServer(viewMode: MastodonPickServerViewModel(context: context, mode: .signUp)), from: self, transition: .show)
_ = coordinator.present(scene: .mastodonPickServer(viewMode: MastodonPickServerViewModel(context: context, mode: .signUp)), from: self, transition: .show)
}
@objc
private func signInButtonDidClicked(_ sender: UIButton) {
coordinator.present(scene: .mastodonPickServer(viewMode: MastodonPickServerViewModel(context: context, mode: .signIn)), from: self, transition: .show)
//TODO: @zeitschlag Present new login-scene
_ = coordinator.present(scene: .mastodonPickServer(viewMode: MastodonPickServerViewModel(context: context, mode: .signIn)), from: self, transition: .show)
}
@objc

View File

@ -22,6 +22,7 @@ extension Mastodon.Entity {
public let approvalRequired: Bool
public let language: String
public let category: String
//TODO: @zeitschlag Is there a way to figure out in advance if a server accepts new registrations? Right now we'd have to query the server and it responts with a `AuthenticationViewModel.AuthenticationError.registrationClosed`
enum CodingKeys: String, CodingKey {
case domain