Add new educational-screen (IOS-134)

This commit is contained in:
Nathan Mattes 2023-04-05 23:33:21 +02:00
parent f60bc7e4f6
commit 30180411aa
7 changed files with 123 additions and 55 deletions

View File

@ -268,30 +268,26 @@
"or": "or"
},
"education": {
"what_is_mastodon": {
"title": "What is",
"description": "Imagine you have an email address that ends with @example.com.\n\nYou can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com."
},
"mastodon_is_like_that": {
"title": "Mastodon is like that",
"description": "Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online."
},
"how_do_i_pick_a_server": {
"title": "How do I pick a server?",
"description": "Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.\n\nYou cant go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), youll never miss a beat anywhere."
},
"mastodon": {
"title": "Welcome to Mastodon",
"description": "Mastodon is a decentralized social network, meaning no single company controls it. Its made up of many independently-run servers, all connected together."
},
"servers": {
"title": "What are servers?",
"description": "Every Mastodon account is hosted on a server — each with its own values, rules, & admins. No matter which one you pick, you can follow and interact with people on any server."
},
"a11y": {
"what_is_mastodon": {
"title": "What is Mastodon?"
}
}
"title": "What is Mastodon?"
}
}
}
},
"login": {
"title": "Welcome back",
"subtitle": "Log you in on the server you created your account on.",
"server_search_field": {
"placeholder": "Enter URL or search for your server"
"placeholder": "Enter URL or search for your server"
}
},
"server_picker": {

View File

@ -135,6 +135,7 @@
9E44C7202967AD17004B2A72 /* MastodonSDKDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; };
9E44C7222967AD17004B2A72 /* MastodonSDKDynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 9E44C71F2967AD17004B2A72 /* MastodonSDKDynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
C24C97032922F30500BAE8CB /* RefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = C24C97022922F30500BAE8CB /* RefreshControl.swift */; };
D807C6C029DE197900A4E17C /* EducationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D807C6BF29DE197900A4E17C /* EducationViewController.swift */; };
D808B94C296ECFDC0031EB1E /* StatusEditHistoryViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808B94B296ECFDC0031EB1E /* StatusEditHistoryViewModel.swift */; };
D808B94E296EFBBA0031EB1E /* StatusEditHistoryTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D808B94D296EFBBA0031EB1E /* StatusEditHistoryTableViewCell.swift */; };
D8099078294BC8A30050219F /* PrivacyTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8099077294BC8A30050219F /* PrivacyTableViewController.swift */; };
@ -771,6 +772,7 @@
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; };
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>"; };
D807C6BF29DE197900A4E17C /* EducationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EducationViewController.swift; sourceTree = "<group>"; };
D808B94B296ECFDC0031EB1E /* StatusEditHistoryViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusEditHistoryViewModel.swift; sourceTree = "<group>"; };
D808B94D296EFBBA0031EB1E /* StatusEditHistoryTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusEditHistoryTableViewCell.swift; sourceTree = "<group>"; };
D8099077294BC8A30050219F /* PrivacyTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrivacyTableViewController.swift; sourceTree = "<group>"; };
@ -1320,6 +1322,7 @@
DBABE3F125ECAC4E00879EE5 /* View */,
0FAA0FDE25E0B57E0017CCDE /* WelcomeViewController.swift */,
DB1D61CE26F1B33600DA8662 /* WelcomeViewModel.swift */,
D807C6BF29DE197900A4E17C /* EducationViewController.swift */,
);
path = Welcome;
sourceTree = "<group>";
@ -2040,6 +2043,7 @@
D8A6FE6029325F5900666A47 /* Localization */,
);
sourceTree = "<group>";
tabWidth = 4;
};
DB427DD325BAA00100D1B89D /* Products */ = {
isa = PBXGroup;
@ -3245,10 +3249,10 @@
targets = (
DB427DD125BAA00100D1B89D /* Mastodon */,
DB427DE725BAA00100D1B89D /* MastodonTests */,
DB8FABC526AEC7B2008E5AF4 /* MastodonIntent */,
DB427DF225BAA00100D1B89D /* MastodonUITests */,
DBF8AE12263293E400C9C23C /* NotificationService */,
DBC6461126A170AB00B0E31B /* ShareActionExtension */,
DB8FABC526AEC7B2008E5AF4 /* MastodonIntent */,
2A64515C29642A8A00CD8B8A /* OpenInActionExtension */,
2A72811F297EA9D7004138C5 /* WidgetExtension */,
);
@ -3788,6 +3792,7 @@
DB68A04A25E9027700CFDF14 /* AdaptiveStatusBarStyleNavigationController.swift in Sources */,
0FB3D33825E6401400AAD544 /* PickServerCell.swift in Sources */,
6213AF5C28939C8A00BCADB6 /* BookmarkViewModel+State.swift in Sources */,
D807C6C029DE197900A4E17C /* EducationViewController.swift in Sources */,
DB6D9F8426358EEC008423CD /* SettingsItem.swift in Sources */,
2D364F7825E66D8300204FDC /* MastodonResendEmailViewModel.swift in Sources */,
DBEFCD7B282A162400C0ABEA /* ReportReasonView.swift in Sources */,

View File

@ -0,0 +1,75 @@
// Copyright © 2023 Mastodon gGmbH. All rights reserved.
import UIKit
import MastodonLocalization
class EducationViewController: UIViewController {
let mastodonLabel: UILabel
let mastodonExplanation: UILabel
let serversLabel: UILabel
let serversExplanation: UILabel
private let contentStackView: UIStackView
// private let contentScrollView: UIScrollView
//TODO: Add ScrollView for dynamic type
init() {
mastodonLabel = UILabel()
mastodonLabel.numberOfLines = 0
mastodonLabel.adjustsFontForContentSizeCategory = true
mastodonLabel.text = L10n.Scene.Welcome.Education.Mastodon.title
mastodonLabel.font = UIFontMetrics(forTextStyle: .title2).scaledFont(for: .systemFont(ofSize: 22, weight: .bold))
mastodonLabel.textColor = .label
mastodonExplanation = UILabel()
mastodonExplanation.numberOfLines = 0
mastodonExplanation.adjustsFontForContentSizeCategory = true
mastodonExplanation.text = L10n.Scene.Welcome.Education.Mastodon.description
mastodonExplanation.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular))
mastodonExplanation.textColor = .label
serversLabel = UILabel()
serversLabel.numberOfLines = 0
serversLabel.adjustsFontForContentSizeCategory = true
serversLabel.text = L10n.Scene.Welcome.Education.Servers.title
serversLabel.font = UIFontMetrics(forTextStyle: .title2).scaledFont(for: .systemFont(ofSize: 22, weight: .bold))
serversLabel.textColor = .label
serversExplanation = UILabel()
serversExplanation.numberOfLines = 0
serversExplanation.adjustsFontForContentSizeCategory = true
serversExplanation.text = L10n.Scene.Welcome.Education.Servers.description
serversExplanation.font = UIFontMetrics(forTextStyle: .body).scaledFont(for: .systemFont(ofSize: 17, weight: .regular))
serversExplanation.textColor = .label
contentStackView = UIStackView(arrangedSubviews: [mastodonLabel, mastodonExplanation, serversLabel, serversExplanation])
contentStackView.translatesAutoresizingMaskIntoConstraints = false
contentStackView.axis = .vertical
contentStackView.alignment = .leading
contentStackView.setCustomSpacing(2, after: mastodonLabel)
contentStackView.setCustomSpacing(24, after: mastodonExplanation)
contentStackView.setCustomSpacing(2, after: serversLabel)
super.init(nibName: nil, bundle: nil)
view.addSubview(contentStackView)
view.backgroundColor = .systemBackground
setupConstraints()
}
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
private func setupConstraints() {
let constraints = [
contentStackView.topAnchor.constraint(equalTo: view.topAnchor, constant: 32),
contentStackView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16),
view.trailingAnchor.constraint(equalTo: contentStackView.trailingAnchor, constant: 16),
view.safeAreaLayoutGuide.bottomAnchor.constraint(greaterThanOrEqualTo: contentStackView.bottomAnchor, constant: 32),
]
NSLayoutConstraint.activate(constraints)
}
}

