chore: add OnboardingAppearance
This commit is contained in:
parent
35ef867adf
commit
5dbd015b16
|
@ -79,17 +79,19 @@
|
|||
"title": "One last thing.",
|
||||
"subtitle": "We just sent an email to %@,\ntap the link to confirm your account.",
|
||||
"button": {
|
||||
"open_email_app": "Open email app",
|
||||
"open_email_app": "Open Email App",
|
||||
"dont_receive_email": "I never got an email"
|
||||
},
|
||||
"dont_receive_email": {
|
||||
"alert_title": "It’s too soon to tell.",
|
||||
"alert_description": "Give our servers another n seconds before sending another email.\nCheck if your email address is correct as well as your junk folder if you haven’t."
|
||||
"title": "Check your email",
|
||||
"description": "Check if your email address is correct as well as your junk folder if you haven’t.",
|
||||
"resend_email": "Resend email"
|
||||
},
|
||||
"open_email_app": {
|
||||
"alert_title": "Check your inbox.",
|
||||
"alert_description": "We just sent you another email. Check your junk folder if you haven’t.",
|
||||
"mail": "Mail"
|
||||
"title": "Check your inbox.",
|
||||
"description": "We just sent you an email. Check your junk folder if you haven’t.",
|
||||
"mail": "Mail",
|
||||
"open_email_client": "Open Email Client"
|
||||
}
|
||||
},
|
||||
"home_timeline": {
|
||||
|
|
|
@ -57,6 +57,8 @@
|
|||
2D76319F25C1521200929FB9 /* StatusSection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D76319E25C1521200929FB9 /* StatusSection.swift */; };
|
||||
2D7631A825C1535600929FB9 /* StatusTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D7631A725C1535600929FB9 /* StatusTableViewCell.swift */; };
|
||||
2D7631B325C159F700929FB9 /* Item.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D7631B225C159F700929FB9 /* Item.swift */; };
|
||||
2D82B9FF25E7863200E36F0F /* OnboardingViewControllerAppearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D82B9FE25E7863200E36F0F /* OnboardingViewControllerAppearance.swift */; };
|
||||
2D82BA0525E7897700E36F0F /* MastodonResendEmailViewModelNavigationDelegateShim.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D82BA0425E7897700E36F0F /* MastodonResendEmailViewModelNavigationDelegateShim.swift */; };
|
||||
2D927F0225C7E4F2004F19B8 /* Mention.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D927F0125C7E4F2004F19B8 /* Mention.swift */; };
|
||||
2D927F0825C7E9A8004F19B8 /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D927F0725C7E9A8004F19B8 /* Tag.swift */; };
|
||||
2D927F0E25C7E9C9004F19B8 /* History.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D927F0D25C7E9C9004F19B8 /* History.swift */; };
|
||||
|
@ -251,6 +253,8 @@
|
|||
2D76319E25C1521200929FB9 /* StatusSection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusSection.swift; sourceTree = "<group>"; };
|
||||
2D7631A725C1535600929FB9 /* StatusTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusTableViewCell.swift; sourceTree = "<group>"; };
|
||||
2D7631B225C159F700929FB9 /* Item.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Item.swift; sourceTree = "<group>"; };
|
||||
2D82B9FE25E7863200E36F0F /* OnboardingViewControllerAppearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewControllerAppearance.swift; sourceTree = "<group>"; };
|
||||
2D82BA0425E7897700E36F0F /* MastodonResendEmailViewModelNavigationDelegateShim.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonResendEmailViewModelNavigationDelegateShim.swift; sourceTree = "<group>"; };
|
||||
2D927F0125C7E4F2004F19B8 /* Mention.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Mention.swift; sourceTree = "<group>"; };
|
||||
2D927F0725C7E9A8004F19B8 /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; };
|
||||
2D927F0D25C7E9C9004F19B8 /* History.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = History.swift; sourceTree = "<group>"; };
|
||||
|
@ -455,6 +459,7 @@
|
|||
children = (
|
||||
2D364F7125E66D7500204FDC /* MastodonResendEmailViewController.swift */,
|
||||
2D364F7725E66D8300204FDC /* MastodonResendEmailViewModel.swift */,
|
||||
2D82BA0425E7897700E36F0F /* MastodonResendEmailViewModelNavigationDelegateShim.swift */,
|
||||
);
|
||||
path = ResendEmail;
|
||||
sourceTree = "<group>";
|
||||
|
@ -548,6 +553,7 @@
|
|||
2D38F1C525CD37F400561493 /* ContentOffsetAdjustableTimelineViewControllerDelegate.swift */,
|
||||
2D38F20725CD491300561493 /* DisposeBagCollectable.swift */,
|
||||
2D5A3D3725CF8D9F002347D6 /* ScrollViewContainer.swift */,
|
||||
2D82B9FE25E7863200E36F0F /* OnboardingViewControllerAppearance.swift */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1386,6 +1392,7 @@
|
|||
2DA7D04425CA52B200804E11 /* TimelineLoaderTableViewCell.swift in Sources */,
|
||||
DB8AF52F25C13561002E6C99 /* DocumentStore.swift in Sources */,
|
||||
DB9D6C2425E502C60051B173 /* MosaicImageViewModel.swift in Sources */,
|
||||
2D82BA0525E7897700E36F0F /* MastodonResendEmailViewModelNavigationDelegateShim.swift in Sources */,
|
||||
2D38F1EB25CD477000561493 /* HomeTimelineViewModel+LoadLatestState.swift in Sources */,
|
||||
DBD9149025DF6D8D00903DFD /* APIService+Onboarding.swift in Sources */,
|
||||
DB98337F25C9452D00AD9700 /* APIService+APIError.swift in Sources */,
|
||||
|
@ -1393,6 +1400,7 @@
|
|||
DBE0822425CD3F1E00FD6BBD /* MastodonRegisterViewModel.swift in Sources */,
|
||||
2DF75B9B25D0E27500694EC8 /* StatusProviderFacade.swift in Sources */,
|
||||
DB5086A525CC0B7000C2C187 /* AvatarBarButtonItem.swift in Sources */,
|
||||
2D82B9FF25E7863200E36F0F /* OnboardingViewControllerAppearance.swift in Sources */,
|
||||
2D38F1E525CD46C100561493 /* HomeTimelineViewModel.swift in Sources */,
|
||||
2D76316B25C14D4C00929FB9 /* PublicTimelineViewModel.swift in Sources */,
|
||||
2D38F1DF25CD46A400561493 /* HomeTimelineViewController+StatusProvider.swift in Sources */,
|
||||
|
|
|
@ -86,17 +86,21 @@ internal enum L10n {
|
|||
}
|
||||
internal enum DontReceiveEmail {
|
||||
/// Give our servers another n seconds before sending another email.\nCheck if your email address is correct as well as your junk folder if you haven’t.
|
||||
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.AlertDescription")
|
||||
internal static let description = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.Description")
|
||||
/// Resend Email
|
||||
internal static let resendEmail = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.ResendEmail")
|
||||
/// It’s too soon to tell.
|
||||
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.AlertTitle")
|
||||
internal static let title = L10n.tr("Localizable", "Scene.ConfirmEmail.DontReceiveEmail.Title")
|
||||
}
|
||||
internal enum OpenEmailApp {
|
||||
/// We just sent you another email. Check your junk folder if you haven’t.
|
||||
internal static let alertDescription = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.AlertDescription")
|
||||
/// Check your inbox.
|
||||
internal static let alertTitle = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.AlertTitle")
|
||||
internal static let description = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.Description")
|
||||
/// Mail
|
||||
internal static let mail = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.Mail")
|
||||
/// Open Email Client
|
||||
internal static let openEmailClient = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient")
|
||||
/// Check your inbox.
|
||||
internal static let title = L10n.tr("Localizable", "Scene.ConfirmEmail.OpenEmailApp.Title")
|
||||
}
|
||||
}
|
||||
internal enum HomeTimeline {
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
//
|
||||
// OnboardingViewControllerAppearance.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by sxiaojian on 2021/2/25.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
protocol OnboardingViewControllerAppearance: UIViewController {
|
||||
func setupOnboardingAppearance()
|
||||
}
|
||||
|
||||
extension OnboardingViewControllerAppearance {
|
||||
func setupOnboardingAppearance() {
|
||||
overrideUserInterfaceStyle = .light
|
||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
||||
|
||||
// set navigationBar transparent
|
||||
let barAppearance = UINavigationBarAppearance()
|
||||
barAppearance.configureWithTransparentBackground()
|
||||
navigationController?.navigationBar.standardAppearance = barAppearance
|
||||
navigationController?.navigationBar.compactAppearance = barAppearance
|
||||
navigationController?.navigationBar.scrollEdgeAppearance = barAppearance
|
||||
|
||||
let backItem = UIBarButtonItem()
|
||||
backItem.title = "back"
|
||||
navigationController?.navigationBar.topItem?.backBarButtonItem = backItem
|
||||
}
|
||||
}
|
|
@ -21,12 +21,14 @@
|
|||
"Common.Countable.Photo.Single" = "photo";
|
||||
"Scene.ConfirmEmail.Button.DontReceiveEmail" = "I never got an email";
|
||||
"Scene.ConfirmEmail.Button.OpenEmailApp" = "Open email app";
|
||||
"Scene.ConfirmEmail.DontReceiveEmail.AlertDescription" = "Give our servers another n seconds before sending another email.
|
||||
"Scene.ConfirmEmail.DontReceiveEmail.Description" = "Give our servers another n seconds before sending another email.
|
||||
Check if your email address is correct as well as your junk folder if you haven’t.";
|
||||
"Scene.ConfirmEmail.DontReceiveEmail.AlertTitle" = "It’s too soon to tell.";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.AlertDescription" = "We just sent you another email. Check your junk folder if you haven’t.";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.AlertTitle" = "Check your inbox.";
|
||||
"Scene.ConfirmEmail.DontReceiveEmail.ResendEmail" = "Resend Email";
|
||||
"Scene.ConfirmEmail.DontReceiveEmail.Title" = "It’s too soon to tell.";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.Description" = "We just sent you another email. Check your junk folder if you haven’t.";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.Mail" = "Mail";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.OpenEmailClient" = "Open Email Client";
|
||||
"Scene.ConfirmEmail.OpenEmailApp.Title" = "Check your inbox.";
|
||||
"Scene.ConfirmEmail.Subtitle" = "We just sent an email to %@,
|
||||
tap the link to confirm your account.";
|
||||
"Scene.ConfirmEmail.Title" = "One last thing.";
|
||||
|
|
|
@ -11,7 +11,7 @@ import Combine
|
|||
import MastodonSDK
|
||||
import UITextField_Shake
|
||||
|
||||
final class AuthenticationViewController: UIViewController, NeedsDependency {
|
||||
final class AuthenticationViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance{
|
||||
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
|
@ -77,9 +77,7 @@ extension AuthenticationViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
overrideUserInterfaceStyle = .dark // FIXME:
|
||||
|
||||
view.backgroundColor = Asset.Colors.Background.systemBackground.color
|
||||
self.setupOnboardingAppearance()
|
||||
|
||||
domainLabel.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(domainLabel)
|
||||
|
|
|
@ -6,11 +6,12 @@
|
|||
//
|
||||
|
||||
import Combine
|
||||
import MastodonSDK
|
||||
import os.log
|
||||
import ThirdPartyMailer
|
||||
import UIKit
|
||||
import MastodonSDK
|
||||
|
||||
final class MastodonConfirmEmailViewController: UIViewController, NeedsDependency {
|
||||
final class MastodonConfirmEmailViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||
|
@ -39,7 +40,7 @@ final class MastodonConfirmEmailViewController: UIViewController, NeedsDependenc
|
|||
let button = UIButton(type: .system)
|
||||
button.titleLabel?.font = .preferredFont(forTextStyle: .headline)
|
||||
button.setBackgroundImage(UIImage.placeholder(color: Asset.Colors.lightBrandBlue.color), for: .normal)
|
||||
button.setTitleColor(.white, for: .normal)
|
||||
button.setTitleColor(Asset.Colors.Label.primary.color, for: .normal)
|
||||
button.setTitle(L10n.Scene.ConfirmEmail.Button.openEmailApp, for: .normal)
|
||||
button.layer.masksToBounds = true
|
||||
button.layer.cornerRadius = 8
|
||||
|
@ -63,16 +64,10 @@ extension MastodonConfirmEmailViewController {
|
|||
super.viewWillAppear(animated)
|
||||
navigationController?.setNavigationBarHidden(false, animated: false)
|
||||
}
|
||||
override func viewDidLoad() {
|
||||
overrideUserInterfaceStyle = .light
|
||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
||||
|
||||
// set navigationBar transparent
|
||||
let barAppearance = UINavigationBarAppearance()
|
||||
barAppearance.configureWithTransparentBackground()
|
||||
navigationController?.navigationBar.standardAppearance = barAppearance
|
||||
navigationController?.navigationBar.compactAppearance = barAppearance
|
||||
navigationController?.navigationBar.scrollEdgeAppearance = barAppearance
|
||||
override func viewDidLoad() {
|
||||
|
||||
self.setupOnboardingAppearance()
|
||||
|
||||
// resizedView
|
||||
let resizedView = UIView()
|
||||
|
@ -103,12 +98,31 @@ extension MastodonConfirmEmailViewController {
|
|||
NSLayoutConstraint.activate([
|
||||
self.openEmailButton.heightAnchor.constraint(equalToConstant: 46),
|
||||
])
|
||||
|
||||
self.viewModel.timestampUpdatePublisher
|
||||
.sink { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
AuthenticationViewModel.verifyAndSaveAuthentication(context: self.context, info: self.viewModel.authenticateInfo, userToken: self.viewModel.userToken)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { completion in
|
||||
switch completion {
|
||||
case .failure(let error):
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", (#file as NSString).lastPathComponent, #line, #function, error.localizedDescription)
|
||||
case .finished:
|
||||
break
|
||||
}
|
||||
} receiveValue: { _ in
|
||||
self.coordinator.setup()
|
||||
}
|
||||
.store(in: &self.disposeBag)
|
||||
}
|
||||
.store(in: &self.disposeBag)
|
||||
}
|
||||
}
|
||||
|
||||
extension MastodonConfirmEmailViewController {
|
||||
@objc private func openEmailButtonPressed(_ sender: UIButton) {
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.alertTitle, message: L10n.Scene.ConfirmEmail.OpenEmailApp.alertDescription, preferredStyle: .alert)
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.title, message: L10n.Scene.ConfirmEmail.OpenEmailApp.description, preferredStyle: .alert)
|
||||
let openEmailAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.Button.openEmailApp, style: .default) { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
self.showEmailAppAlert()
|
||||
|
@ -121,12 +135,15 @@ extension MastodonConfirmEmailViewController {
|
|||
}
|
||||
|
||||
@objc private func dontReceiveButtonPressed(_ sender: UIButton) {
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.alertTitle, message: L10n.Scene.ConfirmEmail.DontReceiveEmail.alertDescription, preferredStyle: .alert)
|
||||
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default) { _ in
|
||||
let url = Mastodon.API.resendEmailURL(domain:self.viewModel.authenticateInfo.domain)
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.title, message: L10n.Scene.ConfirmEmail.DontReceiveEmail.description, preferredStyle: .alert)
|
||||
let resendAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.DontReceiveEmail.resendEmail, style: .default) { _ in
|
||||
let url = Mastodon.API.resendEmailURL(domain: self.viewModel.authenticateInfo.domain)
|
||||
let viewModel = MastodonResendEmailViewModel(resendEmailURL: url, email: self.viewModel.email)
|
||||
self.coordinator.present(scene: .mastodonResendEmail(viewModel: viewModel), from: self, transition: .show)
|
||||
self.coordinator.present(scene: .mastodonResendEmail(viewModel: viewModel), from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default) { _ in
|
||||
}
|
||||
alertController.addAction(resendAction)
|
||||
alertController.addAction(okAction)
|
||||
self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
||||
}
|
||||
|
@ -137,7 +154,7 @@ extension MastodonConfirmEmailViewController {
|
|||
let avaliableClients = clients.filter { client -> Bool in
|
||||
ThirdPartyMailer.application(application, isMailClientAvailable: client)
|
||||
}
|
||||
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .alert)
|
||||
let alertController = UIAlertController(title: L10n.Scene.ConfirmEmail.OpenEmailApp.openEmailClient, message: nil, preferredStyle: .alert)
|
||||
|
||||
let alertAction = UIAlertAction(title: L10n.Scene.ConfirmEmail.OpenEmailApp.mail, style: .default) { _ in
|
||||
UIApplication.shared.open(URL(string: "message://")!, options: [:], completionHandler: nil)
|
||||
|
@ -153,6 +170,5 @@ extension MastodonConfirmEmailViewController {
|
|||
let cancelAction = UIAlertAction(title: L10n.Common.Controls.Actions.cancel, style: .cancel, handler: nil)
|
||||
alertController.addAction(cancelAction)
|
||||
self.coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
import Combine
|
||||
import Foundation
|
||||
import MastodonSDK
|
||||
import os.log
|
||||
|
||||
final class MastodonConfirmEmailViewModel {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
let context: AppContext
|
||||
let coordinator: SceneCoordinator
|
||||
var email: String
|
||||
let authenticateInfo: AuthenticationViewModel.AuthenticateInfo
|
||||
let userToken: Mastodon.Entity.Token
|
||||
|
@ -24,30 +22,10 @@ final class MastodonConfirmEmailViewModel {
|
|||
.share()
|
||||
.eraseToAnyPublisher()
|
||||
|
||||
init(context: AppContext,coordinator: SceneCoordinator, email: String, authenticateInfo: AuthenticationViewModel.AuthenticateInfo, userToken: Mastodon.Entity.Token) {
|
||||
init(context: AppContext, email: String, authenticateInfo: AuthenticationViewModel.AuthenticateInfo, userToken: Mastodon.Entity.Token) {
|
||||
self.context = context
|
||||
self.coordinator = coordinator
|
||||
self.email = email
|
||||
self.authenticateInfo = authenticateInfo
|
||||
self.userToken = userToken
|
||||
timestampUpdatePublisher
|
||||
.sink { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
AuthenticationViewModel.verifyAndSaveAuthentication(context: self.context, info: authenticateInfo, userToken: userToken)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { completion in
|
||||
switch completion {
|
||||
case .failure(let error):
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
|
||||
case .finished:
|
||||
break
|
||||
}
|
||||
} receiveValue: { _ in
|
||||
self.coordinator.setup()
|
||||
}
|
||||
.store(in: &self.disposeBag)
|
||||
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import os.log
|
|||
import UIKit
|
||||
import UITextField_Shake
|
||||
|
||||
final class MastodonRegisterViewController: UIViewController, NeedsDependency {
|
||||
final class MastodonRegisterViewController: UIViewController, NeedsDependency, OnboardingViewControllerAppearance {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||
|
@ -196,8 +196,8 @@ extension MastodonRegisterViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
overrideUserInterfaceStyle = .light
|
||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
||||
self.setupOnboardingAppearance()
|
||||
|
||||
domainLabel.text = "@" + viewModel.domain + " "
|
||||
domainLabel.sizeToFit()
|
||||
passwordCheckLabel.attributedText = viewModel.attributeStringForPassword()
|
||||
|
@ -451,7 +451,7 @@ extension MastodonRegisterViewController {
|
|||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
navigationController?.setNavigationBarHidden(true, animated: false)
|
||||
navigationController?.setNavigationBarHidden(false, animated: false)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -568,11 +568,11 @@ extension MastodonRegisterViewController {
|
|||
} receiveValue: { [weak self] response in
|
||||
guard let self = self else { return }
|
||||
let userToken = response.value
|
||||
// TODO:
|
||||
|
||||
let alertController = UIAlertController(title: L10n.Scene.Register.success, message: L10n.Scene.Register.checkEmail, preferredStyle: .alert)
|
||||
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default) { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
let viewModel = MastodonConfirmEmailViewModel(context: self.context, coordinator: self.coordinator, email: email, authenticateInfo: self.viewModel.authenticateInfo, userToken: userToken)
|
||||
let viewModel = MastodonConfirmEmailViewModel(context: self.context, email: email, authenticateInfo: self.viewModel.authenticateInfo, userToken: userToken)
|
||||
self.coordinator.present(scene: .mastodonConfirmEmail(viewModel: viewModel), from: self, transition: .show)
|
||||
}
|
||||
alertController.addAction(okAction)
|
||||
|
|
|
@ -53,7 +53,7 @@ extension MastodonResendEmailViewController {
|
|||
])
|
||||
|
||||
let request = URLRequest(url: viewModel.resendEmailURL)
|
||||
webView.navigationDelegate = self
|
||||
webView.navigationDelegate = self.viewModel.navigationDelegate
|
||||
webView.load(request)
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: resendEmail via: %s", (#file as NSString).lastPathComponent, #line, #function, viewModel.resendEmailURL.debugDescription)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ final class MastodonResendEmailViewModel {
|
|||
let resendEmailURL: URL
|
||||
let email: String
|
||||
|
||||
private var navigationDelegateShim: MastodonResendEmailViewModelNavigationDelegateShim?
|
||||
|
||||
init(resendEmailURL: URL, email: String) {
|
||||
self.resendEmailURL = resendEmailURL
|
||||
self.email = email
|
||||
|
@ -24,3 +26,12 @@ final class MastodonResendEmailViewModel {
|
|||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
|
||||
}
|
||||
}
|
||||
extension MastodonResendEmailViewModel {
|
||||
|
||||
var navigationDelegate: WKNavigationDelegate {
|
||||
let navigationDelegateShim = MastodonResendEmailViewModelNavigationDelegateShim(viewModel: self)
|
||||
self.navigationDelegateShim = navigationDelegateShim
|
||||
return navigationDelegateShim
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// MastodonResendEmailViewModelNavigationDelegateShim.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by sxiaojian on 2021/2/25.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import Foundation
|
||||
import WebKit
|
||||
|
||||
final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject {
|
||||
|
||||
weak var viewModel: MastodonResendEmailViewModel?
|
||||
|
||||
init(viewModel: MastodonResendEmailViewModel) {
|
||||
self.viewModel = viewModel
|
||||
}
|
||||
|
||||
deinit {
|
||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - WKNavigationDelegate
|
||||
extension MastodonResendEmailViewModelNavigationDelegateShim: WKNavigationDelegate {
|
||||
|
||||
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
import os.log
|
||||
import UIKit
|
||||
|
||||
final class MastodonServerRulesViewController: UIViewController, NeedsDependency {
|
||||
final class MastodonServerRulesViewController: UIViewController, NeedsDependency ,OnboardingViewControllerAppearance{
|
||||
|
||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||
|
@ -78,8 +78,7 @@ extension MastodonServerRulesViewController {
|
|||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
overrideUserInterfaceStyle = .light
|
||||
view.backgroundColor = Asset.Colors.Background.onboardingBackground.color
|
||||
self.setupOnboardingAppearance()
|
||||
|
||||
bottonContainerView.translatesAutoresizingMaskIntoConstraints = false
|
||||
view.addSubview(bottonContainerView)
|
||||
|
@ -144,7 +143,7 @@ extension MastodonServerRulesViewController {
|
|||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
navigationController?.setNavigationBarHidden(true, animated: false)
|
||||
navigationController?.setNavigationBarHidden(false, animated: false)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue