Add basic classes for privacy-screen during onboarding (#690)

This commit is contained in:
Nathan Mattes 2022-12-16 21:30:21 +01:00
parent 96f51f039d
commit 4c6c8b48af
6 changed files with 103 additions and 11 deletions

View File

@ -110,6 +110,8 @@
9E44C7202967AD17004B2A72 /* MastodonSDKDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; }; 9E44C7202967AD17004B2A72 /* MastodonSDKDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; };
9E44C7222967AD17004B2A72 /* MastodonSDKDynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 9E44C7222967AD17004B2A72 /* MastodonSDKDynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
C24C97032922F30500BAE8CB /* RefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24C97022922F30500BAE8CB /* RefreshControl.swift */; }; C24C97032922F30500BAE8CB /* RefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24C97022922F30500BAE8CB /* RefreshControl.swift */; };
D8099078294BC8A30050219F /* PrivacyTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8099077294BC8A30050219F /* PrivacyTableViewController.swift */; };
D809907A294BC9390050219F /* PrivacyTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8099079294BC9390050219F /* PrivacyTableViewCell.swift */; };
D8363B1629469CE200A74079 /* OnboardingNextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8363B1529469CE200A74079 /* OnboardingNextView.swift */; }; D8363B1629469CE200A74079 /* OnboardingNextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8363B1529469CE200A74079 /* OnboardingNextView.swift */; };
D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87BFC8A291D5C6B00FEE264 /* MastodonLoginView.swift */; }; D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87BFC8A291D5C6B00FEE264 /* MastodonLoginView.swift */; };
D87BFC8D291EB81200FEE264 /* MastodonLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87BFC8C291EB81200FEE264 /* MastodonLoginViewModel.swift */; }; D87BFC8D291EB81200FEE264 /* MastodonLoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D87BFC8C291EB81200FEE264 /* MastodonLoginViewModel.swift */; };
@ -659,6 +661,8 @@
C3789232A52F43529CA67E95 /* Pods-MastodonIntent.asdk - debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MastodonIntent.asdk - debug.xcconfig"; path = "Target Support Files/Pods-MastodonIntent/Pods-MastodonIntent.asdk - debug.xcconfig"; sourceTree = "<group>"; }; C3789232A52F43529CA67E95 /* Pods-MastodonIntent.asdk - debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MastodonIntent.asdk - debug.xcconfig"; path = "Target Support Files/Pods-MastodonIntent/Pods-MastodonIntent.asdk - debug.xcconfig"; sourceTree = "<group>"; };
CD92E0F10BDE4FE7C4B999F2 /* Pods_MastodonTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MastodonTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; CD92E0F10BDE4FE7C4B999F2 /* Pods_MastodonTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MastodonTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D7D7CF93E262178800077512 /* Pods-Mastodon-AppShared.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mastodon-AppShared.debug.xcconfig"; path = "Target Support Files/Pods-Mastodon-AppShared/Pods-Mastodon-AppShared.debug.xcconfig"; sourceTree = "<group>"; }; D7D7CF93E262178800077512 /* Pods-Mastodon-AppShared.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Mastodon-AppShared.debug.xcconfig"; path = "Target Support Files/Pods-Mastodon-AppShared/Pods-Mastodon-AppShared.debug.xcconfig"; sourceTree = "<group>"; };
D8099077294BC8A30050219F /* PrivacyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyTableViewController.swift; sourceTree = "<group>"; };
D8099079294BC9390050219F /* PrivacyTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyTableViewCell.swift; sourceTree = "<group>"; };
D8363B1529469CE200A74079 /* OnboardingNextView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = OnboardingNextView.swift; sourceTree = "<group>"; tabWidth = 4; }; D8363B1529469CE200A74079 /* OnboardingNextView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = OnboardingNextView.swift; sourceTree = "<group>"; tabWidth = 4; };
D87BFC8A291D5C6B00FEE264 /* MastodonLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonLoginView.swift; sourceTree = "<group>"; }; D87BFC8A291D5C6B00FEE264 /* MastodonLoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonLoginView.swift; sourceTree = "<group>"; };
D87BFC8C291EB81200FEE264 /* MastodonLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonLoginViewModel.swift; sourceTree = "<group>"; }; D87BFC8C291EB81200FEE264 /* MastodonLoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonLoginViewModel.swift; sourceTree = "<group>"; };
@ -1582,6 +1586,15 @@
path = Bookmark; path = Bookmark;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D8099076294BC2BA0050219F /* Privacy */ = {
isa = PBXGroup;
children = (
D8099077294BC8A30050219F /* PrivacyTableViewController.swift */,
D8099079294BC9390050219F /* PrivacyTableViewCell.swift */,
);
path = Privacy;
sourceTree = "<group>";
};
D8A6AB68291C50F3003AB663 /* Login */ = { D8A6AB68291C50F3003AB663 /* Login */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -1620,6 +1633,7 @@
DB01409B25C40BB600F9F3CF /* Onboarding */ = { DB01409B25C40BB600F9F3CF /* Onboarding */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D8099076294BC2BA0050219F /* Privacy */,
D8A6AB68291C50F3003AB663 /* Login */, D8A6AB68291C50F3003AB663 /* Login */,
DB68A03825E900CC00CFDF14 /* Share */, DB68A03825E900CC00CFDF14 /* Share */,
0FAA0FDD25E0B5700017CCDE /* Welcome */, 0FAA0FDD25E0B5700017CCDE /* Welcome */,
@ -3254,6 +3268,7 @@
DB1FD45A25F27898004CFCFC /* CategoryPickerItem.swift in Sources */, DB1FD45A25F27898004CFCFC /* CategoryPickerItem.swift in Sources */,
DB6180F626391D580018D199 /* MediaPreviewableViewController.swift in Sources */, DB6180F626391D580018D199 /* MediaPreviewableViewController.swift in Sources */,
2D571B2F26004EC000540450 /* NavigationBarProgressView.swift in Sources */, 2D571B2F26004EC000540450 /* NavigationBarProgressView.swift in Sources */,
D8099078294BC8A30050219F /* PrivacyTableViewController.swift in Sources */,
0FAA101225E105390017CCDE /* PrimaryActionButton.swift in Sources */, 0FAA101225E105390017CCDE /* PrimaryActionButton.swift in Sources */,
DB443CD42694627B00159B29 /* AppearanceView.swift in Sources */, DB443CD42694627B00159B29 /* AppearanceView.swift in Sources */,
DBF1D24E269DAF5D00C1C08A /* SearchDetailViewController.swift in Sources */, DBF1D24E269DAF5D00C1C08A /* SearchDetailViewController.swift in Sources */,
@ -3386,6 +3401,7 @@
2A506CF6292D040100059C37 /* HashtagTimelineHeaderView.swift in Sources */, 2A506CF6292D040100059C37 /* HashtagTimelineHeaderView.swift in Sources */,
DBA5E7A5263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift in Sources */, DBA5E7A5263BD28C004598BB /* ContextMenuImagePreviewViewModel.swift in Sources */,
DB3E6FF52807C40300B035AE /* DiscoveryForYouViewController.swift in Sources */, DB3E6FF52807C40300B035AE /* DiscoveryForYouViewController.swift in Sources */,
D809907A294BC9390050219F /* PrivacyTableViewCell.swift in Sources */,
2D38F1E525CD46C100561493 /* HomeTimelineViewModel.swift in Sources */, 2D38F1E525CD46C100561493 /* HomeTimelineViewModel.swift in Sources */,
DB0FCB842796B2A2006C02E2 /* FavoriteViewController+DataSourceProvider.swift in Sources */, DB0FCB842796B2A2006C02E2 /* FavoriteViewController+DataSourceProvider.swift in Sources */,
DB0FCB68279507EF006C02E2 /* DataSourceFacade+Meta.swift in Sources */, DB0FCB68279507EF006C02E2 /* DataSourceFacade+Meta.swift in Sources */,

View File

@ -145,6 +145,7 @@ extension SceneCoordinator {
case welcome case welcome
case mastodonPickServer(viewMode: MastodonPickServerViewModel) case mastodonPickServer(viewMode: MastodonPickServerViewModel)
case mastodonRegister(viewModel: MastodonRegisterViewModel) case mastodonRegister(viewModel: MastodonRegisterViewModel)
case mastodonPrivacyPolicies
case mastodonServerRules(viewModel: MastodonServerRulesViewModel) case mastodonServerRules(viewModel: MastodonServerRulesViewModel)
case mastodonConfirmEmail(viewModel: MastodonConfirmEmailViewModel) case mastodonConfirmEmail(viewModel: MastodonConfirmEmailViewModel)
case mastodonResendEmail(viewModel: MastodonResendEmailViewModel) case mastodonResendEmail(viewModel: MastodonResendEmailViewModel)
@ -413,6 +414,9 @@ private extension SceneCoordinator {
loginViewController.delegate = self loginViewController.delegate = self
viewController = loginViewController viewController = loginViewController
case .mastodonPrivacyPolicies:
let privacyViewController = PrivacyTableViewController(context: appContext, coordinator: self)
viewController = privacyViewController
case .mastodonResendEmail(let viewModel): case .mastodonResendEmail(let viewModel):
let _viewController = MastodonResendEmailViewController() let _viewController = MastodonResendEmailViewController()
_viewController.viewModel = viewModel _viewController.viewModel = viewModel

View File

@ -0,0 +1,13 @@
//
// PrivacyTableViewCell.swift
// Mastodon
//
// Created by Nathan Mattes on 15.12.22.
//
import UIKit
class PrivacyTableViewCell: UITableViewCell {
static let reuseIdentifier = "PrivacyTableViewCell"
//TODO: @zeitschlag Implement
}

View File

@ -0,0 +1,66 @@
//
// PrivacyTableViewController.swift
// Mastodon
//
// Created by Nathan Mattes on 15.12.22.
//
import UIKit
import MastodonCore
import MastodonSDK
// https://joinmastodon.org/ios/privacy
// "\(server.domain)/privacy-policy"
class PrivacyTableViewController: UIViewController, NeedsDependency {
var context: AppContext!
var coordinator: SceneCoordinator!
private let tableView: UITableView
init(context: AppContext, coordinator: SceneCoordinator, server: Mastodon.Entity.Server) {
self.context = context
self.coordinator = coordinator
tableView = UITableView(frame: .zero, style: .insetGrouped)
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.register(PrivacyTableViewCell.self, forCellReuseIdentifier: PrivacyTableViewCell.reuseIdentifier)
tableView.register(OnboardingHeadlineTableViewCell.self, forCellReuseIdentifier: OnboardingHeadlineTableViewCell.reuseIdentifier)
super.init(nibName: nil, bundle: nil)
view.addSubview(tableView)
setupConstraints()
}
required init?(coder: NSCoder) { fatalError("init(coder:) won't been implemented, please don't use Storyboards.") }
private func setupConstraints() {
let constraints = [
tableView.topAnchor.constraint(equalTo: view.topAnchor),
tableView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
view.trailingAnchor.constraint(equalTo: tableView.trailingAnchor),
view.bottomAnchor.constraint(equalTo: tableView.bottomAnchor)
]
NSLayoutConstraint.activate(constraints)
}
//MARK: - Actions
@objc private func backButtonPressed(_ sender: UIButton) {
navigationController?.popViewController(animated: true)
}
@objc private func nextButtonPressed(_ sender: UIButton) {
// let viewModel = MastodonRegisterViewModel(
// context: context,
// domain: viewModel.domain,
// authenticateInfo: viewModel.authenticateInfo,
// instance: viewModel.instance,
// applicationToken: viewModel.applicationToken
// )
// _ = coordinator.present(scene: .mastodonRegister(viewModel: viewModel), from: self, transition: .show)
}
}

View File

@ -68,22 +68,13 @@ extension MastodonServerRulesViewController {
} }
extension MastodonServerRulesViewController { extension MastodonServerRulesViewController {
@objc private func backButtonPressed(_ sender: UIButton) { @objc private func backButtonPressed(_ sender: UIButton) {
navigationController?.popViewController(animated: true) navigationController?.popViewController(animated: true)
} }
@objc private func nextButtonPressed(_ sender: UIButton) { @objc private func nextButtonPressed(_ sender: UIButton) {
let viewModel = MastodonRegisterViewModel( _ = coordinator.present(scene: .mastodonPrivacyPolicies, from: self, transition: .show)
context: context,
domain: viewModel.domain,
authenticateInfo: viewModel.authenticateInfo,
instance: viewModel.instance,
applicationToken: viewModel.applicationToken
)
_ = coordinator.present(scene: .mastodonRegister(viewModel: viewModel), from: self, transition: .show)
} }
} }
// MARK: - OnboardingViewControllerAppearance // MARK: - OnboardingViewControllerAppearance

View File

@ -11,6 +11,8 @@ import MastodonLocalization
final class OnboardingHeadlineTableViewCell: UITableViewCell { final class OnboardingHeadlineTableViewCell: UITableViewCell {
static let reuseIdentifier = "OnboardingHeadlineTableViewCell"
let subTitleLabel: UILabel = { let subTitleLabel: UILabel = {
let label = UILabel() let label = UILabel()
label.font = MastodonPickServerViewController.subTitleFont label.font = MastodonPickServerViewController.subTitleFont