View File

@ -437,7 +437,15 @@ extension WelcomeViewController {
@objc
private func learnMore(_ sender: UIButton) {
//TODO: Show Education-part
let educationViewController = EducationViewController()
educationViewController.modalPresentationStyle = .pageSheet
if let sheetPresentationController = educationViewController.sheetPresentationController {
sheetPresentationController.detents = [.medium()]
sheetPresentationController.prefersGrabberVisible = true
}
present(educationViewController, animated: true)
}
@objc

View File

@ -1512,27 +1512,17 @@ public enum L10n {
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.A11Y.WhatIsMastodon.Title", fallback: "What is Mastodon?")
}
}
public enum HowDoIPickAServer {
/// Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.
///
/// You cant go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), youll never miss a beat anywhere.
public static let description = L10n.tr("Localizable", "Scene.Welcome.Education.HowDoIPickAServer.Description", fallback: "Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.\n\nYou cant go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), youll never miss a beat anywhere.")
/// How do I pick a server?
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.HowDoIPickAServer.Title", fallback: "How do I pick a server?")
public enum Mastodon {
/// Mastodon is a decentralized social network, meaning no single company controls it. Its made up of many independently-run servers, all connected together.
public static let description = L10n.tr("Localizable", "Scene.Welcome.Education.Mastodon.Description", fallback: "Mastodon is a decentralized social network, meaning no single company controls it. Its made up of many independently-run servers, all connected together.")
/// Welcome to Mastodon
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.Mastodon.Title", fallback: "Welcome to Mastodon")
}
public enum MastodonIsLikeThat {
/// Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online.
public static let description = L10n.tr("Localizable", "Scene.Welcome.Education.MastodonIsLikeThat.Description", fallback: "Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online.")
/// Mastodon is like that
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.MastodonIsLikeThat.Title", fallback: "Mastodon is like that")
}
public enum WhatIsMastodon {
/// Imagine you have an email address that ends with @example.com.
///
/// You can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com.
public static let description = L10n.tr("Localizable", "Scene.Welcome.Education.WhatIsMastodon.Description", fallback: "Imagine you have an email address that ends with @example.com.\n\nYou can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com.")
/// What is
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.WhatIsMastodon.Title", fallback: "What is")
public enum Servers {
/// Every Mastodon account is hosted on a server each with its own values, rules, & admins. No matter which one you pick, you can follow and interact with people on any server.
public static let description = L10n.tr("Localizable", "Scene.Welcome.Education.Servers.Description", fallback: "Every Mastodon account is hosted on a server — each with its own values, rules, & admins. No matter which one you pick, you can follow and interact with people on any server.")
/// What are servers?
public static let title = L10n.tr("Localizable", "Scene.Welcome.Education.Servers.Title", fallback: "What are servers?")
}
}
public enum Separator {

View File

@ -520,17 +520,13 @@ uploaded to Mastodon.";
"Scene.SuggestionAccount.Title" = "Find People to Follow";
"Scene.Thread.BackTitle" = "Post";
"Scene.Thread.Title" = "Post from %@";
"Scene.Welcome.Education.A11Y.WhatIsMastodon.Title" = "What is Mastodon?";
"Scene.Welcome.Education.HowDoIPickAServer.Description" = "Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.
"Scene.Welcome.Education.Mastodon.Title" = "Welcome to Mastodon";
"Scene.Welcome.Education.Mastodon.Description" = "Mastodon is a decentralized social network, meaning no single company controls it. Its made up of many independently-run servers, all connected together.";
"Scene.Welcome.Education.Servers.Title" = "What are servers?";
"Scene.Welcome.Education.Servers.Description" = "Every Mastodon account is hosted on a server — each with its own values, rules, & admins. No matter which one you pick, you can follow and interact with people on any server.";
You cant go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), youll never miss a beat anywhere.";
"Scene.Welcome.Education.HowDoIPickAServer.Title" = "How do I pick a server?";
"Scene.Welcome.Education.MastodonIsLikeThat.Description" = "Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online.";
"Scene.Welcome.Education.MastodonIsLikeThat.Title" = "Mastodon is like that";
"Scene.Welcome.Education.WhatIsMastodon.Description" = "Imagine you have an email address that ends with @example.com.
You can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com.";
"Scene.Welcome.Education.WhatIsMastodon.Title" = "What is";
"Scene.Welcome.GetStarted" = "Get Started";
"Scene.Welcome.LogIn" = "Log In";
"Scene.Welcome.Slogan" = "Social networking

View File

@ -522,17 +522,14 @@ uploaded to Mastodon.";
"Scene.SuggestionAccount.Title" = "Find People to Follow";
"Scene.Thread.BackTitle" = "Post";
"Scene.Thread.Title" = "Post from %@";
"Scene.Welcome.Education.A11Y.WhatIsMastodon.Title" = "What is Mastodon?";
"Scene.Welcome.Education.HowDoIPickAServer.Description" = "Different people choose different servers for any number of reasons. art.example is a great place for artists, while glasgow.example might be a good pick for Scots.
You cant go wrong with any of our recommend servers, so regardless of which one you pick (or if you enter your own in the server search bar), youll never miss a beat anywhere.";
"Scene.Welcome.Education.HowDoIPickAServer.Title" = "How do I pick a server?";
"Scene.Welcome.Education.MastodonIsLikeThat.Description" = "Your handle might be @gothgirl654@example.social, but you can still follow, reblog, and chat with @fallout5ever@example.online.";
"Scene.Welcome.Education.MastodonIsLikeThat.Title" = "Mastodon is like that";
"Scene.Welcome.Education.WhatIsMastodon.Description" = "Imagine you have an email address that ends with @example.com.
"Scene.Welcome.Education.Mastodon.Title" = "Welcome to Mastodon";
"Scene.Welcome.Education.Mastodon.Description" = "Mastodon is a decentralized social network, meaning no single company controls it. Its made up of many independently-run servers, all connected together.";
"Scene.Welcome.Education.Servers.Title" = "What are servers?";
"Scene.Welcome.Education.Servers.Description" = "Every Mastodon account is hosted on a server — each with its own values, rules, & admins. No matter which one you pick, you can follow and interact with people on any server.";
You can still send and receive emails from anyone, even if their email ends in @gmail.com or @icloud.com or @example.com.";
"Scene.Welcome.Education.WhatIsMastodon.Title" = "What is";
"Scene.Welcome.GetStarted" = "Get Started";
"Scene.Welcome.LogIn" = "Log In";
"Scene.Welcome.LogIn" = "Log In";
@ -540,6 +537,7 @@ You can still send and receive emails from anyone, even if their email ends in @
"Scene.Welcome.JoinDefault_server" = "Join mastodon.social";
"Scene.Welcome.PickServer" = "Pick my own server";
"Scene.Welcome.Separator.Or" = "Or";
"Widget.Common.UnsupportedWidgetFamily" = "Sorry but this Widget family is unsupported.";
"Widget.Common.UserNotLoggedIn" = "Please open Mastodon to log in to an Account.";
"Widget.FollowersCount.ConfigurationDescription" = "Show number of followers.";